diff options
| author | Luoqi Chen <luoqi@FreeBSD.org> | 1999-04-28 01:04:33 +0000 |
|---|---|---|
| committer | Luoqi Chen <luoqi@FreeBSD.org> | 1999-04-28 01:04:33 +0000 |
| commit | 5206bca10a37e28de61458411f2a06b938eb6820 (patch) | |
| tree | 609612dddc7f4340495110d80a33a9c57e59f904 /sys/amd64/include | |
| parent | a261bdc7a29dc61986d710cfeafbbdfb2bea7c77 (diff) | |
Notes
Diffstat (limited to 'sys/amd64/include')
| -rw-r--r-- | sys/amd64/include/cpufunc.h | 34 | ||||
| -rw-r--r-- | sys/amd64/include/fpu.h | 6 | ||||
| -rw-r--r-- | sys/amd64/include/frame.h | 6 | ||||
| -rw-r--r-- | sys/amd64/include/md_var.h | 5 | ||||
| -rw-r--r-- | sys/amd64/include/mptable.h | 167 | ||||
| -rw-r--r-- | sys/amd64/include/npx.h | 6 | ||||
| -rw-r--r-- | sys/amd64/include/pcb.h | 8 | ||||
| -rw-r--r-- | sys/amd64/include/pcpu.h | 66 | ||||
| -rw-r--r-- | sys/amd64/include/proc.h | 4 | ||||
| -rw-r--r-- | sys/amd64/include/reg.h | 38 | ||||
| -rw-r--r-- | sys/amd64/include/segments.h | 25 | ||||
| -rw-r--r-- | sys/amd64/include/smp.h | 9 | ||||
| -rw-r--r-- | sys/amd64/include/tss.h | 11 |
13 files changed, 186 insertions, 199 deletions
diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h index ce6bf0589001..c1f9f17c8487 100644 --- a/sys/amd64/include/cpufunc.h +++ b/sys/amd64/include/cpufunc.h @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cpufunc.h,v 1.84 1999/01/08 19:51:02 bde Exp $ + * $Id: cpufunc.h,v 1.85 1999/01/09 13:00:27 bde Exp $ */ /* @@ -426,6 +426,34 @@ wrmsr(u_int msr, u_int64_t newval) __asm __volatile(".byte 0x0f, 0x30" : : "A" (newval), "c" (msr)); } +static __inline u_int +rfs(void) +{ + u_int sel; + __asm __volatile("movl %%fs,%0" : "=r" (sel)); + return (sel); +} + +static __inline u_int +rgs(void) +{ + u_int sel; + __asm __volatile("movl %%gs,%0" : "=r" (sel)); + return (sel); +} + +static __inline void +load_fs(u_int sel) +{ + __asm __volatile("movl %0,%%fs" : : "r" (sel)); +} + +static __inline void +load_gs(u_int sel) +{ + __asm __volatile("movl %0,%%gs" : : "r" (sel)); +} + #else /* !__GNUC__ */ int breakpoint __P((void)); @@ -456,6 +484,10 @@ void setbits __P((volatile u_int *addr, u_int bits)); void wbinvd __P((void)); void write_eflags __P((u_int ef)); void wrmsr __P((u_int msr, u_int64_t newval)); +u_int rfs __P((void)); +u_int rgs __P((void)); +void load_fs __P((u_int sel)); +void load_gs __P((u_int sel)); #endif /* __GNUC__ */ diff --git a/sys/amd64/include/fpu.h b/sys/amd64/include/fpu.h index a7608d5f7add..10384c6ebf9b 100644 --- a/sys/amd64/include/fpu.h +++ b/sys/amd64/include/fpu.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)npx.h 5.3 (Berkeley) 1/18/91 - * $Id: npx.h,v 1.13 1997/06/22 16:03:50 peter Exp $ + * $Id: npx.h,v 1.14 1997/07/20 11:06:44 bde Exp $ */ /* @@ -45,6 +45,8 @@ #ifndef _MACHINE_NPX_H_ #define _MACHINE_NPX_H_ +#include <machine/globals.h> + /* Environment information of floating point unit */ struct env87 { long en_cw; /* control word (16bits) */ @@ -135,7 +137,9 @@ struct save87 { #endif #ifdef KERNEL +#ifndef npxproc extern struct proc *npxproc; +#endif int npxdna __P((void)); void npxexit __P((struct proc *p)); diff --git a/sys/amd64/include/frame.h b/sys/amd64/include/frame.h index 05092c2c4c07..7d70c14dff64 100644 --- a/sys/amd64/include/frame.h +++ b/sys/amd64/include/frame.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)frame.h 5.2 (Berkeley) 1/18/91 - * $Id: frame.h,v 1.14 1997/02/22 09:34:38 peter Exp $ + * $Id: frame.h,v 1.15 1997/08/09 00:03:12 dyson Exp $ */ #ifndef _MACHINE_FRAME_H_ @@ -51,6 +51,7 @@ */ struct trapframe { + int tf_fs; int tf_es; int tf_ds; int tf_edi; @@ -75,6 +76,7 @@ struct trapframe { /* Superset of trap frame, for traps from virtual-8086 mode */ struct trapframe_vm86 { + int tf_fs; int tf_es; int tf_ds; int tf_edi; @@ -106,6 +108,7 @@ struct trapframe_vm86 { struct intrframe { int if_vec; int if_ppl; + int if_fs; int if_es; int if_ds; int if_edi; @@ -132,6 +135,7 @@ struct intrframe { struct clockframe { int cf_vec; int cf_ppl; + int cf_fs; int cf_es; int cf_ds; int cf_edi; diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h index fd7bcfd2c661..35b65455e244 100644 --- a/sys/amd64/include/md_var.h +++ b/sys/amd64/include/md_var.h @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: md_var.h,v 1.27 1998/10/30 05:41:15 msmith Exp $ + * $Id: md_var.h,v 1.28 1999/01/08 16:29:58 bde Exp $ */ #ifndef _MACHINE_MD_VAR_H_ @@ -69,7 +69,6 @@ void bcopyb __P((const void *from, void *to, size_t len)); void busdma_swi __P((void)); void cpu_halt __P((void)); void cpu_reset __P((void)); -void cpu_switch_load_fs __P((void)) __asm(__STRING(cpu_switch_load_fs)); void cpu_switch_load_gs __P((void)) __asm(__STRING(cpu_switch_load_gs)); void doreti_iret __P((void)) __asm(__STRING(doreti_iret)); void doreti_iret_fault __P((void)) __asm(__STRING(doreti_iret_fault)); @@ -77,6 +76,8 @@ void doreti_popl_ds __P((void)) __asm(__STRING(doreti_popl_ds)); void doreti_popl_ds_fault __P((void)) __asm(__STRING(doreti_popl_ds_fault)); void doreti_popl_es __P((void)) __asm(__STRING(doreti_popl_es)); void doreti_popl_es_fault __P((void)) __asm(__STRING(doreti_popl_es_fault)); +void doreti_popl_fs __P((void)) __asm(__STRING(doreti_popl_fs)); +void doreti_popl_fs_fault __P((void)) __asm(__STRING(doreti_popl_fs_fault)); int fill_fpregs __P((struct proc *, struct fpreg *)); int fill_regs __P((struct proc *p, struct reg *regs)); void fillw __P((int /*u_short*/ pat, void *base, size_t cnt)); diff --git a/sys/amd64/include/mptable.h b/sys/amd64/include/mptable.h index eca2601a70b2..dcca437e8a10 100644 --- a/sys/amd64/include/mptable.h +++ b/sys/amd64/include/mptable.h @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mp_machdep.c,v 1.96 1999/04/11 00:43:43 tegge Exp $ + * $Id: mp_machdep.c,v 1.97 1999/04/13 03:24:47 tegge Exp $ */ #include "opt_smp.h" @@ -297,28 +297,15 @@ int apic_id_to_logical[NAPICID]; /* Bitmap of all available CPUs */ u_int all_cpus; -/* AP uses this PTD during bootstrap. Do not staticize. */ -pd_entry_t *bootPTD; +/* AP uses this during bootstrap. Do not staticize. */ +char *bootSTK; +int boot_cpuid; /* Hotwire a 0->4MB V==P mapping */ extern pt_entry_t *KPTphys; -/* Virtual address of per-cpu common_tss */ -extern struct i386tss common_tss; -#ifdef VM86 -extern struct segment_descriptor common_tssd; -extern u_int private_tss; /* flag indicating private tss */ -extern u_int my_tr; -#endif /* VM86 */ - -/* IdlePTD per cpu */ -pd_entry_t *IdlePTDS[NCPU]; - -/* "my" private page table page, for BSP init */ -extern pt_entry_t SMP_prvpt[]; - -/* Private page pointer to curcpu's PTD, used during BSP init */ -extern pd_entry_t *my_idlePTD; +/* SMP page table page */ +extern pt_entry_t *SMPpt; struct pcb stoppcbs[NCPU]; @@ -466,41 +453,42 @@ void init_secondary(void) { int gsel_tss; -#ifndef VM86 - u_int my_tr; -#endif + int x, myid = boot_cpuid; + + gdt_segs[GPRIV_SEL].ssd_base = (int) &SMP_prvspace[myid]; + gdt_segs[GPROC0_SEL].ssd_base = + (int) &SMP_prvspace[myid].globaldata.gd_common_tss; + SMP_prvspace[myid].globaldata.gd_prvspace = &SMP_prvspace[myid]; - r_gdt.rd_limit = sizeof(gdt[0]) * (NGDT + NCPU) - 1; - r_gdt.rd_base = (int) gdt; + for (x = 0; x < NGDT; x++) { + ssdtosd(&gdt_segs[x], &gdt[myid * NGDT + x].sd); + } + + r_gdt.rd_limit = NGDT * sizeof(gdt[0]) - 1; + r_gdt.rd_base = (int) &gdt[myid * NGDT]; lgdt(&r_gdt); /* does magic intra-segment return */ + lidt(&r_idt); + lldt(_default_ldt); #ifdef USER_LDT currentldt = _default_ldt; #endif - my_tr = NGDT + cpuid; - gsel_tss = GSEL(my_tr, SEL_KPL); - gdt[my_tr].sd.sd_type = SDT_SYS386TSS; + gsel_tss = GSEL(GPROC0_SEL, SEL_KPL); + gdt[myid * NGDT + GPROC0_SEL].sd.sd_type = SDT_SYS386TSS; common_tss.tss_esp0 = 0; /* not used until after switch */ common_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL); common_tss.tss_ioopt = (sizeof common_tss) << 16; #ifdef VM86 - common_tssd = gdt[my_tr].sd; - private_tss = 0; -#endif /* VM86 */ + common_tssd = gdt[myid * NGDT + GPROC0_SEL].sd; +#endif ltr(gsel_tss); load_cr0(0x8005003b); /* XXX! */ - PTD[0] = 0; pmap_set_opt((unsigned *)PTD); -#if 0 - putmtrr(); - pmap_setvidram(); -#endif - invltlb(); } @@ -558,11 +546,6 @@ mp_enable(u_int boot_addr) u_int ux; #endif /* APIC_IO */ -#if 0 - getmtrr(); - pmap_setvidram(); -#endif - POSTCODE(MP_ENABLE_POST); /* turn on 4MB of V == P addressing so we can get to MP table */ @@ -1770,14 +1753,11 @@ extern int wait_ap(unsigned int); static int start_all_aps(u_int boot_addr) { - int x, i; + int x, i, pg; u_char mpbiosreason; u_long mpbioswarmvec; - pd_entry_t *newptd; - pt_entry_t *newpt; struct globaldata *gd; char *stack; - pd_entry_t *myPTD; POSTCODE(START_ALL_APS_POST); @@ -1799,70 +1779,46 @@ start_all_aps(u_int boot_addr) /* record BSP in CPU map */ all_cpus = 1; + /* set up 0 -> 4MB P==V mapping for AP boot */ + *(int *)PTD = PG_V | PG_RW | ((uintptr_t)(void *)KPTphys & PG_FRAME); + invltlb(); + /* start each AP */ for (x = 1; x <= mp_naps; ++x) { /* This is a bit verbose, it will go away soon. */ - /* alloc new page table directory */ - newptd = (pd_entry_t *)(kmem_alloc(kernel_map, PAGE_SIZE)); - - /* Store the virtual PTD address for this CPU */ - IdlePTDS[x] = newptd; - - /* clone currently active one (ie: IdlePTD) */ - bcopy(PTD, newptd, PAGE_SIZE); /* inc prv page pde */ - - /* set up 0 -> 4MB P==V mapping for AP boot */ - newptd[0] = (void *)(uintptr_t)(PG_V | PG_RW | - ((uintptr_t)(void *)KPTphys & PG_FRAME)); - - /* store PTD for this AP's boot sequence */ - myPTD = (pd_entry_t *)vtophys(newptd); - - /* alloc new page table page */ - newpt = (pt_entry_t *)(kmem_alloc(kernel_map, PAGE_SIZE)); - - /* set the new PTD's private page to point there */ - newptd[MPPTDI] = (pt_entry_t)(PG_V | PG_RW | vtophys(newpt)); - - /* install self referential entry */ - newptd[PTDPTDI] = (pd_entry_t)(PG_V | PG_RW | vtophys(newptd)); + /* first page of AP's private space */ + pg = x * i386_btop(sizeof(struct privatespace)); /* allocate a new private data page */ gd = (struct globaldata *)kmem_alloc(kernel_map, PAGE_SIZE); /* wire it into the private page table page */ - newpt[0] = (pt_entry_t)(PG_V | PG_RW | vtophys(gd)); - - /* wire the ptp into itself for access */ - newpt[1] = (pt_entry_t)(PG_V | PG_RW | vtophys(newpt)); - - /* copy in the pointer to the local apic */ - newpt[2] = SMP_prvpt[2]; - - /* and the IO apic mapping[s] */ - for (i = 16; i < 32; i++) - newpt[i] = SMP_prvpt[i]; + SMPpt[pg] = (pt_entry_t)(PG_V | PG_RW | vtophys(gd)); /* allocate and set up an idle stack data page */ stack = (char *)kmem_alloc(kernel_map, UPAGES*PAGE_SIZE); for (i = 0; i < UPAGES; i++) - newpt[i + 3] = (pt_entry_t)(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack)); + SMPpt[pg + 5 + i] = (pt_entry_t) + (PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack)); - newpt[3 + UPAGES] = 0; /* *prv_CMAP1 */ - newpt[4 + UPAGES] = 0; /* *prv_CMAP2 */ - newpt[5 + UPAGES] = 0; /* *prv_CMAP3 */ - newpt[6 + UPAGES] = 0; /* *prv_PMAP1 */ + SMPpt[pg + 1] = 0; /* *prv_CMAP1 */ + SMPpt[pg + 2] = 0; /* *prv_CMAP2 */ + SMPpt[pg + 3] = 0; /* *prv_CMAP3 */ + SMPpt[pg + 4] = 0; /* *prv_PMAP1 */ /* prime data page for it to use */ - gd->cpuid = x; - gd->cpu_lockid = x << 24; - gd->my_idlePTD = myPTD; - gd->prv_CMAP1 = &newpt[3 + UPAGES]; - gd->prv_CMAP2 = &newpt[4 + UPAGES]; - gd->prv_CMAP3 = &newpt[5 + UPAGES]; - gd->prv_PMAP1 = &newpt[6 + UPAGES]; + gd->gd_cpuid = x; + gd->gd_cpu_lockid = x << 24; + gd->gd_prv_CMAP1 = &SMPpt[pg + 1]; + gd->gd_prv_CMAP2 = &SMPpt[pg + 2]; + gd->gd_prv_CMAP3 = &SMPpt[pg + 3]; + gd->gd_prv_PMAP1 = &SMPpt[pg + 4]; + gd->gd_prv_CADDR1 = SMP_prvspace[x].CPAGE1; + gd->gd_prv_CADDR2 = SMP_prvspace[x].CPAGE2; + gd->gd_prv_CADDR3 = SMP_prvspace[x].CPAGE3; + gd->gd_prv_PADDR1 = (unsigned *)SMP_prvspace[x].PPAGE1; /* setup a vector to our boot code */ *((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET; @@ -1872,7 +1828,9 @@ start_all_aps(u_int boot_addr) outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */ #endif - bootPTD = myPTD; + bootSTK = &SMP_prvspace[x].idlestack[UPAGES*PAGE_SIZE]; + boot_cpuid = x; + /* attempt to start the Application Processor */ CHECK_INIT(99); /* setup checkpoints */ if (!start_ap(x, boot_addr)) { @@ -1910,27 +1868,16 @@ start_all_aps(u_int boot_addr) * because the BSP is cpu#0 and the page is initially zero, and also * because we can refer to variables by name on the BSP.. */ - newptd = (pd_entry_t *)(kmem_alloc(kernel_map, PAGE_SIZE)); - - bcopy(PTD, newptd, PAGE_SIZE); /* inc prv page pde */ - IdlePTDS[0] = newptd; - - /* Point PTD[] to this page instead of IdlePTD's physical page */ - newptd[PTDPTDI] = (pd_entry_t)(PG_V | PG_RW | vtophys(newptd)); - - my_idlePTD = (pd_entry_t *)vtophys(newptd); /* Allocate and setup BSP idle stack */ stack = (char *)kmem_alloc(kernel_map, UPAGES * PAGE_SIZE); for (i = 0; i < UPAGES; i++) - SMP_prvpt[i + 3] = (pt_entry_t)(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack)); + SMPpt[5 + i] = (pt_entry_t) + (PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack)); + *(int *)PTD = 0; pmap_set_opt_bsp(); - for (i = 0; i < mp_ncpus; i++) { - bcopy( (int *) PTD + KPTDI, (int *) IdlePTDS[i] + KPTDI, NKPDE * sizeof (int)); - } - /* number of APs actually started */ return mp_ncpus - 1; } @@ -2250,10 +2197,6 @@ ap_init() panic("cpuid mismatch! boom!!"); } -#if 0 - getmtrr(); -#endif - /* Init local apic for irq's */ apic_initialize(); @@ -2267,8 +2210,6 @@ ap_init() smp_started = 1; /* enable IPI's, tlb shootdown, freezes etc */ smp_active = 1; /* historic */ } - - curproc = NULL; /* make sure */ } #ifdef BETTER_CLOCK diff --git a/sys/amd64/include/npx.h b/sys/amd64/include/npx.h index a7608d5f7add..10384c6ebf9b 100644 --- a/sys/amd64/include/npx.h +++ b/sys/amd64/include/npx.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)npx.h 5.3 (Berkeley) 1/18/91 - * $Id: npx.h,v 1.13 1997/06/22 16:03:50 peter Exp $ + * $Id: npx.h,v 1.14 1997/07/20 11:06:44 bde Exp $ */ /* @@ -45,6 +45,8 @@ #ifndef _MACHINE_NPX_H_ #define _MACHINE_NPX_H_ +#include <machine/globals.h> + /* Environment information of floating point unit */ struct env87 { long en_cw; /* control word (16bits) */ @@ -135,7 +137,9 @@ struct save87 { #endif #ifdef KERNEL +#ifndef npxproc extern struct proc *npxproc; +#endif int npxdna __P((void)); void npxexit __P((struct proc *p)); diff --git a/sys/amd64/include/pcb.h b/sys/amd64/include/pcb.h index d76217ff3b8e..9ab0856137a7 100644 --- a/sys/amd64/include/pcb.h +++ b/sys/amd64/include/pcb.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)pcb.h 5.10 (Berkeley) 5/12/91 - * $Id: pcb.h,v 1.25 1997/10/10 12:40:09 peter Exp $ + * $Id: pcb.h,v 1.26 1998/02/03 21:27:50 bde Exp $ */ #ifndef _I386_PCB_H_ @@ -43,6 +43,7 @@ /* * Intel 386 process control block */ +#include <machine/globals.h> #include <machine/npx.h> struct pcb { @@ -64,14 +65,13 @@ struct pcb { #else u_long pcb_mpnest_dontuse; #endif - int pcb_fs; int pcb_gs; #ifdef VM86 struct pcb_ext *pcb_ext; /* optional pcb extension */ #else struct pcb_ext *pcb_ext_dontuse; #endif - u_long __pcb_spare[1]; /* adjust to avoid core dump size changes */ + u_long __pcb_spare[2]; /* adjust to avoid core dump size changes */ }; /* @@ -83,7 +83,9 @@ struct md_coredump { #ifdef KERNEL +#ifndef curpcb extern struct pcb *curpcb; /* our current running pcb */ +#endif void savectx __P((struct pcb *)); #endif diff --git a/sys/amd64/include/pcpu.h b/sys/amd64/include/pcpu.h index ec5879940ecd..f1d4fdd0ffa1 100644 --- a/sys/amd64/include/pcpu.h +++ b/sys/amd64/include/pcpu.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: globaldata.h,v 1.6 1998/08/18 07:47:12 msmith Exp $ + * $Id: globaldata.h,v 1.7 1999/02/22 15:13:34 bde Exp $ */ /* @@ -39,31 +39,33 @@ * other processors" */ struct globaldata { - struct proc *curproc; - struct proc *npxproc; - struct pcb *curpcb; - struct i386tss common_tss; - struct timeval switchtime; - int switchticks; + struct privatespace *gd_prvspace; /* self-reference */ + struct proc *gd_curproc; + struct proc *gd_npxproc; + struct pcb *gd_curpcb; + struct timeval gd_switchtime; + struct i386tss gd_common_tss; + int gd_switchticks; #ifdef VM86 - struct segment_descriptor common_tssd; - u_int private_tss; - u_int my_tr; + struct segment_descriptor gd_common_tssd; #endif #ifdef USER_LDT - int currentldt; + int gd_currentldt; #endif #ifdef SMP - u_int cpuid; - u_int cpu_lockid; - u_int other_cpus; - pd_entry_t *my_idlePTD; - u_int ss_eflags; - pt_entry_t *prv_CMAP1; - pt_entry_t *prv_CMAP2; - pt_entry_t *prv_CMAP3; - pt_entry_t *prv_PMAP1; - int inside_intr; + u_int gd_cpuid; + u_int gd_cpu_lockid; + u_int gd_other_cpus; + int gd_inside_intr; + u_int gd_ss_eflags; + pt_entry_t *gd_prv_CMAP1; + pt_entry_t *gd_prv_CMAP2; + pt_entry_t *gd_prv_CMAP3; + pt_entry_t *gd_prv_PMAP1; + caddr_t gd_prv_CADDR1; + caddr_t gd_prv_CADDR2; + caddr_t gd_prv_CADDR3; + unsigned *gd_prv_PADDR1; #endif }; @@ -78,28 +80,16 @@ struct privatespace { struct globaldata globaldata; char __filler0[PAGE_SIZE - sizeof(struct globaldata)]; - /* page 1 - page table page */ - pt_entry_t prvpt[NPTEPG]; - - /* page 2 - local apic mapping */ - lapic_t lapic; - char __filler1[PAGE_SIZE - sizeof(lapic_t)]; - - /* page 3..2+UPAGES - idle stack (UPAGES pages) */ - char idlestack[UPAGES * PAGE_SIZE]; - - /* page 3+UPAGES..6+UPAGES - CPAGE1,CPAGE2,CPAGE3,PPAGE1 */ + /* page 1..4 - CPAGE1,CPAGE2,CPAGE3,PPAGE1 */ char CPAGE1[PAGE_SIZE]; char CPAGE2[PAGE_SIZE]; char CPAGE3[PAGE_SIZE]; char PPAGE1[PAGE_SIZE]; - /* page 7+UPAGES..15 - spare, unmapped */ - char __filler2[(9-UPAGES) * PAGE_SIZE]; + /* page 5..4+UPAGES - idle stack (UPAGES pages) */ + char idlestack[UPAGES * PAGE_SIZE]; +}; - /* page 16-31 - space for IO apics */ - char ioapics[16 * PAGE_SIZE]; +extern struct privatespace SMP_prvspace[]; - /* page 32-47 - maybe other cpu's globaldata pages? */ -}; #endif diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h index e7a4744a03b5..ae6cd6337bc3 100644 --- a/sys/amd64/include/proc.h +++ b/sys/amd64/include/proc.h @@ -31,12 +31,14 @@ * SUCH DAMAGE. * * from: @(#)proc.h 7.1 (Berkeley) 5/15/91 - * $Id: proc.h,v 1.7 1997/02/22 09:34:59 peter Exp $ + * $Id: proc.h,v 1.8 1997/05/07 19:55:13 peter Exp $ */ #ifndef _MACHINE_PROC_H_ #define _MACHINE_PROC_H_ +#include <machine/globals.h> + /* * Machine-dependent part of the proc structure for i386. */ diff --git a/sys/amd64/include/reg.h b/sys/amd64/include/reg.h index 28466a838bc8..247011646fa5 100644 --- a/sys/amd64/include/reg.h +++ b/sys/amd64/include/reg.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)reg.h 5.5 (Berkeley) 1/18/91 - * $Id: reg.h,v 1.16 1998/09/14 22:43:40 jdp Exp $ + * $Id: reg.h,v 1.17 1999/04/03 22:19:59 jdp Exp $ */ #ifndef _MACHINE_REG_H_ @@ -51,22 +51,23 @@ * stopped accessing the registers in the trap frame via PT_{READ,WRITE}_U * and we can stop supporting the user area soon. */ -#define tES (0) -#define tDS (1) -#define tEDI (2) -#define tESI (3) -#define tEBP (4) -#define tISP (5) -#define tEBX (6) -#define tEDX (7) -#define tECX (8) -#define tEAX (9) -#define tERR (11) -#define tEIP (12) -#define tCS (13) -#define tEFLAGS (14) -#define tESP (15) -#define tSS (16) +#define tFS (0) +#define tES (1) +#define tDS (2) +#define tEDI (3) +#define tESI (4) +#define tEBP (5) +#define tISP (6) +#define tEBX (7) +#define tEDX (8) +#define tECX (9) +#define tEAX (10) +#define tERR (12) +#define tEIP (13) +#define tCS (14) +#define tEFLAGS (15) +#define tESP (16) +#define tSS (17) /* * Indices for registers in `struct regs' only. @@ -75,13 +76,13 @@ * other registers in application interfaces that copy all the registers * to or from a `struct regs'. */ -#define tFS (17) #define tGS (18) /* * Register set accessible via /proc/$pid/regs and PT_{SET,GET}REGS. */ struct reg { + unsigned int r_fs; unsigned int r_es; unsigned int r_ds; unsigned int r_edi; @@ -99,7 +100,6 @@ struct reg { unsigned int r_eflags; unsigned int r_esp; unsigned int r_ss; - unsigned int r_fs; unsigned int r_gs; }; diff --git a/sys/amd64/include/segments.h b/sys/amd64/include/segments.h index 674b0f38c28e..eaecfa322c5f 100644 --- a/sys/amd64/include/segments.h +++ b/sys/amd64/include/segments.h @@ -35,12 +35,14 @@ * SUCH DAMAGE. * * from: @(#)segments.h 7.1 (Berkeley) 5/9/91 - * $Id: segments.h,v 1.17 1997/08/21 06:32:49 charnier Exp $ + * $Id: segments.h,v 1.18 1999/01/28 11:45:49 newton Exp $ */ #ifndef _MACHINE_SEGMENTS_H_ #define _MACHINE_SEGMENTS_H_ +#include <machine/globals.h> + /* * 386 Segmentation Data Structures and definitions * William F. Jolitz (william@ernie.berkeley.edu) 6/20/1989 @@ -207,19 +209,20 @@ struct region_descriptor { #define GNULL_SEL 0 /* Null Descriptor */ #define GCODE_SEL 1 /* Kernel Code Descriptor */ #define GDATA_SEL 2 /* Kernel Data Descriptor */ -#define GLDT_SEL 3 /* LDT - eventually one per process */ -#define GTGATE_SEL 4 /* Process task switch gate */ -#define GPANIC_SEL 5 /* Task state to consider panic from */ -#define GPROC0_SEL 6 /* Task state process slot zero and up */ -#define GUSERLDT_SEL 7 /* User LDT */ -#define GAPMCODE32_SEL 8 /* APM BIOS 32-bit interface (32bit Code) */ -#define GAPMCODE16_SEL 9 /* APM BIOS 32-bit interface (16bit Code) */ -#define GAPMDATA_SEL 10 /* APM BIOS 32-bit interface (Data) */ +#define GPRIV_SEL 3 /* SMP Per-Processor Private Data */ +#define GPROC0_SEL 4 /* Task state process slot zero and up */ +#define GLDT_SEL 5 /* LDT - eventually one per process */ +#define GUSERLDT_SEL 6 /* User LDT */ +#define GTGATE_SEL 7 /* Process task switch gate */ +#define GPANIC_SEL 8 /* Task state to consider panic from */ +#define GAPMCODE32_SEL 9 /* APM BIOS 32-bit interface (32bit Code) */ +#define GAPMCODE16_SEL 10 /* APM BIOS 32-bit interface (16bit Code) */ +#define GAPMDATA_SEL 11 /* APM BIOS 32-bit interface (Data) */ #ifdef BDE_DEBUGGER #define NGDT 18 /* some of 11-17 are reserved for debugger */ #else -#define NGDT (GAPMDATA_SEL + 1) +#define NGDT 12 #endif /* @@ -237,7 +240,9 @@ struct region_descriptor { #define NLDT (LBSDICALLS_SEL + 1) #ifdef KERNEL +#ifndef currentldt extern int currentldt; +#endif extern int _default_ldt; extern union descriptor gdt[]; extern struct soft_segment_descriptor gdt_segs[]; diff --git a/sys/amd64/include/smp.h b/sys/amd64/include/smp.h index 0f4f915366b6..3750c72011eb 100644 --- a/sys/amd64/include/smp.h +++ b/sys/amd64/include/smp.h @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: smp.h,v 1.43 1998/05/17 22:12:05 tegge Exp $ + * $Id: smp.h,v 1.44 1998/09/06 22:41:40 tegge Exp $ * */ @@ -112,7 +112,6 @@ struct apic_intmapinfo { }; extern struct apic_intmapinfo int_to_apicintpin[]; extern u_int all_cpus; -extern u_char SMP_ioapic[]; extern struct pcb stoppcbs[]; /* functions in mp_machdep.c */ @@ -175,12 +174,6 @@ extern int invltlb_ok; extern int smp_active; extern volatile int smp_idle_loops; -/* 'private' global data in locore.s */ -extern volatile u_int cpuid; -extern volatile u_int cpu_lockid; -extern int inside_intr; -extern volatile u_int other_cpus; - #endif /* !LOCORE */ #endif /* SMP || APIC_IO */ #endif /* KERNEL */ diff --git a/sys/amd64/include/tss.h b/sys/amd64/include/tss.h index 565defab8cb7..636133a9a870 100644 --- a/sys/amd64/include/tss.h +++ b/sys/amd64/include/tss.h @@ -34,12 +34,14 @@ * SUCH DAMAGE. * * from: @(#)tss.h 5.4 (Berkeley) 1/18/91 - * $Id$ + * $Id: tss.h,v 1.8 1997/02/22 09:35:20 peter Exp $ */ #ifndef _MACHINE_TSS_H_ #define _MACHINE_TSS_H_ 1 +#include <machine/globals.h> + /* * Intel 386 Context Data Type */ @@ -79,4 +81,11 @@ struct i386tss { int tss_ioopt; /* options & io offset bitmap: currently zero */ /* XXX unimplemented .. i/o permission bitmap */ }; + +#ifdef KERNEL +#ifndef common_tss +extern struct i386tss common_tss; +#endif +#endif + #endif /* _MACHINE_TSS_H_ */ |
