diff -uNr linux-1.0.9/Makefile linux-elf/Makefile --- linux-1.0.9/Makefile Mon Apr 1 12:40:20 2002 +++ linux-elf/Makefile Mon Apr 1 15:49:09 2002 @@ -10,6 +10,8 @@ else if [ -x /bin/bash ]; then echo /bin/bash; \ else echo sh; fi ; fi) +TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi) + # # Make "config" the default target if there is no configuration file or # "depend" the target if there is no top-level dependency information. @@ -50,7 +52,7 @@ # standard CFLAGS # -CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe +CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -malign-loops=0 -malign-jumps=0 -malign-functions=0 -pipe ifdef CONFIG_CPP CFLAGS := $(CFLAGS) -x c++ @@ -72,26 +74,60 @@ AS86 =as86 -0 -a LD86 =ld86 -0 -AS =as -LD =ld -LDFLAGS =#-qmagic -HOSTCC =gcc -CC =gcc -D__KERNEL__ +CC =/opt/gcc-2.7.2.3/bin/gcc -I$(TOPDIR)/include +HOSTCC =gcc MAKE =make CPP =$(CC) -E AR =ar STRIP =strip +# We use ELF. +# +USE_ELF=yes +# +# We use a.out. +#USE_ELF=no + +# ZLINKFLAGS = -Ttext 0x1000 +# LINKFLAGS = -Ttext 0x100000 +# +# +ifeq ($(USE_ELF),yes) +LD=ld -m elf_i386 +ELF=-D__ELF__ +CPP=$(CC) -E $(ELF) +OBJCOPY =objcopy -O binary -R .note -R .comment -R .stab -R .stabstr +OBJDUMP =objdump +ENCAPS =encaps +CFLAGS := $(CFLAGS) -D__KERNEL__ +OBJDUMP_FLAGS=-k -q +LDFLAGS=-e startup_32 +ZIMAGE_OFFSET=0x1000 +IMAGE_OFFSET=0x100000 +ZLINKFLAGS =-Ttext $(ZIMAGE_OFFSET) $(LDFLAGS) +LINKFLAGS =-Ttext $(IMAGE_OFFSET) $(LDFLAGS) +TOOLFLAGS = -D__BFD__ +else +AS=/usr/i486-linuxaout/bin/as +LD=/usr/i486-linuxaout/bin/ld -m i386linux +CC=gcc -b i486-linuxaout -D__KERNEL__ -I$(TOPDIR)/include +# +# -qmagic (we need to remove the 32 byte header for bootup purposes) +# +ZLINKFLAGS =-qmagic -Ttext 0xfe0 +LINKFLAGS =-qmagic -Ttext 0xfffe0 +TOOLFLAGS = +endif + ARCHIVES =kernel/kernel.o mm/mm.o fs/fs.o net/net.o ipc/ipc.o FILESYSTEMS =fs/filesystems.a DRIVERS =drivers/block/block.a \ drivers/char/char.a \ - drivers/net/net.a \ ibcs/ibcs.o LIBS =lib/lib.a SUBDIRS =kernel drivers mm fs net ipc ibcs lib -KERNELHDRS =/usr/src/linux/include +DRIVERS := $(DRIVERS) drivers/net/net.a ifdef CONFIG_SCSI DRIVERS := $(DRIVERS) drivers/scsi/scsi.a @@ -137,7 +175,7 @@ @echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\" >> tools/version.h tools/build: tools/build.c $(CONFIGURE) - $(HOSTCC) $(CFLAGS) -o $@ $< + $(HOSTCC) $(CFLAGS) $(TOOLFLAGS) -o $@ $< boot/head.o: $(CONFIGURE) boot/head.s @@ -149,14 +187,14 @@ init/main.o: $(CONFIGURE) init/main.c $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $< -tools/system: boot/head.o init/main.o tools/version.o linuxsubdirs +tools/System: boot/head.o init/main.o tools/version.o linuxsubdirs $(LD) $(LDFLAGS) -Ttext 1000 boot/head.o init/main.o tools/version.o \ $(ARCHIVES) \ $(FILESYSTEMS) \ $(DRIVERS) \ $(LIBS) \ - -o tools/system - nm tools/zSystem | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | \ + -o tools/System + nm tools/System | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | \ sort > System.map boot/setup: boot/setup.o @@ -180,13 +218,45 @@ zBoot/zSystem: zBoot/*.c zBoot/*.S tools/zSystem $(MAKE) -C zBoot +Image: $(CONFIGURE) boot/bootsect boot/setup tools/System tools/build +ifeq ($(USE_ELF),yes) + if hash $(ENCAPS) 2> /dev/null; then \ + $(OBJDUMP) $(OBJDUMP_FLAGS) -o $(ZIMAGE_OFFSET) tools/System > tools/vmlinux.out ; \ + else \ + $(OBJCOPY) tools/System tools/vmlinux.out; \ + fi + tools/build boot/bootsect boot/setup tools/vmlinux.out $(ROOT_DEV) > Image +else + tools/build boot/bootsect boot/setup tools/System $(ROOT_DEV) > Image +endif + sync + zImage: $(CONFIGURE) boot/bootsect boot/setup zBoot/zSystem tools/build +ifeq ($(USE_ELF),yes) + if hash $(ENCAPS) 2> /dev/null; then \ + $(OBJDUMP) $(OBJDUMP_FLAGS) -o $(ZIMAGE_OFFSET) zBoot/zSystem > zBoot/vmlinux.out ; \ + else \ + $(OBJCOPY) zBoot/zSystem zBoot/vmlinux.out; \ + fi + tools/build boot/bootsect boot/setup zBoot/vmlinux.out $(ROOT_DEV) > zImage +else tools/build boot/bootsect boot/setup zBoot/zSystem $(ROOT_DEV) > zImage +endif sync +disk: Image + dd bs=8192 if=Image of=/dev/fd0 + zdisk: zImage dd bs=8192 if=zImage of=/dev/fd0 +lilo: $(CONFIGURE) Image + if [ -f /vmlinux ]; then mv /vmlinux /vmlinux.old; fi + if [ -f /System.map ]; then mv /System.map /System.old; fi + cat Image > /vmlinux + cp System.map / + if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi + zlilo: $(CONFIGURE) zImage if [ -f /vmlinuz ]; then mv /vmlinuz /vmlinuz.old; fi if [ -f /zSystem.map ]; then mv /zSystem.map /zSystem.old; fi @@ -229,9 +299,9 @@ rm -f kernel/ksyms.lst rm -f core `find . -name '*.[oas]' -print` rm -f core `find . -name 'core' -print` - rm -f zImage zSystem.map tools/zSystem tools/system - rm -f Image System.map boot/bootsect boot/setup - rm -f zBoot/zSystem zBoot/xtract zBoot/piggyback + rm -f zImage zSystem.map tools/zSystem tools/System + rm -f Image System.map boot/bootsect boot/setup tools/vmlinux.out + rm -f zBoot/zSystem zBoot/xtract zBoot/piggyback zBoot/vmlinux.out rm -f .tmp* drivers/sound/configure rm -f init/*.o tools/build boot/*.o tools/*.o diff -uNr linux-1.0.9/boot/head.S linux-elf/boot/head.S --- linux-1.0.9/boot/head.S Thu Feb 3 11:37:44 1994 +++ linux-elf/boot/head.S Mon Apr 1 15:49:09 2002 @@ -9,14 +9,10 @@ */ .text -.globl _idt,_gdt, -.globl _swapper_pg_dir,_pg0 -.globl _empty_bad_page -.globl _empty_bad_page_table -.globl _empty_zero_page -.globl _tmp_floppy_area,_floppy_track_buffer +#include #include +#include #include #define CL_MAGIC_ADDR 0x90020 @@ -28,6 +24,7 @@ * swapper_pg_dir is the main page directory, address 0x00001000 (or at * address 0x00101000 for a compressed boot). */ + .globl startup_32 startup_32: cld movl $(KERNEL_DS),%eax @@ -35,13 +32,13 @@ mov %ax,%es mov %ax,%fs mov %ax,%gs - lss _stack_start,%esp + lss SYMBOL_NAME(stack_start),%esp /* * Clear BSS first so that there are no surprises... */ xorl %eax,%eax - movl $__edata,%edi - movl $__end,%ecx + movl $ SYMBOL_NAME(_edata),%edi + movl $ SYMBOL_NAME(_end),%ecx subl %edi,%ecx cld rep @@ -69,7 +66,7 @@ * is for the command line. */ movl $0x90000,%esi - movl $_empty_zero_page,%edi + movl $ SYMBOL_NAME(empty_zero_page),%edi movl $512,%ecx cld rep @@ -80,7 +77,7 @@ stosl cmpw $(CL_MAGIC),CL_MAGIC_ADDR jne 1f - movl $_empty_zero_page+2048,%edi + movl $ SYMBOL_NAME(empty_zero_page)+2048,%edi movzwl CL_OFFSET,%esi addl $(CL_BASE_ADDR),%esi movl $2048,%ecx @@ -95,7 +92,7 @@ */ movl %esp,%edi # save stack pointer andl $0xfffffffc,%esp # align stack to avoid AC fault - movl $3,_x86 + movl $3,SYMBOL_NAME(x86) pushfl # push EFLAGS popl %eax # get EFLAGS movl %eax,%ecx # save original EFLAGS @@ -107,7 +104,7 @@ xorl %ecx,%eax # change in flags andl $0x40000,%eax # check if AC bit changed je is386 - movl $4,_x86 + movl $4,SYMBOL_NAME(x86) movl %ecx,%eax xorl $0x200000,%eax # check ID flag pushl %eax @@ -123,7 +120,7 @@ .byte 0x0f, 0xa2 # check the processor type andl $0xf00, %eax # Set _x86 with the family shrl $8, %eax # returned. - movl %eax, _x86 + movl %eax, SYMBOL_NAME(x86) movl %edi,%esp # restore esp movl %cr0,%eax # 486+ andl $0x80000011,%eax # Save PG,PE,ET @@ -153,14 +150,14 @@ mov %ax,%es mov %ax,%fs mov %ax,%gs - lss _stack_start,%esp + lss SYMBOL_NAME(stack_start),%esp xorl %eax,%eax lldt %ax pushl %eax # These are the parameters to main :-) pushl %eax pushl %eax cld # gcc2 wants the direction flag cleared at all times - call _start_kernel + call SYMBOL_NAME(start_kernel) L6: jmp L6 # main should never return here, but # just in case, we know what happens. @@ -169,7 +166,7 @@ * We depend on ET to be correct. This checks for 287/387. */ check_x87: - movl $0,_hard_math + movl $0,SYMBOL_NAME(hard_math) clts fninit fstsw %ax @@ -180,7 +177,7 @@ movl %eax,%cr0 ret .align 2 -1: movl $1,_hard_math +1: movl $1,SYMBOL_NAME(hard_math) .byte 0xDB,0xE4 /* fsetpm for 287, ignored by 387 */ ret @@ -200,7 +197,7 @@ movw %dx,%ax /* selector = 0x0010 = cs */ movw $0x8E00,%dx /* interrupt gate - dpl=0, present */ - lea _idt,%edi + lea SYMBOL_NAME(idt),%edi mov $256,%ecx rp_sidt: movl %eax,(%edi) @@ -222,24 +219,26 @@ * (ref: update, 25Sept92) -- croutons@crunchy.uucp * (ref: 92.10.11 - Linus Torvalds. Corrected 16M limit - no upper memory limit) */ -.align 2 + ALIGN setup_paging: movl $1024*2,%ecx /* 2 pages - swapper_pg_dir+1 page table */ xorl %eax,%eax - movl $_swapper_pg_dir,%edi /* swapper_pg_dir is at 0x1000 */ + movl $ SYMBOL_NAME(swapper_pg_dir),%edi /* swapper_pg_dir is at 0x1000 */ cld;rep;stosl /* Identity-map the kernel in low 4MB memory for ease of transition */ - movl $_pg0+7,_swapper_pg_dir /* set present bit/user r/w */ +/* set present bit/user r/w */ + movl $ SYMBOL_NAME(pg0)+7,SYMBOL_NAME(swapper_pg_dir) /* But the real place is at 0xC0000000 */ - movl $_pg0+7,_swapper_pg_dir+3072 /* set present bit/user r/w */ - movl $_pg0+4092,%edi +/* set present bit/user r/w */ + movl $ SYMBOL_NAME(pg0)+7,SYMBOL_NAME(swapper_pg_dir)+3072 + movl $ SYMBOL_NAME(pg0)+4092,%edi movl $0x03ff007,%eax /* 4Mb - 4096 + 7 (r/w user,p) */ std 1: stosl /* fill the page backwards - more efficient :-) */ subl $0x1000,%eax jge 1b cld - movl $_swapper_pg_dir,%eax + movl $ SYMBOL_NAME(swapper_pg_dir),%eax movl %eax,%cr3 /* cr3 - page directory start */ movl %cr0,%eax orl $0x80000000,%eax @@ -257,30 +256,30 @@ * by 2-3k. This would be a good thing to do at some point..... */ .org 0x1000 -_swapper_pg_dir: +ENTRY(swapper_pg_dir) /* * The page tables are initialized to only 4MB here - the final page * tables are set up later depending on memory size. */ .org 0x2000 -_pg0: +ENTRY(pg0) .org 0x3000 -_empty_bad_page: +ENTRY(empty_bad_page) .org 0x4000 -_empty_bad_page_table: +ENTRY(empty_bad_page_table) .org 0x5000 -_empty_zero_page: +ENTRY(empty_zero_page) .org 0x6000 /* * tmp_floppy_area is used by the floppy-driver when DMA cannot * reach to a buffer-block. It needs to be aligned, so that it isn't * on a 64kB border. */ -_tmp_floppy_area: +ENTRY(tmp_floppy_area) .fill 1024,1,0 /* * floppy_track_buffer is used to buffer one track of floppy data: it @@ -288,8 +288,8 @@ * sector read/write can mess it up. It can contain one full track of * data (18*2*512 bytes). */ -_floppy_track_buffer: +ENTRY(floppy_track_buffer) .fill 512*2*18,1,0 /* This is the default interrupt "handler" :-) */ int_msg: @@ -308,7 +309,7 @@ mov %ax,%es mov %ax,%fs pushl $int_msg - call _printk + call SYMBOL_NAME(printk) popl %eax pop %fs pop %es @@ -321,28 +322,26 @@ /* * The interrupt descriptor table has room for 256 idt's */ -.align 4 + ALIGN .word 0 idt_descr: .word 256*8-1 # idt contains 256 entries - .long 0xc0000000+_idt + .long 0xc0000000+SYMBOL_NAME(idt) -.align 4 -_idt: +ENTRY(idt) .fill 256,8,0 # idt is uninitialized -.align 4 + ALIGN .word 0 gdt_descr: .word (8+2*NR_TASKS)*8-1 - .long 0xc0000000+_gdt + .long 0xc0000000+SYMBOL_NAME(gdt) /* * This gdt setup gives the kernel a 1GB address space at virtual * address 0xC0000000 - space enough for expansion, I hope. */ -.align 4 -_gdt: +ENTRY(gdt) .quad 0x0000000000000000 /* NULL descriptor */ .quad 0x0000000000000000 /* not used */ .quad 0xc0c39a000000ffff /* 0x10 kernel 1GB code at 0xC0000000 */ diff -uNr linux-1.0.9/drivers/FPU-emu/Makefile linux-elf/drivers/FPU-emu/Makefile --- linux-1.0.9/drivers/FPU-emu/Makefile Tue Jan 11 10:10:47 1994 +++ linux-elf/drivers/FPU-emu/Makefile Mon Apr 1 15:49:09 2002 @@ -12,7 +12,7 @@ $(CC) $(CFLAGS) $(MATH_EMULATION) -c $< .S.o: - $(CC) -D__ASSEMBLER__ $(PARANOID) $(REENTRANT) -c $< + $(CC) -D__ASSEMBLER__ $(ELF) $(PARANOID) $(REENTRANT) -c $< .s.o: $(CC) -c $< diff -uNr linux-1.0.9/drivers/FPU-emu/div_small.S linux-elf/drivers/FPU-emu/div_small.S --- linux-1.0.9/drivers/FPU-emu/div_small.S Wed Dec 1 13:44:16 1993 +++ linux-elf/drivers/FPU-emu/div_small.S Mon Apr 1 15:49:09 2002 @@ -17,11 +17,8 @@ #include "fpu_asm.h" .text - .align 2,144 -.globl _div_small - -_div_small: +ENTRY(div_small) pushl %ebp movl %esp,%ebp diff -uNr linux-1.0.9/drivers/FPU-emu/fpu_asm.h linux-elf/drivers/FPU-emu/fpu_asm.h --- linux-1.0.9/drivers/FPU-emu/fpu_asm.h Wed Dec 1 13:44:16 1993 +++ linux-elf/drivers/FPU-emu/fpu_asm.h Mon Apr 1 15:49:09 2002 @@ -9,9 +9,10 @@ #ifndef _FPU_ASM_H_ #define _FPU_ASM_H_ +#include #include "fpu_emu.h" -#define EXCEPTION _exception +#define EXCEPTION SYMBOL_NAME(exception) #define PARAM1 8(%ebp) diff -uNr linux-1.0.9/drivers/FPU-emu/poly_div.S linux-elf/drivers/FPU-emu/poly_div.S --- linux-1.0.9/drivers/FPU-emu/poly_div.S Wed Dec 1 13:44:16 1993 +++ linux-elf/drivers/FPU-emu/poly_div.S Mon Apr 1 15:49:09 2002 @@ -19,9 +19,7 @@ .text /*---------------------------------------------------------------------------*/ - .align 2,144 -.globl _poly_div2 -_poly_div2: +ENTRY(poly_div2) pushl %ebp movl %esp,%ebp @@ -41,9 +39,7 @@ leave ret /*---------------------------------------------------------------------------*/ - .align 2,144 -.globl _poly_div4 -_poly_div4: +ENTRY(poly_div4) pushl %ebp movl %esp,%ebp @@ -68,9 +64,7 @@ leave ret /*---------------------------------------------------------------------------*/ - .align 2,144 -.globl _poly_div16 -_poly_div16: +ENTRY(poly_div16) pushl %ebp movl %esp,%ebp diff -uNr linux-1.0.9/drivers/FPU-emu/poly_mul64.S linux-elf/drivers/FPU-emu/poly_mul64.S --- linux-1.0.9/drivers/FPU-emu/poly_mul64.S Wed Dec 1 13:44:16 1993 +++ linux-elf/drivers/FPU-emu/poly_mul64.S Mon Apr 1 15:49:09 2002 @@ -15,9 +15,7 @@ #include "fpu_asm.h" .text - .align 2,144 -.globl _mul64 -_mul64: +ENTRY(mul64) pushl %ebp movl %esp,%ebp subl $16,%esp diff -uNr linux-1.0.9/drivers/FPU-emu/polynomial.S linux-elf/drivers/FPU-emu/polynomial.S --- linux-1.0.9/drivers/FPU-emu/polynomial.S Wed Dec 1 13:44:16 1993 +++ linux-elf/drivers/FPU-emu/polynomial.S Mon Apr 1 15:49:09 2002 @@ -35,9 +35,7 @@ #define ACCUM_LS_HI -9(%ebp) /* high byte of accum ls */ .text - .align 2,144 -.globl _polynomial -_polynomial: +ENTRY(polynomial) pushl %ebp movl %esp,%ebp subl $32,%esp diff -uNr linux-1.0.9/drivers/FPU-emu/reg_div.S linux-elf/drivers/FPU-emu/reg_div.S --- linux-1.0.9/drivers/FPU-emu/reg_div.S Thu Feb 3 11:11:40 1994 +++ linux-elf/drivers/FPU-emu/reg_div.S Mon Apr 1 15:49:09 2002 @@ -19,10 +19,7 @@ .text - .align 2 - -.globl _reg_div -_reg_div: +ENTRY(reg_div) pushl %ebp movl %esp,%ebp #ifdef REENTRANT_FPU @@ -47,7 +44,7 @@ cmpl EXP_UNDER,EXP(%esi) jg xL_arg1_not_denormal - call _denormal_operand + call SYMBOL_NAME(denormal_operand) orl %eax,%eax jnz fpu_Arith_exit @@ -55,7 +52,7 @@ cmpl EXP_UNDER,EXP(%ebx) jg xL_arg2_not_denormal - call _denormal_operand + call SYMBOL_NAME(denormal_operand) orl %eax,%eax jnz fpu_Arith_exit @@ -75,7 +72,7 @@ addl EXP_BIAS,%edx movl %edx,EXP(%edi) - jmp _divide_kernel + jmp SYMBOL_NAME(divide_kernel) /*-----------------------------------------------------------------------*/ @@ -92,14 +89,14 @@ pushl %edi /* Destination */ pushl %esi pushl %ebx /* Ordering is important here */ - call _real_2op_NaN + call SYMBOL_NAME(real_2op_NaN) jmp LDiv_exit /* Invalid operations */ L_zero_zero: L_inf_inf: pushl %edi /* Destination */ - call _arith_invalid /* 0/0 or Infinity/Infinity */ + call SYMBOL_NAME(arith_invalid) /* 0/0 or Infinity/Infinity */ jmp LDiv_exit L_no_NaN_arg: @@ -126,7 +123,7 @@ cmpl EXP_UNDER,EXP(%ebx) jg L_copy_arg1 /* Answer is Inf */ - call _denormal_operand + call SYMBOL_NAME(denormal_operand) orl %eax,%eax jnz fpu_Arith_exit #endif DENORM_OPERAND @@ -151,7 +148,7 @@ movb SIGN(%esi),%al xorb SIGN(%ebx),%al pushl %eax /* lower 8 bits have the sign */ - call _divide_by_zero + call SYMBOL_NAME(divide_by_zero) jmp LDiv_exit L_arg2_not_zero: @@ -165,7 +162,7 @@ cmpl EXP_UNDER,EXP(%esi) jg L_return_zero /* Answer is zero */ - call _denormal_operand + call SYMBOL_NAME(denormal_operand) orl %eax,%eax jnz fpu_Arith_exit #endif DENORM_OPERAND @@ -185,7 +182,7 @@ cmpl EXP_UNDER,EXP(%ebx) jg L_copy_arg1 /* Answer is zero */ - call _denormal_operand + call SYMBOL_NAME(denormal_operand) orl %eax,%eax jnz fpu_Arith_exit #endif DENORM_OPERAND @@ -241,11 +238,11 @@ call EXCEPTION /* Generate a NaN for unknown tags */ - movl _CONST_QNaN,%eax + movl SYMBOL_NAME(CONST_QNaN),%eax movl %eax,(%edi) - movl _CONST_QNaN+4,%eax + movl SYMBOL_NAME(CONST_QNaN)+4,%eax movl %eax,SIGL(%edi) - movl _CONST_QNaN+8,%eax + movl SYMBOL_NAME(CONST_QNaN)+8,%eax movl %eax,SIGH(%edi) jmp LDiv_exit /* %eax is nz */ #endif PARANOID diff -uNr linux-1.0.9/drivers/FPU-emu/reg_norm.S linux-elf/drivers/FPU-emu/reg_norm.S --- linux-1.0.9/drivers/FPU-emu/reg_norm.S Tue Jan 11 10:10:49 1994 +++ linux-elf/drivers/FPU-emu/reg_norm.S Mon Apr 1 15:49:09 2002 @@ -19,10 +19,7 @@ .text - .align 2,144 -.globl _normalize - -_normalize: +ENTRY(normalize) pushl %ebp movl %esp,%ebp pushl %ebx @@ -34,7 +31,7 @@ je L_ok pushl $0x220 - call _exception + call SYMBOL_NAME(exception) addl $4,%esp L_ok: @@ -86,23 +83,21 @@ L_underflow: push %ebx - call _arith_underflow + call SYMBOL_NAME(arith_underflow) pop %ebx jmp L_exit L_overflow: push %ebx - call _arith_overflow + call SYMBOL_NAME(arith_overflow) pop %ebx jmp L_exit /* Normalise without reporting underflow or overflow */ - .align 2,144 -.globl _normalize_nuo -_normalize_nuo: +ENTRY(normalize_nuo) pushl %ebp movl %esp,%ebp pushl %ebx @@ -114,7 +109,7 @@ je L_ok_nuo pushl $0x221 - call _exception + call SYMBOL_NAME(exception) addl $4,%esp L_ok_nuo: diff -uNr linux-1.0.9/drivers/FPU-emu/reg_round.S linux-elf/drivers/FPU-emu/reg_round.S --- linux-1.0.9/drivers/FPU-emu/reg_round.S Wed Feb 16 12:07:57 1994 +++ linux-elf/drivers/FPU-emu/reg_round.S Mon Apr 1 15:49:09 2002 @@ -101,14 +101,13 @@ .text - .align 2,144 + .globl fpu_reg_round .globl fpu_reg_round_sqrt .globl fpu_Arith_exit -.globl _round_reg /* Entry point when called from C */ -_round_reg: +ENTRY(round_reg) pushl %ebp movl %esp,%ebp pushl %esi @@ -435,7 +434,7 @@ */ xL_precision_lost_up: push %eax - call _set_precision_flag_up + call SYMBOL_NAME(set_precision_flag_up) popl %eax jmp xL_no_precision_loss @@ -445,7 +444,7 @@ */ xL_precision_lost_down: push %eax - call _set_precision_flag_down + call SYMBOL_NAME(set_precision_flag_down) popl %eax jmp xL_no_precision_loss @@ -598,7 +597,7 @@ /* There must be a masked underflow */ push %eax pushl EX_Underflow - call _exception + call SYMBOL_NAME(exception) popl %eax popl %eax jmp xL_Normalised @@ -610,12 +609,12 @@ */ L_underflow_to_zero: push %eax - call _set_precision_flag_down + call SYMBOL_NAME(set_precision_flag_down) popl %eax push %eax pushl EX_Underflow - call _exception + call SYMBOL_NAME(exception) popl %eax popl %eax @@ -628,7 +627,7 @@ /* The operations resulted in a number too large to represent. */ L_overflow: push %edi - call _arith_overflow + call SYMBOL_NAME(arith_overflow) pop %edi jmp fpu_reg_round_exit diff -uNr linux-1.0.9/drivers/FPU-emu/reg_u_add.S linux-elf/drivers/FPU-emu/reg_u_add.S --- linux-1.0.9/drivers/FPU-emu/reg_u_add.S Wed Dec 1 13:44:16 1993 +++ linux-elf/drivers/FPU-emu/reg_u_add.S Mon Apr 1 15:49:09 2002 @@ -29,9 +29,7 @@ #include "control_w.h" .text - .align 2,144 -.globl _reg_u_add -_reg_u_add: +ENTRY(reg_u_add) pushl %ebp movl %esp,%ebp pushl %esi @@ -45,7 +43,7 @@ cmpl EXP_UNDER,EXP(%esi) jg xOp1_not_denorm - call _denormal_operand + call SYMBOL_NAME(denormal_operand) orl %eax,%eax jnz fpu_Arith_exit @@ -53,7 +51,7 @@ cmpl EXP_UNDER,EXP(%edi) jg xOp2_not_denorm - call _denormal_operand + call SYMBOL_NAME(denormal_operand) orl %eax,%eax jnz fpu_Arith_exit diff -uNr linux-1.0.9/drivers/FPU-emu/reg_u_div.S linux-elf/drivers/FPU-emu/reg_u_div.S --- linux-1.0.9/drivers/FPU-emu/reg_u_div.S Wed Dec 1 13:44:16 1993 +++ linux-elf/drivers/FPU-emu/reg_u_div.S Mon Apr 1 15:49:09 2002 @@ -69,13 +69,8 @@ .text - .align 2,144 -.globl _reg_u_div - -.globl _divide_kernel - -_reg_u_div: +ENTRY(reg_u_div) pushl %ebp movl %esp,%ebp #ifdef REENTRANT_FPU @@ -95,7 +90,7 @@ cmpl EXP_UNDER,%eax jg xOp1_not_denorm - call _denormal_operand + call SYMBOL_NAME(denormal_operand) orl %eax,%eax jnz fpu_Arith_exit @@ -104,14 +99,14 @@ cmpl EXP_UNDER,%eax jg xOp2_not_denorm - call _denormal_operand + call SYMBOL_NAME(denormal_operand) orl %eax,%eax jnz fpu_Arith_exit xOp2_not_denorm: #endif DENORM_OPERAND -_divide_kernel: +ENTRY(divide_kernel) #ifdef PARANOID /* testl $0x80000000, SIGH(%esi) // Dividend */ /* je L_bugged */ diff -uNr linux-1.0.9/drivers/FPU-emu/reg_u_mul.S linux-elf/drivers/FPU-emu/reg_u_mul.S --- linux-1.0.9/drivers/FPU-emu/reg_u_mul.S Wed Dec 1 13:44:16 1993 +++ linux-elf/drivers/FPU-emu/reg_u_mul.S Mon Apr 1 15:49:09 2002 @@ -44,10 +44,7 @@ .text - .align 2,144 - -.globl _reg_u_mul -_reg_u_mul: +ENTRY(reg_u_mul) pushl %ebp movl %esp,%ebp #ifdef REENTRANT_FPU @@ -73,7 +70,7 @@ cmpl EXP_UNDER,%eax jg xOp1_not_denorm - call _denormal_operand + call SYMBOL_NAME(denormal_operand) orl %eax,%eax jnz fpu_Arith_exit @@ -82,7 +79,7 @@ cmpl EXP_UNDER,%eax jg xOp2_not_denorm - call _denormal_operand + call SYMBOL_NAME(denormal_operand) orl %eax,%eax jnz fpu_Arith_exit diff -uNr linux-1.0.9/drivers/FPU-emu/reg_u_sub.S linux-elf/drivers/FPU-emu/reg_u_sub.S --- linux-1.0.9/drivers/FPU-emu/reg_u_sub.S Wed Dec 1 13:44:16 1993 +++ linux-elf/drivers/FPU-emu/reg_u_sub.S Mon Apr 1 15:49:09 2002 @@ -30,9 +30,7 @@ #include "control_w.h" .text - .align 2,144 -.globl _reg_u_sub -_reg_u_sub: +ENTRY(reg_u_sub) pushl %ebp movl %esp,%ebp pushl %esi @@ -46,7 +44,7 @@ cmpl EXP_UNDER,EXP(%esi) jg xOp1_not_denorm - call _denormal_operand + call SYMBOL_NAME(denormal_operand) orl %eax,%eax jnz fpu_Arith_exit @@ -54,7 +52,7 @@ cmpl EXP_UNDER,EXP(%edi) jg xOp2_not_denorm - call _denormal_operand + call SYMBOL_NAME(denormal_operand) orl %eax,%eax jnz fpu_Arith_exit diff -uNr linux-1.0.9/drivers/FPU-emu/wm_shrx.S linux-elf/drivers/FPU-emu/wm_shrx.S --- linux-1.0.9/drivers/FPU-emu/wm_shrx.S Wed Dec 1 13:44:16 1993 +++ linux-elf/drivers/FPU-emu/wm_shrx.S Mon Apr 1 15:49:09 2002 @@ -17,7 +17,6 @@ #include "fpu_asm.h" .text - .align 2,144 /*---------------------------------------------------------------------------+ | unsigned shrx(void *arg1, unsigned arg2) | @@ -33,9 +32,7 @@ | Results returned in the 64 bit arg and eax. | +---------------------------------------------------------------------------*/ - .globl _shrx - -_shrx: +ENTRY(shrx) push %ebp movl %esp,%ebp pushl %esi @@ -113,8 +110,7 @@ | part which has been shifted out of the arg. | | Results returned in the 64 bit arg and eax. | +---------------------------------------------------------------------------*/ - .globl _shrxs -_shrxs: +ENTRY(shrxs) push %ebp movl %esp,%ebp pushl %esi diff -uNr linux-1.0.9/drivers/FPU-emu/wm_sqrt.S linux-elf/drivers/FPU-emu/wm_sqrt.S --- linux-1.0.9/drivers/FPU-emu/wm_sqrt.S Wed Dec 1 13:44:16 1993 +++ linux-elf/drivers/FPU-emu/wm_sqrt.S Mon Apr 1 15:49:09 2002 @@ -74,10 +74,7 @@ .text - .align 2,144 - -.globl _wm_sqrt -_wm_sqrt: +ENTRY(wm_sqrt) pushl %ebp movl %esp,%ebp #ifdef REENTRANT_FPU diff -uNr linux-1.0.9/drivers/char/console.c linux-elf/drivers/char/console.c --- linux-1.0.9/drivers/char/console.c Wed Feb 23 07:52:24 1994 +++ linux-elf/drivers/char/console.c Mon Apr 1 15:49:09 2002 @@ -433,7 +433,7 @@ __asm__("cld\n\t" "rep\n\t" "movsl\n\t" - "movl _video_num_columns,%1\n\t" + "movl "SYMBOL_NAME_STR(video_num_columns)",%1\n\t" "rep\n\t" "stosw" : /* no output */ @@ -460,7 +460,7 @@ __asm__("cld\n\t" "rep\n\t" "movsl\n\t" - "movl _video_num_columns,%%ecx\n\t" + "movl "SYMBOL_NAME_STR(video_num_columns)",%%ecx\n\t" "rep\n\t" "stosw" : /* no output */ @@ -480,7 +480,7 @@ "rep\n\t" "movsl\n\t" "addl $2,%%edi\n\t" /* %edi has been decremented by 4 */ - "movl _video_num_columns,%%ecx\n\t" + "movl "SYMBOL_NAME_STR(video_num_columns)",%%ecx\n\t" "rep\n\t" "stosw\n\t" "cld" diff -uNr linux-1.0.9/drivers/char/keyboard.c linux-elf/drivers/char/keyboard.c --- linux-1.0.9/drivers/char/keyboard.c Thu Mar 3 07:05:22 1994 +++ linux-elf/drivers/char/keyboard.c Mon Apr 1 15:49:09 2002 @@ -868,7 +868,7 @@ /* nothing */; outb(0xfe,0x64); /* pulse reset low */ } - __asm__("\tlidt _no_idt"); + __asm__("\tlidt "SYMBOL_NAME_STR(no_idt)); } } diff -uNr linux-1.0.9/drivers/scsi/seagate.c linux-elf/drivers/scsi/seagate.c --- linux-1.0.9/drivers/scsi/seagate.c Wed Dec 1 13:44:16 1993 +++ linux-elf/drivers/scsi/seagate.c Mon Apr 1 15:49:09 2002 @@ -1103,8 +1103,8 @@ cld - movl _st0x_cr_sr, %%ebx - movl _st0x_dr, %%edi + movl "SYMBOL_NAME_STR(st0x_cr_sr)", %%ebx + movl "SYMBOL_NAME_STR(st0x_dr)", %%edi 1: movb (%%ebx), %%al\n" /* @@ -1239,8 +1239,8 @@ jz 2f cld - movl _st0x_cr_sr, %%esi - movl _st0x_dr, %%ebx + movl "SYMBOL_NAME_STR(st0x_cr_sr)", %%esi + movl "SYMBOL_NAME_STR(st0x_dr)", %%ebx 1: movb (%%esi), %%al\n" /* diff -uNr linux-1.0.9/include/asm/irq.h linux-elf/include/asm/irq.h --- linux-1.0.9/include/asm/irq.h Fri Dec 31 09:10:42 1993 +++ linux-elf/include/asm/irq.h Mon Apr 1 15:49:09 2002 @@ -79,8 +79,8 @@ "inb $0x21,%al\n\t" \ "jmp 1f\n" \ "1:\tjmp 1f\n" \ - "1:\torb $" #mask ",_cache_21\n\t" \ - "movb _cache_21,%al\n\t" \ + "1:\torb $" #mask ","SYMBOL_NAME_STR(cache_21)"\n\t" \ + "movb "SYMBOL_NAME_STR(cache_21)",%al\n\t" \ "outb %al,$0x21\n\t" \ "jmp 1f\n" \ "1:\tjmp 1f\n" \ @@ -91,8 +91,8 @@ "inb $0xA1,%al\n\t" \ "jmp 1f\n" \ "1:\tjmp 1f\n" \ - "1:\torb $" #mask ",_cache_A1\n\t" \ - "movb _cache_A1,%al\n\t" \ + "1:\torb $" #mask ","SYMBOL_NAME_STR(cache_A1)"\n\t" \ + "movb "SYMBOL_NAME_STR(cache_A1)",%al\n\t" \ "outb %al,$0xA1\n\t" \ "jmp 1f\n" \ "1:\tjmp 1f\n" \ @@ -106,16 +106,16 @@ "inb $0x21,%al\n\t" \ "jmp 1f\n" \ "1:\tjmp 1f\n" \ - "1:\tandb $~(" #mask "),_cache_21\n\t" \ - "movb _cache_21,%al\n\t" \ + "1:\tandb $~(" #mask "),"SYMBOL_NAME_STR(cache_21)"\n\t" \ + "movb "SYMBOL_NAME_STR(cache_21)",%al\n\t" \ "outb %al,$0x21\n\t" #define UNBLK_SECOND(mask) \ "inb $0xA1,%al\n\t" \ "jmp 1f\n" \ "1:\tjmp 1f\n" \ - "1:\tandb $~(" #mask "),_cache_A1\n\t" \ - "movb _cache_A1,%al\n\t" \ + "1:\tandb $~(" #mask "),"SYMBOL_NAME_STR(cache_A1)"\n\t" \ + "movb "SYMBOL_NAME_STR(cache_A1)",%al\n\t" \ "outb %al,$0xA1\n\t" #define IRQ_NAME2(nr) nr##_interrupt(void) @@ -128,36 +128,36 @@ asmlinkage void FAST_IRQ_NAME(nr); \ asmlinkage void BAD_IRQ_NAME(nr); \ __asm__( \ -"\n.align 4\n" \ -"_IRQ" #nr "_interrupt:\n\t" \ +"\n"ALIGN_STR"\n" \ +SYMBOL_NAME_STR(IRQ) #nr "_interrupt:\n\t" \ "pushl $-"#nr"-2\n\t" \ SAVE_ALL \ ACK_##chip(mask) \ - "incl _intr_count\n\t"\ + "incl "SYMBOL_NAME_STR(intr_count)"\n\t"\ "sti\n\t" \ "movl %esp,%ebx\n\t" \ "pushl %ebx\n\t" \ "pushl $" #nr "\n\t" \ - "call _do_IRQ\n\t" \ + "call "SYMBOL_NAME_STR(do_IRQ)"\n\t" \ "addl $8,%esp\n\t" \ "cli\n\t" \ UNBLK_##chip(mask) \ - "decl _intr_count\n\t" \ + "decl "SYMBOL_NAME_STR(intr_count)"\n\t" \ "jmp ret_from_sys_call\n" \ -"\n.align 4\n" \ -"_fast_IRQ" #nr "_interrupt:\n\t" \ +"\n"ALIGN_STR"\n" \ +SYMBOL_NAME_STR(fast_IRQ) #nr "_interrupt:\n\t" \ SAVE_MOST \ ACK_##chip(mask) \ - "incl _intr_count\n\t" \ + "incl "SYMBOL_NAME_STR(intr_count)"\n\t" \ "pushl $" #nr "\n\t" \ - "call _do_fast_IRQ\n\t" \ + "call "SYMBOL_NAME_STR(do_fast_IRQ)"\n\t" \ "addl $4,%esp\n\t" \ "cli\n\t" \ UNBLK_##chip(mask) \ - "decl _intr_count\n\t" \ + "decl "SYMBOL_NAME_STR(intr_count)"\n\t" \ RESTORE_MOST \ -"\n\n.align 4\n" \ -"_bad_IRQ" #nr "_interrupt:\n\t" \ +"\n"ALIGN_STR"\n" \ +SYMBOL_NAME_STR(bad_IRQ) #nr "_interrupt:\n\t" \ SAVE_MOST \ ACK_##chip(mask) \ RESTORE_MOST); diff -uNr linux-1.0.9/include/linux/linkage.h linux-elf/include/linux/linkage.h --- linux-1.0.9/include/linux/linkage.h Wed Dec 1 13:44:15 1993 +++ linux-elf/include/linux/linkage.h Mon Apr 1 15:49:09 2002 @@ -1,10 +1,43 @@ #ifndef _LINUX_LINKAGE_H #define _LINUX_LINKAGE_H -#ifdef __cplusplus -#define asmlinkage extern "C" -#else #define asmlinkage + +/* + * The a.out "as" interprets .align as 2^n, but ELF "as" interprets as n. + * For absolute minimum size, (at a performance cost) don't do alignment. + * Only really impacts sys_call.S anyway. + */ +#ifdef __ELF__ +#define ALIGN .align 4,0x90 +#define ALIGN_STR ".align 4,0x90" +#else +#define ALIGN .align 2,0x90 +#define ALIGN_STR ".align 2,0x90" +#endif + +#ifdef __ELF__ +#define SYMBOL_NAME_STR(X) #X +#define SYMBOL_NAME(X) X +#ifdef __STDC__ +#define SYMBOL_NAME_LABEL(X) X##: +#else +#define SYMBOL_NAME_LABEL(X) X/**/: #endif +#else +#define SYMBOL_NAME_STR(X) "_"#X +#ifdef __STDC__ +#define SYMBOL_NAME(X) _##X +#define SYMBOL_NAME_LABEL(X) _##X##: +#else +#define SYMBOL_NAME(X) _/**/X +#define SYMBOL_NAME_LABEL(X) _/**/X/**/: +#endif +#endif + +#define ENTRY(name) \ + .globl SYMBOL_NAME(name); \ + ALIGN; \ + SYMBOL_NAME_LABEL(name) #endif diff -uNr linux-1.0.9/include/linux/sched.h linux-elf/include/linux/sched.h --- linux-1.0.9/include/linux/sched.h Mon Apr 1 12:40:20 2002 +++ linux-elf/include/linux/sched.h Mon Apr 1 15:49:09 2002 @@ -357,13 +357,13 @@ * tha math co-processor latest. */ #define switch_to(tsk) \ -__asm__("cmpl %%ecx,_current\n\t" \ +__asm__("cmpl %%ecx,"SYMBOL_NAME_STR(current)"\n\t" \ "je 1f\n\t" \ "cli\n\t" \ - "xchgl %%ecx,_current\n\t" \ + "xchgl %%ecx,"SYMBOL_NAME_STR(current)"\n\t" \ "ljmp %0\n\t" \ "sti\n\t" \ - "cmpl %%ecx,_last_task_used_math\n\t" \ + "cmpl %%ecx,"SYMBOL_NAME_STR(last_task_used_math)"\n\t" \ "jne 1f\n\t" \ "clts\n" \ "1:" \ diff -uNr linux-1.0.9/include/linux/sys.h linux-elf/include/linux/sys.h --- linux-1.0.9/include/linux/sys.h Mon Jan 31 15:31:24 1994 +++ linux-elf/include/linux/sys.h Mon Apr 1 15:49:09 2002 @@ -4,147 +4,12 @@ * system call entry points */ -#define sys_clone sys_fork - -#ifdef __cplusplus -extern "C" { -#endif +/* + * This should match with what is in sys_call.S + */ +#define NR_syscalls 141 -extern int sys_setup(); /* 0 */ -extern int sys_exit(); -extern int sys_fork(); -extern int sys_read(); -extern int sys_write(); -extern int sys_open(); /* 5 */ -extern int sys_close(); -extern int sys_waitpid(); -extern int sys_creat(); -extern int sys_link(); -extern int sys_unlink(); /* 10 */ -extern int sys_execve(); -extern int sys_chdir(); -extern int sys_time(); -extern int sys_mknod(); -extern int sys_chmod(); /* 15 */ -extern int sys_chown(); -extern int sys_break(); -extern int sys_stat(); -extern int sys_lseek(); -extern int sys_getpid(); /* 20 */ -extern int sys_mount(); -extern int sys_umount(); -extern int sys_setuid(); -extern int sys_getuid(); -extern int sys_stime(); /* 25 */ -extern int sys_ptrace(); -extern int sys_alarm(); -extern int sys_fstat(); -extern int sys_pause(); -extern int sys_utime(); /* 30 */ -extern int sys_stty(); -extern int sys_gtty(); -extern int sys_access(); -extern int sys_nice(); -extern int sys_ftime(); /* 35 */ -extern int sys_sync(); -extern int sys_kill(); -extern int sys_rename(); -extern int sys_mkdir(); -extern int sys_rmdir(); /* 40 */ -extern int sys_dup(); -extern int sys_pipe(); -extern int sys_times(); -extern int sys_prof(); -extern int sys_brk(); /* 45 */ -extern int sys_setgid(); -extern int sys_getgid(); -extern int sys_signal(); -extern int sys_geteuid(); -extern int sys_getegid(); /* 50 */ -extern int sys_acct(); -extern int sys_phys(); -extern int sys_lock(); -extern int sys_ioctl(); -extern int sys_fcntl(); /* 55 */ -extern int sys_mpx(); -extern int sys_setpgid(); -extern int sys_ulimit(); -extern int sys_uname(); -extern int sys_umask(); /* 60 */ -extern int sys_chroot(); -extern int sys_ustat(); -extern int sys_dup2(); -extern int sys_getppid(); -extern int sys_getpgrp(); /* 65 */ -extern int sys_setsid(); -extern int sys_sigaction(); -extern int sys_sgetmask(); -extern int sys_ssetmask(); -extern int sys_setreuid(); /* 70 */ -extern int sys_setregid(); -extern int sys_sigpending(); -extern int sys_sigsuspend(); -extern int sys_sethostname(); -extern int sys_setrlimit(); /* 75 */ -extern int sys_getrlimit(); -extern int sys_getrusage(); -extern int sys_gettimeofday(); -extern int sys_settimeofday(); -extern int sys_getgroups(); /* 80 */ -extern int sys_setgroups(); -extern int sys_select(); -extern int sys_symlink(); -extern int sys_lstat(); -extern int sys_readlink(); /* 85 */ -extern int sys_uselib(); -extern int sys_swapon(); -extern int sys_reboot(); -extern int sys_readdir(); -extern int sys_mmap(); /* 90 */ -extern int sys_munmap(); -extern int sys_truncate(); -extern int sys_ftruncate(); -extern int sys_fchmod(); -extern int sys_fchown(); /* 95 */ -extern int sys_getpriority(); -extern int sys_setpriority(); -extern int sys_profil(); -extern int sys_statfs(); -extern int sys_fstatfs(); /* 100 */ -extern int sys_ioperm(); -extern int sys_socketcall(); -extern int sys_syslog(); -extern int sys_getitimer(); -extern int sys_setitimer(); /* 105 */ -extern int sys_newstat(); -extern int sys_newlstat(); -extern int sys_newfstat(); -extern int sys_newuname(); -extern int sys_iopl(); /* 110 */ -extern int sys_vhangup(); -extern int sys_idle(); -extern int sys_vm86(); -extern int sys_wait4(); -extern int sys_swapoff(); /* 115 */ -extern int sys_sysinfo(); -extern int sys_ipc(); -extern int sys_fsync(); -extern int sys_sigreturn(); -extern int sys_setdomainname(); /* 120 */ -extern int sys_olduname(); -extern int sys_old_syscall(); -extern int sys_modify_ldt(); -extern int sys_adjtimex(); -extern int sys_mprotect(); /* 125 */ -extern int sys_sigprocmask(); -extern int sys_create_module(); -extern int sys_init_module(); -extern int sys_delete_module(); -extern int sys_get_kernel_syms(); /* 130 */ -extern int sys_quotactl(); -extern int sys_getpgid(); -extern int sys_fchdir(); -extern int sys_bdflush(); +#define sys_clone sys_fork /* * These are system calls that will be removed at some time @@ -169,11 +34,10 @@ #define sys_quotactl sys_ni_syscall #define sys_bdflush sys_ni_syscall - -typedef int (*fn_ptr)(); - -#ifdef __cplusplus -} -#endif +#define sys_sysfs sys_ni_syscall +#define sys_personality sys_ni_syscall +#define sys_setfsuid sys_ni_syscall +#define sys_setfsgid sys_ni_syscall +#define sys_llseek sys_ni_syscall #endif diff -uNr linux-1.0.9/kernel/sched.c linux-elf/kernel/sched.c --- linux-1.0.9/kernel/sched.c Mon Apr 1 12:40:20 2002 +++ linux-elf/kernel/sched.c Mon Apr 1 15:49:09 2002 @@ -102,56 +102,18 @@ short b; } stack_start = { & user_stack [PAGE_SIZE>>2] , KERNEL_DS }; -struct kernel_stat kstat = - { 0, 0, 0, { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +struct kernel_stat kstat = { 0 }; /* * int 0x80 entry points.. Moved away from the header file, as * iBCS2 may also want to use the '' headers.. */ -#ifdef __cplusplus -extern "C" { -#endif int sys_ni_syscall(void) { return -EINVAL; } -fn_ptr sys_call_table[] = { sys_setup, sys_exit, sys_fork, sys_read, -sys_write, sys_open, sys_close, sys_waitpid, sys_creat, sys_link, -sys_unlink, sys_execve, sys_chdir, sys_time, sys_mknod, sys_chmod, -sys_chown, sys_break, sys_stat, sys_lseek, sys_getpid, sys_mount, -sys_umount, sys_setuid, sys_getuid, sys_stime, sys_ptrace, sys_alarm, -sys_fstat, sys_pause, sys_utime, sys_stty, sys_gtty, sys_access, -sys_nice, sys_ftime, sys_sync, sys_kill, sys_rename, sys_mkdir, -sys_rmdir, sys_dup, sys_pipe, sys_times, sys_prof, sys_brk, sys_setgid, -sys_getgid, sys_signal, sys_geteuid, sys_getegid, sys_acct, sys_phys, -sys_lock, sys_ioctl, sys_fcntl, sys_mpx, sys_setpgid, sys_ulimit, -sys_olduname, sys_umask, sys_chroot, sys_ustat, sys_dup2, sys_getppid, -sys_getpgrp, sys_setsid, sys_sigaction, sys_sgetmask, sys_ssetmask, -sys_setreuid,sys_setregid, sys_sigsuspend, sys_sigpending, -sys_sethostname, sys_setrlimit, sys_getrlimit, sys_getrusage, -sys_gettimeofday, sys_settimeofday, sys_getgroups, sys_setgroups, -sys_select, sys_symlink, sys_lstat, sys_readlink, sys_uselib, -sys_swapon, sys_reboot, sys_readdir, sys_mmap, sys_munmap, sys_truncate, -sys_ftruncate, sys_fchmod, sys_fchown, sys_getpriority, sys_setpriority, -sys_profil, sys_statfs, sys_fstatfs, sys_ioperm, sys_socketcall, -sys_syslog, sys_setitimer, sys_getitimer, sys_newstat, sys_newlstat, -sys_newfstat, sys_uname, sys_iopl, sys_vhangup, sys_idle, sys_vm86, -sys_wait4, sys_swapoff, sys_sysinfo, sys_ipc, sys_fsync, sys_sigreturn, -sys_clone, sys_setdomainname, sys_newuname, sys_modify_ldt, -sys_adjtimex, sys_mprotect, sys_sigprocmask, sys_create_module, -sys_init_module, sys_delete_module, sys_get_kernel_syms, sys_quotactl, -sys_getpgid, sys_fchdir, sys_bdflush }; - -/* So we don't have to do any more manual updating.... */ -int NR_syscalls = sizeof(sys_call_table)/sizeof(fn_ptr); - -#ifdef __cplusplus -} -#endif - /* * 'math_state_restore()' saves the current math information in the * old math state array, and gets the new ones from the current task diff -uNr linux-1.0.9/kernel/sys_call.S linux-elf/kernel/sys_call.S --- linux-1.0.9/kernel/sys_call.S Wed Dec 1 13:44:15 1993 +++ linux-elf/kernel/sys_call.S Mon Apr 1 15:49:09 2002 @@ -40,7 +40,9 @@ * 40(%esp) - %oldss */ +#include #include +#include EBX = 0x00 ECX = 0x04 @@ -77,18 +79,10 @@ errno = 24 dbgreg6 = 52 dbgreg7 = 56 +exec_domain = 60 ENOSYS = 38 -.globl _system_call,_lcall7 -.globl _device_not_available, _coprocessor_error -.globl _divide_error,_debug,_nmi,_int3,_overflow,_bounds,_invalid_op -.globl _double_fault,_coprocessor_segment_overrun -.globl _invalid_TSS,_segment_not_present,_stack_segment -.globl _general_protection,_reserved -.globl _alignment_check,_page_fault -.globl ret_from_sys_call - #define SAVE_ALL \ cld; \ push %gs; \ @@ -111,7 +105,7 @@ #define RESTORE_ALL \ cmpw $(KERNEL_CS),CS(%esp); \ je 1f; \ - movl _current,%eax; \ + movl SYMBOL_NAME(current),%eax; \ movl dbgreg7(%eax),%ebx; \ movl %ebx,%db7; \ 1: popl %ebx; \ @@ -128,8 +122,7 @@ addl $4,%esp; \ iret -.align 4 -_lcall7: +ENTRY(lcall7) pushfl # We get a different stack layout with call gates, pushl %eax # which has to be cleaned up later.. SAVE_ALL @@ -140,39 +133,45 @@ movl %edx,EIP(%esp) # Now we move them to their "normal" places movl %ecx,CS(%esp) # movl %esp,%eax + movl SYMBOL_NAME(current),%edx pushl %eax - call _iABI_emulate + movl exec_domain(%edx),%edx # Get the execution domain + movl 4(%edx),%edx # Get the lcall7 handler for the domain + call *%edx popl %eax jmp ret_from_sys_call -.align 4 + ALIGN handle_bottom_half: pushfl - incl _intr_count + incl SYMBOL_NAME(intr_count) sti - call _do_bottom_half + call SYMBOL_NAME(do_bottom_half) popfl - decl _intr_count + decl SYMBOL_NAME(intr_count) jmp 9f -.align 4 + ALIGN reschedule: pushl $ret_from_sys_call - jmp _schedule -.align 4 -_system_call: + jmp SYMBOL_NAME(schedule) + +ENTRY(system_call) pushl %eax # save orig_eax SAVE_ALL movl $-ENOSYS,EAX(%esp) - cmpl _NR_syscalls,%eax + cmpl $(NR_syscalls),%eax jae ret_from_sys_call - movl _current,%ebx + movl SYMBOL_NAME(sys_call_table)(,%eax,4),%eax + testl %eax,%eax + je ret_from_sys_call + movl SYMBOL_NAME(current),%ebx andl $~CF_MASK,EFLAGS(%esp) # clear carry - assume no errors movl $0,errno(%ebx) movl %db6,%edx movl %edx,dbgreg6(%ebx) # save current hardware debugging status testb $0x20,flags(%ebx) # PF_TRACESYS jne 1f - call _sys_call_table(,%eax,4) + call *%eax movl %eax,EAX(%esp) # save the return value movl errno(%ebx),%edx negl %edx @@ -180,27 +179,28 @@ movl %edx,EAX(%esp) orl $(CF_MASK),EFLAGS(%esp) # set carry to indicate error jmp ret_from_sys_call -.align 4 -1: call _syscall_trace + ALIGN +1: call SYMBOL_NAME(syscall_trace) movl ORIG_EAX(%esp),%eax - call _sys_call_table(,%eax,4) + call SYMBOL_NAME(sys_call_table)(,%eax,4) movl %eax,EAX(%esp) # save the return value - movl _current,%eax + movl SYMBOL_NAME(current),%eax movl errno(%eax),%edx negl %edx je 1f movl %edx,EAX(%esp) orl $(CF_MASK),EFLAGS(%esp) # set carry to indicate error -1: call _syscall_trace +1: call SYMBOL_NAME(syscall_trace) - .align 4,0x90 + ALIGN + .globl ret_from_sys_call ret_from_sys_call: - cmpl $0,_intr_count + cmpl $0,SYMBOL_NAME(intr_count) jne 2f - movl _bh_mask,%eax - andl _bh_active,%eax +9: movl SYMBOL_NAME(bh_mask),%eax + andl SYMBOL_NAME(bh_active),%eax jne handle_bottom_half -9: movl EFLAGS(%esp),%eax # check VM86 flag: CS/SS are + movl EFLAGS(%esp),%eax # check VM86 flag: CS/SS are testl $(VM_MASK),%eax # different then jne 1f cmpw $(KERNEL_CS),CS(%esp) # was old code segment supervisor ? @@ -209,10 +209,10 @@ orl $(IF_MASK),%eax # these just try to make sure andl $~NT_MASK,%eax # the program doesn't do anything movl %eax,EFLAGS(%esp) # stupid - cmpl $0,_need_resched + cmpl $0,SYMBOL_NAME(need_resched) jne reschedule - movl _current,%eax - cmpl _task,%eax # task[0] cannot have signals + movl SYMBOL_NAME(current),%eax + cmpl SYMBOL_NAME(task),%eax # task[0] cannot have signals je 2f cmpl $0,state(%eax) # state jne reschedule @@ -224,33 +224,32 @@ andl signal(%eax),%ecx jne signal_return 2: RESTORE_ALL -.align 4 + ALIGN signal_return: movl %esp,%ecx pushl %ecx testl $(VM_MASK),EFLAGS(%ecx) jne v86_signal_return pushl %ebx - call _do_signal + call SYMBOL_NAME(do_signal) popl %ebx popl %ebx RESTORE_ALL -.align 4 + ALIGN v86_signal_return: - call _save_v86_state + call SYMBOL_NAME(save_v86_state) movl %eax,%esp pushl %eax pushl %ebx - call _do_signal + call SYMBOL_NAME(do_signal) popl %ebx popl %ebx RESTORE_ALL -.align 4 -_divide_error: +ENTRY(divide_error) pushl $0 # no error code - pushl $_do_divide_error -.align 4,0x90 + pushl $ SYMBOL_NAME(do_divide_error) + ALIGN error_code: push %fs push %es @@ -279,7 +278,7 @@ movl $(USER_DS),%edx mov %dx,%fs pushl %eax - movl _current,%eax + movl SYMBOL_NAME(current),%eax movl %db6,%edx movl %edx,dbgreg6(%eax) # save current hardware debugging status popl %eax @@ -287,104 +286,231 @@ addl $8,%esp jmp ret_from_sys_call -.align 4 -_coprocessor_error: +ENTRY(coprocessor_error) pushl $0 - pushl $_do_coprocessor_error + pushl $ SYMBOL_NAME(do_coprocessor_error) jmp error_code -.align 4 -_device_not_available: +ENTRY(device_not_available) pushl $-1 # mark this as an int SAVE_ALL pushl $ret_from_sys_call movl %cr0,%eax testl $0x4,%eax # EM (math emulation bit) - je _math_state_restore + je SYMBOL_NAME(math_state_restore) pushl $0 # temporary storage for ORIG_EIP - call _math_emulate + call SYMBOL_NAME(math_emulate) addl $4,%esp ret -.align 4 -_debug: +ENTRY(debug) pushl $0 - pushl $_do_debug + pushl $ SYMBOL_NAME(do_debug) jmp error_code -.align 4 -_nmi: +ENTRY(nmi) pushl $0 - pushl $_do_nmi + pushl $ SYMBOL_NAME(do_nmi) jmp error_code -.align 4 -_int3: +ENTRY(int3) pushl $0 - pushl $_do_int3 + pushl $ SYMBOL_NAME(do_int3) jmp error_code -.align 4 -_overflow: +ENTRY(overflow) pushl $0 - pushl $_do_overflow + pushl $ SYMBOL_NAME(do_overflow) jmp error_code -.align 4 -_bounds: +ENTRY(bounds) pushl $0 - pushl $_do_bounds + pushl $ SYMBOL_NAME(do_bounds) jmp error_code -.align 4 -_invalid_op: +ENTRY(invalid_op) pushl $0 - pushl $_do_invalid_op + pushl $ SYMBOL_NAME(do_invalid_op) jmp error_code -.align 4 -_coprocessor_segment_overrun: +ENTRY(coprocessor_segment_overrun) pushl $0 - pushl $_do_coprocessor_segment_overrun + pushl $ SYMBOL_NAME(do_coprocessor_segment_overrun) jmp error_code -.align 4 -_reserved: +ENTRY(reserved) pushl $0 - pushl $_do_reserved - jmp error_code - -.align 4 -_double_fault: - pushl $_do_double_fault - jmp error_code - -.align 4 -_invalid_TSS: - pushl $_do_invalid_TSS + pushl $ SYMBOL_NAME(do_reserved) jmp error_code -.align 4 -_segment_not_present: - pushl $_do_segment_not_present +ENTRY(double_fault) + pushl $ SYMBOL_NAME(do_double_fault) jmp error_code -.align 4 -_stack_segment: - pushl $_do_stack_segment - jmp error_code - -.align 4 -_general_protection: - pushl $_do_general_protection - jmp error_code - -.align 4 -_alignment_check: - pushl $_do_alignment_check - jmp error_code - -.align 4 -_page_fault: - pushl $_do_page_fault - jmp error_code +ENTRY(invalid_TSS) + pushl $ SYMBOL_NAME(do_invalid_TSS) + jmp error_code + +ENTRY(segment_not_present) + pushl $ SYMBOL_NAME(do_segment_not_present) + jmp error_code + +ENTRY(stack_segment) + pushl $ SYMBOL_NAME(do_stack_segment) + jmp error_code + +ENTRY(general_protection) + pushl $ SYMBOL_NAME(do_general_protection) + jmp error_code + +ENTRY(alignment_check) + pushl $ SYMBOL_NAME(do_alignment_check) + jmp error_code + +ENTRY(page_fault) + pushl $ SYMBOL_NAME(do_page_fault) + jmp error_code + +.data +ENTRY(sys_call_table) + .long SYMBOL_NAME(sys_setup) /* 0 */ + .long SYMBOL_NAME(sys_exit) + .long SYMBOL_NAME(sys_fork) + .long SYMBOL_NAME(sys_read) + .long SYMBOL_NAME(sys_write) + .long SYMBOL_NAME(sys_open) /* 5 */ + .long SYMBOL_NAME(sys_close) + .long SYMBOL_NAME(sys_waitpid) + .long SYMBOL_NAME(sys_creat) + .long SYMBOL_NAME(sys_link) + .long SYMBOL_NAME(sys_unlink) /* 10 */ + .long SYMBOL_NAME(sys_execve) + .long SYMBOL_NAME(sys_chdir) + .long SYMBOL_NAME(sys_time) + .long SYMBOL_NAME(sys_mknod) + .long SYMBOL_NAME(sys_chmod) /* 15 */ + .long SYMBOL_NAME(sys_chown) + .long SYMBOL_NAME(sys_break) + .long SYMBOL_NAME(sys_stat) + .long SYMBOL_NAME(sys_lseek) + .long SYMBOL_NAME(sys_getpid) /* 20 */ + .long SYMBOL_NAME(sys_mount) + .long SYMBOL_NAME(sys_umount) + .long SYMBOL_NAME(sys_setuid) + .long SYMBOL_NAME(sys_getuid) + .long SYMBOL_NAME(sys_stime) /* 25 */ + .long SYMBOL_NAME(sys_ptrace) + .long SYMBOL_NAME(sys_alarm) + .long SYMBOL_NAME(sys_fstat) + .long SYMBOL_NAME(sys_pause) + .long SYMBOL_NAME(sys_utime) /* 30 */ + .long SYMBOL_NAME(sys_stty) + .long SYMBOL_NAME(sys_gtty) + .long SYMBOL_NAME(sys_access) + .long SYMBOL_NAME(sys_nice) + .long SYMBOL_NAME(sys_ftime) /* 35 */ + .long SYMBOL_NAME(sys_sync) + .long SYMBOL_NAME(sys_kill) + .long SYMBOL_NAME(sys_rename) + .long SYMBOL_NAME(sys_mkdir) + .long SYMBOL_NAME(sys_rmdir) /* 40 */ + .long SYMBOL_NAME(sys_dup) + .long SYMBOL_NAME(sys_pipe) + .long SYMBOL_NAME(sys_times) + .long SYMBOL_NAME(sys_prof) + .long SYMBOL_NAME(sys_brk) /* 45 */ + .long SYMBOL_NAME(sys_setgid) + .long SYMBOL_NAME(sys_getgid) + .long SYMBOL_NAME(sys_signal) + .long SYMBOL_NAME(sys_geteuid) + .long SYMBOL_NAME(sys_getegid) /* 50 */ + .long SYMBOL_NAME(sys_acct) + .long SYMBOL_NAME(sys_phys) + .long SYMBOL_NAME(sys_lock) + .long SYMBOL_NAME(sys_ioctl) + .long SYMBOL_NAME(sys_fcntl) /* 55 */ + .long SYMBOL_NAME(sys_mpx) + .long SYMBOL_NAME(sys_setpgid) + .long SYMBOL_NAME(sys_ulimit) + .long SYMBOL_NAME(sys_olduname) + .long SYMBOL_NAME(sys_umask) /* 60 */ + .long SYMBOL_NAME(sys_chroot) + .long SYMBOL_NAME(sys_ustat) + .long SYMBOL_NAME(sys_dup2) + .long SYMBOL_NAME(sys_getppid) + .long SYMBOL_NAME(sys_getpgrp) /* 65 */ + .long SYMBOL_NAME(sys_setsid) + .long SYMBOL_NAME(sys_sigaction) + .long SYMBOL_NAME(sys_sgetmask) + .long SYMBOL_NAME(sys_ssetmask) + .long SYMBOL_NAME(sys_setreuid) /* 70 */ + .long SYMBOL_NAME(sys_setregid) + .long SYMBOL_NAME(sys_sigsuspend) + .long SYMBOL_NAME(sys_sigpending) + .long SYMBOL_NAME(sys_sethostname) + .long SYMBOL_NAME(sys_setrlimit) /* 75 */ + .long SYMBOL_NAME(sys_getrlimit) + .long SYMBOL_NAME(sys_getrusage) + .long SYMBOL_NAME(sys_gettimeofday) + .long SYMBOL_NAME(sys_settimeofday) + .long SYMBOL_NAME(sys_getgroups) /* 80 */ + .long SYMBOL_NAME(sys_setgroups) + .long SYMBOL_NAME(sys_select) + .long SYMBOL_NAME(sys_symlink) + .long SYMBOL_NAME(sys_lstat) + .long SYMBOL_NAME(sys_readlink) /* 85 */ + .long SYMBOL_NAME(sys_uselib) + .long SYMBOL_NAME(sys_swapon) + .long SYMBOL_NAME(sys_reboot) + .long SYMBOL_NAME(sys_readdir) + .long SYMBOL_NAME(sys_mmap) /* 90 */ + .long SYMBOL_NAME(sys_munmap) + .long SYMBOL_NAME(sys_truncate) + .long SYMBOL_NAME(sys_ftruncate) + .long SYMBOL_NAME(sys_fchmod) + .long SYMBOL_NAME(sys_fchown) /* 95 */ + .long SYMBOL_NAME(sys_getpriority) + .long SYMBOL_NAME(sys_setpriority) + .long SYMBOL_NAME(sys_profil) + .long SYMBOL_NAME(sys_statfs) + .long SYMBOL_NAME(sys_fstatfs) /* 100 */ + .long SYMBOL_NAME(sys_ioperm) + .long SYMBOL_NAME(sys_socketcall) + .long SYMBOL_NAME(sys_syslog) + .long SYMBOL_NAME(sys_setitimer) + .long SYMBOL_NAME(sys_getitimer) /* 105 */ + .long SYMBOL_NAME(sys_newstat) + .long SYMBOL_NAME(sys_newlstat) + .long SYMBOL_NAME(sys_newfstat) + .long SYMBOL_NAME(sys_uname) + .long SYMBOL_NAME(sys_iopl) /* 110 */ + .long SYMBOL_NAME(sys_vhangup) + .long SYMBOL_NAME(sys_idle) + .long SYMBOL_NAME(sys_vm86) + .long SYMBOL_NAME(sys_wait4) + .long SYMBOL_NAME(sys_swapoff) /* 115 */ + .long SYMBOL_NAME(sys_sysinfo) + .long SYMBOL_NAME(sys_ipc) + .long SYMBOL_NAME(sys_fsync) + .long SYMBOL_NAME(sys_sigreturn) + .long SYMBOL_NAME(sys_clone) /* 120 */ + .long SYMBOL_NAME(sys_setdomainname) + .long SYMBOL_NAME(sys_newuname) + .long SYMBOL_NAME(sys_modify_ldt) + .long SYMBOL_NAME(sys_adjtimex) + .long SYMBOL_NAME(sys_mprotect) /* 125 */ + .long SYMBOL_NAME(sys_sigprocmask) + .long SYMBOL_NAME(sys_create_module) + .long SYMBOL_NAME(sys_init_module) + .long SYMBOL_NAME(sys_delete_module) + .long SYMBOL_NAME(sys_get_kernel_syms) /* 130 */ + .long SYMBOL_NAME(sys_quotactl) + .long SYMBOL_NAME(sys_getpgid) + .long SYMBOL_NAME(sys_fchdir) + .long SYMBOL_NAME(sys_bdflush) + .long SYMBOL_NAME(sys_sysfs) /* 135 */ + .long SYMBOL_NAME(sys_personality) + .long 0 /* for afs_syscall */ + .long SYMBOL_NAME(sys_setfsuid) + .long SYMBOL_NAME(sys_setfsgid) + .long SYMBOL_NAME(sys_llseek) /* 140 */ diff -uNr linux-1.0.9/net/inet/loopback.c linux-elf/net/inet/loopback.c --- linux-1.0.9/net/inet/loopback.c Wed Jan 19 12:27:09 1994 +++ linux-elf/net/inet/loopback.c Mon Apr 1 15:49:09 2002 @@ -72,14 +72,14 @@ dev->tbusy = 0; #if 1 - __asm__("cmpl $0,_intr_count\n\t" + __asm__("cmpl $0,"SYMBOL_NAME_STR(intr_count)"\n\t" "jne 1f\n\t" - "movl _bh_active,%%eax\n\t" - "testl _bh_mask,%%eax\n\t" + "movl "SYMBOL_NAME_STR(bh_active)",%%eax\n\t" + "testl "SYMBOL_NAME_STR(bh_mask)",%%eax\n\t" "je 1f\n\t" - "incl _intr_count\n\t" - "call _do_bottom_half\n\t" - "decl _intr_count\n" + "incl "SYMBOL_NAME_STR(intr_count)"\n\t" + "call "SYMBOL_NAME_STR(do_bottom_half)"\n\t" + "decl "SYMBOL_NAME_STR(intr_count)"\n" "1:" : : diff -uNr linux-1.0.9/zBoot/Makefile linux-elf/zBoot/Makefile --- linux-1.0.9/zBoot/Makefile Wed Mar 9 10:11:16 1994 +++ linux-elf/zBoot/Makefile Mon Apr 1 15:49:09 2002 @@ -4,10 +4,16 @@ #LD = gcc #TEST = -DTEST_DRIVER -zOBJECTS = $(HEAD) inflate.o unzip.o misc.o +OBJECTS = $(HEAD) inflate.o unzip.o misc.o CFLAGS = -O2 -DSTDC_HEADERS $(TEST) +ifeq ($(USE_ELF),yes) +TARGET=--target elf32-i386 +INPUT_DATA=input_data +INPUT_LEN=input_len +endif + .c.s: $(CC) $(CFLAGS) -S -o $*.s $< .s.o: @@ -17,16 +23,39 @@ all: zSystem -zSystem: piggy.o $(zOBJECTS) - $(LD) $(LDFLAGS) -o zSystem -Ttext 1000 $(zOBJECTS) piggy.o +zSystem: piggy.o $(OBJECTS) + $(LD) $(LDFLAGS) -o zSystem -Ttext 1000 $(OBJECTS) piggy.o -head.o: head.s +vmlinux: piggy.o $(OBJECTS) + $(LD) $(ZLINKFLAGS) -o vmlinux $(OBJECTS) piggy.o -head.s: head.S ../include/linux/tasks.h - $(CPP) -traditional head.S -o head.s +head.o: head.S $(TOPDIR)/include/linux/tasks.h + $(CC) -traditional -c head.S +ifeq ($(USE_ELF),yes) + +# You cannot compress a file and have the kernel uncompress it, it must +# be stdin +piggy.o: $(SYSTEM) + tmppiggy=/tmp/$$$$piggy; \ + rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \ + if hash $(ENCAPS) 2> /dev/null; then \ + $(OBJDUMP) $(OBJDUMP_FLAGS) -o $(IMAGE_OFFSET) $(SYSTEM) > $$tmppiggy; \ + else \ + $(OBJCOPY) $(SYSTEM) $$tmppiggy; \ + fi ; \ + gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \ + if hash $(ENCAPS) 2> /dev/null; then \ + $(ENCAPS) $(TARGET) piggy.o $$tmppiggy.gz $(INPUT_DATA) $(INPUT_LEN); \ + else \ + echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk; \ + $(LD) -m elf_i386 -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-i386 -T $$tmppiggy.lnk; \ + fi; \ + rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk +else piggy.o: $(SYSTEM) xtract piggyback ./xtract $(SYSTEM) | gzip -9 | ./piggyback > piggy.o +endif $(SYSTEM): $(MAKE) -C .. tools/zSystem diff -uNr linux-1.0.9/zBoot/head.S linux-elf/zBoot/head.S --- linux-1.0.9/zBoot/head.S Wed Dec 1 13:44:15 1993 +++ linux-elf/zBoot/head.S Mon Apr 1 15:49:09 2002 @@ -19,8 +19,9 @@ .text #include +#include -startup_32: +ENTRY(startup_32) cld cli movl $(KERNEL_DS),%eax @@ -28,7 +29,7 @@ mov %ax,%es mov %ax,%fs mov %ax,%gs - lss _stack_start,%esp + lss SYMBOL_NAME(stack_start),%esp xorl %eax,%eax 1: incl %eax # check that A20 really IS enabled movl %eax,0x000000 # loop forever if it isn't @@ -45,8 +46,8 @@ * Clear BSS */ xorl %eax,%eax - movl $__edata,%edi - movl $__end,%ecx + movl $ SYMBOL_NAME(_edata),%edi + movl $ SYMBOL_NAME(_end),%ecx subl %edi,%ecx cld rep @@ -54,5 +55,5 @@ /* * Do the decompression, and jump to the new kernel.. */ - call _decompress_kernel + call SYMBOL_NAME(decompress_kernel) ljmp $(KERNEL_CS), $0x100000 diff -ur linux-1.0.9/tools/build.c linux/tools/build.c --- linux-1.0.9/tools/build.c Mon Apr 1 12:40:20 2002 +++ linux/tools/build.c Mon Apr 1 15:49:09 2002 @@ -31,8 +31,12 @@ #include #include +#include + #define MINIX_HEADER 32 -#define GCC_HEADER 1024 +#ifndef __BFD__ +static int GCC_HEADER = sizeof(struct exec); +#endif -#define SYS_SIZE DEF_SYSSIZE +#define SYS_SIZE 0x7F00 @@ -87,7 +91,9 @@ int i,c,id, sz; unsigned long sys_size; char buf[1024]; +#ifndef __BFD__ struct exec *ex = (struct exec *)buf; +#endif char major_root, minor_root; struct stat sb; @@ -186,6 +192,7 @@ if ((id=open(argv[3],O_RDONLY,0))<0) die("Unable to open 'system'"); +#ifndef __BFD__ if (read(id,buf,GCC_HEADER) != GCC_HEADER) die("Unable to read header of 'system'"); if (N_MAGIC(*ex) != ZMAGIC) @@ -196,6 +203,14 @@ ex->a_data /1024, ex->a_bss /1024); sz = N_SYMOFF(*ex) - GCC_HEADER + 4; +#else + if (fstat (id, &sb)) { + perror ("fstat"); + die ("Unable to stat 'system'"); + } + sz = sb.st_size; + fprintf (stderr, "System is %d kB\n", sz/1024); +#endif sys_size = (sz + 15) / 16; if (sys_size > SYS_SIZE) die("System is too big");