1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
Index: fbsd-6/sys/i386/i386/locore.s
===================================================================
--- fbsd-6.orig/sys/i386/i386/locore.s
+++ fbsd-6/sys/i386/i386/locore.s
@@ -358,7 +358,7 @@ NON_GPROF_ENTRY(sigcode)
pushl %eax
testl $PSL_VM,UC_EFLAGS(%eax)
jne 1f
- movl UC_GS(%eax),%gs /* restore %gs */
+ movw UC_GS(%eax),%gs /* restore %gs */
1:
movl $SYS_sigreturn,%eax
pushl %eax /* junk to fake return addr. */
@@ -375,7 +375,7 @@ freebsd4_sigcode:
pushl %eax
testl $PSL_VM,UC4_EFLAGS(%eax)
jne 1f
- movl UC4_GS(%eax),%gs /* restore %gs */
+ movw UC4_GS(%eax),%gs /* restore %gs */
1:
movl $344,%eax /* 4.x SYS_sigreturn */
pushl %eax /* junk to fake return addr. */
@@ -393,7 +393,7 @@ osigcode:
pushl %eax
testl $PSL_VM,SC_PS(%eax)
jne 9f
- movl SC_GS(%eax),%gs /* restore %gs */
+ movw SC_GS(%eax),%gs /* restore %gs */
9:
movl $103,%eax /* 3.x SYS_sigreturn */
pushl %eax /* junk to fake return addr. */
Index: fbsd-6/sys/i386/include/cpufunc.h
===================================================================
--- fbsd-6.orig/sys/i386/include/cpufunc.h
+++ fbsd-6/sys/i386/include/cpufunc.h
@@ -452,7 +452,7 @@ static __inline u_int
rfs(void)
{
u_int sel;
- __asm __volatile("movl %%fs,%0" : "=rm" (sel));
+ __asm __volatile("movw %%fs,%0" : "=rm" (sel));
return (sel);
}
@@ -460,7 +460,7 @@ static __inline u_int
rgs(void)
{
u_int sel;
- __asm __volatile("movl %%gs,%0" : "=rm" (sel));
+ __asm __volatile("movw %%gs,%0" : "=rm" (sel));
return (sel);
}
@@ -468,20 +468,20 @@ static __inline u_int
rss(void)
{
u_int sel;
- __asm __volatile("movl %%ss,%0" : "=rm" (sel));
+ __asm __volatile("movw %%ss,%0" : "=rm" (sel));
return (sel);
}
static __inline void
load_fs(u_int sel)
{
- __asm __volatile("movl %0,%%fs" : : "rm" (sel));
+ __asm __volatile("movw %0,%%fs" : : "rm" (sel));
}
static __inline void
load_gs(u_int sel)
{
- __asm __volatile("movl %0,%%gs" : : "rm" (sel));
+ __asm __volatile("movw %0,%%gs" : : "rm" (sel));
}
static __inline void
Index: fbsd-6/sys/i386/i386/swtch.s
===================================================================
--- fbsd-6.orig/sys/i386/i386/swtch.s
+++ fbsd-6/sys/i386/i386/swtch.s
@@ -111,7 +111,7 @@ ENTRY(cpu_switch)
movl %ebp,PCB_EBP(%edx)
movl %esi,PCB_ESI(%edx)
movl %edi,PCB_EDI(%edx)
- movl %gs,PCB_GS(%edx)
+ movw %gs,PCB_GS(%edx)
pushfl /* PSL */
popl PCB_PSL(%edx)
/* Check to see if we need to call a switchout function. */
@@ -279,7 +279,7 @@ sw1:
/* This must be done after loading the user LDT. */
.globl cpu_switch_load_gs
cpu_switch_load_gs:
- movl PCB_GS(%edx),%gs
+ movw PCB_GS(%edx),%gs
/* Test if debug registers should be restored. */
testl $PCB_DBREGS,PCB_FLAGS(%edx)
@@ -348,7 +348,7 @@ ENTRY(savectx)
movl %ebp,PCB_EBP(%ecx)
movl %esi,PCB_ESI(%ecx)
movl %edi,PCB_EDI(%ecx)
- movl %gs,PCB_GS(%ecx)
+ movw %gs,PCB_GS(%ecx)
pushfl
popl PCB_PSL(%ecx)
Index: fbsd-6/sys/compat/ndis/winx32_wrap.S
===================================================================
--- fbsd-6.orig/sys/compat/ndis/winx32_wrap.S
+++ fbsd-6/sys/compat/ndis/winx32_wrap.S
@@ -364,7 +364,7 @@ ENTRY(x86_getfs)
ret
ENTRY(x86_setfs)
- movl 4(%esp),%fs
+ movw 4(%esp),%fs
ret
ENTRY(x86_gettid)
Index: fbsd-6/sys/i386/linux/linux_locore.s
===================================================================
--- fbsd-6.orig/sys/i386/linux/linux_locore.s
+++ fbsd-6/sys/i386/linux/linux_locore.s
@@ -8,7 +8,7 @@
NON_GPROF_ENTRY(linux_sigcode)
call *LINUX_SIGF_HANDLER(%esp)
leal LINUX_SIGF_SC(%esp),%ebx /* linux scp */
- movl LINUX_SC_GS(%ebx),%gs
+ movw LINUX_SC_GS(%ebx),%gs
movl %esp, %ebx /* pass sigframe */
push %eax /* fake ret addr */
movl $LINUX_SYS_linux_sigreturn,%eax /* linux_sigreturn() */
@@ -19,7 +19,7 @@ NON_GPROF_ENTRY(linux_sigcode)
linux_rt_sigcode:
call *LINUX_RT_SIGF_HANDLER(%esp)
leal LINUX_RT_SIGF_UC(%esp),%ebx /* linux ucp */
- movl LINUX_SC_GS(%ebx),%gs
+ movw LINUX_SC_GS(%ebx),%gs
push %eax /* fake ret addr */
movl $LINUX_SYS_linux_rt_sigreturn,%eax /* linux_rt_sigreturn() */
int $0x80 /* enter kernel with args */
|