List Info

Thread: Re: REG_C8REG




Re: REG_C8REG
country flaguser name
United States
2007-04-17 20:41:56
>> Keith Kanios wrote:
>>>
>>> For example, in 16/32-bit on the x64, the
seeming "lock mov reg32,cr0"
>>> would actually be "mov reg32,cr8".
However, in 64-bit long mode, you
>>> use
>>> the REX prefix to signify "mov
reg32/64,CR8". This also goes for the
>>> opposite ("mov cr8,reg32/64").
>>>
>>
>> Okay, I just checked in a patch which uses the new
334 code to indicate
>> "LOCK is really REX.R".  It now works
correctly in both the assembler
>> and disassembler.  I also tightened up the checking
of high resources in
>> 16- or 32-bit mode ("mov eax,cr9" would
compile in 32-bit mode, but
>> would actually generate "mov eax,cr1" for
example.)
>>
>> 	-hpa
>>
>>
>
> Cool.
>
> 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.


------------------------------------------------------------
-------------
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-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nasm-devel

Re: REG_C8REG
country flaguser name
United States
2007-04-17 21:06:47
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.
> 

Wow!  That's ... weird!

	-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-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nasm-devel

Re: REG_C8REG
country flaguser name
United States
2007-04-17 21:17:24
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-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nasm-devel

Re: REG_C8REG
country flaguser name
United States
2007-04-17 21:29:05
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.
> 

Found the problem.  The 324 code was being incorrectly
processed in 
calcsize().  Fixed.

	-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-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nasm-devel

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )