Keith Kanios wrote:
>>
>> Something I noticed. Check out "mov
eax[rip+$]", then check out "mov
>> rax[rip+$]" in the disassembly. Anyone else
see anything wrong with that?
>
> Too quick for my own good. "mov eax,[rip+$]"
and "mov rax,[rip+$]"
> respectively.
>
Okay, the bug is actually in the assembler (or in the outbin
backend),
not in the disassembler... look at the bytes output:
00000000 8B05FAFFFFFF mov eax,[rip:0x0]
00000006 488B05F9FFFFFF mov rax,[rip:0x6]
0000000D 8B05FBFFFFFF mov eax,[rip:0xe]
00000013 488B05FAFFFFFF mov rax,[rip:0x14]
0000001A 8B1DFCFFFFFF mov ebx,[rip:0x1c]
00000020 488B1DFBFFFFFF mov rbx,[rip:0x22]
The offset is increased by one for each iteration. Now,
looking at the
list file, it appears that the assembler really is trying to
do the
right thing, but it miscomputes the length of the REX-ified
instruction.
This is almost certainly my bug from the last checkin,
since I messed
with the length computing routine.
(Note: I have to admit to not being all that happy about
having one
routine computing the length and one routine emitting bytes.
It would
be better to have one routine which did both, by having
out() either
just run a counter, or call the backend, depending on
context.
Something for the TODO list. Now when NASM has a future
again, I guess
it's time to make a list of this kind of code cleanups that
should be done.)
1 bits 64
2 00000000 8B05(00000000) mov
eax,[rip+$]
3 00000006 488B05(06000000) mov
rax,[rip+$]
4 0000000E 8B05(0E000000) mov
eax,[rip+$]
5 00000014 488B05(14000000) mov
rax,[rip+$]
6 0000001C 8B1D(1C000000) mov
ebx,[rip+$]
7 00000022 488B1D(22000000) mov
rbx,[rip+$]
-hpa
------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
Nasm-devel mailing list
Nasm-devel lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nasm-devel
a>
|