Added CVS version header to all the files.

One more small change in APIC
This commit is contained in:
Stanislav Shwartsman 2005-03-19 20:44:01 +00:00
parent f77ddd9701
commit 3074078297
19 changed files with 85 additions and 102 deletions

View File

@ -1,4 +1,6 @@
/////////////////////////////////////////////////////////////////////////
// $Id: 3dnow.cc,v 1.15 2005-03-19 20:44:00 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2002 Stanislav Shwartsman
// Written by Stanislav Shwartsman <gate at fidonet.org.il>
@ -17,6 +19,7 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
/////////////////////////////////////////////////////////////////////////
#define NEED_CPU_REG_SHORTCUTS 1
#include "bochs.h"

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: apic.cc,v 1.43 2005-03-19 18:42:59 sshwarts Exp $
// $Id: apic.cc,v 1.44 2005-03-19 20:44:00 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
#define NEED_CPU_REG_SHORTCUTS 1
@ -18,7 +18,6 @@ bx_generic_apic_c::bx_generic_apic_c ()
id = APIC_UNKNOWN_ID;
put("APIC?");
settype(APICLOG);
hwreset ();
}
void bx_generic_apic_c::set_arb_id (int new_arb_id)
@ -219,6 +218,10 @@ bx_bool bx_generic_apic_c::deliver (Bit8u dest, Bit8u dest_mode, Bit8u delivery_
/* once = false */
break;
case APIC_DM_INIT:
// NOTE: special behavior of local apics is handled in
// bx_local_apic_c::deliver
// normal INIT IPI sent to processors
for (i = 0; i < BX_LOCAL_APIC_NUM; i++) {
if (deliver_bitmask & (1<<i)) local_apic_index[i]->init();
@ -379,8 +382,7 @@ void bx_local_apic_c::init ()
icr_high = icr_low = log_dest = task_priority = 0;
spurious_vec = 0xff; // software disabled (bit 8)
// KPL
// Register a non-active timer for use when the timer is started.
// KPL: Register a non-active timer for use when the timer is started.
timer_handle = bx_pc_system.register_timer_ticks(this,
BX_CPU(0)->local_apic.periodic_smf, 0, 0, 0, "lapic");
}
@ -426,7 +428,7 @@ void bx_local_apic_c::write (Bit32u addr, Bit32u *data, unsigned len)
if (len != 4) {
BX_PANIC (("local apic write with len=%d (should be 4)", len));
}
BX_DEBUG(("%s: write %08x to APIC address %08x", cpu->name, *data, addr));
BX_DEBUG(("%s: write 0x%08x to APIC address %08x", cpu->name, *data, addr));
addr &= 0xff0;
Bit32u value = *data;
switch (addr) {
@ -460,7 +462,8 @@ void bx_local_apic_c::write (Bit32u addr, Bit32u *data, unsigned len)
BX_DEBUG (("set destination format to %02x", dest_format));
break;
case 0xf0: // spurious interrupt vector
spurious_vec = (spurious_vec & 0x0f) | (value & 0x3f0);
// bits 0-3 are hardwired to logical '1
spurious_vec = (spurious_vec & 0xff) | (value & 0x30f);
break;
case 0x280: // error status reg
// Here's what the IA-devguide-3 says on p.7-45:
@ -826,18 +829,14 @@ Bit32u bx_local_apic_c::get_delivery_bitmask (Bit8u dest, Bit8u dest_mode)
Bit8u bx_local_apic_c::get_ppr ()
{
Bit32u tpr = (task_priority >> 4) & 0xf; /* we want 7:4 */
Bit32u isrv = (highest_priority_int(isr) >> 4) & 0xf; /* ditto */
int ppr = highest_priority_int (isr);
if (tpr >= isrv)
proc_priority = task_priority & 0xff;
else
proc_priority = isrv << 4; /* low 4 bits of PPR have to be cleared */
if ((ppr < 0) || ((task_priority & 0xF0) >= (ppr & 0xF0)))
ppr = task_priority;
else
ppr &= 0xF0;
if (bx_dbg.apic)
BX_DEBUG(("%s: get_ppr returning %#x", cpu->name, proc_priority));
return (Bit8u) proc_priority;
return ppr;
}
Bit8u bx_local_apic_c::get_tpr ()

View File

@ -1,4 +1,7 @@
/////////////////////////////////////////////////////////////////////////
// $Id: apic.h,v 1.14 2005-03-19 20:44:00 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
//
// MandrakeSoft S.A.
@ -20,6 +23,7 @@
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
/////////////////////////////////////////////////////////////////////////
#ifndef BX_CPU_APIC_H
@ -91,12 +95,11 @@ class BOCHSAPI bx_local_apic_c : public bx_generic_apic_c
// cleared when the interrupt is acknowledged by the processor.
Bit8u irr[BX_LOCAL_APIC_MAX_INTS];
// ISR=in-service register. When an IRR bit is cleared, the corresponding
// bit in ISR is set. The ISR bit is cleared when
Bit8u isr[BX_LOCAL_APIC_MAX_INTS];
// bit in ISR is set.
Bit8u isr[BX_LOCAL_APIC_MAX_INTS];
Bit32u arb_id;
Bit32u arb_priority;
Bit32u task_priority;
Bit32u proc_priority;
Bit32u log_dest;
Bit32u dest_format;
Bit32u spurious_vec;

View File

@ -1,4 +1,6 @@
/////////////////////////////////////////////////////////////////////////
// $Id:
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
//
@ -21,6 +23,8 @@
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
/////////////////////////////////////////////////////////////////////////
#define NEED_CPU_REG_SHORTCUTS 1

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: descriptor.h
// $Id: descriptor.h,v 1.5 2005-03-19 20:44:00 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.

View File

@ -1,4 +1,6 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fetchdecode.h,v 1.15 2005-03-19 20:44:00 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 Stanislav Shwartsman
// Written by Stanislav Shwartsman <gate at fidonet.org.il>
@ -16,6 +18,9 @@
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
/////////////////////////////////////////////////////////////////////////
#ifndef BX_COMMON_FETCHDECODE_TABLES_H
#define BX_COMMON_FETCHDECODE_TABLES_H

View File

@ -1,4 +1,6 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fpu_emu.cc,v 1.2 2005-03-19 20:44:00 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
// Copyright (C) 2004 MandrakeSoft S.A.
//
// MandrakeSoft S.A.

View File

@ -1,4 +1,6 @@
/////////////////////////////////////////////////////////////////////////
// $Id: i387.h,v 1.28 2005-03-19 20:44:00 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004 Stanislav Shwartsman
// Written by Stanislav Shwartsman <gate at fidonet.org.il>

View File

@ -1,4 +1,6 @@
/////////////////////////////////////////////////////////////////////////
// $Id: icache.h,v 1.5 2005-03-19 20:44:00 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
//

View File

@ -1,4 +1,6 @@
/////////////////////////////////////////////////////////////////////////
// $Id: mmx.cc,v 1.44 2005-03-19 20:44:00 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2002 Stanislav Shwartsman
// Written by Stanislav Shwartsman <gate at fidonet.org.il>
@ -17,6 +19,7 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
/////////////////////////////////////////////////////////////////////////
#define NEED_CPU_REG_SHORTCUTS 1

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: segment_ctrl.cc,v 1.11 2003-10-06 10:01:12 sshwarts Exp $
// $Id: segment_ctrl.cc,v 1.12 2005-03-19 20:44:00 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -23,12 +23,8 @@
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
/////////////////////////////////////////////////////////////////////////
@ -37,18 +33,13 @@
#define LOG_THIS BX_CPU_THIS_PTR
void
BX_CPU_C::LES_GvMp(bxInstruction_c *i)
void BX_CPU_C::LES_GvMp(bxInstruction_c *i)
{
if (i->modC0()) {
// (BW) NT seems to use this when booting.
BX_INFO(("invalid use of LES, must use memory reference!"));
UndefinedOpcode(i);
}
}
#if BX_CPU_LEVEL > 2
if (i->os32L()) {
@ -61,10 +52,10 @@ BX_CPU_C::LES_GvMp(bxInstruction_c *i)
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES], es);
BX_WRITE_32BIT_REGZ(i->nnn(), reg_32);
}
}
else
#endif /* BX_CPU_LEVEL > 2 */
{ /* 16 bit mode */
{ /* 16 bit mode */
Bit16u reg_16, es;
read_virtual_word(i->seg(), RMAddr(i), &reg_16);
@ -73,16 +64,15 @@ BX_CPU_C::LES_GvMp(bxInstruction_c *i)
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES], es);
BX_WRITE_16BIT_REG(i->nnn(), reg_16);
}
}
}
void
BX_CPU_C::LDS_GvMp(bxInstruction_c *i)
void BX_CPU_C::LDS_GvMp(bxInstruction_c *i)
{
if (i->modC0()) {
BX_INFO(("invalid use of LDS, must use memory reference!"));
UndefinedOpcode(i);
}
}
#if BX_CPU_LEVEL > 2
if (i->os32L()) {
@ -95,7 +85,7 @@ BX_CPU_C::LDS_GvMp(bxInstruction_c *i)
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS], ds);
BX_WRITE_32BIT_REGZ(i->nnn(), reg_32);
}
}
else
#endif /* BX_CPU_LEVEL > 2 */
{ /* 16 bit mode */
@ -107,20 +97,17 @@ BX_CPU_C::LDS_GvMp(bxInstruction_c *i)
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS], ds);
BX_WRITE_16BIT_REG(i->nnn(), reg_16);
}
}
}
void
BX_CPU_C::LFS_GvMp(bxInstruction_c *i)
{
#if BX_CPU_LEVEL < 3
BX_PANIC(("lfs_gvmp: not supported on 8086"));
#else /* 386+ */
#if BX_CPU_LEVEL >= 3
void BX_CPU_C::LFS_GvMp(bxInstruction_c *i)
{
if (i->modC0()) {
BX_INFO(("invalid use of LFS, must use memory reference!"));
UndefinedOpcode(i);
}
}
if (i->os32L()) {
Bit32u reg_32;
@ -132,7 +119,7 @@ BX_CPU_C::LFS_GvMp(bxInstruction_c *i)
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS], fs);
BX_WRITE_32BIT_REGZ(i->nnn(), reg_32);
}
}
else { /* 16 bit operand size */
Bit16u reg_16;
Bit16u fs;
@ -143,21 +130,15 @@ BX_CPU_C::LFS_GvMp(bxInstruction_c *i)
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS], fs);
BX_WRITE_16BIT_REG(i->nnn(), reg_16);
}
#endif
}
}
void
BX_CPU_C::LGS_GvMp(bxInstruction_c *i)
void BX_CPU_C::LGS_GvMp(bxInstruction_c *i)
{
#if BX_CPU_LEVEL < 3
BX_PANIC(("lgs_gvmp: not supported on 8086"));
#else /* 386+ */
if (i->modC0()) {
BX_INFO(("invalid use of LGS, must use memory reference!"));
UndefinedOpcode(i);
}
}
if (i->os32L()) {
Bit32u reg_32;
@ -169,7 +150,7 @@ BX_CPU_C::LGS_GvMp(bxInstruction_c *i)
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS], gs);
BX_WRITE_32BIT_REGZ(i->nnn(), reg_32);
}
}
else { /* 16 bit operand size */
Bit16u reg_16;
Bit16u gs;
@ -180,21 +161,15 @@ BX_CPU_C::LGS_GvMp(bxInstruction_c *i)
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS], gs);
BX_WRITE_16BIT_REG(i->nnn(), reg_16);
}
#endif
}
}
void
BX_CPU_C::LSS_GvMp(bxInstruction_c *i)
void BX_CPU_C::LSS_GvMp(bxInstruction_c *i)
{
#if BX_CPU_LEVEL < 3
BX_PANIC(("lss_gvmp: not supported on 8086"));
#else /* 386+ */
if (i->modC0()) {
BX_INFO(("invalid use of LSS, must use memory reference!"));
UndefinedOpcode(i);
}
}
if (i->os32L()) {
Bit32u reg_32;
@ -206,7 +181,7 @@ BX_CPU_C::LSS_GvMp(bxInstruction_c *i)
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS], ss_raw);
BX_WRITE_32BIT_REGZ(i->nnn(), reg_32);
}
}
else { /* 16 bit operand size */
Bit16u reg_16;
Bit16u ss_raw;
@ -217,6 +192,7 @@ BX_CPU_C::LSS_GvMp(bxInstruction_c *i)
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS], ss_raw);
BX_WRITE_16BIT_REG(i->nnn(), reg_16);
}
#endif
}
}
#endif

View File

@ -1,4 +1,6 @@
/////////////////////////////////////////////////////////////////////////
// $Id: soft_int.cc,v 1.25 2005-03-19 20:44:00 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
//

View File

@ -1,4 +1,6 @@
/////////////////////////////////////////////////////////////////////////
// $Id: sse.cc,v 1.31 2005-03-19 20:44:00 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 Stanislav Shwartsman
// Written by Stanislav Shwartsman <gate at fidonet.org.il>

View File

@ -1,4 +1,6 @@
/////////////////////////////////////////////////////////////////////////
// $Id: sse_move.cc,v 1.35 2005-03-19 20:44:01 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 Stanislav Shwartsman
// Written by Stanislav Shwartsman <gate at fidonet.org.il>

View File

@ -1,4 +1,6 @@
/////////////////////////////////////////////////////////////////////////
// $Id: sse_pfp.cc,v 1.20 2005-03-19 20:44:01 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 Stanislav Shwartsman
// Written by Stanislav Shwartsman <gate at fidonet.org.il>

View File

@ -1,4 +1,6 @@
/////////////////////////////////////////////////////////////////////////
// $Id: sse_rcp.cc,v 1.8 2005-03-19 20:44:01 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 Stanislav Shwartsman
// Written by Stanislav Shwartsman <gate at fidonet.org.il>

View File

@ -1,4 +1,6 @@
/////////////////////////////////////////////////////////////////////////
// $Id: stack_pro.cc,v 1.21 2005-03-19 20:44:01 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
//

View File

@ -1,4 +1,6 @@
/////////////////////////////////////////////////////////////////////////
// $Id: xmm.h,v 1.17 2005-03-19 20:44:01 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 Stanislav Shwartsman
// Written by Stanislav Shwartsman <gate at fidonet.org.il>

View File

@ -55,15 +55,6 @@ diff -u -r1.14 apic.cc
#define LOG_THIS this->
bx_generic_apic_c *apic_index[APIC_MAX_ID];
@@ -15,7 +18,7 @@
id = APIC_UNKNOWN_ID;
put("APIC?");
settype(APICLOG);
- hwreset ();
+ // hwreset (); see bx_local_apic_c::bx_local_apic_c
}
bx_generic_apic_c::~bx_generic_apic_c ()
@@ -169,32 +178,51 @@
bx_bool bx_generic_apic_c::deliver (Bit8u dest, Bit8u dest_mode, Bit8u delivery_mode, Bit8u vector, Bit8u polarity, Bit8u trig_mode)
@ -292,27 +283,6 @@ diff -u -r1.14 apic.cc
}
}
BX_INFO(("}", cpu->name));
@@ -691,14 +776,14 @@
}
Bit8u bx_local_apic_c::get_ppr ()
+
{
- static int warned = 0;
- if (warned < 10) {
- BX_ERROR(("WARNING: Local APIC Processor Priority not implemented, returning 0"));
- warned++;
- }
- // should look at TPR, vector of highest priority isr, etc.
- return 0;
+ int ppr;
+
+ ppr = highest_priority_int (isr); // see what's in service now
+ if ((ppr < 0) || ((task_priority & 0xF0) >= (ppr & 0xF0))) ppr = task_priority; // or if tpr is higher, use that
+ else ppr &= 0xF0;
+ return (ppr);
}
Index: cpu/cpu.cc
===================================================================