Changed push_32() and push_64() to issue SS(0) for a push outside of

stack limits. This is needed for EROS, and probably for L4, as both
rely on this SS fault (and the corresponding GP fault) to trigger the
switch from small address spaces to large address spaces. The
push_16() code was already correct, and I find the inconsistency a bit
odd.

I'm not 100% sure about the push_64() change, so I made the change
with a comment but left it a BX_PANIC() rather than switching it to
BX_INFO. I'll ask Peter momentarily to have a look and let me know.

While I was added, changed the push_16() BX_INFO message to be
consistent with the others -- all now say 'push outside stack limits'.
This commit is contained in:
Jonathan S. Shapiro 2002-11-07 14:02:47 +00:00
parent b5b78258bf
commit 0aac231adb

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: stack_pro.cc,v 1.10 2002-10-25 11:44:35 bdenney Exp $
// $Id: stack_pro.cc,v 1.11 2002-11-07 14:02:47 shap Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -52,7 +52,7 @@ BailBigRSP("push_16");
#endif
temp_ESP = SP;
if (!can_push(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache, temp_ESP, 2)) {
BX_PANIC(("push_16(): can't push on stack"));
BX_PANIC(("push_16(): push outside stack limits"));
exception(BX_SS_EXCEPTION, 0, 0);
return;
}
@ -97,8 +97,8 @@ BailBigRSP("push_32");
/* 32bit stack size: pushes use SS:ESP */
if (protected_mode()) {
if (!can_push(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache, ESP, 4)) {
BX_PANIC(("push_32(): push outside stack limits"));
/* #SS(0) */
BX_INFO(("push_32(): push outside stack limits"));
exception(BX_SS_EXCEPTION, 0, 0);
}
}
else { /* real mode */
@ -115,8 +115,8 @@ BailBigRSP("push_32");
else { /* 16bit stack size: pushes use SS:SP */
if (protected_mode()) {
if (!can_push(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache, SP, 4)) {
BX_PANIC(("push_32(): push outside stack limits"));
/* #SS(0) */
BX_INFO(("push_32(): push outside stack limits"));
exception(BX_SS_EXCEPTION, 0, 0);
}
}
else { /* real mode */
@ -138,8 +138,13 @@ BX_CPU_C::push_64(Bit64u value64)
{
/* 64bit stack size: pushes use SS:RSP, assume protected mode */
if (!can_push(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache, RSP, 8)) {
/* FIX: I (shap) think this should be an SS_EXCEPTION similar to
the 32bit case above, and it used to be commented #SS(0), but
until somebody who groks the hammer chip can double check this
I am leaving this as a BX_PANIC(). If this change is correct,
please change the BX_PANIC to a BX_INFO(). */
BX_PANIC(("push_64(): push outside stack limits"));
/* #SS(0) */
exception(BX_SS_EXCEPTION, 0, 0); /* #SS(0) */
}
write_virtual_qword(BX_SEG_REG_SS, RSP-8, &value64);