summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsc <rsc>2006-09-08 15:31:23 +0000
committerrsc <rsc>2006-09-08 15:31:23 +0000
commitb02e13f0f67d86c895b1272ebaca6f4902d7dbb1 (patch)
tree15a287d4e01478b873ebc91e1739ee390b3a432a
parent3689c7f5cea4b0b48ab1c96ff6346f0a475b7a62 (diff)
downloadxv6-labs-b02e13f0f67d86c895b1272ebaca6f4902d7dbb1.tar.gz
xv6-labs-b02e13f0f67d86c895b1272ebaca6f4902d7dbb1.tar.bz2
xv6-labs-b02e13f0f67d86c895b1272ebaca6f4902d7dbb1.zip
shorten
-rw-r--r--bootasm.S22
1 files changed, 9 insertions, 13 deletions
diff --git a/bootasm.S b/bootasm.S
index aa462b9..c9982d2 100644
--- a/bootasm.S
+++ b/bootasm.S
@@ -54,16 +54,15 @@ seta20.2:
movb $0xdf,%al # Enable
outb %al,$0x60 # A20
- # Switch from real to protected mode
- # The descriptors in our GDT allow all physical memory to be accessed.
- # Furthermore, the descriptors have base addresses of 0, so that the
- # segment translation is a NOP, ie. virtual addresses are identical to
- # their physical addresses. With this setup, immediately after
- # enabling protected mode it will still appear to this code
- # that it is running directly on physical memory with no translation.
- # This initial NOP-translation setup is required by the processor
- # to ensure that the transition to protected mode occurs smoothly.
-
+# Switch from real to protected mode
+# The descriptors in our GDT allow all physical memory to be accessed.
+# Furthermore, the descriptors have base addresses of 0, so that the
+# segment translation is a NOP, ie. virtual addresses are identical to
+# their physical addresses. With this setup, immediately after
+# enabling protected mode it will still appear to this code
+# that it is running directly on physical memory with no translation.
+# This initial NOP-translation setup is required by the processor
+# to ensure that the transition to protected mode occurs smoothly.
real_to_prot:
cli # Mandatory since we dont set up an IDT
lgdt gdtdesc # load GDT -- mandatory in protected mode
@@ -85,19 +84,16 @@ protcseg:
movw %ax, %fs # -> FS
movw %ax, %gs # -> GS
movw %ax, %ss # -> SS: Stack Segment
-
call cmain # finish the boot load from C.
# cmain() should not return
spin:
jmp spin # ..but in case it does, spin
-
.p2align 2 # force 4 byte alignment
gdt:
SEG_NULLASM # null seg
SEG_ASM(STA_X|STA_R, 0x0, 0xffffffff) # code seg
SEG_ASM(STA_W, 0x0, 0xffffffff) # data seg
-
gdtdesc:
.word 0x17 # sizeof(gdt) - 1
.long gdt # address gdt