diff options
-rw-r--r-- | i386/i386/cpu_number.h | 13 | ||||
-rw-r--r-- | i386/i386/cswitch.S | 6 | ||||
-rw-r--r-- | i386/i386/locore.S | 4 |
3 files changed, 12 insertions, 11 deletions
diff --git a/i386/i386/cpu_number.h b/i386/i386/cpu_number.h index a6dd47d6..b6c3a629 100644 --- a/i386/i386/cpu_number.h +++ b/i386/i386/cpu_number.h @@ -45,11 +45,14 @@ #endif #ifdef __x86_64__ #define CX(addr, reg) addr(,reg,8) +#warning Missing CPU_NUMBER() for 64 bit +#define CPU_NUMBER(reg) #endif -/* XXX For now */ -#define CPU_NUMBER(reg) movl $0,reg -#define cpu_number() 0 +#ifndef __ASSEMBLER__ +#include "kern/cpu_number.h" +int cpu_number(void); +#endif #else /* NCPUS == 1 */ @@ -58,8 +61,4 @@ #endif /* NCPUS == 1 */ -#ifndef __ASSEMBLER__ -#include "kern/cpu_number.h" -#endif - #endif /* _I386_CPU_NUMBER_H_ */ diff --git a/i386/i386/cswitch.S b/i386/i386/cswitch.S index 718c8aac..ae941bdd 100644 --- a/i386/i386/cswitch.S +++ b/i386/i386/cswitch.S @@ -110,7 +110,7 @@ ENTRY(Thread_continue) */ ENTRY(switch_to_shutdown_context) CPU_NUMBER(%edx) - movl EXT(active_stacks)(,%edx,4),%ecx /* get old kernel stack */ + movl CX(EXT(active_stacks),%edx),%ecx /* get old kernel stack */ movl %ebx,KSS_EBX(%ecx) /* save registers */ movl %ebp,KSS_EBP(%ecx) movl %edi,KSS_EDI(%ecx) @@ -124,8 +124,8 @@ ENTRY(switch_to_shutdown_context) movl 4(%esp),%ebx /* get routine to run next */ movl 8(%esp),%esi /* get its argument */ - movl EXT(interrupt_stack)(,%edx,4),%ecx /* point to its interrupt stack */ - lea INTSTACK_SIZE(%ecx),%esp /* switch to it (top) */ + movl CX(EXT(int_stack_base),%edx),%ecx /* point to its interrupt stack */ + lea -4+INTSTACK_SIZE(%ecx),%esp /* switch to it (top) */ pushl %eax /* push thread */ call EXT(thread_dispatch) /* reschedule thread */ diff --git a/i386/i386/locore.S b/i386/i386/locore.S index 5ac238f7..55add6e4 100644 --- a/i386/i386/locore.S +++ b/i386/i386/locore.S @@ -689,6 +689,7 @@ ENTRY(all_intrs) CPU_NUMBER(%edx) movl CX(EXT(int_stack_top),%edx),%ecx + xchgl %ecx,%esp /* switch to interrupt stack */ #if STAT_TIME @@ -733,7 +734,8 @@ LEXT(return_to_iret) /* ( label for kdb_kintr and hardclock) */ iret /* return to caller */ int_from_intstack: - cmpl EXT(int_stack_base),%esp /* seemingly looping? */ + CPU_NUMBER(%edx) + cmpl CX(EXT(int_stack_base),%edx),%esp /* seemingly looping? */ jb stack_overflowed /* if not: */ call EXT(interrupt) /* call interrupt routine */ _return_to_iret_i: /* ( label for kdb_kintr) */ |