Revert the skipping of segment register reloads as it appears to actually

be a pessimization on non Pentium4 CPUs.  More importantly, it is buggy as
it can cause GPF's when using APM or vm86.
This commit is contained in:
John Baldwin 2004-02-03 22:00:42 +00:00
parent 908579c172
commit 7a9d7023a2
2 changed files with 40 additions and 34 deletions

View File

@ -57,18 +57,6 @@
pushl %es ; \
pushl %fs
#define PUSH_FRAME_AND_SET_SEGS \
PUSH_FRAME ; \
mov %fs,%ax ; /* get current per-cpu selector */ \
cmp $KPSEL,%ax ; /* are we already in the kernel? */ \
je 1f ; /* skip expensive segment reloads */ \
mov $KDSEL,%ax ; /* load kernel ds, es and fs */ \
mov %ax,%ds ; \
mov %ax,%es ; \
mov $KPSEL,%ax ; \
mov %ax,%fs ; \
1:
#define POP_FRAME \
popl %fs ; \
popl %es ; \
@ -87,7 +75,12 @@
.text ; \
SUPERALIGN_TEXT ; \
IDTVEC(vec_name) ; \
PUSH_FRAME_AND_SET_SEGS ; \
PUSH_FRAME ; \
movl $KDSEL, %eax ; /* reload with kernel's data segment */ \
mov %ax, %ds ; \
mov %ax, %es ; \
movl $KPSEL, %eax ; /* reload with per-CPU data segment */ \
mov %ax, %fs ; \
FAKE_MCOUNT(13*4(%esp)) ; \
movl lapic, %edx ; /* pointer to local APIC */ \
movl LA_ISR + 16 * (index)(%edx), %eax ; /* load ISR */ \
@ -137,12 +130,9 @@ MCOUNT_LABEL(eintr2)
IDTVEC(invltlb)
pushl %eax
pushl %ds
mov %ds,%ax /* get current data selector */
cmp $KDSEL,%ax /* are we already in the kernel? */
je 1f /* skip expensive segment reload */
movl $KDSEL, %eax /* Kernel data selector */
mov %ax, %ds
1:
#ifdef COUNT_XINVLTLB_HITS
pushl %fs
movl $KPSEL, %eax /* Private space selector */
@ -173,12 +163,9 @@ IDTVEC(invltlb)
IDTVEC(invlpg)
pushl %eax
pushl %ds
mov %ds,%ax /* get current data selector */
cmp $KDSEL,%ax /* are we already in the kernel? */
je 1f /* skip expensive segment reload */
movl $KDSEL, %eax /* Kernel data selector */
mov %ax, %ds
1:
#ifdef COUNT_XINVLTLB_HITS
pushl %fs
movl $KPSEL, %eax /* Private space selector */
@ -210,12 +197,9 @@ IDTVEC(invlrng)
pushl %eax
pushl %edx
pushl %ds
mov %ds,%ax /* get current data selector */
cmp $KDSEL,%ax /* are we already in the kernel? */
je 1f /* skip expensive segment reload */
movl $KDSEL, %eax /* Kernel data selector */
mov %ax, %ds
1:
#ifdef COUNT_XINVLTLB_HITS
pushl %fs
movl $KPSEL, %eax /* Private space selector */
@ -250,7 +234,12 @@ IDTVEC(invlrng)
.text
SUPERALIGN_TEXT
IDTVEC(hardclock)
PUSH_FRAME_AND_SET_SEGS
PUSH_FRAME
movl $KDSEL, %eax /* reload with kernel's data segment */
mov %ax, %ds
mov %ax, %es
movl $KPSEL, %eax
mov %ax, %fs
movl lapic, %edx
movl $0, LA_EOI(%edx) /* End Of Interrupt to APIC */
@ -268,7 +257,12 @@ IDTVEC(hardclock)
.text
SUPERALIGN_TEXT
IDTVEC(statclock)
PUSH_FRAME_AND_SET_SEGS
PUSH_FRAME
movl $KDSEL, %eax /* reload with kernel's data segment */
mov %ax, %ds
mov %ax, %es
movl $KPSEL, %eax
mov %ax, %fs
movl lapic, %edx
movl $0, LA_EOI(%edx) /* End Of Interrupt to APIC */
@ -292,7 +286,12 @@ IDTVEC(statclock)
.text
SUPERALIGN_TEXT
IDTVEC(cpuast)
PUSH_FRAME_AND_SET_SEGS
PUSH_FRAME
movl $KDSEL, %eax
mov %ax, %ds /* use KERNEL data segment */
mov %ax, %es
movl $KPSEL, %eax
mov %ax, %fs
movl lapic, %edx
movl $0, LA_EOI(%edx) /* End Of Interrupt to APIC */
@ -378,7 +377,12 @@ IDTVEC(cpustop)
.text
SUPERALIGN_TEXT
IDTVEC(rendezvous)
PUSH_FRAME_AND_SET_SEGS
PUSH_FRAME
movl $KDSEL, %eax
mov %ax, %ds /* use KERNEL data segment */
mov %ax, %es
movl $KPSEL, %eax
mov %ax, %fs
call smp_rendezvous_action
@ -393,7 +397,12 @@ IDTVEC(rendezvous)
*/
SUPERALIGN_TEXT
IDTVEC(lazypmap)
PUSH_FRAME_AND_SET_SEGS
PUSH_FRAME
movl $KDSEL, %eax
mov %ax, %ds /* use KERNEL data segment */
mov %ax, %es
movl $KPSEL, %eax
mov %ax, %fs
call pmap_lazyfix_action

View File

@ -63,15 +63,12 @@ IDTVEC(vec_name) ; \
pushl %ds ; /* save data and extra segments ... */ \
pushl %es ; \
pushl %fs ; \
mov %fs,%ax ; /* get current per-cpu selector */ \
cmp $KPSEL,%ax ; /* are we already in the kernel? */ \
je 1f ; /* skip expensive segment reloads */ \
mov $KDSEL,%ax ; /* load kernel ds, es and fs */ \
mov %ax,%ds ; \
mov %ax,%es ; \
mov $KPSEL,%ax ; \
mov %ax,%fs ; \
1: ; \
; \
FAKE_MCOUNT(13*4(%esp)) ; /* XXX late to avoid double count */ \
pushl $irq_num; /* pass the IRQ */ \
call atpic_handle_intr ; \