From 6d491de4d3bde7e9a86d2a84e0e3a37947c5250c Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Wed, 30 Mar 2005 22:31:03 +0000 Subject: [PATCH] Fixed bug with jumping from long mode when executing interrupt --- bochs/cpu/cpu.h | 12 +++++++----- bochs/cpu/debugstuff.cc | 4 ++-- bochs/cpu/exception.cc | 11 +---------- bochs/cpu/segment_ctrl_pro.cc | 6 +++--- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/bochs/cpu/cpu.h b/bochs/cpu/cpu.h index 0ad057301..fabfcbf33 100644 --- a/bochs/cpu/cpu.h +++ b/bochs/cpu/cpu.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: cpu.h,v 1.212 2005-03-30 20:52:42 sshwarts Exp $ +// $Id: cpu.h,v 1.213 2005-03-30 22:30:37 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -451,10 +451,12 @@ typedef struct { } \ } \ BX_CPP_INLINE void BX_CPU_C::clear_VM() { \ - BX_CPU_THIS_PTR eflags.val32 &= ~(1<> %02x", (unsigned) instr_buf[j])); diff --git a/bochs/cpu/exception.cc b/bochs/cpu/exception.cc index 75e933f2e..c97fa0d38 100644 --- a/bochs/cpu/exception.cc +++ b/bochs/cpu/exception.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: exception.cc,v 1.52 2005-03-30 21:43:08 sshwarts Exp $ +// $Id: exception.cc,v 1.53 2005-03-30 22:31:03 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -232,9 +232,6 @@ void BX_CPU_C::interrupt(Bit8u vector, bx_bool is_INT, bx_bool is_error_code, Bi // load new RSP values from TSS - int savemode = BX_CPU_THIS_PTR cpu_mode; - BX_CPU_THIS_PTR cpu_mode = BX_MODE_LONG_64; - // need to switch to 64 bit mode temporarily here. // this means that any exception after here might be delivered // a little insanely. Like faults are page faults.. @@ -266,7 +263,6 @@ void BX_CPU_C::interrupt(Bit8u vector, bx_bool is_INT, bx_bool is_error_code, Bi if ( is_error_code ) push_64(error_code); - BX_CPU_THIS_PTR cpu_mode = savemode; load_cs(&cs_selector, &cs_descriptor, cs_descriptor.dpl); RIP = gate_dest_offset; @@ -298,9 +294,6 @@ void BX_CPU_C::interrupt(Bit8u vector, bx_bool is_INT, bx_bool is_error_code, Bi // align stack RSP = RSP & BX_CONST64(0xfffffffffffffff0); - int savemode = BX_CPU_THIS_PTR cpu_mode; - BX_CPU_THIS_PTR cpu_mode = BX_MODE_LONG_64; - // push flags onto stack // push current CS selector onto stack // push return offset onto stack @@ -312,8 +305,6 @@ void BX_CPU_C::interrupt(Bit8u vector, bx_bool is_INT, bx_bool is_error_code, Bi if ( is_error_code ) push_64(error_code); - BX_CPU_THIS_PTR cpu_mode = savemode; - // load CS:IP from gate // load CS descriptor // set the RPL field of CS to CPL diff --git a/bochs/cpu/segment_ctrl_pro.cc b/bochs/cpu/segment_ctrl_pro.cc index c481f3431..a0e7203e5 100644 --- a/bochs/cpu/segment_ctrl_pro.cc +++ b/bochs/cpu/segment_ctrl_pro.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: segment_ctrl_pro.cc,v 1.34 2005-03-30 20:53:04 sshwarts Exp $ +// $Id: segment_ctrl_pro.cc,v 1.35 2005-03-30 22:31:03 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -560,11 +560,11 @@ BX_CPU_C::load_cs(bx_selector_t *selector, bx_descriptor_t *descriptor, if (BX_CPU_THIS_PTR msr.lma) { if (descriptor->u.segment.l) { BX_CPU_THIS_PTR cpu_mode = BX_MODE_LONG_64; - BX_INFO(("Long Mode Activated")); + BX_DEBUG(("Long Mode Activated")); loadSRegLMNominal(BX_SEG_REG_CS, selector->value, 0, cpl); } else { - BX_INFO(("Compatibility Mode Activated")); + BX_DEBUG(("Compatibility Mode Activated")); BX_CPU_THIS_PTR cpu_mode = BX_MODE_LONG_COMPAT; } }