flat assembler
Message board for the users of flat assembler.

Index > Linux > How to access the address of index Ap using assembly

Author
Thread Post new topic Reply to topic
juanchen



Joined: 21 Jun 2008
Posts: 3
juanchen
I am trying to translate the clause xp[xi]/=Ap[Ai] to assembly code.
At the first several statements, I want to assign Ap[Ai] to the low 64 bit of xmm1 as follows.
asm volatile ("mov %[Ai], %%edx":: [Ai] "m" (Ai));
asm volatile ("shll $2, %edx");
asm volatile ("add %%ecx,%%edx":: "c" (Ap));
asm volatile ("movlpd (%edx),%xmm1");
But when the fourth statement is executed, segment fault occors. I trace the process of execution and suspect that the address of Ap is wrong. I am not sure that whether the third statement is right.
Post 25 Jun 2008, 12:45
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
Here's a really lame guess: maybe (code, data) have to be 16-byte aligned??
Post 30 Jun 2008, 21:08
View user's profile Send private message Visit poster's website 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-2020, Tomasz Grysztar.

Powered by rwasa.