[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Lightning] How to use jit_ldxr_l
From: |
Paolo Bonzini |
Subject: |
Re: [Lightning] How to use jit_ldxr_l |
Date: |
Thu, 22 Jul 2010 18:43:15 +0200 |
On Wed, Jul 21, 2010 at 20:46, Mathieu Suen <address@hidden> wrote:
> On Jul 21, 2010, at 6:07 PM, Paolo Bonzini wrote:
>
>> On 07/21/2010 04:47 PM, Mathieu Suen wrote:
>>> Hi,
>>>
>>> I have some question concerning the ldxr/ldxi/ldr/ldi instruction.
>>> Am I right to say that in Intel it is similar to the lea instruction?
>>
>> No, ld/st are a move from/to memory.
>>
>>> If yes I am wondering what is the meaning of
>>>
>>> jit_ldxr_p(JIT_R0, JIT_R1, ...);
>>>
>>> compare to
>>>
>>> jit_ldxr_i(JIT_R0, JIT_R1, 3);
>>
>> This is wrong. The second source operand must be a register, as in all
>> jit_XXXr_YY instruction.
>>
>>> I mgiht not using the jit_ldxr_i / jit_ldxr_p correctly.
>>
>> jit_ldxr_p and jit_ldxr_l (jit_ldxr_i) are exactly the same, but jit_ldxr_i
>> sign-extends the 32-bit value to 64 bits on 64-bit architectures.
>> jit_ldxr_ui zero-extends.
>
> Ok so
> jit_ldxr_i(JIT_R0, JIT_R1, JIT_R2)
>
> is equivalent to the at&t assembly:
>
> mov %r2(%r1), %r0
>
> mov %r1(%r2), %r0
There is no such syntax. There are
mov (%r1,%r2,1), %r0
and
mov (%r2,%r1,1), %r0
lightning will pick whatever is needed to get a correct memory mode
(for example %esp can only be given as the first register in AT&T
assembly but no such restriction exists in lightning).
The best place to get a quick list of macros with its arguments is in
the porting part of the manual: there you can find definitions such as
#define jit_ldxr_p(d, s1, s2)
#define jit_ldxi_p(d, rs, is)
which make it clear what is destination and what is source, what is
register and what is immediate.
Paolo