Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151820407
D50414.id155683.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D50414.id155683.diff
View Options
diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S
--- a/sys/amd64/amd64/cpu_switch.S
+++ b/sys/amd64/amd64/cpu_switch.S
@@ -91,14 +91,8 @@
jnz 2f
testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip)
jz 2f
- movl %fs,%eax
- cmpl $KUF32SEL,%eax
- jne 1f
rdfsbase %rax
movq %rax,PCB_FSBASE(%r8)
-1: movl %gs,%eax
- cmpl $KUG32SEL,%eax
- jne 2f
movq %rdx,%r12
movl $MSR_KGSBASE,%ecx /* Read user gs base */
rdmsr
diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S
--- a/sys/amd64/amd64/exception.S
+++ b/sys/amd64/amd64/exception.S
@@ -479,22 +479,14 @@
jz 6f /* already running with kernel GS.base */
testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip)
jz 2f
- cmpw $KUF32SEL,TF_FS(%rsp)
- jne 1f
rdfsbase %rax
-1: cmpw $KUG32SEL,TF_GS(%rsp)
- jne 2f
rdgsbase %rdx
2: swapgs
lfence
movq PCPU(CURPCB),%rdi
testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip)
jz 4f
- cmpw $KUF32SEL,TF_FS(%rsp)
- jne 3f
movq %rax,PCB_FSBASE(%rdi)
-3: cmpw $KUG32SEL,TF_GS(%rsp)
- jne 4f
movq %rdx,PCB_GSBASE(%rdi)
orl $PCB_FULL_IRET,PCB_FLAGS(%rdi) /* full iret from user #gp */
4: call handle_ibrs_entry
@@ -730,12 +722,8 @@
orl $PCB_FULL_IRET,PCB_FLAGS(%rdi)
testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip)
jz 3f
- cmpw $KUF32SEL,TF_FS(%rsp)
- jne 2f
rdfsbase %rax
movq %rax,PCB_FSBASE(%rdi)
-2: cmpw $KUG32SEL,TF_GS(%rsp)
- jne 3f
movl $MSR_KGSBASE,%ecx
rdmsr
shlq $32,%rdx
@@ -842,12 +830,8 @@
orl $PCB_FULL_IRET,PCB_FLAGS(%rdi)
testb $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip)
jz 3f
- cmpw $KUF32SEL,TF_FS(%rsp)
- jne 2f
rdfsbase %rax
movq %rax,PCB_FSBASE(%rdi)
-2: cmpw $KUG32SEL,TF_GS(%rsp)
- jne 3f
movl $MSR_KGSBASE,%ecx
rdmsr
shlq $32,%rdx
@@ -1177,8 +1161,6 @@
.globl ld_fs
ld_fs:
movw %ax,%fs
- cmpw $KUF32SEL,%ax
- jne 1f
movl $MSR_FSBASE,%ecx
movl PCB_FSBASE(%r8),%eax
movl PCB_FSBASE+4(%r8),%edx
@@ -1212,8 +1194,6 @@
* from the previously saved msr read.
*/
movl $MSR_KGSBASE,%ecx
- cmpw $KUG32SEL,%si
- jne 1f
movl PCB_GSBASE(%r8),%eax
movl PCB_GSBASE+4(%r8),%edx
jmp ld_gsbase
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -1797,10 +1797,8 @@
(pcb->pcb_flags & PCB_FULL_IRET) == 0) {
r = intr_disable();
if ((pcb->pcb_flags & PCB_FULL_IRET) == 0) {
- if (rfs() == _ufssel)
- pcb->pcb_fsbase = rdfsbase();
- if (rgs() == _ugssel)
- pcb->pcb_gsbase = rdmsr(MSR_KGSBASE);
+ pcb->pcb_fsbase = rdfsbase();
+ pcb->pcb_gsbase = rdmsr(MSR_KGSBASE);
}
set_pcb_flags_raw(pcb, flags);
intr_restore(r);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 11, 9:28 PM (4 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31309406
Default Alt Text
D50414.id155683.diff (2 KB)
Attached To
Mode
D50414: amd64: do not handle fs/gs bases conditionally on the selector
Attached
Detach File
Event Timeline
Log In to Comment