diff options
Diffstat (limited to 'sys/amd64/amd64/machdep.c')
-rw-r--r-- | sys/amd64/amd64/machdep.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index f4d019a..2c916ac 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -240,6 +240,7 @@ vm_offset_t phys_avail[10]; static vm_offset_t buffer_sva, buffer_eva; vm_offset_t clean_sva, clean_eva; static vm_offset_t pager_sva, pager_eva; +static struct trapframe proc0_tf; #define offsetof(type, member) ((size_t)(&((type *)0)->member)) @@ -434,6 +435,7 @@ again: mp_start(); /* fire up the APs and APICs */ mp_announce(); #endif /* SMP */ + cpu_setregs(); } int @@ -1077,6 +1079,22 @@ setregs(p, entry, stack, ps_strings) p->p_retval[1] = 0; } +void +cpu_setregs(void) +{ + unsigned int cr0; + + cr0 = rcr0(); + cr0 |= CR0_NE; /* Done by npxinit() */ + cr0 |= CR0_MP | CR0_TS; /* Done at every execve() too. */ +#ifdef I386_CPU + if (cpu_class != CPUCLASS_386) +#endif + cr0 |= CR0_WP | CR0_AM; + load_cr0(cr0); + load_gs(_udatasel); +} + static int sysctl_machdep_adjkerntz(SYSCTL_HANDLER_ARGS) { @@ -1981,6 +1999,7 @@ init386(first) proc0.p_addr->u_pcb.pcb_mpnest = 1; #endif proc0.p_addr->u_pcb.pcb_ext = 0; + proc0.p_md.md_regs = &proc0_tf; } #if defined(I586_CPU) && !defined(NO_F00F_HACK) |