Quiz 3
Following shows relevant part of xv6 bootasm.S from the p1-booting branch
Read carefully before answering. There may be some subtle changes from the xv6
bootasm.S. You can assume that the elided code in...was unchanged.
.code16
start:
...
lgdt gdtdesc
...
ljmp $(SEG_KCODE<<3), $start32
.code32
start32:
...
movw $(SEG_KDATA<<3), %ax # Load data segment selector
movw %ax, %ds # DS points to data segment
...
# Bootstrap GDT
.p2align 2
gdt:
SEG_NULLASM # null segment
SEG_ASM(STA_X|STA_R, 0x0, 0xffffffff) # code segment
SEG_ASM(STA_W, 0x200000, 0xffffffff) # data segment
...