From e9fa54de58846a8726b9320d6b10809ff65ccecf Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Sun, 30 Dec 2012 12:45:50 -0600 Subject: x86: implement x87 fp instruction fnstsw This patch implements the fnstsw instruction. The code was originally written by Vince Weaver. Gabe had made some comments about the code, but those were never addressed. This patch addresses those comments. --- .../x87/control/save_and_restore_x87_control_word.py | 12 +++++++++++- .../x86/isa/insts/x87/control/save_x87_status_word.py | 18 +++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) (limited to 'src/arch/x86/isa/insts') diff --git a/src/arch/x86/isa/insts/x87/control/save_and_restore_x87_control_word.py b/src/arch/x86/isa/insts/x87/control/save_and_restore_x87_control_word.py index 0fc4ef7b7..5657c8d47 100644 --- a/src/arch/x86/isa/insts/x87/control/save_and_restore_x87_control_word.py +++ b/src/arch/x86/isa/insts/x87/control/save_and_restore_x87_control_word.py @@ -38,5 +38,15 @@ microcode = ''' # FLDCW # FSTCW -# FNSTCW + +def macroop FNSTCW_M { + rdval t1, fcw + st t1, seg, sib, disp, dataSize=2 +}; + +def macroop FNSTCW_P { + rdip t7 + rdval t1, fcw + st t1, seg, sib, disp, dataSize=2 +}; ''' diff --git a/src/arch/x86/isa/insts/x87/control/save_x87_status_word.py b/src/arch/x86/isa/insts/x87/control/save_x87_status_word.py index 2739852a4..65ff8006b 100644 --- a/src/arch/x86/isa/insts/x87/control/save_x87_status_word.py +++ b/src/arch/x86/isa/insts/x87/control/save_x87_status_word.py @@ -36,6 +36,22 @@ # Authors: Gabe Black microcode = ''' + # FSTSW -# FNSTSW + +def macroop FNSTSW_R { + rdval t1, fsw + mov rax, rax, t1, dataSize=2 +}; + +def macroop FNSTSW_M { + rdval t1, fsw + st t1, seg, sib, disp, dataSize=2 +}; + +def macroop FNSTSW_P { + rdip t7 + rdval t1, fsw + st t1, seg, riprel, disp, dataSize=2 +}; ''' -- cgit v1.2.3