Added bx_cpuid value to the BX_CPU class to avoid any problems with BX_CPU_ID implementation
This commit is contained in:
parent
cdfc3cbce4
commit
7fa75388a1
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cpu.h,v 1.128 2003-02-13 15:03:57 sshwarts Exp $
|
||||
// $Id: cpu.h,v 1.129 2003-02-13 15:51:18 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -237,6 +237,12 @@
|
||||
#define CPL (BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.rpl)
|
||||
#endif
|
||||
|
||||
#if BX_SMP_PROCESSORS==1
|
||||
#define BX_CPU_ID 0
|
||||
#else
|
||||
#define BX_CPU_ID (BX_CPU_THIS_PTR bx_cpuid)
|
||||
#endif
|
||||
|
||||
#endif // defined(NEED_CPU_REG_SHORTCUTS)
|
||||
|
||||
#define BX_DE_EXCEPTION 0 // Divide Error (fault)
|
||||
@ -354,14 +360,6 @@ BOCHSAPI extern BX_CPU_C bx_cpu;
|
||||
BOCHSAPI extern BX_CPU_C *bx_cpu_array[BX_SMP_PROCESSORS];
|
||||
#endif
|
||||
|
||||
|
||||
#if BX_SMP_PROCESSORS==1
|
||||
#define BX_CPU_ID 0
|
||||
#else
|
||||
#define BX_CPU_ID (BX_CPU_THIS - BX_CPU(0))
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct {
|
||||
/* 31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16
|
||||
* ==|==|=====|==|==|==|==|==|==|==|==|==|==|==|==
|
||||
@ -1291,6 +1289,8 @@ public: // for now...
|
||||
|
||||
char name[64];
|
||||
|
||||
unsigned bx_cpuid;
|
||||
|
||||
// General register set
|
||||
// eax: accumulator
|
||||
// ebx: base
|
||||
@ -1588,6 +1588,7 @@ union {
|
||||
ArithmeticalFlag(PF, 4, 2);
|
||||
ArithmeticalFlag(CF, 0, 0);
|
||||
|
||||
void set_cpu_id(unsigned id);
|
||||
|
||||
// constructors & destructors...
|
||||
BX_CPU_C();
|
||||
@ -2815,7 +2816,7 @@ union {
|
||||
unsigned opa, unsigned opb);
|
||||
#endif
|
||||
|
||||
BX_CPP_INLINE unsigned which_cpu(void);
|
||||
BX_CPP_INLINE unsigned which_cpu(void) { return bx_cpuid; }
|
||||
BX_CPP_INLINE const bx_gen_reg_t *get_gen_reg() { return gen_reg; }
|
||||
|
||||
DECLARE_EFLAGS_ACCESSORS()
|
||||
@ -2955,15 +2956,14 @@ IMPLEMENT_32BIT_REGISTER_ACCESSORS(EBP);
|
||||
IMPLEMENT_32BIT_REGISTER_ACCESSORS(ESI);
|
||||
IMPLEMENT_32BIT_REGISTER_ACCESSORS(EDI);
|
||||
|
||||
BX_CPP_INLINE void BX_CPU_C::set_cpu_id(unsigned id) {
|
||||
BX_CPU_THIS_PTR bx_cpuid = id;
|
||||
}
|
||||
|
||||
BX_SMF BX_CPP_INLINE Bit8u BX_CPU_C_PREFIX get_CPL(void) {
|
||||
return (BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.rpl);
|
||||
}
|
||||
|
||||
BX_CPP_INLINE unsigned BX_CPU_C::which_cpu(void) {
|
||||
return (BX_CPU_ID);
|
||||
}
|
||||
|
||||
BX_CPP_INLINE Bit32u BX_CPU_C::get_EIP(void) {
|
||||
return (BX_CPU_THIS_PTR dword.eip);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: init.cc,v 1.45 2003-02-13 15:04:02 sshwarts Exp $
|
||||
// $Id: init.cc,v 1.46 2003-02-13 15:51:22 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -36,9 +36,9 @@
|
||||
#define BX_DEVICE_ID 3
|
||||
#define BX_STEPPING_ID 0
|
||||
|
||||
BX_CPU_C::BX_CPU_C()
|
||||
BX_CPU_C::BX_CPU_C(): bx_cpuid(0)
|
||||
#if BX_SUPPORT_APIC
|
||||
: local_apic (this)
|
||||
,local_apic (this)
|
||||
#endif
|
||||
{
|
||||
// in case of SMF, you cannot reference any member data
|
||||
@ -168,7 +168,7 @@ cpu_param_handler (bx_param_c *param, int set, Bit64s val)
|
||||
|
||||
void BX_CPU_C::init(BX_MEM_C *addrspace)
|
||||
{
|
||||
BX_DEBUG(( "Init $Id: init.cc,v 1.45 2003-02-13 15:04:02 sshwarts Exp $"));
|
||||
BX_DEBUG(( "Init $Id: init.cc,v 1.46 2003-02-13 15:51:22 sshwarts Exp $"));
|
||||
// BX_CPU_C constructor
|
||||
BX_CPU_THIS_PTR set_INTR (0);
|
||||
#if BX_SUPPORT_APIC
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: main.cc,v 1.222 2003-02-06 23:16:51 cbothamy Exp $
|
||||
// $Id: main.cc,v 1.223 2003-02-13 15:51:12 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -2196,10 +2196,11 @@ bx_init_hardware()
|
||||
BX_MEM(0)->load_ROM(bx_options.vgarom.Opath->getptr (), 0xc0000);
|
||||
|
||||
BX_CPU(0)->init (BX_MEM(0));
|
||||
BX_CPU(0)->set_cpu_id(0);
|
||||
#if BX_SUPPORT_APIC
|
||||
BX_CPU(0)->local_apic.set_id (0);
|
||||
BX_INSTR_INIT(0);
|
||||
#endif
|
||||
BX_INSTR_INIT(0);
|
||||
BX_CPU(0)->reset(BX_RESET_HARDWARE);
|
||||
#else
|
||||
// SMP initialization
|
||||
@ -2222,10 +2223,11 @@ bx_init_hardware()
|
||||
bx_mem_array[0]->load_ROM(bx_options.vgarom.Opath->getptr (), 0xc0000);
|
||||
|
||||
for (int i=0; i<BX_SMP_PROCESSORS; i++) {
|
||||
BX_CPU(i) = new BX_CPU_C ();
|
||||
BX_CPU(i) = new BX_CPU_C;
|
||||
BX_CPU(i)->init (bx_mem_array[0]);
|
||||
// assign apic ID from the index of this loop
|
||||
// if !BX_SUPPORT_APIC, this will not compile.
|
||||
BX_CPU(i)->set_cpu_id(i);
|
||||
BX_CPU(i)->local_apic.set_id (i);
|
||||
BX_INSTR_INIT(i);
|
||||
BX_CPU(i)->reset(BX_RESET_HARDWARE);
|
||||
|
Loading…
Reference in New Issue
Block a user