Author Topic: Question about x87 FPU fsave and fstenv instructions  (Read 6761 times)

Offline ben321

  • Full Member
  • **
  • Posts: 184
Question about x87 FPU fsave and fstenv instructions
« 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?

Offline debs3759

  • Global Moderator
  • Full Member
  • *****
  • Posts: 224
  • Country: gb
    • GPUZoo
Re: Question about x87 FPU fsave and fstenv instructions
« Reply #1 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)
My graphics card database: www.gpuzoo.com

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Question about x87 FPU fsave and fstenv instructions
« Reply #2 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


Offline ben321

  • Full Member
  • **
  • Posts: 184
Re: Question about x87 FPU fsave and fstenv instructions
« Reply #3 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?

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us

Offline debs3759

  • Global Moderator
  • Full Member
  • *****
  • Posts: 224
  • Country: gb
    • GPUZoo
Re: Question about x87 FPU fsave and fstenv instructions
« Reply #5 on: October 09, 2022, 04:13:45 AM »
Page 3-251 of 24319102.pdf
My graphics card database: www.gpuzoo.com