flat assembler
Message board for the users of flat assembler.

Index > Linux > 64-bit registers

Author
Thread Post new topic Reply to topic
nunu



Joined: 13 Jan 2007
Posts: 1
nunu
Hi. I want to use 64-bit registers (processor: Intel Celeron D) under 32-bit
Linux. So I wrote program listed below, compiled and launched:

format ELF executable
entry start
use64

segment readable executable

start:

; mov rbx,msg
; mov rax,[rbx]
; inc rbx
; mov [rbx],rax

mov eax,4
mov ebx,1
mov ecx,msg
mov edx,msg_size
int 0x80
mov eax,1
xor ebx,ebx
int 0x80

segment readable writeable

msg db 'HelloWorld',0xA
msg_size = $-msg

The result was 'HelloWorld'. OK. But try to omit every semicolon, compile
and launch again. 'HFellWorld' will appear on the screen. Why it's not 'HHelloWord' ?
Post 13 Jan 2007, 13:09
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
You can't use 64-bit registers under 32-bit environment. The REX byte uses encodings that under 32-bit context are INCs and DECs.
Post 13 Jan 2007, 14:32
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2140
Location: Estonia
Madis731
Celeron D didn't have 64-bit GPRs, but maybe you mean SSE registers - there are used by SSE instructions.
Post 25 Jan 2007, 21:03
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger 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. Also on YouTube, Twitter.

Website powered by rwasa.