flat assembler
Message board for the users of flat assembler.

Index > Main > Instruction bug?

Author
Thread Post new topic Reply to topic
mkm79



Joined: 27 Feb 2004
Posts: 8
mkm79 16 Jan 2007, 04:24
The example code

The instruction: mulps xmm0, [ebx+ecx*4]
If the PAE is ON - it is not working, if OFF - works well

Any body know what is it?
Below simple example

Code:
format PE console
include '%fasminc%\win32a.inc'

  ; preparation
  mov    eax, v1
  mov    ebx, v2
  xor    ecx, ecx
  xorps  xmm0, xmm0

  ; did not work (if PAE is OFF - works fine)
  ; comment next 2 line to check working example
  movups xmm0, [eax+ecx*4]
  mulps  xmm0, [ebx+ecx*4]

  ; work fine
  movups xmm0, [eax+ecx*4]
  movups xmm1, [ebx+ecx*4]
  mulps  xmm0, xmm1

  invoke  ExitProcess

v1  dd  0,0,0,0
v2  dd  0,0,0,0

data import
 library   kernel32,'KERNEL32.DLL'
 import    kernel32,\
           ExitProcess,'ExitProcess'
end data
    

_________________
Best regards,
Kostya
Post 16 Jan 2007, 04:24
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 16 Jan 2007, 05:41
Code:
align 16

v1  dd  0,0,0,0 
v2  dd  0,0,0,0    

Solves the problem. By PAE do you mean Page Address Extention? Are you sure that disabling it makes the code work? How did you disable it?

The reason for the failure is that MULPS needs a 16-byte aligned memory operand while MOVUPS don't (but MOVAPS needs the alignment).
Post 16 Jan 2007, 05:41
View user's profile Send private message Reply with quote
mkm79



Joined: 27 Feb 2004
Posts: 8
mkm79 17 Jan 2007, 06:35
LocoDelAssembly, Sorry for I distracted you. I forgot that mulps uses aligned memory.
The influence of PAE maybe was because the main program is in C, that allocates memory using malloc.
You asked how I'm turned off PAE - simply by editing boot.ini file of WinXP and substitution of other ntoskernel file
Post 17 Jan 2007, 06:35
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.