From 9eb9373ad6544a6ddba7f34889fe772f689f8eea Mon Sep 17 00:00:00 2001 From: AceVest Date: Sat, 18 Oct 2014 20:25:01 +0800 Subject: [PATCH] add exit support --- bin/hello.c | 1 - lib/libc.S | 23 ++++++----------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/bin/hello.c b/bin/hello.c index 07043e9..0fb8a96 100644 --- a/bin/hello.c +++ b/bin/hello.c @@ -15,7 +15,6 @@ int main() { printf("hello world\n"); - exit(0); return 0; } diff --git a/lib/libc.S b/lib/libc.S index ea20738..bffe2c5 100644 --- a/lib/libc.S +++ b/lib/libc.S @@ -1,4 +1,5 @@ .extern main +.extern exit .global _start _start: @@ -9,30 +10,18 @@ _start: nop nop -/* - movl $11, %eax; - - pushl $1f; - pushl %ecx; - pushl %edx; - pushl %ebp; - movl %esp,%ebp; - sysenter; - 1: - -loop: - jmp loop - */ - - pushl $0xAAAAAAAA + pushl $0x22222222 pushl $0x11111111 call main - addl $12, %esp + pushl $0 + call exit + addl $4, %esp + nop nop nop -- 2.44.0