flat assembler
Message board for the users of flat assembler.
Index
> Main > SSE and SSE2 tutorial? |
Author |
|
decard 07 Jan 2004, 14:16
SSE and SSE2 instructions are described in FASM manual, it should be anough to start. I haven't seen any tutorial yet
|
|||
07 Jan 2004, 14:16 |
|
MazeGen 07 Jan 2004, 19:44
|
|||
07 Jan 2004, 19:44 |
|
MattBro 08 Oct 2004, 06:42
Ive been playing around with some of the SSE2 instructions and I've run into a brick wall with this issue of privileged instructions. In particular I need to use fxsave and fxrstor to temporarily save these registers, however I run into an unhandled exception and a privileged instruction error when I try to use fxsave.
I have a 2.6 GHz pentium 4 and am running Windows XP SP-1, which I thought was SSE aware. I even tried setting bits in cr4, but I can't even access that register I believe due to the same privileged instruction error. I know my processor has SSE2 instructions, but I can't seem to run some of them. I must be missing something obvious with this privileged mode stuff, but I haven't find much about it on the web so far. -Matt _________________ -- ------------------------------------------------------- "I am the Way and the Truth and the Light, no one comes to the Father except through me" - Jesus --------------------------------------------------------- |
|||
08 Oct 2004, 06:42 |
|
MazeGen 09 Oct 2004, 03:14
Quote:
You probably forgot to align the memory operand on a 16-byte boundary. Otherwise you get #GP. |
|||
09 Oct 2004, 03:14 |
|
MattBro 09 Oct 2004, 04:35
Perhaps you are right. I actually am a bit confused about how the alignment directive works in fasm. Here is a code fragment:
Code: ; printf call to a message box ; this version creates it's own local format string data ; It uses a different temporary buffer from Bprintf ; formstr should be an immediate string variable macro Aprintf formstr, [args] { common local str00 jmp @f str00 db formstr,0 @@: fxsave [fxmem] pusha if ~ args eq cinvoke wsprintf, _ctmp, str00, args else cinvoke wsprintf, _ctmp, str00 end if invoke MessageBox, HWND_DESKTOP, _ctmp, _gencap,MB_OK popa fxrstor [fxmem] } section '.data' data readable writeable times 2047 dd 0 stacktop dd 0 _ctmp db ? times 127 db 0 _gencap db 'MacroFlow',0000000 align 4 label fxmem times 512 db 0 str0 db ' register 0 contains 0',0 align 4 one dd 0 My basic problem is that I want to protect mmx / xmm registers while they are being used by external function calls. In this case I need to preserve the state while calling my print macro Aprintf. The data segment was auto-generated by my compiler, so its a little ugly. Update: Actually looking at the debug output of my crashed routine, the fxsave call decompiles to: fxsave [ds:40508Ch] The hex address appears to be divisable by 4. _________________ -- ------------------------------------------------------- "I am the Way and the Truth and the Light, no one comes to the Father except through me" - Jesus --------------------------------------------------------- |
|||
09 Oct 2004, 04:35 |
|
roticv 09 Oct 2004, 06:10
It should be
Code:
align 16
label fxmem
|
|||
09 Oct 2004, 06:10 |
|
MattBro 09 Oct 2004, 06:25
Well I'll be ! You are right. Thanks for your help.
I suppose that a lot of the other memory move instructions require 16 byte alignment as well ? -Regards |
|||
09 Oct 2004, 06:25 |
|
Matrix 09 Oct 2004, 13:20
alf_ua wrote: I have a very good MMX one but still can't found any SSE and SSE2 tutorial. If anyone have a link to it then please post it here. and that was what i saw on intel.com however i was searching for cpu instructions's descriptions from 8086 to pentium and they don't care about it. MATRIX |
|||
09 Oct 2004, 13:20 |
|
MazeGen 16 Oct 2004, 16:04
MattBro wrote: I suppose that a lot of the other memory move instructions require 16 byte alignment as well ? AFAIK there are only a few such instructions, such as some forms of MOV instructions. Note that these instructions have its versions which don't require the alignment: MOVDQA vs MOVDQU, MOVAPD vs MOVUPD, ... |
|||
16 Oct 2004, 16:04 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.