On Mon, 2005-06-06 at 19:26 -0400, Mike Frysinger wrote:
> i use asm label tricks:
> $ cat test.c
> int main(int argc, char *argv[])
> {
> int a;
> asm("startit:");
> a = 10;
> asm("stopit:");
> return 0;
> }
>
> $ gcc -c test.c && objdump -d test.o
> test.o: file format elf64-x86-64
>
> Disassembly of section .text:
>
> 0000000000000000 <main>:
> 0: 55 push %rbp
> 1: 48 89 e5 mov %rsp,%rbp
> 4: 89 7d fc mov %edi,0xfffffffffffffffc(%rbp)
> 7: 48 89 75 f0 mov %rsi,0xfffffffffffffff0(%rbp)
>
> 000000000000000b <startit>:
> b: c7 45 ec 0a 00 00 00 movl $0xa,0xffffffffffffffec(%rbp)
>
> 0000000000000012 <stopit>:
> 12: b8 00 00 00 00 mov $0x0,%eax
> 17: c9 leaveq
> 18: c3 retq
> -mike
Well, the pages I was reading used the nop trick but it looks like a
better solution has been presented. I almost forgot that integers are
still 32 bit on x86-64 so explaining the movl instead of movq. For
those interested the "gcc -S" is (the #APP/#NO_APP is gcc's way of
marking inline asm):
--------- 8< ----------
#APP
startit:
#NO_APP
movl $10, -20(%rbp)
#APP
stopit:
#NO_APP
--------- >8 ----------
Thanks Vapier,
--
Tres
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel