diff options
38 files changed, 743 insertions, 164 deletions
diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S index 3898a53..a74cd09 100644 --- a/sys/amd64/amd64/cpu_switch.S +++ b/sys/amd64/amd64/cpu_switch.S @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: swtch.s,v 1.45 1997/04/14 18:12:05 phk Exp $ + * $Id: swtch.s,v 1.46 1997/04/20 06:41:26 phk Exp $ */ #include "npx.h" @@ -233,7 +233,7 @@ rem3id: .asciz "remrq.id" ALIGN_TEXT _idle: xorl %ebp,%ebp - movl $tmpstk,%esp + movl $HIDENAME(tmpstk),%esp movl _IdlePTD,%ecx movl %ecx,%cr3 diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index bce496a..6e3f5c7 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 - * $Id: npx.c,v 1.39 1997/02/22 09:36:57 peter Exp $ + * $Id: npx.c,v 1.40 1997/03/24 11:23:58 bde Exp $ */ #include "npx.h" @@ -53,6 +53,7 @@ #endif #include <sys/signalvar.h> +#include <machine/asmacros.h> #include <machine/cpu.h> #include <machine/pcb.h> #include <machine/md_var.h> @@ -147,13 +148,15 @@ static volatile u_int npx_traps_while_probing; * interrupts. We'll still need a special exception 16 handler. The busy * latch stuff in probeintr() can be moved to npxprobe(). */ + inthand_t probeintr; asm (" .text -_probeintr: + .p2align 2,0x90 +" __XSTRING(CNAME(probeintr)) ": ss - incl _npx_intrs_while_probing + incl " __XSTRING(CNAME(npx_intrs_while_probing)) " pushl %eax movb $0x20,%al # EOI (asm in strings loses cpp features) outb %al,$0xa0 # IO_ICU2 @@ -168,9 +171,10 @@ inthand_t probetrap; asm (" .text -_probetrap: + .p2align 2,0x90 +" __XSTRING(CNAME(probetrap)) ": ss - incl _npx_traps_while_probing + incl " __XSTRING(CNAME(npx_traps_while_probing)) " fnclex iret "); diff --git a/sys/amd64/amd64/identcpu.c b/sys/amd64/amd64/identcpu.c index e78382b..bb99ca8 100644 --- a/sys/amd64/amd64/identcpu.c +++ b/sys/amd64/amd64/identcpu.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: Id: machdep.c,v 1.193 1996/06/18 01:22:04 bde Exp - * $Id: identcpu.c,v 1.13 1997/02/22 09:32:19 peter Exp $ + * $Id: identcpu.c,v 1.14 1997/03/22 18:51:57 kato Exp $ */ #include "opt_cpu.h" @@ -47,6 +47,7 @@ #include <sys/kernel.h> #include <sys/sysctl.h> +#include <machine/asmacros.h> #include <machine/cpu.h> #include <machine/reg.h> #include <machine/psl.h> @@ -426,9 +427,10 @@ inthand_t bluetrap; asm (" .text -_bluetrap: + .p2align 2,0x90 +" __XSTRING(CNAME(bluetrap)) ": ss - movl $0xa8c1d, _trap_by_wrmsr # Don't ask meaning of the number :-). + movl $0xa8c1d," __XSTRING(CNAME(trap_by_wrmsr)) " # Don't ask meaning of the number :-). addl $2, (%esp) # I know wrmsr is a 2-bytes instruction. iret "); diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S index cd56539..63c1112 100644 --- a/sys/amd64/amd64/locore.S +++ b/sys/amd64/amd64/locore.S @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)locore.s 7.3 (Berkeley) 5/13/91 - * $Id: locore.s,v 1.83 1997/04/07 07:15:49 peter Exp $ + * $Id: locore.s,v 1.84 1997/04/07 08:38:19 peter Exp $ * * originally from: locore.s, by William F. Jolitz * @@ -92,9 +92,9 @@ .data ALIGN_DATA /* just to be sure */ - .globl tmpstk + .globl HIDENAME(tmpstk) .space 0x2000 /* space for tmpstk - temporary stack */ -tmpstk: +HIDENAME(tmpstk): .globl _boothowto,_bootdev @@ -237,7 +237,7 @@ _pc98_system_parameter: * the old stack, but it need not be, since recover_bootinfo actually * returns via the old frame. */ - movl $R(tmpstk),%esp + movl $R(HIDENAME(tmpstk)),%esp #ifdef PC98 testb $0x02,0x100620 /* pc98_machine_type & M_EPSON_PC98 */ @@ -403,7 +403,7 @@ NON_GPROF_ENTRY(sigcode) movl $SYS_sigreturn,%eax /* sigreturn() */ LCALL(0x7,0) /* enter kernel with args on stack */ hlt /* never gets here */ - .align 2,0x90 /* long word text-align */ + ALIGN_TEXT _esigcode: .data diff --git a/sys/amd64/amd64/locore.s b/sys/amd64/amd64/locore.s index cd56539..63c1112 100644 --- a/sys/amd64/amd64/locore.s +++ b/sys/amd64/amd64/locore.s @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)locore.s 7.3 (Berkeley) 5/13/91 - * $Id: locore.s,v 1.83 1997/04/07 07:15:49 peter Exp $ + * $Id: locore.s,v 1.84 1997/04/07 08:38:19 peter Exp $ * * originally from: locore.s, by William F. Jolitz * @@ -92,9 +92,9 @@ .data ALIGN_DATA /* just to be sure */ - .globl tmpstk + .globl HIDENAME(tmpstk) .space 0x2000 /* space for tmpstk - temporary stack */ -tmpstk: +HIDENAME(tmpstk): .globl _boothowto,_bootdev @@ -237,7 +237,7 @@ _pc98_system_parameter: * the old stack, but it need not be, since recover_bootinfo actually * returns via the old frame. */ - movl $R(tmpstk),%esp + movl $R(HIDENAME(tmpstk)),%esp #ifdef PC98 testb $0x02,0x100620 /* pc98_machine_type & M_EPSON_PC98 */ @@ -403,7 +403,7 @@ NON_GPROF_ENTRY(sigcode) movl $SYS_sigreturn,%eax /* sigreturn() */ LCALL(0x7,0) /* enter kernel with args on stack */ hlt /* never gets here */ - .align 2,0x90 /* long word text-align */ + ALIGN_TEXT _esigcode: .data diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 3513198..9ed0b1d 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.236 1997/04/07 07:15:50 peter Exp $ + * $Id: machdep.c,v 1.237 1997/04/13 04:07:24 dyson Exp $ */ #include "npx.h" @@ -126,6 +126,7 @@ extern void earlysetcpuclass(void); /* same header file */ extern void finishidentcpu(void); extern void panicifcpuunsupported(void); extern void initializecpu(void); +extern void init_sets(void); static void cpu_startup __P((void *)); SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL) @@ -978,6 +979,11 @@ init386(first) atdevbase = ISA_HOLE_START + KERNBASE; /* + * Fill in the length fields of all linker sets (necessary for ELF). + */ + init_sets(); + + /* * Initialize the console before we print anything out. */ cninit(); diff --git a/sys/amd64/amd64/swtch.s b/sys/amd64/amd64/swtch.s index 3898a53..a74cd09 100644 --- a/sys/amd64/amd64/swtch.s +++ b/sys/amd64/amd64/swtch.s @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: swtch.s,v 1.45 1997/04/14 18:12:05 phk Exp $ + * $Id: swtch.s,v 1.46 1997/04/20 06:41:26 phk Exp $ */ #include "npx.h" @@ -233,7 +233,7 @@ rem3id: .asciz "remrq.id" ALIGN_TEXT _idle: xorl %ebp,%ebp - movl $tmpstk,%esp + movl $HIDENAME(tmpstk),%esp movl _IdlePTD,%ecx movl %ecx,%cr3 diff --git a/sys/amd64/include/asmacros.h b/sys/amd64/include/asmacros.h index 9b3559b..097e8dc 100644 --- a/sys/amd64/include/asmacros.h +++ b/sys/amd64/include/asmacros.h @@ -30,26 +30,42 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: asmacros.h,v 1.14 1997/02/22 09:33:56 peter Exp $ + * $Id: asmacros.h,v 1.15 1997/03/09 13:57:33 bde Exp $ */ #ifndef _MACHINE_ASMACROS_H_ #define _MACHINE_ASMACROS_H_ #include <sys/cdefs.h> +#include <machine/asnames.h> /* XXX too much duplication in various asm*.h's. */ -#define ALIGN_DATA .align 2 /* 4 byte alignment, zero filled */ +/* + * CNAME and HIDENAME manage the relationship between symbol names in C + * and the equivalent assembly language names. CNAME is given a name as + * it would be used in a C program. It expands to the equivalent assembly + * language name. HIDENAME is given an assembly-language name, and expands + * to a possibly-modified form that will be invisible to C programs. + */ +#if defined(__ELF__) +#define CNAME(csym) csym +#define HIDENAME(asmsym) __CONCAT(.,asmsym) +#else +#define CNAME(csym) __CONCAT(_,csym) +#define HIDENAME(asmsym) asmsym +#endif + +#define ALIGN_DATA .p2align 2 /* 4 byte alignment, zero filled */ #ifdef GPROF -#define ALIGN_TEXT .align 4,0x90 /* 16-byte alignment, nop filled */ +#define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */ #else -#define ALIGN_TEXT .align 2,0x90 /* 4-byte alignment, nop filled */ +#define ALIGN_TEXT .p2align 2,0x90 /* 4-byte alignment, nop filled */ #endif -#define SUPERALIGN_TEXT .align 4,0x90 /* 16-byte alignment, nop filled */ +#define SUPERALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */ -#define GEN_ENTRY(name) ALIGN_TEXT; .globl __CONCAT(_,name); \ - __CONCAT(_,name): +#define GEN_ENTRY(name) ALIGN_TEXT; .globl CNAME(name); \ + CNAME(name): #define NON_GPROF_ENTRY(name) GEN_ENTRY(name) #define NON_GPROF_RET .byte 0xc3 /* opcode for `ret' */ diff --git a/sys/amd64/isa/npx.c b/sys/amd64/isa/npx.c index bce496a..6e3f5c7 100644 --- a/sys/amd64/isa/npx.c +++ b/sys/amd64/isa/npx.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 - * $Id: npx.c,v 1.39 1997/02/22 09:36:57 peter Exp $ + * $Id: npx.c,v 1.40 1997/03/24 11:23:58 bde Exp $ */ #include "npx.h" @@ -53,6 +53,7 @@ #endif #include <sys/signalvar.h> +#include <machine/asmacros.h> #include <machine/cpu.h> #include <machine/pcb.h> #include <machine/md_var.h> @@ -147,13 +148,15 @@ static volatile u_int npx_traps_while_probing; * interrupts. We'll still need a special exception 16 handler. The busy * latch stuff in probeintr() can be moved to npxprobe(). */ + inthand_t probeintr; asm (" .text -_probeintr: + .p2align 2,0x90 +" __XSTRING(CNAME(probeintr)) ": ss - incl _npx_intrs_while_probing + incl " __XSTRING(CNAME(npx_intrs_while_probing)) " pushl %eax movb $0x20,%al # EOI (asm in strings loses cpp features) outb %al,$0xa0 # IO_ICU2 @@ -168,9 +171,10 @@ inthand_t probetrap; asm (" .text -_probetrap: + .p2align 2,0x90 +" __XSTRING(CNAME(probetrap)) ": ss - incl _npx_traps_while_probing + incl " __XSTRING(CNAME(npx_traps_while_probing)) " fnclex iret "); diff --git a/sys/conf/Makefile.i386 b/sys/conf/Makefile.i386 index 15d7cfd..d1cacbc 100644 --- a/sys/conf/Makefile.i386 +++ b/sys/conf/Makefile.i386 @@ -1,7 +1,7 @@ # Makefile.i386 -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $Id$ +# $Id: Makefile.i386,v 1.93 1997/02/22 09:31:39 peter Exp $ # # Makefile for FreeBSD # @@ -15,9 +15,9 @@ # /sys/i386/conf/Makefile.i386 # after which config should be rerun for all machines. # -CC?= cc -CPP?= cpp -LD?= /usr/bin/ld + +BINFORMAT?= aout +#BINFORMAT?= elf .if exists(./@/.) S= ./@ @@ -54,18 +54,26 @@ DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< DRIVER_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $< PROFILE_C= ${CC} -c ${CFLAGS} ${PARAM} $< -SYSTEM_CFILES= ioconf.c param.c vnode_if.c config.c +SYSTEM_CFILES= ${I386}/i386/setdef0.c ioconf.c param.c vnode_if.c config.c \ + ${I386}/i386/setdef1.c SYSTEM_SFILES= ${I386}/i386/locore.s -SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o +SYSTEM_OBJS= locore.o setdef0.o vnode_if.o ${OBJS} ioconf.o param.o config.o \ + setdef1.o SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS} -SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ -SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o .if ${CFLAGS:M-g} == "" SYMORDER_EXCLUDE=-x symbols.exclude .endif +SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ +.if ${BINFORMAT} == aout +SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o SYSTEM_LD_TAIL= @echo rearranging symbols; \ symorder -m ${SYMORDER_EXCLUDE} symbols.sort $@; \ size $@; chmod 755 $@ +.endif +.if ${BINFORMAT} == elf +SYSTEM_LD= @${LD} -Bstatic -Ttext ${LOAD_ADDRESS} -e btext -o $@ -X ${SYSTEM_OBJS} vers.o +SYSTEM_LD_TAIL= @size $@; chmod 755 $@ +.endif %BEFORE_DEPEND @@ -101,6 +109,12 @@ symbols.sort: ${I386}/i386/symbols.raw locore.o: ${I386}/i386/locore.s assym.s ${NORMAL_S} +setdef0.o: ${I386}/i386/setdef0.c + ${NORMAL_C} + +setdef1.o: ${I386}/i386/setdef1.c + ${NORMAL_C} + # everything potentially depends on the Makefile since everything potentially # depends on the options. Some things are more dependent on the Makefile for # historical reasons. @@ -134,7 +148,7 @@ depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND} rm -f .newdep mkdep -a -f .newdep ${COPTS} ${CFILES} ${SYSTEM_CFILES} mkdep -a -f .newdep ${COPTS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c - MKDEP_CPP="${CPP}" ; export MKDEP_CPP ; \ + MKDEP_CPP="${CC} -E -x assembler-with-cpp" ; export MKDEP_CPP ; \ mkdep -a -f .newdep -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES} rm -f .depend mv -f .newdep .depend diff --git a/sys/conf/Makefile.powerpc b/sys/conf/Makefile.powerpc index 15d7cfd..d1cacbc 100644 --- a/sys/conf/Makefile.powerpc +++ b/sys/conf/Makefile.powerpc @@ -1,7 +1,7 @@ # Makefile.i386 -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $Id$ +# $Id: Makefile.i386,v 1.93 1997/02/22 09:31:39 peter Exp $ # # Makefile for FreeBSD # @@ -15,9 +15,9 @@ # /sys/i386/conf/Makefile.i386 # after which config should be rerun for all machines. # -CC?= cc -CPP?= cpp -LD?= /usr/bin/ld + +BINFORMAT?= aout +#BINFORMAT?= elf .if exists(./@/.) S= ./@ @@ -54,18 +54,26 @@ DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< DRIVER_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $< PROFILE_C= ${CC} -c ${CFLAGS} ${PARAM} $< -SYSTEM_CFILES= ioconf.c param.c vnode_if.c config.c +SYSTEM_CFILES= ${I386}/i386/setdef0.c ioconf.c param.c vnode_if.c config.c \ + ${I386}/i386/setdef1.c SYSTEM_SFILES= ${I386}/i386/locore.s -SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o +SYSTEM_OBJS= locore.o setdef0.o vnode_if.o ${OBJS} ioconf.o param.o config.o \ + setdef1.o SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS} -SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ -SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o .if ${CFLAGS:M-g} == "" SYMORDER_EXCLUDE=-x symbols.exclude .endif +SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ +.if ${BINFORMAT} == aout +SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o SYSTEM_LD_TAIL= @echo rearranging symbols; \ symorder -m ${SYMORDER_EXCLUDE} symbols.sort $@; \ size $@; chmod 755 $@ +.endif +.if ${BINFORMAT} == elf +SYSTEM_LD= @${LD} -Bstatic -Ttext ${LOAD_ADDRESS} -e btext -o $@ -X ${SYSTEM_OBJS} vers.o +SYSTEM_LD_TAIL= @size $@; chmod 755 $@ +.endif %BEFORE_DEPEND @@ -101,6 +109,12 @@ symbols.sort: ${I386}/i386/symbols.raw locore.o: ${I386}/i386/locore.s assym.s ${NORMAL_S} +setdef0.o: ${I386}/i386/setdef0.c + ${NORMAL_C} + +setdef1.o: ${I386}/i386/setdef1.c + ${NORMAL_C} + # everything potentially depends on the Makefile since everything potentially # depends on the options. Some things are more dependent on the Makefile for # historical reasons. @@ -134,7 +148,7 @@ depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND} rm -f .newdep mkdep -a -f .newdep ${COPTS} ${CFILES} ${SYSTEM_CFILES} mkdep -a -f .newdep ${COPTS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c - MKDEP_CPP="${CPP}" ; export MKDEP_CPP ; \ + MKDEP_CPP="${CC} -E -x assembler-with-cpp" ; export MKDEP_CPP ; \ mkdep -a -f .newdep -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES} rm -f .depend mv -f .newdep .depend diff --git a/sys/gnu/i386/fpemul/div_small.s b/sys/gnu/i386/fpemul/div_small.s index d38d921..6022500 100644 --- a/sys/gnu/i386/fpemul/div_small.s +++ b/sys/gnu/i386/fpemul/div_small.s @@ -57,7 +57,7 @@ * W. Metzenthen June 1994. * * - * $Id$ + * $Id: div_small.s,v 1.6 1997/02/22 09:29:00 peter Exp $ * */ @@ -68,11 +68,7 @@ #include <gnu/i386/fpemul/fpu_asm.h> .text - .align 2,144 - -.globl _div_small - -_div_small: +ENTRY(div_small) pushl %ebp movl %esp,%ebp diff --git a/sys/gnu/i386/fpemul/fpu_asm.h b/sys/gnu/i386/fpemul/fpu_asm.h index 6a647b6..c72784b 100644 --- a/sys/gnu/i386/fpemul/fpu_asm.h +++ b/sys/gnu/i386/fpemul/fpu_asm.h @@ -54,13 +54,14 @@ * W. Metzenthen June 1994. * * - * $Id$ + * $Id: fpu_asm.h,v 1.6 1997/02/22 09:29:03 peter Exp $ * */ #ifndef _FPU_ASM_H_ #define _FPU_ASM_H_ +#include <machine/asmacros.h> #include <gnu/i386/fpemul/fpu_emu.h> #define EXCEPTION _exception diff --git a/sys/gnu/i386/fpemul/poly_div.s b/sys/gnu/i386/fpemul/poly_div.s index 4a1fdb7..318dc16 100644 --- a/sys/gnu/i386/fpemul/poly_div.s +++ b/sys/gnu/i386/fpemul/poly_div.s @@ -57,7 +57,7 @@ * W. Metzenthen June 1994. * * - * $Id$ + * $Id: poly_div.s,v 1.6 1997/02/22 09:29:16 peter Exp $ * */ @@ -66,9 +66,7 @@ .text /*---------------------------------------------------------------------------*/ - .align 2,144 -.globl _poly_div2 -_poly_div2: +ENTRY(poly_div2) pushl %ebp movl %esp,%ebp @@ -88,9 +86,7 @@ poly_div2_exit: leave ret /*---------------------------------------------------------------------------*/ - .align 2,144 -.globl _poly_div4 -_poly_div4: +ENTRY(poly_div4) pushl %ebp movl %esp,%ebp @@ -115,9 +111,7 @@ poly_div4_exit: leave ret /*---------------------------------------------------------------------------*/ - .align 2,144 -.globl _poly_div16 -_poly_div16: +ENTRY(poly_div16) pushl %ebp movl %esp,%ebp diff --git a/sys/gnu/i386/fpemul/poly_mul64.s b/sys/gnu/i386/fpemul/poly_mul64.s index 417739e..e8089d0 100644 --- a/sys/gnu/i386/fpemul/poly_mul64.s +++ b/sys/gnu/i386/fpemul/poly_mul64.s @@ -59,7 +59,7 @@ * W. Metzenthen June 1994. * * - * $Id$ + * $Id: poly_mul64.s,v 1.6 1997/02/22 09:29:17 peter Exp $ * */ @@ -67,9 +67,7 @@ #include <gnu/i386/fpemul/fpu_asm.h> .text - .align 2,144 -.globl _mul64 -_mul64: +ENTRY(mul64) pushl %ebp movl %esp,%ebp subl $16,%esp diff --git a/sys/gnu/i386/fpemul/polynomial.s b/sys/gnu/i386/fpemul/polynomial.s index 79e7876..e989225 100644 --- a/sys/gnu/i386/fpemul/polynomial.s +++ b/sys/gnu/i386/fpemul/polynomial.s @@ -64,7 +64,7 @@ * W. Metzenthen June 1994. * * - * $Id$ + * $Id: polynomial.s,v 1.6 1997/02/22 09:29:19 peter Exp $ * */ @@ -79,9 +79,7 @@ .text - .align 2,144 -.globl _polynomial -_polynomial: +ENTRY(polynomial) pushl %ebp movl %esp,%ebp subl $32,%esp diff --git a/sys/gnu/i386/fpemul/reg_div.s b/sys/gnu/i386/fpemul/reg_div.s index d1a5a58..61396cf 100644 --- a/sys/gnu/i386/fpemul/reg_div.s +++ b/sys/gnu/i386/fpemul/reg_div.s @@ -60,7 +60,7 @@ * W. Metzenthen June 1994. * * - * $Id$ + * $Id: reg_div.s,v 1.6 1997/02/22 09:29:22 peter Exp $ * */ @@ -69,10 +69,7 @@ #include <gnu/i386/fpemul/control_w.h> .text - .align 2 - -.globl _reg_div -_reg_div: +ENTRY(reg_div) pushl %ebp movl %esp,%ebp diff --git a/sys/gnu/i386/fpemul/reg_norm.s b/sys/gnu/i386/fpemul/reg_norm.s index c8313c1..f1a24f3 100644 --- a/sys/gnu/i386/fpemul/reg_norm.s +++ b/sys/gnu/i386/fpemul/reg_norm.s @@ -61,7 +61,7 @@ * W. Metzenthen June 1994. * * - * $Id$ + * $Id: reg_norm.s,v 1.6 1997/02/22 09:29:24 peter Exp $ * */ @@ -71,10 +71,7 @@ .text - .align 2,144 -.globl _normalize - -_normalize: +ENTRY(normalize) pushl %ebp movl %esp,%ebp pushl %ebx @@ -141,10 +138,7 @@ L_overflow: /* Normalise without reporting underflow or overflow */ - .align 2,144 -.globl _normalize_nuo - -_normalize_nuo: +ENTRY(normalize_nuo) pushl %ebp movl %esp,%ebp pushl %ebx diff --git a/sys/gnu/i386/fpemul/reg_round.s b/sys/gnu/i386/fpemul/reg_round.s index a716157..8da2f0b 100644 --- a/sys/gnu/i386/fpemul/reg_round.s +++ b/sys/gnu/i386/fpemul/reg_round.s @@ -65,7 +65,7 @@ * W. Metzenthen June 1994. * * - * $Id$ + * $Id: reg_round.s,v 1.6 1997/02/22 09:29:25 peter Exp $ * */ @@ -128,21 +128,19 @@ #define UNMASKED_UNDERFLOW $2 .data - .align 2,0 + ALIGN_DATA FPU_bits_lost: .byte 0 FPU_denormal: .byte 0 .text - .align 2,144 .globl FPU_round .globl FPU_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 diff --git a/sys/gnu/i386/fpemul/reg_u_add.s b/sys/gnu/i386/fpemul/reg_u_add.s index b8ae1c6..21aac51 100644 --- a/sys/gnu/i386/fpemul/reg_u_add.s +++ b/sys/gnu/i386/fpemul/reg_u_add.s @@ -62,7 +62,7 @@ * W. Metzenthen June 1994. * * - * $Id$ + * $Id: reg_u_add.s,v 1.6 1997/02/22 09:29:25 peter Exp $ * */ @@ -81,9 +81,7 @@ #include <gnu/i386/fpemul/control_w.h> .text - .align 2,144 -.globl _reg_u_add -_reg_u_add: +ENTRY(reg_u_add) pushl %ebp movl %esp,%ebp /* subl $16,%esp*/ diff --git a/sys/gnu/i386/fpemul/reg_u_div.s b/sys/gnu/i386/fpemul/reg_u_div.s index f863916..bfc7137 100644 --- a/sys/gnu/i386/fpemul/reg_u_div.s +++ b/sys/gnu/i386/fpemul/reg_u_div.s @@ -57,7 +57,7 @@ * W. Metzenthen June 1994. * * - * $Id$ + * $Id: reg_u_div.s,v 1.6 1997/02/22 09:29:26 peter Exp $ * */ @@ -85,7 +85,7 @@ Result: accum_3:accum_2:accum_1:accum_0 Overflow flag: ovfl_flag */ - .align 2,0 + ALIGN_DATA accum_3: .long 0 accum_2: @@ -103,13 +103,10 @@ ovfl_flag: .text - .align 2,144 - -.globl _reg_u_div .globl _divide_kernel -_reg_u_div: +ENTRY(reg_u_div) pushl %ebp movl %esp,%ebp diff --git a/sys/gnu/i386/fpemul/reg_u_mul.s b/sys/gnu/i386/fpemul/reg_u_mul.s index c05e346..08c5192 100644 --- a/sys/gnu/i386/fpemul/reg_u_mul.s +++ b/sys/gnu/i386/fpemul/reg_u_mul.s @@ -57,7 +57,7 @@ * W. Metzenthen June 1994. * * - * $Id$ + * $Id: reg_u_mul.s,v 1.6 1997/02/22 09:29:27 peter Exp $ * */ @@ -77,7 +77,7 @@ .data - .align 2,0 + ALIGN_DATA accum_0: .long 0 accum_1: @@ -85,10 +85,7 @@ accum_1: .text - .align 2,144 - -.globl _reg_u_mul -_reg_u_mul: +ENTRY(reg_u_mul) pushl %ebp movl %esp,%ebp pushl %esi diff --git a/sys/gnu/i386/fpemul/reg_u_sub.s b/sys/gnu/i386/fpemul/reg_u_sub.s index 3cb89e2..310cc36 100644 --- a/sys/gnu/i386/fpemul/reg_u_sub.s +++ b/sys/gnu/i386/fpemul/reg_u_sub.s @@ -61,7 +61,7 @@ * W. Metzenthen June 1994. * * - * $Id$ + * $Id: reg_u_sub.s,v 1.6 1997/02/22 09:29:27 peter Exp $ * */ @@ -81,9 +81,7 @@ #include <gnu/i386/fpemul/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 diff --git a/sys/gnu/i386/fpemul/wm_shrx.s b/sys/gnu/i386/fpemul/wm_shrx.s index 9631c32..b50199d 100644 --- a/sys/gnu/i386/fpemul/wm_shrx.s +++ b/sys/gnu/i386/fpemul/wm_shrx.s @@ -62,7 +62,7 @@ * W. Metzenthen June 1994. * * - * $Id$ + * $Id: wm_shrx.s,v 1.6 1997/02/22 09:29:29 peter Exp $ * */ @@ -70,7 +70,6 @@ #include <gnu/i386/fpemul/fpu_asm.h> .text - .align 2,144 /*---------------------------------------------------------------------------+ | unsigned shrx(void *arg1, unsigned arg2) | @@ -86,9 +85,7 @@ | Results returned in the 64 bit arg and eax. | +---------------------------------------------------------------------------*/ - .globl _shrx - -_shrx: +ENTRY(shrx) push %ebp movl %esp,%ebp pushl %esi diff --git a/sys/gnu/i386/fpemul/wm_sqrt.s b/sys/gnu/i386/fpemul/wm_sqrt.s index 42412b1..ead5355 100644 --- a/sys/gnu/i386/fpemul/wm_sqrt.s +++ b/sys/gnu/i386/fpemul/wm_sqrt.s @@ -60,7 +60,7 @@ * W. Metzenthen June 1994. * * - * $Id$ + * $Id: wm_sqrt.s,v 1.6 1997/02/22 09:29:30 peter Exp $ * */ @@ -85,7 +85,7 @@ /* Local storage: */ - .align 4,0 + ALIGN_DATA accum_3: .long 0 /* ms word */ accum_2: @@ -107,11 +107,8 @@ fsqrt_arg_0: .long 0 /* ls word, at most the ms bit is set */ .text - .align 2,144 -.globl _wm_sqrt - -_wm_sqrt: +ENTRY(wm_sqrt) pushl %ebp movl %esp,%ebp pushl %esi diff --git a/sys/i386/conf/Makefile.i386 b/sys/i386/conf/Makefile.i386 index 15d7cfd..d1cacbc 100644 --- a/sys/i386/conf/Makefile.i386 +++ b/sys/i386/conf/Makefile.i386 @@ -1,7 +1,7 @@ # Makefile.i386 -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $Id$ +# $Id: Makefile.i386,v 1.93 1997/02/22 09:31:39 peter Exp $ # # Makefile for FreeBSD # @@ -15,9 +15,9 @@ # /sys/i386/conf/Makefile.i386 # after which config should be rerun for all machines. # -CC?= cc -CPP?= cpp -LD?= /usr/bin/ld + +BINFORMAT?= aout +#BINFORMAT?= elf .if exists(./@/.) S= ./@ @@ -54,18 +54,26 @@ DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< DRIVER_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $< PROFILE_C= ${CC} -c ${CFLAGS} ${PARAM} $< -SYSTEM_CFILES= ioconf.c param.c vnode_if.c config.c +SYSTEM_CFILES= ${I386}/i386/setdef0.c ioconf.c param.c vnode_if.c config.c \ + ${I386}/i386/setdef1.c SYSTEM_SFILES= ${I386}/i386/locore.s -SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o +SYSTEM_OBJS= locore.o setdef0.o vnode_if.o ${OBJS} ioconf.o param.o config.o \ + setdef1.o SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS} -SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ -SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o .if ${CFLAGS:M-g} == "" SYMORDER_EXCLUDE=-x symbols.exclude .endif +SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ +.if ${BINFORMAT} == aout +SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o SYSTEM_LD_TAIL= @echo rearranging symbols; \ symorder -m ${SYMORDER_EXCLUDE} symbols.sort $@; \ size $@; chmod 755 $@ +.endif +.if ${BINFORMAT} == elf +SYSTEM_LD= @${LD} -Bstatic -Ttext ${LOAD_ADDRESS} -e btext -o $@ -X ${SYSTEM_OBJS} vers.o +SYSTEM_LD_TAIL= @size $@; chmod 755 $@ +.endif %BEFORE_DEPEND @@ -101,6 +109,12 @@ symbols.sort: ${I386}/i386/symbols.raw locore.o: ${I386}/i386/locore.s assym.s ${NORMAL_S} +setdef0.o: ${I386}/i386/setdef0.c + ${NORMAL_C} + +setdef1.o: ${I386}/i386/setdef1.c + ${NORMAL_C} + # everything potentially depends on the Makefile since everything potentially # depends on the options. Some things are more dependent on the Makefile for # historical reasons. @@ -134,7 +148,7 @@ depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND} rm -f .newdep mkdep -a -f .newdep ${COPTS} ${CFILES} ${SYSTEM_CFILES} mkdep -a -f .newdep ${COPTS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c - MKDEP_CPP="${CPP}" ; export MKDEP_CPP ; \ + MKDEP_CPP="${CC} -E -x assembler-with-cpp" ; export MKDEP_CPP ; \ mkdep -a -f .newdep -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES} rm -f .depend mv -f .newdep .depend diff --git a/sys/i386/i386/identcpu.c b/sys/i386/i386/identcpu.c index e78382b..bb99ca8 100644 --- a/sys/i386/i386/identcpu.c +++ b/sys/i386/i386/identcpu.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: Id: machdep.c,v 1.193 1996/06/18 01:22:04 bde Exp - * $Id: identcpu.c,v 1.13 1997/02/22 09:32:19 peter Exp $ + * $Id: identcpu.c,v 1.14 1997/03/22 18:51:57 kato Exp $ */ #include "opt_cpu.h" @@ -47,6 +47,7 @@ #include <sys/kernel.h> #include <sys/sysctl.h> +#include <machine/asmacros.h> #include <machine/cpu.h> #include <machine/reg.h> #include <machine/psl.h> @@ -426,9 +427,10 @@ inthand_t bluetrap; asm (" .text -_bluetrap: + .p2align 2,0x90 +" __XSTRING(CNAME(bluetrap)) ": ss - movl $0xa8c1d, _trap_by_wrmsr # Don't ask meaning of the number :-). + movl $0xa8c1d," __XSTRING(CNAME(trap_by_wrmsr)) " # Don't ask meaning of the number :-). addl $2, (%esp) # I know wrmsr is a 2-bytes instruction. iret "); diff --git a/sys/i386/i386/locore.s b/sys/i386/i386/locore.s index cd56539..63c1112 100644 --- a/sys/i386/i386/locore.s +++ b/sys/i386/i386/locore.s @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)locore.s 7.3 (Berkeley) 5/13/91 - * $Id: locore.s,v 1.83 1997/04/07 07:15:49 peter Exp $ + * $Id: locore.s,v 1.84 1997/04/07 08:38:19 peter Exp $ * * originally from: locore.s, by William F. Jolitz * @@ -92,9 +92,9 @@ .data ALIGN_DATA /* just to be sure */ - .globl tmpstk + .globl HIDENAME(tmpstk) .space 0x2000 /* space for tmpstk - temporary stack */ -tmpstk: +HIDENAME(tmpstk): .globl _boothowto,_bootdev @@ -237,7 +237,7 @@ _pc98_system_parameter: * the old stack, but it need not be, since recover_bootinfo actually * returns via the old frame. */ - movl $R(tmpstk),%esp + movl $R(HIDENAME(tmpstk)),%esp #ifdef PC98 testb $0x02,0x100620 /* pc98_machine_type & M_EPSON_PC98 */ @@ -403,7 +403,7 @@ NON_GPROF_ENTRY(sigcode) movl $SYS_sigreturn,%eax /* sigreturn() */ LCALL(0x7,0) /* enter kernel with args on stack */ hlt /* never gets here */ - .align 2,0x90 /* long word text-align */ + ALIGN_TEXT _esigcode: .data diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 3513198..9ed0b1d 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.236 1997/04/07 07:15:50 peter Exp $ + * $Id: machdep.c,v 1.237 1997/04/13 04:07:24 dyson Exp $ */ #include "npx.h" @@ -126,6 +126,7 @@ extern void earlysetcpuclass(void); /* same header file */ extern void finishidentcpu(void); extern void panicifcpuunsupported(void); extern void initializecpu(void); +extern void init_sets(void); static void cpu_startup __P((void *)); SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL) @@ -978,6 +979,11 @@ init386(first) atdevbase = ISA_HOLE_START + KERNBASE; /* + * Fill in the length fields of all linker sets (necessary for ELF). + */ + init_sets(); + + /* * Initialize the console before we print anything out. */ cninit(); diff --git a/sys/i386/i386/setdef0.c b/sys/i386/i386/setdef0.c new file mode 100644 index 0000000..975a655 --- /dev/null +++ b/sys/i386/i386/setdef0.c @@ -0,0 +1,92 @@ +/*- + * Copyright (c) 1997 John D. Polstra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + */ + +extern void init_sets(void); + +#ifdef __ELF__ + +#include <sys/param.h> +#include <sys/kernel.h> + +/* + * BEGIN_SET creates the section and label for a set, and emits the + * count word at the front of it. The count word initially contains 0, + * but is filled in with the correct value at runtime by init_sets(). + */ +#define BEGIN_SET(set) \ + __asm__(".section .set." #set ",\"aw\""); \ + __asm__(".globl " #set); \ + __asm__(".type " #set ",@object"); \ + __asm__(".p2align 2"); \ + __asm__(#set ":"); \ + __asm__(".long 0"); \ + __asm__(".previous") + +/* + * DEFINE_SET calls BEGIN_SET and also enters the set into the mother + * of all sets, `set_of_sets'. + */ +#define DEFINE_SET(set) BEGIN_SET(set); DATA_SET(set_of_sets, set) + +/* + * Define a set that contains a list of all the other linker sets. + */ + +BEGIN_SET(set_of_sets); + +#include <i386/i386/setdefs.h> /* Contains a `DEFINE_SET' for each set */ + +extern struct linker_set set_of_sets; + +/* + * Fill in the leading "ls_length" fields of all linker sets. This is + * needed for ELF. For a.out, it is already done by the linker. + */ +void +init_sets(void) +{ + struct linker_set **lspp = (struct linker_set **) set_of_sets.ls_items; + struct linker_set *lsp; + + for (; (lsp = *lspp) != NULL; lspp++) { + int i; + + for (i = 0; lsp->ls_items[i] != NULL; i++) /* Count items */ + ; + lsp->ls_length = i; + } +} + +#else /* ! __ELF__ */ + +void +init_sets(void) +{ +} + +#endif /* __ELF__ */ diff --git a/sys/i386/i386/setdef1.c b/sys/i386/i386/setdef1.c new file mode 100644 index 0000000..c372380 --- /dev/null +++ b/sys/i386/i386/setdef1.c @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 1997 John D. Polstra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + */ + +#ifdef __ELF__ + +/* + * END_SET emits the NULL terminator for a set. + */ +#define END_SET(set) \ + __asm__(".section .set." #set ",\"aw\""); \ + __asm__(".long 0"); \ + __asm__(".previous") + +#define DEFINE_SET(set) END_SET(set) + +#include <i386/i386/setdefs.h> /* Contains a `DEFINE_SET' for each set */ + +END_SET(set_of_sets); /* Terminate the mother of all sets */ + +#endif diff --git a/sys/i386/i386/setdefs.h b/sys/i386/i386/setdefs.h new file mode 100644 index 0000000..87034e9 --- /dev/null +++ b/sys/i386/i386/setdefs.h @@ -0,0 +1,107 @@ +/*- + * Copyright (c) 1997 John D. Polstra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + */ + +#ifndef _MACHINE_SETDEFS_H_ +#define _MACHINE_SETDEFS_H_ + +/* + * This file contains declarations for each linker set that can possibly + * be included in the system. Every linker set must have an entry in this + * file, regardless of whether it happens to be configured into a given + * kernel. + * + * These declarations are unused for a.out, but they are needed for an + * ELF kernel. ELF does not directly support linker sets, so they are + * simulated by creating a separate section for each set. This header + * is included by two source files: setdef0.c at the beginning of the + * link (just after locore.s), and setdef1.c at the end of the link. + * The DEFINE_SET macro is defined differently in these two souces, so + * that it emits the leading count word for each set in setdef0.c, and + * the trailing NULL pointer for each set in setdef1.c. + */ + +DEFINE_SET(db_show_cmd_set); +DEFINE_SET(domain_set); +DEFINE_SET(eisadriver_set); +DEFINE_SET(execsw_set); +DEFINE_SET(netisr_set); +DEFINE_SET(pcibus_set); +DEFINE_SET(pcidevice_set); +DEFINE_SET(sysctl_); +DEFINE_SET(sysctl__debug); +DEFINE_SET(sysctl__hw); +DEFINE_SET(sysctl__kern); +DEFINE_SET(sysctl__kern_ipc); +DEFINE_SET(sysctl__kern_ntp_pll); +DEFINE_SET(sysctl__kern_proc); +DEFINE_SET(sysctl__kern_proc_pgrp); +DEFINE_SET(sysctl__kern_proc_pid); +DEFINE_SET(sysctl__kern_proc_ruid); +DEFINE_SET(sysctl__kern_proc_tty); +DEFINE_SET(sysctl__kern_proc_uid); +DEFINE_SET(sysctl__machdep); +DEFINE_SET(sysctl__net); +DEFINE_SET(sysctl__net_inet); +DEFINE_SET(sysctl__net_inet_div); +DEFINE_SET(sysctl__net_inet_icmp); +DEFINE_SET(sysctl__net_inet_igmp); +DEFINE_SET(sysctl__net_inet_ip); +DEFINE_SET(sysctl__net_inet_ip_fw); +DEFINE_SET(sysctl__net_inet_ip_portrange); +DEFINE_SET(sysctl__net_inet_raw); +DEFINE_SET(sysctl__net_inet_tcp); +DEFINE_SET(sysctl__net_inet_udp); +DEFINE_SET(sysctl__net_ipx); +DEFINE_SET(sysctl__net_ipx_error); +DEFINE_SET(sysctl__net_ipx_ipx); +DEFINE_SET(sysctl__net_ipx_spx); +DEFINE_SET(sysctl__net_link); +DEFINE_SET(sysctl__net_link_ether); +DEFINE_SET(sysctl__net_link_ether_inet); +DEFINE_SET(sysctl__net_link_generic); +DEFINE_SET(sysctl__net_link_generic_ifdata); +DEFINE_SET(sysctl__net_link_generic_system); +DEFINE_SET(sysctl__net_local); +DEFINE_SET(sysctl__net_local_dgram); +DEFINE_SET(sysctl__net_local_stream); +DEFINE_SET(sysctl__net_routetable); +DEFINE_SET(sysctl__sysctl); +DEFINE_SET(sysctl__sysctl_name); +DEFINE_SET(sysctl__sysctl_next); +DEFINE_SET(sysctl__sysctl_oidfmt); +DEFINE_SET(sysctl__user); +DEFINE_SET(sysctl__vfs); +DEFINE_SET(sysctl__vfs_ffs); +DEFINE_SET(sysctl__vfs_generic); +DEFINE_SET(sysctl__vfs_nfs); +DEFINE_SET(sysctl__vm); +DEFINE_SET(sysinit_set); +DEFINE_SET(vfs_opv_descs_); +DEFINE_SET(vfs_set); + +#endif /* !_MACHINE_SETDEFS_H_ */ diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s index 3898a53..a74cd09 100644 --- a/sys/i386/i386/swtch.s +++ b/sys/i386/i386/swtch.s @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: swtch.s,v 1.45 1997/04/14 18:12:05 phk Exp $ + * $Id: swtch.s,v 1.46 1997/04/20 06:41:26 phk Exp $ */ #include "npx.h" @@ -233,7 +233,7 @@ rem3id: .asciz "remrq.id" ALIGN_TEXT _idle: xorl %ebp,%ebp - movl $tmpstk,%esp + movl $HIDENAME(tmpstk),%esp movl _IdlePTD,%ecx movl %ecx,%cr3 diff --git a/sys/i386/include/asmacros.h b/sys/i386/include/asmacros.h index 9b3559b..097e8dc 100644 --- a/sys/i386/include/asmacros.h +++ b/sys/i386/include/asmacros.h @@ -30,26 +30,42 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: asmacros.h,v 1.14 1997/02/22 09:33:56 peter Exp $ + * $Id: asmacros.h,v 1.15 1997/03/09 13:57:33 bde Exp $ */ #ifndef _MACHINE_ASMACROS_H_ #define _MACHINE_ASMACROS_H_ #include <sys/cdefs.h> +#include <machine/asnames.h> /* XXX too much duplication in various asm*.h's. */ -#define ALIGN_DATA .align 2 /* 4 byte alignment, zero filled */ +/* + * CNAME and HIDENAME manage the relationship between symbol names in C + * and the equivalent assembly language names. CNAME is given a name as + * it would be used in a C program. It expands to the equivalent assembly + * language name. HIDENAME is given an assembly-language name, and expands + * to a possibly-modified form that will be invisible to C programs. + */ +#if defined(__ELF__) +#define CNAME(csym) csym +#define HIDENAME(asmsym) __CONCAT(.,asmsym) +#else +#define CNAME(csym) __CONCAT(_,csym) +#define HIDENAME(asmsym) asmsym +#endif + +#define ALIGN_DATA .p2align 2 /* 4 byte alignment, zero filled */ #ifdef GPROF -#define ALIGN_TEXT .align 4,0x90 /* 16-byte alignment, nop filled */ +#define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */ #else -#define ALIGN_TEXT .align 2,0x90 /* 4-byte alignment, nop filled */ +#define ALIGN_TEXT .p2align 2,0x90 /* 4-byte alignment, nop filled */ #endif -#define SUPERALIGN_TEXT .align 4,0x90 /* 16-byte alignment, nop filled */ +#define SUPERALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */ -#define GEN_ENTRY(name) ALIGN_TEXT; .globl __CONCAT(_,name); \ - __CONCAT(_,name): +#define GEN_ENTRY(name) ALIGN_TEXT; .globl CNAME(name); \ + CNAME(name): #define NON_GPROF_ENTRY(name) GEN_ENTRY(name) #define NON_GPROF_RET .byte 0xc3 /* opcode for `ret' */ diff --git a/sys/i386/include/asnames.h b/sys/i386/include/asnames.h new file mode 100644 index 0000000..afac9f3 --- /dev/null +++ b/sys/i386/include/asnames.h @@ -0,0 +1,251 @@ +/*- + * Copyright (c) 1997 John D. Polstra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + */ + +#ifndef _MACHINE_ASNAMES_H_ +#define _MACHINE_ASNAMES_H_ + +/* + * This file is used by the kernel assembly language sources to provide + * the proper mapping between the global names used in assembly language + * code and the corresponding C symbols. By convention, all C symbols + * that are referenced from assembly language are prefixed with `_'. + * That happens to be the same prefix that the a.out compiler attaches + * to each C symbol. + * + * When using the ELF compiler, C symbols are identical to the corresponding + * assembly language symbols. Thus the extra underscores cause problems. + * The defines in this file map the underscore names back to the proper + * unadorned names. + * + * Every global symbol that is referenced from both C source and assembly + * language source must have an entry in this file, or the kernel will + * not build properly using the ELF compiler. + * + * This file is included by <machine/asmacros.h>, and it is OK to rely + * on that. + */ + +#ifdef __ELF__ + +#define _APTD APTD +#define _APTDpde APTDpde +#define _APTmap APTmap +#define _CONST_QNaN CONST_QNaN +#define _IdlePTD IdlePTD +#define _PTD PTD +#define _PTDpde PTDpde +#define _PTmap PTmap +#define _Xalign Xalign +#define _Xbnd Xbnd +#define _Xbpt Xbpt +#define _Xdbg Xdbg +#define _Xdiv Xdiv +#define _Xdna Xdna +#define _Xfastintr0 Xfastintr0 +#define _Xfastintr1 Xfastintr1 +#define _Xfastintr10 Xfastintr10 +#define _Xfastintr11 Xfastintr11 +#define _Xfastintr12 Xfastintr12 +#define _Xfastintr13 Xfastintr13 +#define _Xfastintr14 Xfastintr14 +#define _Xfastintr15 Xfastintr15 +#define _Xfastintr2 Xfastintr2 +#define _Xfastintr3 Xfastintr3 +#define _Xfastintr4 Xfastintr4 +#define _Xfastintr5 Xfastintr5 +#define _Xfastintr6 Xfastintr6 +#define _Xfastintr7 Xfastintr7 +#define _Xfastintr8 Xfastintr8 +#define _Xfastintr9 Xfastintr9 +#define _Xfpu Xfpu +#define _Xfpusegm Xfpusegm +#define _Xill Xill +#define _Xint0x80_syscall Xint0x80_syscall +#define _Xintr0 Xintr0 +#define _Xintr1 Xintr1 +#define _Xintr10 Xintr10 +#define _Xintr11 Xintr11 +#define _Xintr12 Xintr12 +#define _Xintr13 Xintr13 +#define _Xintr14 Xintr14 +#define _Xintr15 Xintr15 +#define _Xintr2 Xintr2 +#define _Xintr3 Xintr3 +#define _Xintr4 Xintr4 +#define _Xintr5 Xintr5 +#define _Xintr6 Xintr6 +#define _Xintr7 Xintr7 +#define _Xintr8 Xintr8 +#define _Xintr9 Xintr9 +#define _Xmchk Xmchk +#define _Xmissing Xmissing +#define _Xnmi Xnmi +#define _Xofl Xofl +#define _Xpage Xpage +#define _Xprot Xprot +#define _Xrsvd Xrsvd +#define _Xstk Xstk +#define _Xsyscall Xsyscall +#define _Xtss Xtss +#define __default_ldt _default_ldt +#define __ucodesel _ucodesel +#define __udatasel _udatasel +#define _alltraps alltraps +#define _apm_addr apm_addr +#define _apm_bios_call apm_bios_call +#define _apm_cs16_base apm_cs16_base +#define _apm_cs32_base apm_cs32_base +#define _apm_cs_entry apm_cs_entry +#define _apm_cs_limit apm_cs_limit +#define _apm_current_gdt_pdesc apm_current_gdt_pdesc +#define _apm_ds_base apm_ds_base +#define _apm_ds_limit apm_ds_limit +#define _apm_flags apm_flags +#define _apm_init_image apm_init_image +#define _apm_init_image_size apm_init_image_size +#define _apm_setup apm_setup +#define _apm_version apm_version +#define _arith_invalid arith_invalid +#define _arith_overflow arith_overflow +#define _arith_underflow arith_underflow +#define _bcopy bcopy +#define _bcopy_vector bcopy_vector +#define _bio_imask bio_imask +#define _bluetrap bluetrap +#define _bootdev bootdev +#define _boothowto boothowto +#define _bootinfo bootinfo +#define _bootstrap_gdt bootstrap_gdt +#define _bzero bzero +#define _cnt cnt +#define _copyin_vector copyin_vector +#define _copyout_vector copyout_vector +#define _cpl cpl +#define _cpu cpu +#define _cpu_class cpu_class +#define _cpu_feature cpu_feature +#define _cpu_high cpu_high +#define _cpu_id cpu_id +#define _cpu_vendor cpu_vendor +#define _curpcb curpcb +#define _curproc curproc +#define _currentldt currentldt +#define _cypoll cypoll +#define _denormal_operand denormal_operand +#define _div_small div_small +#define _divide_by_zero divide_by_zero +#define _divide_kernel divide_kernel +#define _edata edata +#define _eintrcnt eintrcnt +#define _eintrnames eintrnames +#define _end end +#define _etext etext +#define _exception exception +#define _fastmove fastmove +#define _generic_bcopy generic_bcopy +#define _generic_bzero generic_bzero +#define _generic_copyin generic_copyin +#define _generic_copyout generic_copyout +#define _i586_ctr_bias i586_ctr_bias +#define _i586_ctr_freq i586_ctr_freq +#define _i586_ctr_multiplier i586_ctr_multiplier +#define _idqs idqs +#define _imen imen +#define _init386 init386 +#define _intr_countp intr_countp +#define _intr_handler intr_handler +#define _intr_mask intr_mask +#define _intr_nesting_level intr_nesting_level +#define _intr_unit intr_unit +#define _intrcnt intrcnt +#define _intrnames intrnames +#define _ipending ipending +#define _kernelname kernelname +#define _kstack kstack +#define _linux_sigcode linux_sigcode +#define _linux_szsigcode linux_szsigcode +#define _main main +#define _mul64 mul64 +#define _net_imask net_imask +#define _netisr netisr +#define _netisrs netisrs +#define _nfs_diskless nfs_diskless +#define _nfs_diskless_valid nfs_diskless_valid +#define _normalize normalize +#define _normalize_nuo normalize_nuo +#define _npx_intrs_while_probing npx_intrs_while_probing +#define _npx_traps_while_probing npx_traps_while_probing +#define _npxintr npxintr +#define _npxproc npxproc +#define _npxsave npxsave +#define _ovbcopy_vector ovbcopy_vector +#define _panic panic +#define _poly_div16 poly_div16 +#define _poly_div2 poly_div2 +#define _poly_div4 poly_div4 +#define _polynomial polynomial +#define _probeintr probeintr +#define _probetrap probetrap +#define _proc0paddr proc0paddr +#define _qs qs +#define _rcpoll rcpoll +#define _real_2op_NaN real_2op_NaN +#define _reg_div reg_div +#define _reg_u_add reg_u_add +#define _reg_u_div reg_u_div +#define _reg_u_mul reg_u_mul +#define _reg_u_sub reg_u_sub +#define _round_reg round_reg +#define _rtqs rtqs +#define _set_precision_flag_down set_precision_flag_down +#define _set_precision_flag_up set_precision_flag_up +#define _set_user_ldt set_user_ldt +#define _shrx shrx +#define _shrxs shrxs +#define _sigcode sigcode +#define _siopoll siopoll +#define _softclock softclock +#define _splz splz +#define _syscall syscall +#define _szsigcode szsigcode +#define _time time +#define _timer0_max_count timer0_max_count +#define _timer0_overflow_threshold timer0_overflow_threshold +#define _timer0_prescaler_count timer0_prescaler_count +#define _trap trap +#define _trap_by_wrmsr trap_by_wrmsr +#define _trapwrite trapwrite +#define _tty_imask tty_imask +#define _userconfig_from_boot userconfig_from_boot +#define _vm_page_zero_idle vm_page_zero_idle +#define _want_resched want_resched +#define _wm_sqrt wm_sqrt + +#endif /* __ELF__ */ + +#endif /* !_MACHINE_ASNAMES_H_ */ diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c index bce496a..6e3f5c7 100644 --- a/sys/i386/isa/npx.c +++ b/sys/i386/isa/npx.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 - * $Id: npx.c,v 1.39 1997/02/22 09:36:57 peter Exp $ + * $Id: npx.c,v 1.40 1997/03/24 11:23:58 bde Exp $ */ #include "npx.h" @@ -53,6 +53,7 @@ #endif #include <sys/signalvar.h> +#include <machine/asmacros.h> #include <machine/cpu.h> #include <machine/pcb.h> #include <machine/md_var.h> @@ -147,13 +148,15 @@ static volatile u_int npx_traps_while_probing; * interrupts. We'll still need a special exception 16 handler. The busy * latch stuff in probeintr() can be moved to npxprobe(). */ + inthand_t probeintr; asm (" .text -_probeintr: + .p2align 2,0x90 +" __XSTRING(CNAME(probeintr)) ": ss - incl _npx_intrs_while_probing + incl " __XSTRING(CNAME(npx_intrs_while_probing)) " pushl %eax movb $0x20,%al # EOI (asm in strings loses cpp features) outb %al,$0xa0 # IO_ICU2 @@ -168,9 +171,10 @@ inthand_t probetrap; asm (" .text -_probetrap: + .p2align 2,0x90 +" __XSTRING(CNAME(probetrap)) ": ss - incl _npx_traps_while_probing + incl " __XSTRING(CNAME(npx_traps_while_probing)) " fnclex iret "); diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 7da4cc1..5f7dcca 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 - * $Id$ + * $Id: cdefs.h,v 1.13 1997/02/22 09:44:52 peter Exp $ */ #ifndef _SYS_CDEFS_H_ @@ -54,12 +54,16 @@ * The __CONCAT macro is a bit tricky -- make sure you don't put spaces * in between its arguments. __CONCAT can also concatenate double-quoted * strings produced by the __STRING macro, but this only works with ANSI C. + * + * __XSTRING is like __STRING, but it expands any macros in its argument + * first. It is only available with ANSI C. */ #if defined(__STDC__) || defined(__cplusplus) #define __P(protos) protos /* full-blown ANSI C */ #define __CONCAT1(x,y) x ## y #define __CONCAT(x,y) __CONCAT1(x,y) -#define __STRING(x) #x +#define __STRING(x) #x /* stringify without expanding x */ +#define __XSTRING(x) __STRING(x) /* expand x, then stringify */ #define __const const /* define reserved names to standard */ #define __signed signed diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h index ded1c9f..c426d81 100644 --- a/sys/sys/kernel.h +++ b/sys/sys/kernel.h @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * @(#)kernel.h 8.3 (Berkeley) 1/21/94 - * $Id: kernel.h,v 1.26 1997/03/22 08:03:45 bde Exp $ + * $Id: kernel.h,v 1.27 1997/04/06 11:14:12 dufault Exp $ */ #ifndef _SYS_KERNEL_H_ @@ -77,7 +77,23 @@ extern long timedelta; /* * The following macros are used to declare global sets of objects, which * are collected by the linker into a `struct linker_set' as defined below. - * + * For ELF, this is done by constructing a separate segment for each set. + * For a.out, it is done automatically by the linker. + */ +#if defined(__ELF__) + +#define MAKE_SET(set, sym) \ + __asm__(".section .set." #set ",\"aw\""); \ + __asm__(".long " #sym); \ + __asm__(".previous"); +#define TEXT_SET(set, sym) MAKE_SET(set, sym) +#define DATA_SET(set, sym) MAKE_SET(set, sym) +#define BSS_SET(set, sym) MAKE_SET(set, sym) +#define ABS_SET(set, sym) MAKE_SET(set, sym) + +#else + +/* * NB: the constants defined below must match those defined in * ld/ld.h. Since their calculation requires arithmetic, we * can't name them symbolically (e.g., 23 is N_SETT | N_EXT). @@ -90,6 +106,8 @@ extern long timedelta; #define BSS_SET(set, sym) MAKE_SET(set, sym, 27) #define ABS_SET(set, sym) MAKE_SET(set, sym, 21) +#endif + /* * Enumerated types for known system startup interfaces. |