From c299dcedc6d73aab56d9c659623d7112c2e9c4bb Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Mon, 30 Sep 2013 11:51:25 +0200 Subject: x86: Fix re-entrancy problems in x87 store instructions X87 store instructions typically loads and pops the top value of the stack and stores it in memory. The current implementation pops the stack at the same time as the floating point value is loaded to a temporary register. This will corrupt the state of the x87 stack if the store fails. This changeset introduces a pop87 micro-instruction that pops the stack and uses this instruction in the affected macro-instructions to pop the stack after storing the value to memory. --- src/arch/x86/isa/microops/fpop.isa | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/arch/x86/isa/microops') diff --git a/src/arch/x86/isa/microops/fpop.isa b/src/arch/x86/isa/microops/fpop.isa index 142138fb2..8a77914d9 100644 --- a/src/arch/x86/isa/microops/fpop.isa +++ b/src/arch/x86/isa/microops/fpop.isa @@ -411,4 +411,13 @@ let {{ class chsfp(FpUnaryOp): code = 'FpDestReg = (-1) * (FpSrcReg1);' flag_code = 'FSW = FSW & (~CC1Bit);' + + class Pop87(FpUnaryOp): + def __init__(self, spm=1, UpdateFTW=True): + super(Pop87, self).__init__( \ + "InstRegIndex(FLOATREG_MICROFP0)", \ + "InstRegIndex(FLOATREG_MICROFP0)", \ + spm=spm, SetStatus=False, UpdateFTW=UpdateFTW) + + code = '' }}; -- cgit v1.2.3