Code indent, no functionality changes

This commit is contained in:
Stanislav Shwartsman 2005-07-01 14:06:02 +00:00
parent 8380541a8f
commit 3d2e2162f3
7 changed files with 61 additions and 79 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: flag_ctrl_pro.cc,v 1.17 2005-06-16 17:25:04 sshwarts Exp $
// $Id: flag_ctrl_pro.cc,v 1.18 2005-07-01 14:05:56 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -73,9 +73,8 @@ BX_CPU_C::write_flags(Bit16u flags, bx_bool change_IOPL, bx_bool change_IF)
#if BX_CPU_LEVEL >= 3
void
BX_CPU_C::write_eflags(Bit32u eflags_raw, bx_bool change_IOPL, bx_bool change_IF,
bx_bool change_VM, bx_bool change_RF)
void BX_CPU_C::write_eflags(Bit32u eflags_raw, bx_bool change_IOPL,
bx_bool change_IF, bx_bool change_VM, bx_bool change_RF)
{
Bit32u changeMask = 0x4dd5;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: init.cc,v 1.70 2005-04-10 19:42:48 sshwarts Exp $
// $Id: init.cc,v 1.71 2005-07-01 14:05:57 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -160,7 +160,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.70 2005-04-10 19:42:48 sshwarts Exp $"));
BX_DEBUG(( "Init $Id: init.cc,v 1.71 2005-07-01 14:05:57 sshwarts Exp $"));
// BX_CPU_C constructor
BX_CPU_THIS_PTR set_INTR (0);
#if BX_SUPPORT_APIC
@ -603,8 +603,8 @@ void BX_CPU_C::reset(unsigned source)
BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].cache.u.segment.avl = 0;
#endif
/* FS and descriptor cache */
#if BX_CPU_LEVEL >= 3
/* FS and descriptor cache */
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].selector.value = 0x0000;
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].selector.index = 0x0000;
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].selector.ti = 0;
@ -626,10 +626,8 @@ void BX_CPU_C::reset(unsigned source)
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.g = 0; /* byte granular */
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.d_b = 0; /* 16bit default size */
BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].cache.u.segment.avl = 0;
#endif
/* GS and descriptor cache */
#if BX_CPU_LEVEL >= 3
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].selector.value = 0x0000;
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].selector.index = 0x0000;
BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].selector.ti = 0;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: proc_ctrl.cc,v 1.107 2005-05-27 01:53:38 sshwarts Exp $
// $Id: proc_ctrl.cc,v 1.108 2005-07-01 14:05:59 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -149,11 +149,9 @@ void BX_CPU_C::WBINVD(bxInstruction_c *i)
#endif
}
#if BX_CPU_LEVEL >= 3
void BX_CPU_C::MOV_DdRd(bxInstruction_c *i)
{
#if BX_CPU_LEVEL < 3
BX_PANIC(("MOV_DdRd: not supported on < 386"));
#else
Bit32u val_32;
if (v8086_mode()) {
@ -283,14 +281,10 @@ void BX_CPU_C::MOV_DdRd(bxInstruction_c *i)
BX_PANIC(("MOV_DdRd: control register index out of range"));
break;
}
#endif
}
void BX_CPU_C::MOV_RdDd(bxInstruction_c *i)
{
#if BX_CPU_LEVEL < 3
BX_PANIC(("MOV_RdDd: not supported on < 386"));
#else
Bit32u val_32;
if (v8086_mode()) {
@ -360,7 +354,6 @@ void BX_CPU_C::MOV_RdDd(bxInstruction_c *i)
val_32 = 0;
}
BX_WRITE_32BIT_REGZ(i->rm(), val_32);
#endif
}
#if BX_SUPPORT_X86_64
@ -553,7 +546,9 @@ void BX_CPU_C::MOV_RqDq(bxInstruction_c *i)
}
BX_WRITE_64BIT_REG(i->rm(), val_64);
}
#endif // #if BX_SUPPORT_X86_64
#endif // #if BX_SUPPORT_X86_64
#endif // #if BX_CPU_LEVEL >= 3
void BX_CPU_C::LMSW_Ew(bxInstruction_c *i)
{
@ -623,12 +618,10 @@ void BX_CPU_C::SMSW_Ew(bxInstruction_c *i)
#endif
}
#if BX_CPU_LEVEL >= 3
void BX_CPU_C::MOV_CdRd(bxInstruction_c *i)
{
// mov general register data to control register
#if BX_CPU_LEVEL < 3
BX_PANIC(("MOV_CdRd: not supported on < 386"));
#else
Bit32u val_32;
if (v8086_mode()) {
@ -698,15 +691,11 @@ void BX_CPU_C::MOV_CdRd(bxInstruction_c *i)
BX_PANIC(("MOV_CdRd: control register index out of range"));
break;
}
#endif
}
void BX_CPU_C::MOV_RdCd(bxInstruction_c *i)
{
// mov control register data to register
#if BX_CPU_LEVEL < 3
BX_PANIC(("MOV_RdCd: not supported on < 386"));
#else
Bit32u val_32;
if (v8086_mode()) {
@ -771,7 +760,6 @@ void BX_CPU_C::MOV_RdCd(bxInstruction_c *i)
val_32 = 0;
}
BX_WRITE_32BIT_REGZ(i->rm(), val_32);
#endif
}
#if BX_SUPPORT_X86_64
@ -929,7 +917,9 @@ void BX_CPU_C::MOV_RqCq(bxInstruction_c *i)
BX_WRITE_64BIT_REG(i->rm(), val_64);
}
#endif // #if BX_SUPPORT_X86_64
#endif // #if BX_SUPPORT_X86_64
#endif // #if BX_CPU_LEVEL >= 3
void BX_CPU_C::MOV_TdRd(bxInstruction_c *i)
{
@ -2276,7 +2266,6 @@ Bit32u BX_CPU_C::hwdebug_compare(Bit32u laddr_0, unsigned size,
}
return(0);
}
#endif
/*

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: shift32.cc,v 1.26 2004-12-24 22:44:13 sshwarts Exp $
// $Id: shift32.cc,v 1.27 2005-07-01 14:06:02 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -399,7 +399,7 @@ void BX_CPU_C::SAR_Ed(bxInstruction_c *i)
if (!count) return;
/* count < 32, since only lower 5 bits used */
/* count < 32, since only lower 5 bits used */
if (op1_32 & 0x80000000) {
result_32 = (op1_32 >> count) | (0xffffffff << (32 - count));
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: stack32.cc,v 1.27 2005-05-20 20:06:50 sshwarts Exp $
// $Id: stack32.cc,v 1.28 2005-07-01 14:06:02 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -404,8 +404,6 @@ void BX_CPU_C::LEAVE(bxInstruction_c *i)
#else
Bit32u temp_EBP;
//invalidate_prefetch_q();
#if BX_CPU_LEVEL >= 3
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.d_b)
temp_EBP = EBP;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: stack_pro.cc,v 1.21 2005-03-19 20:44:01 sshwarts Exp $
// $Id: stack_pro.cc,v 1.22 2005-07-01 14:06:02 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -29,6 +29,7 @@
#include "bochs.h"
#define LOG_THIS BX_CPU_THIS_PTR
void BX_CPP_AttrRegparmN(1)
BX_CPU_C::push_16(Bit16u value16)
{
@ -85,13 +86,13 @@ void BX_CPU_C::push_32(Bit32u value32)
if (!can_push(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache, ESP, 4)) {
BX_INFO(("push_32(): push outside stack limits"));
exception(BX_SS_EXCEPTION, 0, 0);
}
}
}
else { /* real mode */
if ((ESP>=1) && (ESP<=3)) {
BX_PANIC(("push_32: ESP=%08x", (unsigned) ESP));
}
}
}
write_virtual_dword(BX_SEG_REG_SS, ESP-4, &value32);
ESP -= 4;
@ -101,13 +102,13 @@ void BX_CPU_C::push_32(Bit32u value32)
if (!can_push(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache, SP, 4)) {
BX_INFO(("push_32(): push outside stack limits"));
exception(BX_SS_EXCEPTION, 0, 0);
}
}
}
else { /* real mode */
if ((SP>=1) && (SP<=3)) {
BX_PANIC(("push_32: SP=%08x", (unsigned) SP));
}
}
}
write_virtual_dword(BX_SEG_REG_SS, (Bit16u) (SP-4), &value32);
SP -= 4;
@ -132,8 +133,7 @@ void BX_CPU_C::push_64(Bit64u value64)
#endif /* BX_CPU_LEVEL >= 3 */
void
BX_CPU_C::pop_16(Bit16u *value16_ptr)
void BX_CPU_C::pop_16(Bit16u *value16_ptr)
{
Bit32u temp_ESP;
@ -150,8 +150,8 @@ BX_CPU_C::pop_16(Bit16u *value16_ptr)
BX_ERROR(("pop_16(): can't pop from stack"));
exception(BX_SS_EXCEPTION, 0, 0);
return;
}
}
}
#endif
/* access within limits */
@ -164,8 +164,7 @@ BX_CPU_C::pop_16(Bit16u *value16_ptr)
}
#if BX_CPU_LEVEL >= 3
void
BX_CPU_C::pop_32(Bit32u *value32_ptr)
void BX_CPU_C::pop_32(Bit32u *value32_ptr)
{
Bit32u temp_ESP;
@ -181,8 +180,8 @@ BX_CPU_C::pop_32(Bit32u *value32_ptr)
BX_ERROR(("pop_32(): can't pop from stack"));
exception(BX_SS_EXCEPTION, 0, 0);
return;
}
}
}
/* access within limits */
read_virtual_dword(BX_SEG_REG_SS, temp_ESP, value32_ptr);
@ -200,7 +199,7 @@ void BX_CPU_C::pop_64(Bit64u *value64_ptr)
BX_ERROR(("pop_64(): can't pop from stack"));
exception(BX_SS_EXCEPTION, 0, 0);
return;
}
}
/* access within limits */
@ -220,7 +219,7 @@ BX_CPU_C::can_push(bx_descriptor_t *descriptor, Bit32u esp, Bit32u bytes)
#if BX_SUPPORT_X86_64
if (BX_CPU_THIS_PTR cpu_mode == BX_MODE_LONG_64) {
return(1);
}
}
#endif
// small stack compares against 16-bit SP
@ -231,12 +230,12 @@ BX_CPU_C::can_push(bx_descriptor_t *descriptor, Bit32u esp, Bit32u bytes)
if (descriptor->valid==0) {
BX_PANIC(("can_push(): SS invalidated."));
return(0);
}
}
if (descriptor->p==0) {
BX_PANIC(("can_push(): descriptor not present"));
return(0);
}
}
if (descriptor->u.segment.c_ed) { /* expand down segment */
@ -250,27 +249,27 @@ BX_CPU_C::can_push(bx_descriptor_t *descriptor, Bit32u esp, Bit32u bytes)
if (esp==0) {
BX_PANIC(("can_push(): esp=0, wraparound?"));
return(0);
}
}
if (esp < bytes) {
BX_PANIC(("can_push(): expand-down: esp < N"));
return(0);
}
}
if ( (esp - bytes) <= descriptor->u.segment.limit_scaled ) {
BX_PANIC(("can_push(): expand-down: esp-N < limit"));
return(0);
}
}
if ( esp > expand_down_limit ) {
BX_PANIC(("can_push(): esp > expand-down-limit"));
return(0);
}
return(1);
}
return(1);
}
else { /* normal (expand-up) segment */
if (descriptor->u.segment.limit_scaled==0) {
BX_PANIC(("can_push(): found limit of 0"));
return(0);
}
}
// Look at case where esp==0. Possibly, it's an intentional wraparound
// If so, limit must be the maximum for the given stack size
@ -282,84 +281,82 @@ BX_CPU_C::can_push(bx_descriptor_t *descriptor, Bit32u esp, Bit32u bytes)
BX_INFO(("can_push(): esp=0, normal, wraparound? limit=%08x",
descriptor->u.segment.limit_scaled));
return(0);
}
}
if ( !descriptor->u.segment.d_b ) {
// Weird case for 16-bit SP.
esp = ((esp-bytes) & 0xffff) + bytes;
}
}
if (esp < bytes) {
BX_INFO(("can_push(): expand-up: esp < N"));
return(0);
}
}
if ((esp-1) > descriptor->u.segment.limit_scaled) {
BX_INFO(("can_push(): expand-up: SP > limit"));
return(0);
}
}
/* all checks pass */
return(1);
}
}
}
#endif
#if BX_CPU_LEVEL >= 2
bx_bool
BX_CPU_C::can_pop(Bit32u bytes)
bx_bool BX_CPU_C::can_pop(Bit32u bytes)
{
Bit32u temp_ESP, expand_down_limit;
#if BX_SUPPORT_X86_64
if (BX_CPU_THIS_PTR cpu_mode == BX_MODE_LONG_64) {
return(1);
}
}
#endif
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.d_b) { /* Big bit set: use ESP */
temp_ESP = ESP;
expand_down_limit = 0xFFFFFFFF;
}
}
else { /* Big bit clear: use SP */
temp_ESP = SP;
expand_down_limit = 0xFFFF;
}
}
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid==0) {
BX_PANIC(("can_pop(): SS invalidated."));
return(0); /* never gets here */
}
}
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.p==0) { /* ??? */
BX_PANIC(("can_pop(): SS.p = 0"));
return(0);
}
}
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.c_ed) { /* expand down segment */
if ( temp_ESP == expand_down_limit ) {
BX_PANIC(("can_pop(): found SP=ffff"));
return(0);
}
}
if ( ((expand_down_limit - temp_ESP) + 1) >= bytes )
return(1);
return(0);
}
}
else { /* normal (expand-up) segment */
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.limit_scaled==0) {
BX_PANIC(("can_pop(): SS.limit = 0"));
}
}
if ( temp_ESP == expand_down_limit ) {
BX_PANIC(("can_pop(): found SP=ffff"));
return(0);
}
}
if ( temp_ESP > BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.limit_scaled ) {
BX_PANIC(("can_pop(): eSP > SS.limit"));
return(0);
}
}
if ( ((BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.limit_scaled - temp_ESP) + 1) >= bytes )
return(1);
return(0);
}
}
}
#endif
@ -377,22 +374,22 @@ BX_CPU_C::decrementESPForPush(unsigned nBytes, Bit32u *eSP_ptr)
if (!can_push(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache, eSP, nBytes)) {
BX_INFO(("decrementESPForPush: push outside stack limits"));
exception(BX_SS_EXCEPTION, 0, 0);
}
}
}
else { // Real Mode.
if ( (eSP>=1) && (eSP<nBytes) ) {
BX_PANIC(("decrementESPForPush: eSP=%08x", (unsigned) eSP));
}
}
}
// And finally, decrement eSP and return the new eSP value.
eSP -= nBytes;
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.d_b) {
ESP = eSP;
*eSP_ptr = eSP;
}
}
else {
SP = (Bit16u) eSP;
*eSP_ptr = SP;
}
}
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: vm8086.cc,v 1.19 2005-03-13 20:18:37 sshwarts Exp $
// $Id: vm8086.cc,v 1.20 2005-07-01 14:06:02 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -304,4 +304,5 @@ void BX_CPU_C::v8086_message(void)
BX_INFO((" to use virtual-8086 mode features."));
BX_PANIC(("Bummer!"));
}
#endif // BX_SUPPORT_V8086_MODE