Mail Archives: djgpp/1997/07/07/18:19:31
On Sun, 6 Jul 1997, john Conner wrote:
> asm("leal _RAM,%ebp"); /* RAM is a c pointer */
>
> It crashes every time. I get a gpf or stack fault.
> It works fine if I use esi,edi,ect. Any help?
Forgive me if I'm wrong, but isn't the proper line:
asm("leal %ebp,_RAM");
Your line is moving the contents of _RAM (undefined at the time, I'm
assuming) to ebp. AT&T syntax is "backwards" (in relation to Intel).
The opcodes act like:
grammer: [verb] FROM [src] TO [dest]
opcode: [verb] [src], [dest]
ie: movb 5, %eax
instead of:
grammer: [verb] TO [dest] FROM [src]
opcode: [verb] [dest], [src]
ie: mov ax, 3
AT&T syntax makes a little more sense gramatically (in terms of English),
but for people raised on Intel, it's dang confusing sometimes. ;)
/\/\att /\/\astracci mmastrac AT acs DOT ucalgary DOT ca
GCS/GE d- s+:+ a--- C++++ UA P+ L E-- W+ N++ o K+ w+ O M- V
PS++ PE++ Y+ PGP t+++ 5+++ X++ R++ tv+ b+++ DI++++ I
G++ e h r* z?
- Raw text -