Add Exit conditions for stack over/underflows
It's bad to continue when these states happen. Let's see if a game triggers it. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3861
This commit is contained in:
parent
bb807af8c7
commit
a59544bf7d
2 changed files with 9 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2002-2013 The DOSBox Team
|
||||
* Copyright (C) 2002-2014 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -42,9 +42,7 @@ static void FPU_FNOP(void){
|
|||
}
|
||||
|
||||
static void FPU_PUSH(double in){
|
||||
TOP = (TOP - 1) &7;
|
||||
//actually check if empty
|
||||
fpu.tags[TOP] = TAG_Valid;
|
||||
FPU_PREP_PUSH();
|
||||
fpu.regs[TOP].d = in;
|
||||
// LOG(LOG_FPU,LOG_ERROR)("Pushed at %d %g to the stack",newtop,in);
|
||||
return;
|
||||
|
@ -52,10 +50,12 @@ static void FPU_PUSH(double in){
|
|||
|
||||
static void FPU_PREP_PUSH(void){
|
||||
TOP = (TOP - 1) &7;
|
||||
if (GCC_UNLIKELY(fpu.tags[TOP] != TAG_Empty)) E_Exit("FPU stack overflow");
|
||||
fpu.tags[TOP] = TAG_Valid;
|
||||
}
|
||||
|
||||
static void FPU_FPOP(void){
|
||||
if (GCC_UNLIKELY(fpu.tags[TOP] == TAG_Empty)) E_Exit("FPU stack underflow");
|
||||
fpu.tags[TOP]=TAG_Empty;
|
||||
//maybe set zero in it as well
|
||||
TOP = ((TOP+1)&7);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2002-2013 The DOSBox Team
|
||||
* Copyright (C) 2002-2014 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -957,11 +957,13 @@ static void FPU_FNOP(void){
|
|||
|
||||
static void FPU_PREP_PUSH(void){
|
||||
TOP = (TOP - 1) &7;
|
||||
fpu.tags[TOP]=TAG_Valid;
|
||||
if (GCC_UNLIKELY(fpu.tags[TOP] != TAG_Empty)) E_Exit("FPU stack overflow");
|
||||
fpu.tags[TOP] = TAG_Valid;
|
||||
}
|
||||
|
||||
static void FPU_FPOP(void){
|
||||
fpu.tags[TOP]=TAG_Empty;
|
||||
if (GCC_UNLIKELY(fpu.tags[TOP] == TAG_Empty)) E_Exit("FPU stack underflow");
|
||||
fpu.tags[TOP] = TAG_Empty;
|
||||
TOP = ((TOP+1)&7);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue