aboutsummaryrefslogtreecommitdiffstats
path: root/sample
diff options
context:
space:
mode:
authorhpa <hpa>2003-12-13 02:22:56 +0000
committerhpa <hpa>2003-12-13 02:22:56 +0000
commit71f30d9fccf71b4c6be7a01a3b47deaa2e5ab3c6 (patch)
tree4e43f678e8a4ef37a4417fd302ff404f87b16cdc /sample
parent1419b1baf164fa130f47178d28cbe516fe5b3c6c (diff)
downloadsyslinux-71f30d9fccf71b4c6be7a01a3b47deaa2e5ab3c6.tar.gz
Minor com32 wrapper code cleanup
Diffstat (limited to 'sample')
-rw-r--r--sample/Makefile8
-rw-r--r--sample/c32entry.S7
-rw-r--r--sample/c32exit.S10
3 files changed, 21 insertions, 4 deletions
diff --git a/sample/Makefile b/sample/Makefile
index 8964c004..8a2eb6de 100644
--- a/sample/Makefile
+++ b/sample/Makefile
@@ -27,18 +27,22 @@ OBJCOPY = objcopy
PPMTOLSS16 = ../ppmtolss16
LIB = libcom32.a
-LIBOBJS = conio.o atou.o skipatou.o printf.o
+LIBOBJS = conio.o atou.o skipatou.o printf.o c32exit.o
.SUFFIXES: .lss .c .o .elf .c32
-all: syslogo.lss comecho.com hello.c32 hello2.c32 filetest.c32 c32echo.c32 fd.c32 chain.c32
+all: syslogo.lss comecho.com hello.c32 hello2.c32 filetest.c32 c32echo.c32 \
+ fd.c32 chain.c32 $(LIB)
+.PRECIOUS: %.o
%.o: %.S
$(CC) $(SFLAGS) -c -o $@ $<
+.PRECIOUS: %.o
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
+.PRECIOUS: %.elf
%.elf: c32entry.o %.o $(LIB)
$(LD) -Ttext 0x101000 -e _start -o $@ $^
diff --git a/sample/c32entry.S b/sample/c32entry.S
index 1ae57a2c..ee71d8fc 100644
--- a/sample/c32entry.S
+++ b/sample/c32entry.S
@@ -47,9 +47,10 @@ _start:
rep ; stosl
# Copy COM32 invocation parameters
- leal 4(%esp),%esi
+ leal 4(%esp),%esi # Argument list
movl $__com32,%edi
movl $6,%ecx
+ movl %esp,-4(%edi) # Save the initial stack ptr
cmpl (%esi),%ecx
jbe 1f
movl (%esi),%ecx
@@ -60,5 +61,7 @@ _start:
jmp __start
.section ".bss","a"
+ .globl __entry_esp
+__entry_esp: .space 4
.globl __com32
-__com32: .space 24
+__com32: .space 4*6
diff --git a/sample/c32exit.S b/sample/c32exit.S
new file mode 100644
index 00000000..5c5ba030
--- /dev/null
+++ b/sample/c32exit.S
@@ -0,0 +1,10 @@
+# $Id#
+#
+# Implementation of exit() for com32 based on c32entry.S
+#
+ .text
+ .globl exit
+exit:
+ movl 4(%esp),%eax # Exit code in %eax = return value
+ movl (__entry_esp),%esp # Return stack pointer to entry value
+ ret # Return to termination address