Author Topic: MMX Fsave / Frstor Memory Error  (Read 8687 times)

nobody

  • Guest
MMX Fsave / Frstor Memory Error
« on: January 03, 2010, 06:02:20 PM »
Hi,

I am struggling with a little piece of code. Maybe someone can help me.

The challenge:
A piece of assembly code is included in C and uses the xmm and
mmx registers. Their state needs to be restored and saved.

I get a memory exception, although I am aligning by 16.
Always on fxsave instruction; other fxrstor not used yet.

Also I do not know how to get nasm to use the memory adr
of fxmemory directly. I have to write the adress to fxmemory_ptr
first.

Any help welcome.

Thanks.
Bjorn


I am trying to use the following code:

global fxsave_xmmx
fxsave_xmmx:
fwait
fxsave [abs fxmemory_ptr]
ret

global fxrestore_xmmx
fxrestore_xmmx:
fxrstor [abs fxmemory_ptr]
fwait
ret

align 16
global fxmemory_ptr
fxmemory_ptr dq 00h
align 16
global fxmemory
fxmemory dq 00h,00h,00h,00h,00h,00h,00h,00h
dq 00h,00h,00h,00h,00h,00h,00h,00h
dq 00h,00h,00h,00h,00h,00h,00h,00h
dq 00h,00h,00h,00h,00h,00h,00h,00h
dq 00h,00h,00h,00h,00h,00h,00h,00h
dq 00h,00h,00h,00h,00h,00h,00h,00h
dq 00h,00h,00h,00h,00h,00h,00h,00h
dq 00h,00h,00h,00h,00h,00h,00h,00h

nobody

  • Guest
Re: MMX Fsave / Frstor Memory Error
« Reply #1 on: January 03, 2010, 06:46:00 PM »
Ok, problem solved.

section .text align=64 // section .data align=64 (or 16)

Somehow my alignment wishes in the previous code were ignored, no error produced. Only the above alignment code works.

Thx anyway.