diff options
Diffstat (limited to 'i386')
-rw-r--r-- | i386/i386/db_trace.c | 4 | ||||
-rw-r--r-- | i386/i386/fpu.c | 2 | ||||
-rw-r--r-- | i386/i386/locore.S | 14 | ||||
-rw-r--r-- | i386/i386/machine_task.c | 2 | ||||
-rw-r--r-- | i386/i386/pcb.c | 2 | ||||
-rw-r--r-- | i386/i386at/model_dep.c | 17 | ||||
-rw-r--r-- | i386/i386at/model_dep.h | 9 | ||||
-rw-r--r-- | i386/intel/pmap.c | 4 |
8 files changed, 31 insertions, 23 deletions
diff --git a/i386/i386/db_trace.c b/i386/i386/db_trace.c index ec338591..c8789e71 100644 --- a/i386/i386/db_trace.c +++ b/i386/i386/db_trace.c @@ -37,6 +37,7 @@ #include <machine/machspl.h> #include <machine/db_interface.h> #include <machine/db_trace.h> +#include <i386at/model_dep.h> #include <ddb/db_access.h> #include <ddb/db_command.h> @@ -129,7 +130,6 @@ db_i386_reg_value( long *dp = 0; db_expr_t null_reg = 0; thread_t thread = ap->thread; - extern unsigned int_stack_high; if (db_option(ap->modif, 'u')) { if (thread == THREAD_NULL) { @@ -139,7 +139,7 @@ db_i386_reg_value( if (thread == current_thread()) { if (ddb_regs.cs & 0x3) dp = vp->valuep; - else if (ddb_regs.ebp < int_stack_high) + else if (ON_INT_STACK(ddb_regs.ebp)) db_error("cannot get/set user registers in nested interrupt\n"); } } else { diff --git a/i386/i386/fpu.c b/i386/i386/fpu.c index 0f34833e..ddf4c8ed 100644 --- a/i386/i386/fpu.c +++ b/i386/i386/fpu.c @@ -189,7 +189,7 @@ fpu_module_init(void) { kmem_cache_init(&ifps_cache, "i386_fpsave_state", sizeof(struct i386_fpsave_state), 16, - NULL, NULL, NULL, 0); + NULL, 0); } /* diff --git a/i386/i386/locore.S b/i386/i386/locore.S index 8cefbccb..c715d959 100644 --- a/i386/i386/locore.S +++ b/i386/i386/locore.S @@ -542,8 +542,10 @@ trap_from_kernel: #if MACH_KDB || MACH_TTD movl %esp,%ebx /* save current stack */ - cmpl EXT(int_stack_high),%esp /* on an interrupt stack? */ - jb 1f /* OK if so */ + movl %esp,%edx /* on an interrupt stack? */ + and $(~(KERNEL_STACK_SIZE-1)),%edx + cmpl EXT(int_stack_base),%edx + je 1f /* OK if so */ CPU_NUMBER(%edx) /* get CPU number */ cmpl CX(EXT(kernel_stack),%edx),%esp @@ -647,8 +649,10 @@ ENTRY(all_intrs) pushl %edx cld /* clear direction flag */ - cmpl %ss:EXT(int_stack_high),%esp /* on an interrupt stack? */ - jb int_from_intstack /* if not: */ + movl %esp,%edx /* on an interrupt stack? */ + and $(~(KERNEL_STACK_SIZE-1)),%edx + cmpl %ss:EXT(int_stack_base),%edx + je int_from_intstack /* if not: */ pushl %ds /* save segment registers */ pushl %es @@ -707,7 +711,7 @@ LEXT(return_to_iret) /* ( label for kdb_kintr and hardclock) */ iret /* return to caller */ int_from_intstack: - cmpl $EXT(_intstack),%esp /* seemingly looping? */ + cmpl EXT(int_stack_base),%esp /* seemingly looping? */ jb stack_overflowed /* if not: */ call EXT(interrupt) /* call interrupt routine */ _return_to_iret_i: /* ( label for kdb_kintr) */ diff --git a/i386/i386/machine_task.c b/i386/i386/machine_task.c index 490b1022..d592838a 100644 --- a/i386/i386/machine_task.c +++ b/i386/i386/machine_task.c @@ -38,7 +38,7 @@ void machine_task_module_init (void) { kmem_cache_init (&machine_task_iopb_cache, "i386_task_iopb", IOPB_BYTES, 0, - NULL, NULL, NULL, 0); + NULL, 0); } diff --git a/i386/i386/pcb.c b/i386/i386/pcb.c index 3a0eba0f..6b22e4c4 100644 --- a/i386/i386/pcb.c +++ b/i386/i386/pcb.c @@ -371,7 +371,7 @@ thread_t switch_context( void pcb_module_init(void) { kmem_cache_init(&pcb_cache, "pcb", sizeof(struct pcb), 0, - NULL, NULL, NULL, 0); + NULL, 0); fpu_module_init(); } diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c index 7638b832..62763ae1 100644 --- a/i386/i386at/model_dep.c +++ b/i386/i386at/model_dep.c @@ -47,6 +47,7 @@ #include <kern/cpu_number.h> #include <kern/debug.h> #include <kern/mach_clock.h> +#include <kern/macros.h> #include <kern/printf.h> #include <kern/startup.h> #include <sys/time.h> @@ -133,8 +134,9 @@ extern char version[]; /* If set, reboot the system on ctrl-alt-delete. */ boolean_t rebootflag = FALSE; /* exported to kdintr */ -/* XX interrupt stack pointer and highwater mark, for locore.S. */ -vm_offset_t int_stack_top, int_stack_high; +/* Interrupt stack. */ +static char int_stack[KERNEL_STACK_SIZE] __aligned(KERNEL_STACK_SIZE); +vm_offset_t int_stack_top, int_stack_base; #ifdef LINUX_DEV extern void linux_init(void); @@ -398,11 +400,6 @@ i386at_init(void) pmap_clear_bootstrap_pagetable((void *)boot_info.pt_base); #endif /* MACH_PV_PAGETABLES */ - /* Interrupt stacks are allocated in physical memory, - while kernel stacks are allocated in kernel virtual memory, - so phys_last_addr serves as a convenient dividing point. */ - int_stack_high = phystokv(phys_last_addr); - /* * Initialize and activate the real i386 protected-mode structures. */ @@ -448,10 +445,8 @@ i386at_init(void) hyp_p2m_init(); #endif /* MACH_XEN */ - /* XXX We'll just use the initialization stack we're already running on - as the interrupt stack for now. Later this will have to change, - because the init stack will get freed after bootup. */ - asm("movl %%esp,%0" : "=m" (int_stack_top)); + int_stack_base = (vm_offset_t)&int_stack; + int_stack_top = int_stack_base + KERNEL_STACK_SIZE - 4; } /* diff --git a/i386/i386at/model_dep.h b/i386/i386at/model_dep.h index aa240320..47551b85 100644 --- a/i386/i386at/model_dep.h +++ b/i386/i386at/model_dep.h @@ -19,8 +19,17 @@ #ifndef _MODEL_DEP_H_ #define _MODEL_DEP_H_ +#include <i386/vm_param.h> #include <mach/vm_prot.h> +/* + * Interrupt stack. + */ +extern vm_offset_t int_stack_top, int_stack_base; + +/* Check whether P points to the interrupt stack. */ +#define ON_INT_STACK(P) (((P) & ~(KERNEL_STACK_SIZE-1)) == int_stack_base) + extern int timemmap(dev_t dev, vm_offset_t off, vm_prot_t prot); void inittodr(void); diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c index 22e20c97..0771a08d 100644 --- a/i386/intel/pmap.c +++ b/i386/intel/pmap.c @@ -978,9 +978,9 @@ void pmap_init(void) * and of the physical-to-virtual entries. */ s = (vm_size_t) sizeof(struct pmap); - kmem_cache_init(&pmap_cache, "pmap", s, 0, NULL, NULL, NULL, 0); + kmem_cache_init(&pmap_cache, "pmap", s, 0, NULL, 0); s = (vm_size_t) sizeof(struct pv_entry); - kmem_cache_init(&pv_list_cache, "pv_entry", s, 0, NULL, NULL, NULL, 0); + kmem_cache_init(&pv_list_cache, "pv_entry", s, 0, NULL, 0); #if NCPUS > 1 /* |