diff options
author | hpa <hpa> | 2002-11-18 22:22:37 +0000 |
---|---|---|
committer | hpa <hpa> | 2002-11-18 22:22:37 +0000 |
commit | b918509b86a1d65427fe9270886c41b5d0491344 (patch) | |
tree | e76cb483ca01a5f2a719768983a0ca0195a3df62 /sample | |
parent | f3b2b7af08efd9872c973f47410b39de63490230 (diff) | |
download | syslinux-b918509b86a1d65427fe9270886c41b5d0491344.tar.gz |
Fix the COM32 sample programsyslinux-2.01-pre2
Diffstat (limited to 'sample')
-rw-r--r-- | sample/Makefile | 14 | ||||
-rw-r--r-- | sample/c32entry.S | 14 | ||||
-rw-r--r-- | sample/hello.c | 6 |
3 files changed, 25 insertions, 9 deletions
diff --git a/sample/Makefile b/sample/Makefile index 58d6d052..54fdb097 100644 --- a/sample/Makefile +++ b/sample/Makefile @@ -18,6 +18,7 @@ CC = gcc LD = ld CFLAGS = -march=i386 -O2 -fomit-frame-pointer -I../com32/include +SFLAGS = -march=i386 LDFLAGS = -s OBJCOPY = objcopy PPMTOLSS16 = ../ppmtolss16 @@ -26,10 +27,16 @@ PPMTOLSS16 = ../ppmtolss16 all: syslogo.lss hello.c32 -.c.o: +%.o: %.S + $(CC) $(SFLAGS) -c -o $@ $< + +%.o: %.c $(CC) $(CFLAGS) -c -o $@ $< -.elf.c32: +%.elf: c32entry.o %.o + $(LD) -Ttext 0x101000 -e _start -o $@ $^ + +%.c32: %.elf $(OBJCOPY) -O binary $< $@ syslogo.lss: syslogo.png $(PPMTOLSS16) @@ -37,9 +44,6 @@ syslogo.lss: syslogo.png $(PPMTOLSS16) $(PPMTOLSS16) \#000000=0 \#d0d0d0=7 \#f6f6f6=15 \ > syslogo.lss -hello.elf: hello.o - $(LD) -Ttext 0x101000 -e _start -o $@ $< - clean: rm -f *.lss *.o *.elf *.c32 diff --git a/sample/c32entry.S b/sample/c32entry.S new file mode 100644 index 00000000..f1c476ca --- /dev/null +++ b/sample/c32entry.S @@ -0,0 +1,14 @@ + .section ".text","ax" + .globl _start +_start: + movl $0x21cd4cff,%eax + leal 4(%esp),%esi + movl $__com32,%edi + mov $5,%ecx + cld + rep ; movsl + jmp __start + + .section ".bss","a" + .globl __com32 +__com32: .space 20 diff --git a/sample/hello.c b/sample/hello.c index bb8bbfa6..a2b79dde 100644 --- a/sample/hello.c +++ b/sample/hello.c @@ -27,9 +27,7 @@ static inline void memset(void *buf, int ch, unsigned int len) : "+D" (buf), "+c" (len) : "a" (ch) : "memory"); } -int _start(unsigned int nargs, char *cmdline, - void (*syscall)(unsigned char, com32sys_t *, com32sys_t *), - void *bounce_ptr, unsigned int bounce_len) +int __start(void) { const char *msg = "Hello, World!\r\n"; com32sys_t inreg, outreg; @@ -40,7 +38,7 @@ int _start(unsigned int nargs, char *cmdline, for ( p = msg ; *p ; p++ ) { inreg.edx.b[0] = *p; inreg.eax.b[1] = 0x02; /* Write Character */ - syscall(0x21, &inreg, NULL); + __com32.cs_syscall(0x21, &inreg, NULL); } return 0; |