Date: Sun, 16 Nov 2003 14:42:09 -0800 (PST) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 42590 for review Message-ID: <200311162242.hAGMg9R3025909@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=42590 Change 42590 by peter@peter_overcee on 2003/11/16 14:41:46 tidy up some #if's. Note that I'm not using aliased gdt[] tables for each cpu. The 'ltr' instuction (which we do only once on amd64) initiates a one-time copy from the selector to the hidden task register. We do not need to preserve the GPROC0_SEL entry after the ltr finishes. We only need to make sure that each cpu points to its own tss struct for its own tss_rsp0 value. Affected files ... .. //depot/projects/hammer/sys/amd64/amd64/mp_machdep.c#36 edit Differences ... ==== //depot/projects/hammer/sys/amd64/amd64/mp_machdep.c#36 (text+ko) ==== @@ -310,13 +310,9 @@ void init_secondary(void) { + struct pcpu *pc; + u_int64_t msr, cr0; int cpu, gsel_tss; - u_int64_t msr; -#if 1 - int x; -#endif - u_int64_t cr0; - struct pcpu *pc; /* Set by the startup code for us to use */ cpu = bootAP; @@ -326,19 +322,8 @@ common_tss[cpu].tss_rsp0 = 0; /* not used until after switch */ gdt_segs[GPROC0_SEL].ssd_base = (long) &common_tss[cpu]; - -#if 1 - for (x = 0; x < NGDT; x++) - if (x != GPROC0_SEL && x != (GPROC0_SEL + 1)) - ssdtosd(&gdt_segs[x], &gdt[cpu * NGDT + x]); -#endif ssdtosyssd(&gdt_segs[GPROC0_SEL], - (struct system_segment_descriptor *)&gdt[cpu * NGDT + GPROC0_SEL]); - -#if 1 - r_gdt.rd_limit = NGDT * sizeof(gdt[0]) - 1; - r_gdt.rd_base = (long) &gdt[cpu * NGDT]; -#endif + (struct system_segment_descriptor *)&gdt[GPROC0_SEL]); lgdt(&r_gdt); /* does magic intra-segment return */ @@ -355,15 +340,10 @@ wrmsr(MSR_FSBASE, 0); /* User value */ wrmsr(MSR_GSBASE, (u_int64_t)pc); - wrmsr(MSR_KGSBASE, (u_int64_t)pc); /* User value while we're in the kernel */ + wrmsr(MSR_KGSBASE, (u_int64_t)pc); /* XXX User value while we're in the kernel */ lidt(&r_idt); -#if 1 - /* Every 'ltr' changes the type from SDT_SYSTSS to SDT_SYSBSY */ - ((struct system_segment_descriptor *)&gdt[cpu * NGDT + GPROC0_SEL])->sd_type = SDT_SYSTSS; -#endif - gsel_tss = GSEL(GPROC0_SEL, SEL_KPL); ltr(gsel_tss);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311162242.hAGMg9R3025909>