Luca Dariz, le sam. 05 févr. 2022 18:51:29 +0100, a ecrit: > Signed-off-by: Luca Dariz <l...@orpolo.org>
Applied, thanks! > --- > i386/i386/i386asm.sym | 4 ++++ > i386/i386/ktss.c | 8 ++++++-- > i386/i386/pcb.c | 4 ++++ > i386/i386/tss.h | 24 ++++++++++++++++++++++-- > 4 files changed, 36 insertions(+), 4 deletions(-) > > diff --git a/i386/i386/i386asm.sym b/i386/i386/i386asm.sym > index 9e1d13d7..417c040d 100644 > --- a/i386/i386/i386asm.sym > +++ b/i386/i386/i386asm.sym > @@ -95,8 +95,12 @@ offset i386_interrupt_state i eip > offset i386_interrupt_state i cs > offset i386_interrupt_state i efl > > +#ifdef __x86_64__ > +offset i386_tss tss rsp0 > +#else > offset i386_tss tss esp0 > offset i386_tss tss ss0 > +#endif > > offset machine_slot sub_type cpu_type > > diff --git a/i386/i386/ktss.c b/i386/i386/ktss.c > index 917e6305..24e12cf4 100644 > --- a/i386/i386/ktss.c > +++ b/i386/i386/ktss.c > @@ -55,11 +55,15 @@ ktss_init(void) > fill_gdt_sys_descriptor(KERNEL_TSS, > kvtolin(&ktss), sizeof(struct task_tss) - 1, > ACC_PL_K|ACC_TSS, 0); > - > /* Initialize the master TSS. */ > +#ifdef __x86_64__ > + ktss.tss.rsp0 = (unsigned long)(exception_stack+1024); > + ktss.tss.io_bit_map_offset = IOPB_INVAL; > +#else /* ! __x86_64__ */ > ktss.tss.ss0 = KERNEL_DS; > ktss.tss.esp0 = (unsigned long)(exception_stack+1024); > - ktss.tss.io_bit_map_offset = IOPB_INVAL; > > + ktss.tss.io_bit_map_offset = IOPB_INVAL; > +#endif /* __x86_64__ */ > /* Set the last byte in the I/O bitmap to all 1's. */ > ktss.barrier = 0xff; > > diff --git a/i386/i386/pcb.c b/i386/i386/pcb.c > index 23585323..23b734e3 100644 > --- a/i386/i386/pcb.c > +++ b/i386/i386/pcb.c > @@ -153,7 +153,11 @@ void switch_ktss(pcb_t pcb) > if (hyp_stack_switch(KERNEL_DS, pcb_stack_top)) > panic("stack_switch"); > #else /* MACH_RING1 */ > +#ifdef __x86_64__ > + curr_ktss(mycpu)->tss.rsp0 = pcb_stack_top; > +#else /* __x86_64__ */ > curr_ktss(mycpu)->tss.esp0 = pcb_stack_top; > +#endif /* __x86_64__ */ > #endif /* MACH_RING1 */ > } > > diff --git a/i386/i386/tss.h b/i386/i386/tss.h > index ff25f217..31e1f5cb 100644 > --- a/i386/i386/tss.h > +++ b/i386/i386/tss.h > @@ -27,13 +27,33 @@ > #ifndef _I386_TSS_H_ > #define _I386_TSS_H_ > > +#include <sys/types.h> > #include <mach/inline.h> > > #include <machine/io_perm.h> > > /* > - * i386 Task State Segment > + * x86 Task State Segment > */ > +#ifdef __x86_64__ > +struct i386_tss { > + uint32_t _reserved0; > + uint64_t rsp0; > + uint64_t rsp1; > + uint64_t rsp2; > + uint64_t _reserved1; > + uint64_t ist1; > + uint64_t ist2; > + uint64_t ist3; > + uint64_t ist4; > + uint64_t ist5; > + uint64_t ist6; > + uint64_t ist7; > + uint64_t _reserved2; > + uint16_t _reserved3; > + uint16_t io_bit_map_offset; > +} __attribute__((__packed__)); > +#else /* ! __x86_64__ */ > struct i386_tss { > int back_link; /* segment number of previous task, > if nested */ > @@ -67,7 +87,7 @@ struct i386_tss { > /* offset to start of IO permission > bit map */ > }; > - > +#endif /* __x86_64__ */ > > /* The structure extends the above TSS structure by an I/O permission bitmap > and the barrier. */ > -- > 2.30.2 > > -- Samuel --- Pour une évaluation indépendante, transparente et rigoureuse ! Je soutiens la Commission d'Évaluation de l'Inria.