summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorkmacy <kmacy@FreeBSD.org>2008-08-16 21:38:46 +0000
committerkmacy <kmacy@FreeBSD.org>2008-08-16 21:38:46 +0000
commit03af772d719ef8689614b02c015a0b67c87e53e8 (patch)
tree99eea7b4e451a8c998c77a091994bb204cce5837 /sys
parent4e5478c963e4a76535c8e6c57a4e5c030658b3d3 (diff)
downloadFreeBSD-src-03af772d719ef8689614b02c015a0b67c87e53e8.zip
FreeBSD-src-03af772d719ef8689614b02c015a0b67c87e53e8.tar.gz
Call in to xen for privileged aspects of context switching
MFC after: 1 month
Diffstat (limited to 'sys')
-rw-r--r--sys/i386/i386/swtch.s24
1 files changed, 18 insertions, 6 deletions
diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s
index 6ffd5d5..27a0094 100644
--- a/sys/i386/i386/swtch.s
+++ b/sys/i386/i386/swtch.s
@@ -88,7 +88,7 @@ ENTRY(cpu_throw)
movl 8(%esp),%ecx /* New thread */
movl TD_PCB(%ecx),%edx
movl PCB_CR3(%edx),%eax
- movl %eax,%cr3 /* new address space */
+ LOAD_CR3(%eax)
/* set bit in new pm_active */
movl TD_PROC(%ecx),%eax
movl P_VMSPACE(%eax), %ebx
@@ -181,10 +181,10 @@ ENTRY(cpu_switch)
cmpl %eax,IdlePTD /* Kernel address space? */
#endif
je sw0
- movl %cr3,%ebx /* The same address space? */
+ READ_CR3(%ebx) /* The same address space? */
cmpl %ebx,%eax
je sw0
- movl %eax,%cr3 /* new address space */
+ LOAD_CR3(%eax) /* new address space */
movl %esi,%eax
movl PCPU(CPUID),%esi
SETOP %eax,TD_LOCK(%edi) /* Switchout td_lock */
@@ -211,6 +211,18 @@ sw0:
SETOP %esi,TD_LOCK(%edi) /* Switchout td_lock */
sw1:
BLOCK_SPIN(%ecx)
+#ifdef XEN
+ pushl %eax
+ pushl %ecx
+ pushl %edx
+ call xen_handle_thread_switch
+ popl %edx
+ popl %ecx
+ popl %eax
+ /*
+ * XXX set IOPL
+ */
+#else
/*
* At this point, we've switched address spaces and are ready
* to load up the rest of the next context.
@@ -259,7 +271,7 @@ sw1:
movl 12(%esi), %ebx
movl %eax, 8(%edi)
movl %ebx, 12(%edi)
-
+#endif
/* Restore context. */
movl PCB_EBX(%edx),%ebx
movl PCB_ESP(%edx),%esp
@@ -285,7 +297,7 @@ sw1:
movl _default_ldt,%eax
cmpl PCPU(CURRENTLDT),%eax
je 2f
- lldt _default_ldt
+ LLDT(_default_ldt)
movl %eax,PCPU(CURRENTLDT)
jmp 2f
1:
@@ -389,7 +401,7 @@ ENTRY(savectx)
* parent's npx state for forks by forgetting to reload.
*/
pushfl
- cli
+ CLI
movl PCPU(FPCURTHREAD),%eax
testl %eax,%eax
je 1f
OpenPOWER on IntegriCloud