aboutsummaryrefslogtreecommitdiff
path: root/sys/i386
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2004-02-03 22:00:42 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2004-02-03 22:00:42 +0000
commit7a9d7023a212cc15b5c2add18ecf518a135c56d5 (patch)
treeb9a6efd2fe16362b210ece58d105d4016f3e1d9b /sys/i386
parent908579c17277a6608589b9946077ed6683da3f91 (diff)
downloadsrc-7a9d7023a212cc15b5c2add18ecf518a135c56d5.tar.gz
src-7a9d7023a212cc15b5c2add18ecf518a135c56d5.zip
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.
Notes
Notes: svn path=/head/; revision=125405
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/apic_vector.s69
-rw-r--r--sys/i386/isa/atpic_vector.s5
2 files changed, 40 insertions, 34 deletions
diff --git a/sys/i386/i386/apic_vector.s b/sys/i386/i386/apic_vector.s
index ad7038c39f86..871fd7981676 100644
--- a/sys/i386/i386/apic_vector.s
+++ b/sys/i386/i386/apic_vector.s
@@ -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
diff --git a/sys/i386/isa/atpic_vector.s b/sys/i386/isa/atpic_vector.s
index 4b819ce44688..e3dc38f6f383 100644
--- a/sys/i386/isa/atpic_vector.s
+++ b/sys/i386/isa/atpic_vector.s
@@ -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 ; \