From 7c434002a4e47486e9a2d7b2f32b1ddf42d37e2a Mon Sep 17 00:00:00 2001 From: Paul Richards Date: Fri, 18 Jun 1993 02:47:24 +0000 Subject: [PATCH] Upgrade to GCC 2.X --- sys/amd64/amd64/machdep.c | 29 ++++++++++++++++++----------- sys/i386/i386/machdep.c | 29 ++++++++++++++++++----------- sys/i386/i386/math_emulate.c | 2 +- sys/i386/isa/icu.s | 2 +- sys/i386/isa/wd.c | 21 ++++++++++++++------- 5 files changed, 52 insertions(+), 31 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index f0351a7ddf9e..076bad91c304 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -49,7 +49,7 @@ * 20 Apr 93 Bruce Evans New npx-0.5 code * 25 Apr 93 Bruce Evans New intr-0.1 code */ -static char rcsid[] = "$Header: /usr/src/sys.386bsd/i386/i386/RCS/machdep.c,v 1.2 92/01/21 14:22:09 william Exp Locker: root $"; +static char rcsid[] = "$Header: /home/cvs/386BSD/src/sys.386bsd/i386/i386/machdep.c,v 1.1.1.1 93/06/12 14:58:06 rgrimes Exp $"; #include @@ -85,6 +85,10 @@ extern vm_offset_t avail_end; #define EXPECT_BASEMEM 640 /* The expected base memory*/ #define INFORM_WAIT 1 /* Set to pause berfore crash in weird cases*/ +#if __GNUC__ >= 2 +__main(){} +#endif + /* * Declare these as initialized data so we can patch them. */ @@ -653,6 +657,7 @@ setregs(p, entry) /* * Initialize segments & interrupt table */ +#define DESCRIPTOR_SIZE 8 #define GNULL_SEL 0 /* Null Descriptor */ @@ -664,13 +669,13 @@ setregs(p, entry) #define GPROC0_SEL 6 /* Task state process slot zero and up */ #define NGDT GPROC0_SEL+1 -union descriptor gdt[GPROC0_SEL+1]; +unsigned char gdt[GPROC0_SEL+1][DESCRIPTOR_SIZE]; /* interrupt descriptor table */ struct gate_descriptor idt[NIDT]; /* local descriptor table */ -union descriptor ldt[5]; +unsigned char ldt[5][DESCRIPTOR_SIZE]; #define LSYS5CALLS_SEL 0 /* forced by intel BCS */ #define LSYS5SIGR_SEL 1 @@ -831,7 +836,7 @@ init386(first) struct gate_descriptor *gdp; extern int sigcode,szsigcode; /* table descriptors - used to load tables by microp */ - struct region_descriptor r_gdt, r_idt; + unsigned short r_gdt[3], r_idt[3]; int pagesinbase, pagesinext; @@ -845,12 +850,12 @@ init386(first) /* make gdt memory segments */ gdt_segs[GCODE_SEL].ssd_limit = btoc((int) &etext + NBPG); - for (x=0; x < NGDT; x++) ssdtosd(gdt_segs+x, gdt+x); + for (x=0; x < NGDT; x++) ssdtosd(gdt_segs+x, &gdt[x][0]); /* make ldt memory segments */ ldt_segs[LUCODE_SEL].ssd_limit = btoc(UPT_MIN_ADDRESS); ldt_segs[LUDATA_SEL].ssd_limit = btoc(UPT_MIN_ADDRESS); /* Note. eventually want private ldts per process */ - for (x=0; x < 5; x++) ssdtosd(ldt_segs+x, ldt+x); + for (x=0; x < 5; x++) ssdtosd(ldt_segs+x, &ldt[x][0]); /* exceptions */ setidt(0, &IDTVEC(div), SDT_SYS386TGT, SEL_KPL); @@ -891,11 +896,13 @@ init386(first) isa_defaultirq(); #endif - r_gdt.rd_limit = sizeof(gdt)-1; - r_gdt.rd_base = (int) gdt; + r_gdt[0] = (unsigned short) (sizeof(gdt) - 1); + r_gdt[1] = (unsigned short) ((int) gdt & 0xffff); + r_gdt[2] = (unsigned short) ((int) gdt >> 16); lgdt(&r_gdt); - r_idt.rd_limit = sizeof(idt)-1; - r_idt.rd_base = (int) idt; + r_idt[0] = (unsigned short) (sizeof(idt) - 1); + r_idt[1] = (unsigned short) ((int) idt & 0xfffff); + r_idt[2] = (unsigned short) ((int) idt >> 16); lidt(&r_idt); lldt(GSEL(GLDT_SEL, SEL_KPL)); @@ -975,7 +982,7 @@ init386(first) ltr(_gsel_tss); /* make a call gate to reenter kernel with */ - gdp = &ldt[LSYS5CALLS_SEL].gd; + gdp = (struct gate_descriptor *) &ldt[LSYS5CALLS_SEL][0]; x = (int) &IDTVEC(syscall); gdp->gd_looffset = x++; diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index f0351a7ddf9e..076bad91c304 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -49,7 +49,7 @@ * 20 Apr 93 Bruce Evans New npx-0.5 code * 25 Apr 93 Bruce Evans New intr-0.1 code */ -static char rcsid[] = "$Header: /usr/src/sys.386bsd/i386/i386/RCS/machdep.c,v 1.2 92/01/21 14:22:09 william Exp Locker: root $"; +static char rcsid[] = "$Header: /home/cvs/386BSD/src/sys.386bsd/i386/i386/machdep.c,v 1.1.1.1 93/06/12 14:58:06 rgrimes Exp $"; #include @@ -85,6 +85,10 @@ extern vm_offset_t avail_end; #define EXPECT_BASEMEM 640 /* The expected base memory*/ #define INFORM_WAIT 1 /* Set to pause berfore crash in weird cases*/ +#if __GNUC__ >= 2 +__main(){} +#endif + /* * Declare these as initialized data so we can patch them. */ @@ -653,6 +657,7 @@ setregs(p, entry) /* * Initialize segments & interrupt table */ +#define DESCRIPTOR_SIZE 8 #define GNULL_SEL 0 /* Null Descriptor */ @@ -664,13 +669,13 @@ setregs(p, entry) #define GPROC0_SEL 6 /* Task state process slot zero and up */ #define NGDT GPROC0_SEL+1 -union descriptor gdt[GPROC0_SEL+1]; +unsigned char gdt[GPROC0_SEL+1][DESCRIPTOR_SIZE]; /* interrupt descriptor table */ struct gate_descriptor idt[NIDT]; /* local descriptor table */ -union descriptor ldt[5]; +unsigned char ldt[5][DESCRIPTOR_SIZE]; #define LSYS5CALLS_SEL 0 /* forced by intel BCS */ #define LSYS5SIGR_SEL 1 @@ -831,7 +836,7 @@ init386(first) struct gate_descriptor *gdp; extern int sigcode,szsigcode; /* table descriptors - used to load tables by microp */ - struct region_descriptor r_gdt, r_idt; + unsigned short r_gdt[3], r_idt[3]; int pagesinbase, pagesinext; @@ -845,12 +850,12 @@ init386(first) /* make gdt memory segments */ gdt_segs[GCODE_SEL].ssd_limit = btoc((int) &etext + NBPG); - for (x=0; x < NGDT; x++) ssdtosd(gdt_segs+x, gdt+x); + for (x=0; x < NGDT; x++) ssdtosd(gdt_segs+x, &gdt[x][0]); /* make ldt memory segments */ ldt_segs[LUCODE_SEL].ssd_limit = btoc(UPT_MIN_ADDRESS); ldt_segs[LUDATA_SEL].ssd_limit = btoc(UPT_MIN_ADDRESS); /* Note. eventually want private ldts per process */ - for (x=0; x < 5; x++) ssdtosd(ldt_segs+x, ldt+x); + for (x=0; x < 5; x++) ssdtosd(ldt_segs+x, &ldt[x][0]); /* exceptions */ setidt(0, &IDTVEC(div), SDT_SYS386TGT, SEL_KPL); @@ -891,11 +896,13 @@ init386(first) isa_defaultirq(); #endif - r_gdt.rd_limit = sizeof(gdt)-1; - r_gdt.rd_base = (int) gdt; + r_gdt[0] = (unsigned short) (sizeof(gdt) - 1); + r_gdt[1] = (unsigned short) ((int) gdt & 0xffff); + r_gdt[2] = (unsigned short) ((int) gdt >> 16); lgdt(&r_gdt); - r_idt.rd_limit = sizeof(idt)-1; - r_idt.rd_base = (int) idt; + r_idt[0] = (unsigned short) (sizeof(idt) - 1); + r_idt[1] = (unsigned short) ((int) idt & 0xfffff); + r_idt[2] = (unsigned short) ((int) idt >> 16); lidt(&r_idt); lldt(GSEL(GLDT_SEL, SEL_KPL)); @@ -975,7 +982,7 @@ init386(first) ltr(_gsel_tss); /* make a call gate to reenter kernel with */ - gdp = &ldt[LSYS5CALLS_SEL].gd; + gdp = (struct gate_descriptor *) &ldt[LSYS5CALLS_SEL][0]; x = (int) &IDTVEC(syscall); gdp->gd_looffset = x++; diff --git a/sys/i386/i386/math_emulate.c b/sys/i386/i386/math_emulate.c index faf55a452110..8d3cfcf9bf27 100644 --- a/sys/i386/i386/math_emulate.c +++ b/sys/i386/i386/math_emulate.c @@ -625,7 +625,7 @@ char * ea(struct trapframe * info, unsigned short code) I387.fos = 0x17; return (char *) offset; } - tmp = & (long)REG(rm); + tmp = (long *) ®(rm); switch (mod) { case 0: offset = 0; break; case 1: diff --git a/sys/i386/isa/icu.s b/sys/i386/isa/icu.s index 1b93c65ae4a9..5ec301598504 100644 --- a/sys/i386/isa/icu.s +++ b/sys/i386/isa/icu.s @@ -80,7 +80,7 @@ _cpl: .long 0xffff # current priority (all off) .globl _imen _imen: .long 0xffff # interrupt mask enable (all off) -# .globl _highmask +/* .globl _highmask */ _highmask: .long HIGHMASK .globl _ttymask _ttymask: .long 0 diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c index bbec45b5696c..1f3794cfb14e 100644 --- a/sys/i386/isa/wd.c +++ b/sys/i386/isa/wd.c @@ -154,12 +154,12 @@ struct isa_driver wddriver = { wdprobe, wdattach, "wd", }; -void wdustart(struct disk *); -void wdstart(); -int wdcommand(struct disk *, int); -int wdcontrol(struct buf *); -int wdsetctlr(dev_t, struct disk *); -int wdgetctlr(int, struct disk *); +static void wdustart(struct disk *); +static void wdstart(); +static int wdcommand(struct disk *, int); +static int wdcontrol(struct buf *); +static int wdsetctlr(dev_t, struct disk *); +static int wdgetctlr(int, struct disk *); /* * Probe for controller. @@ -423,7 +423,14 @@ wdstart() */ if ((du->dk_flags & (DKFL_SINGLE|DKFL_BADSECT)) /* 19 Aug 92*/ == (DKFL_SINGLE|DKFL_BADSECT)) - for (bt_ptr = du->dk_bad.bt_bad; bt_ptr->bt_cyl != -1; bt_ptr++) { + /* XXX + * BAD144END was done to clean up some old bad code that was + * attempting to compare a u_short to -1. This makes the compilers + * happy and clearly shows what is going on. + * rgrimes 93/06/17 + */ +#define BAD144END (u_short)(-1) + for (bt_ptr = du->dk_bad.bt_bad; bt_ptr->bt_cyl != BAD144END; bt_ptr++) { if (bt_ptr->bt_cyl > cylin) /* Sorted list, and we passed our cylinder. quit. */ break;