$ in GNU as assembler
Peter Barada
pbarada@mail.wm.sps.mot.com
Tue Apr 23 12:47:00 GMT 2002
> What is the meaning of $ in the GNU as assembler when it is prefixed
>to a number. For example, what is the difference between
>
>mov $0x53, %al
>
>and
>
>mov 0x53, %al.
The simple test case:
char a;
void b(void)
{
a = 0x53;
}
void c(void)
{
*(char *)(0x53) = a;
}
Compiles into:
b:
pushl %ebp
movl %esp, %ebp
movb $83, a
popl %ebp
ret
c:
pushl %ebp
movl %esp, %ebp
movb a, %al
movb %al, 83
popl %ebp
ret
So from this I'd conclude that the '$' is an immediate prefix to
indicate that it tells the assembler to load the value of 0x53(83)
into 'a' instead of loading the value at *memory address* 0x53 into
%al.
--
Peter Barada Peter.Barada@motorola.com
Wizard 781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola) 781-270-0193 (fax)
More information about the Binutils
mailing list