Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
887f1968
提交
887f1968
7月 11, 2009
创建
作者:
Russ Cox
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bootasm cleanup
上级
8b75366c
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
12 行增加
和
12 行删除
+12
-12
bootasm.S
bootasm.S
+1
-2
bootother.S
bootother.S
+11
-10
没有找到文件。
bootasm.S
浏览文件 @
887f1968
...
@@ -86,8 +86,7 @@ gdt:
...
@@ -86,8 +86,7 @@ gdt:
SEG_NULLASM # null seg
SEG_NULLASM # null seg
SEG_ASM(STA_X|STA_R, 0x0, 0xffffffff) # code seg
SEG_ASM(STA_X|STA_R, 0x0, 0xffffffff) # code seg
SEG_ASM(STA_W, 0x0, 0xffffffff) # data seg
SEG_ASM(STA_W, 0x0, 0xffffffff) # data seg
SEG_ASM(STA_W, 0x100, 0xffffffff) # per-cpu data seg; 0x100 is okay for now
gdtdesc:
gdtdesc:
.word
0x1f
# sizeof(gdt) - 1
.word
(gdtdesc - gdt - 1)
# sizeof(gdt) - 1
.long gdt # address gdt
.long gdt # address gdt
bootother.S
浏览文件 @
887f1968
...
@@ -19,15 +19,15 @@
...
@@ -19,15 +19,15 @@
# - it uses the address at start-4 for the %esp
# - it uses the address at start-4 for the %esp
# - it jumps to the address at start-8 instead of calling bootmain
# - it jumps to the address at start-8 instead of calling bootmain
.set PROT_MODE_CSEG, 0x8 # kernel code segment selector
#define SEG_KCODE 1 // kernel code
.set PROT_MODE_DSEG, 0x10 # kernel data segment selector
#define SEG_KDATA 2 // kernel data+stack
.set CR0_PE_ON, 0x1 # protected mode enable flag
#define CR0_PE 1 // protected mode enable bit
.code16 # Assemble for 16-bit mode
.globl start
.globl start
start:
start:
.code16 # Assemble for 16-bit mode
cli # Disable interrupts
cli # Disable interrupts
cld # String operations increment
# Set up the important data segment registers (DS, ES, SS).
# Set up the important data segment registers (DS, ES, SS).
xorw %ax,%ax # Segment number zero
xorw %ax,%ax # Segment number zero
...
@@ -42,22 +42,23 @@ start:
...
@@ -42,22 +42,23 @@ start:
# effective memory map does not change during the switch.
# effective memory map does not change during the switch.
lgdt gdtdesc
lgdt gdtdesc
movl %cr0, %eax
movl %cr0, %eax
orl $CR0_PE
_ON
, %eax
orl $CR0_PE, %eax
movl %eax, %cr0
movl %eax, %cr0
# Jump to next instruction, but in 32-bit code segment.
# Jump to next instruction, but in 32-bit code segment.
# Switches processor into 32-bit mode.
# Switches processor into 32-bit mode.
ljmp $
PROT_MODE_CSEG
, $protcseg
ljmp $
(SEG_KCODE<<3)
, $protcseg
.code32 # Assemble for 32-bit mode
.code32 # Assemble for 32-bit mode
protcseg:
protcseg:
# Set up the protected-mode data segment registers
# Set up the protected-mode data segment registers
movw $
PROT_MODE_DSEG
, %ax # Our data segment selector
movw $
(SEG_KDATA<<3)
, %ax # Our data segment selector
movw %ax, %ds # -> DS: Data Segment
movw %ax, %ds # -> DS: Data Segment
movw %ax, %es # -> ES: Extra Segment
movw %ax, %es # -> ES: Extra Segment
movw %ax, %ss # -> SS: Stack Segment
movw $0, %ax # Zero segments not ready for use
movw %ax, %fs # -> FS
movw %ax, %fs # -> FS
movw %ax, %gs # -> GS
movw %ax, %gs # -> GS
movw %ax, %ss # -> SS: Stack Segment
movl start-4, %esp
movl start-4, %esp
movl start-8, %eax
movl start-8, %eax
...
@@ -81,5 +82,5 @@ gdt:
...
@@ -81,5 +82,5 @@ gdt:
SEG_ASM(STA_W, 0x0, 0xffffffff) # data seg
SEG_ASM(STA_W, 0x0, 0xffffffff) # data seg
gdtdesc:
gdtdesc:
.word
0x17
# sizeof(gdt) - 1
.word
(gdtdesc - gdt - 1)
# sizeof(gdt) - 1
.long gdt # address gdt
.long gdt # address gdt
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论