# An example of the FSAVE and FRSTOR instructions
#
# fsave把所有FPU寄存器复制到一个108字节的内存位置,然后初始化FPU状态。
#
# frstor恢复FPU时,所有FPU都被恢复为执行FSAVE时的状态。
#
.section .data
value1:
.float 12.34
value2:
.float 56.789
rup:
.byte 0x7f, 0x0b
.section .bss
.lcomm buffer, 108
.section .text
.globl main
main:
nop
finit
flds value1
flds value2
fldcw rup
fsave buffer
flds value2
flds value1
frstor buffer
movl $1, %eax
movl $0, %ebx
int $0x80
# gcc -g -o 16 16-fsave.s -m32
#