From owner-cvs-sys Fri Dec 5 21:01:21 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id VAA17589 for cvs-sys-outgoing; Fri, 5 Dec 1997 21:01:21 -0800 (PST) (envelope-from owner-cvs-sys) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id VAA17572; Fri, 5 Dec 1997 21:01:02 -0800 (PST) (envelope-from bde@zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.7/8.6.9) id PAA30883; Sat, 6 Dec 1997 15:56:53 +1100 Date: Sat, 6 Dec 1997 15:56:53 +1100 From: Bruce Evans Message-Id: <199712060456.PAA30883@godzilla.zeta.org.au> To: jkh@FreeBSD.ORG, Studded@dal.net Subject: Re: cvs commit: src/sys/i386/i386 identcpu.c machdep.c trap.c Cc: cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, cvs-sys@FreeBSD.ORG Sender: owner-cvs-sys@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >> jkh 1997/12/04 06:36:58 PST >> >> Modified files: (Branch: RELENG_2_2) >> sys/i386/i386 identcpu.c machdep.c trap.c >> Log: >> MFC: F00F cleanup. >> >> Revision Changes Path >> 1.7.2.12 +3 -3 src/sys/i386/i386/identcpu.c >> 1.209.2.16 +4 -4 src/sys/i386/i386/machdep.c >> 1.83.2.4 +5 -5 src/sys/i386/i386/trap.c > > I'm still getting the errors in the first attachment when compiling the >kernel with -Wall on 2.2.5-Stable. Even if it's not compiled with -Wall, >it's still giving errors, which people on -questions have asked about >already. Given that this is supposed to be a "bug fix" I think it >behooves us to make at least machdep.c compile clean. I realize that >these errors probably are not significant, and if I could fix them I >would. I fixed the warnings and style bugs but am not ready to commit anything yet (the new idt can be allocated better...). >cc -c -O -Wall -pipe -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -nostdinc -I- -I. -I../.. -I../../../include -DCOMPAT_43 -DMSDOSFS -DFFS -DINET -DKERNEL ../../i386/i38 >6/machdep.c >../../i386/i386/machdep.c: In function `cpu_startup': >../../i386/i386/machdep.c:231: warning: long unsigned int format, unsigned int arg (arg 2) >../../i386/i386/machdep.c:231: warning: long unsigned int format, unsigned int arg (arg 3) Don't use -Wall unless you want to work on fixing the small problems it exposes. Bruce diff -c2 machdep.c~ machdep.c *** machdep.c~ Fri Dec 5 16:10:32 1997 --- machdep.c Sat Dec 6 15:34:39 1997 *************** *** 1537,1575 **** proc0.p_addr->u_pcb.pcb_flags = 0; proc0.p_addr->u_pcb.pcb_cr3 = (int)IdlePTD; proc0.p_addr->u_pcb.pcb_mpnest = 1; proc0.p_addr->u_pcb.pcb_ext = 0; } #if defined(I586_CPU) && !defined(NO_F00F_HACK) ! void f00f_hack(void); ! SYSINIT(f00f_hack, SI_SUB_INTRINSIC, SI_ORDER_FIRST, f00f_hack, NULL); void ! f00f_hack(void) { struct region_descriptor r_idt; ! unsigned char *tmp; ! int i; if (!has_f00f_bug) return; ! ! printf("Intel Pentium F00F detected, installing workaround\n"); ! ! r_idt.rd_limit = sizeof(idt) - 1; ! tmp = kmem_alloc(kernel_map, PAGE_SIZE * 2); if (tmp == 0) panic("kmem_alloc returned 0"); ! if (((unsigned int)tmp & (PAGE_SIZE-1)) != 0) ! panic("kmem_alloc returned non-page-aligned memory"); ! /* Put the first seven entries in the lower page */ ! t_idt = (struct gate_descriptor*)(tmp + PAGE_SIZE - (7*8)); bcopy(idt, t_idt, sizeof(idt)); ! r_idt.rd_base = (int)t_idt; ! lidt(&r_idt); ! if (vm_map_protect(kernel_map, tmp, tmp + PAGE_SIZE, ! VM_PROT_READ, FALSE) != KERN_SUCCESS) panic("vm_map_protect failed"); ! return; } #endif /* defined(I586_CPU) && !NO_F00F_HACK */ --- 1595,1635 ---- proc0.p_addr->u_pcb.pcb_flags = 0; proc0.p_addr->u_pcb.pcb_cr3 = (int)IdlePTD; + #ifdef SMP proc0.p_addr->u_pcb.pcb_mpnest = 1; + #endif + #ifdef VM86 proc0.p_addr->u_pcb.pcb_ext = 0; + #endif } #if defined(I586_CPU) && !defined(NO_F00F_HACK) ! static void f00f_hack __P((void *unused)); ! SYSINIT(f00f_hack, SI_SUB_INTRINSIC, SI_ORDER_FIRST, f00f_hack, NULL) void ! f00f_hack(unused) ! void *unused; ! { struct region_descriptor r_idt; ! vm_offset_t tmp; if (!has_f00f_bug) return; ! printf("Intel Pentium detected, installing workaround for F00F bug\n"); tmp = kmem_alloc(kernel_map, PAGE_SIZE * 2); if (tmp == 0) panic("kmem_alloc returned 0"); ! ! /* Put the problematic entry (#6) at the end of the lower page. */ ! t_idt = (struct gate_descriptor *) ! (tmp + PAGE_SIZE - 7 * sizeof(struct gate_descriptor)); ! bcopy(idt, t_idt, sizeof(idt)); ! if (vm_map_protect(kernel_map, tmp, tmp + PAGE_SIZE, VM_PROT_READ, ! FALSE) != KERN_SUCCESS) panic("vm_map_protect failed"); ! r_idt.rd_limit = sizeof(idt) - 1; ! r_idt.rd_base = (unsigned)t_idt; ! lidt(&r_idt); } #endif /* defined(I586_CPU) && !NO_F00F_HACK */