Applied, thanks! Damien Zammit, le mar. 31 janv. 2023 09:36:38 +0000, a ecrit: > TODO: Return kernel_id via lookup table, not apic_id > > --- > i386/i386/cpu_number.h | 7 +++++++ > i386/i386/locore.S | 15 +++++++++------ > 2 files changed, 16 insertions(+), 6 deletions(-) > > diff --git a/i386/i386/cpu_number.h b/i386/i386/cpu_number.h > index 9aef6370..a6dd47d6 100644 > --- a/i386/i386/cpu_number.h > +++ b/i386/i386/cpu_number.h > @@ -35,6 +35,13 @@ > /* More-specific code must define cpu_number() and CPU_NUMBER. */ > #ifdef __i386__ > #define CX(addr, reg) addr(,reg,4) > + > +#define CPU_NUMBER(reg) \ > + movl %cs:lapic, reg ;\ > + movl %cs:APIC_ID(reg), reg ;\ > + shrl $24, reg ;\ > + > + > #endif > #ifdef __x86_64__ > #define CX(addr, reg) addr(,reg,8) > diff --git a/i386/i386/locore.S b/i386/i386/locore.S > index ff78e80d..5ac238f7 100644 > --- a/i386/i386/locore.S > +++ b/i386/i386/locore.S > @@ -541,13 +541,15 @@ _kret_iret: > trap_from_kernel: > #if MACH_KDB || MACH_TTD > movl %esp,%ebx /* save current stack */ > - > movl %esp,%edx /* on an interrupt stack? */ > - and $(~(KERNEL_STACK_SIZE-1)),%edx > - cmpl EXT(int_stack_base),%edx > + > + CPU_NUMBER(%ecx) > + and $(~(INTSTACK_SIZE-1)),%edx > + cmpl CX(EXT(int_stack_base),%ecx),%edx > je 1f /* OK if so */ > > - CPU_NUMBER(%edx) /* get CPU number */ > + movl %ecx,%edx > + > cmpl CX(EXT(kernel_stack),%edx),%esp > /* already on kernel stack? */ > ja 0f > @@ -668,9 +670,10 @@ ENTRY(all_intrs) > pushl %edx > cld /* clear direction flag */ > > + CPU_NUMBER(%ecx) > movl %esp,%edx /* on an interrupt stack? */ > - and $(~(KERNEL_STACK_SIZE-1)),%edx > - cmpl %ss:EXT(int_stack_base),%edx > + and $(~(INTSTACK_SIZE-1)),%edx > + cmpl %ss:CX(EXT(int_stack_base),%ecx),%edx > je int_from_intstack /* if not: */ > > pushl %ds /* save segment registers */ > -- > 2.34.1 > > >
-- Samuel --- Pour une évaluation indépendante, transparente et rigoureuse ! Je soutiens la Commission d'Évaluation de l'Inria.