NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: ben321 on October 08, 2022, 10:35:09 PM

Title: Question about x87 FPU fsave and fstenv instructions
Post by: ben321 on October 08, 2022, 10:35:09 PM
What is the difference between the fsave and fstenv instructions. The descriptions I've seen for these both seem to indicate that they dump the complete state of the FPU to a memory location. Can someone here explain the difference between these two instructions?
Title: Re: Question about x87 FPU fsave and fstenv instructions
Post by: debs3759 on October 08, 2022, 10:44:12 PM
FSTENV stores the FPU operating environment (control word, status word, tag word, instruction
pointer, data pointer and last opcode) into memory. The memory area is 14 or 28 bytes long,
depending on the CPU mode at the time.

FSAVE saves the entire floating-point unit state, including all the information saved by FSTENV
plus the contents of all the registers, to a 94 or 108 byte area of memory
(depending on the CPU mode).

(copied from nasmdoc 0.98)
Title: Re: Question about x87 FPU fsave and fstenv instructions
Post by: Frank Kotler on October 08, 2022, 10:54:46 PM
Unless my memory fails me - quite possible = "fsave" saves the whole fpu state and "fstenv" saves only the environment...

(this is obsolete!)
http://home.myfairpoint.net/fbkotler/nasmdocc.html#section-A.4.97

If in doubt, why not try it?

Best,
Frank

Title: Re: Question about x87 FPU fsave and fstenv instructions
Post by: ben321 on October 08, 2022, 11:41:59 PM
FSTENV stores the FPU operating environment (control word, status word, tag word, instruction
pointer, data pointer and last opcode) into memory. The memory area is 14 or 28 bytes long,
depending on the CPU mode at the time.

FSAVE saves the entire floating-point unit state, including all the information saved by FSTENV
plus the contents of all the registers, to a 94 or 108 byte area of memory
(depending on the CPU mode).

(copied from nasmdoc 0.98)

Is there documentation somewhere, that tells the memory layout of the FPU environment dump form the FSTENV instruction?
Title: Re: Question about x87 FPU fsave and fstenv instructions
Post by: Frank Kotler on October 09, 2022, 01:33:04 AM
Maybe?
https://www.plantation-productions.com/Webster/www.artofasm.com/DOS/ch14/CH14-5.html#HEADING5-95

Best,
Frank

Title: Re: Question about x87 FPU fsave and fstenv instructions
Post by: debs3759 on October 09, 2022, 04:13:45 AM
Page 3-251 of 24319102.pdf