From 5d07e08579b8a8bb920b8659ee3987940bbc2ddb Mon Sep 17 00:00:00 2001 From: cgd Date: Sat, 3 Apr 1993 02:15:18 +0000 Subject: [PATCH] added changes from Steven Reiz (based on those by Poul-Henning Kamp ) to get the kernel to compile properly when gcc2.* is cc. (should still work when gcc1.39 is in use.) --- lib/csu/i386/crt0.c | 3 +++ sys/arch/i386/include/segments.h | 8 ++++++++ sys/arch/i386/isa/npx.c | 22 +++++++++++++++++++++- sys/kern/init_main.c | 2 +- sys/kern/subr_xxx.c | 2 +- sys/sys/systm.h | 2 +- 6 files changed, 35 insertions(+), 4 deletions(-) diff --git a/lib/csu/i386/crt0.c b/lib/csu/i386/crt0.c index 363098b326c6..b941ccded207 100644 --- a/lib/csu/i386/crt0.c +++ b/lib/csu/i386/crt0.c @@ -50,6 +50,9 @@ int errno = 0; asm(".text"); asm(".long 0xc000c000"); +asm(".long 0xc000c000"); +asm(".long 0xc000c000"); +asm(".long 0xc000c000"); extern unsigned char etext; extern unsigned char eprol asm ("eprol"); diff --git a/sys/arch/i386/include/segments.h b/sys/arch/i386/include/segments.h index 0456e59ac86b..3f55bc0104e7 100644 --- a/sys/arch/i386/include/segments.h +++ b/sys/arch/i386/include/segments.h @@ -42,6 +42,10 @@ * William F. Jolitz (william@ernie.berkeley.edu) 6/20/1989 */ +#if __GNUC__ >= 2 +#pragma pack(1) +#endif + /* * Selectors */ @@ -194,3 +198,7 @@ struct region_descriptor { #define NIDT 256 #define NRSVIDT 32 /* reserved entries for cpu exceptions */ + +#if __GNUC__ >= 2 +#pragma pack(4) +#endif diff --git a/sys/arch/i386/isa/npx.c b/sys/arch/i386/isa/npx.c index c2518fbd6698..57bcb755bb99 100644 --- a/sys/arch/i386/isa/npx.c +++ b/sys/arch/i386/isa/npx.c @@ -33,7 +33,7 @@ * * @(#)npx.c 7.2 (Berkeley) 5/12/91 */ -static char rcsid[] = "$Header: /cvsroot/src/sys/arch/i386/isa/Attic/npx.c,v 1.1.1.1 1993/03/21 09:45:37 cgd Exp $"; +static char rcsid[] = "$Header: /cvsroot/src/sys/arch/i386/isa/Attic/npx.c,v 1.2 1993/04/03 02:18:02 cgd Exp $"; #include "npx.h" #if NNPX > 0 @@ -126,7 +126,11 @@ npxinit(control) { asm (" fninit"); asm(" fldcw %0" : : "g" (wd)); if (curpcb) { +#if __GNUC__ >= 2 + asm(" fnsave 0(%0) " : : "a" (&curpcb->pcb_savefpu) ); +#else asm(" fnsave %0 " : : "g" (curpcb->pcb_savefpu) ); +#endif curpcb->pcb_flags |= FP_NEEDSRESTORE; } load_cr0(rcr0() | CR0_EM); /* start emulating */ @@ -141,7 +145,11 @@ npxload() { if (npxproc) panic ("npxload"); npxproc = curproc; npxpcb = curpcb; +#if __GNUC__ >= 2 + asm(" frstor 0(%0) " : : "a" (&curpcb->pcb_savefpu) ); +#else asm(" frstor %0 " : : "g" (curpcb->pcb_savefpu) ); +#endif } /* @@ -150,7 +158,11 @@ npxload() { npxunload() { if (npxproc == 0) panic ("npxunload"); +#if __GNUC__ >= 2 + asm(" fsave 0(%0) " : : "a" (&npxpcb->pcb_savefpu) ); +#else asm(" fsave %0 " : : "g" (npxpcb->pcb_savefpu) ); +#endif npxproc = 0 ; } @@ -167,7 +179,11 @@ static status; asm (" fnstsw %0 " : "=m" (status) : "m" (status) ); /* sync state in process context structure, in advance of debugger/process looking for it */ if (npxproc == 0 || npxexists == 0) panic ("npxintr"); +#if __GNUC__ >= 2 + asm (" fnsave 0(%0) " : : "a" (&npxpcb->pcb_savefpu) ); +#else asm (" fnsave %0 " : : "g" (npxpcb->pcb_savefpu) ); +#endif #ifdef notyet /* encode the appropriate code for detailed information on this exception */ @@ -206,7 +222,11 @@ npxdna() { if (npxexists == 0) return(0); load_cr0(rcr0() & ~CR0_EM); /* stop emulating */ if (curpcb->pcb_flags & FP_NEEDSRESTORE) +#if __GNUC__ >= 2 + asm(" frstor 0(%0) " : : "a" (&curpcb->pcb_savefpu)); +#else asm(" frstor %0 " : : "g" (curpcb->pcb_savefpu)); +#endif curpcb->pcb_flags |= FP_WASUSED | FP_NEEDSSAVE; curpcb->pcb_flags &= ~FP_NEEDSRESTORE; npxproc = curproc; diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 063aa4b4b195..6d9f5eab7a63 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1 +1 @@ -revision 1.3 intentionally removed +revision 1.4 intentionally removed diff --git a/sys/kern/subr_xxx.c b/sys/kern/subr_xxx.c index 4d8ce97231f8..7d70031a96a7 100644 --- a/sys/kern/subr_xxx.c +++ b/sys/kern/subr_xxx.c @@ -198,7 +198,7 @@ bcmp(v1, v2, len) #ifdef NEED_STRLEN strlen(s1) - register char *s1; + const register char *s1; { register int len; diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 16dc1f6467d4..063aa4b4b195 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -1 +1 @@ -revision 1.2 intentionally removed +revision 1.3 intentionally removed