Port-arm archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: SVC (SWI) for Thumb
On Aug 14, 2013, at 3:08 PM, David Laight <david%l8s.co.uk@localhost> wrote:
> On Wed, Aug 14, 2013 at 07:37:44AM -0700, Matt Thomas wrote:
>>>> movs r0, #(syscall - 254)/8
>>>> lsls r0, r0, #3
>>>
>>> Shouldn't that be a shift by 8 ?
>>
>> No. The add can only take a 3 bit value (hence, the divide by 8)
>>
>>>> adds r0, r0, #((syscall - 254) & 7)
>
> Hmmm... I was looking at the 0x3xxx instruction, not the 0x1exx one.
Ya. I changed it to use the 0x3xxx instruction
So now it's either
Less than 255:
movs r0, #syscall
armv7:
movw r0, #syscall
multiple of 4:
movs r0, #(syscall/4)
lsls r0, r0, #2
multiple of 2:
movs r0, #(syscall/2)
lsls r0, r0, #1
everything else:
movs r0, #(syscall/256)
lsls r0, r0, #8
adds r0, r0, #(syscall&255)
Home |
Main Index |
Thread Index |
Old Index