summaryrefslogtreecommitdiff
path: root/trapasm.S
diff options
context:
space:
mode:
authorrsc <rsc>2009-05-31 01:00:38 +0000
committerrsc <rsc>2009-05-31 01:00:38 +0000
commite97519a6d2efd56eb5b5ff2e4c4b20048a33c7af (patch)
treeede9368cea8ba44c70d35ced9e754d3da5a35bb5 /trapasm.S
parentba6cd8a685cdf86f308ba8c8cd1faa39adf86fa5 (diff)
downloadxv6-labs-e97519a6d2efd56eb5b5ff2e4c4b20048a33c7af.tar.gz
xv6-labs-e97519a6d2efd56eb5b5ff2e4c4b20048a33c7af.tar.bz2
xv6-labs-e97519a6d2efd56eb5b5ff2e4c4b20048a33c7af.zip
sync with c; .text is implied
Diffstat (limited to 'trapasm.S')
-rw-r--r--trapasm.S20
1 files changed, 13 insertions, 7 deletions
diff --git a/trapasm.S b/trapasm.S
index 962ba10..59fca57 100644
--- a/trapasm.S
+++ b/trapasm.S
@@ -1,6 +1,6 @@
-.text
-
-.set SEG_KDATA_SEL, 0x10 # selector for SEG_KDATA
+#define SEG_KCODE 1 // kernel code
+#define SEG_KDATA 2 // kernel data+stack
+#define SEG_KCPU 3 // kernel per-cpu data
# vectors.S sends all traps here.
.globl alltraps
@@ -12,10 +12,16 @@ alltraps:
pushl %gs
pushal
- # Set up data segments.
- movl $SEG_KDATA_SEL, %eax
- movw %ax,%ds
- movw %ax,%es
+ # Set up data and per-cpu segments.
+ # Can find out KDATA from %ss.
+ # Assume that KCPU is KDATA+1.
+ movw $(SEG_KDATA<<3), %ax
+ movw %ss, %ax
+ movw %ax, %ds
+ movw %ax, %es
+ movw $(SEG_KCPU<<3), %ax
+ movw %ax, %fs
+ movw %ax, %gs
# Call trap(tf), where tf=%esp
pushl %esp