Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
e97519a6
提交
e97519a6
5月 31, 2009
创建
作者:
rsc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sync with c; .text is implied
上级
ba6cd8a6
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
25 行增加
和
18 行删除
+25
-18
bootasm.S
bootasm.S
+12
-9
trapasm.S
trapasm.S
+13
-7
vectors.pl
vectors.pl
+0
-2
没有找到文件。
bootasm.S
浏览文件 @
e97519a6
...
...
@@ -5,15 +5,16 @@
# memory at physical address 0x7c00 and starts executing in real mode
# with %cs=0 %ip=7c00.
.set CSEG32, 0x8 # kernel code segment selector
.set DSEG32, 0x10 # kernel data segment selector
.set CR0_PE, 0x1 # protected mode enable flag
#define SEG_KCODE 1 // kernel code
#define SEG_KDATA 2 // kernel data+stack
#define SEG_KCPU 3 // kernel per-cpu data
#define CR0_PE 1 // protected mode enable bit
.code16 # Assemble for 16-bit mode
.globl start
start:
cli # Disable interrupts
cld # String operations increment
# Set up the important data segment registers (DS, ES, SS).
xorw %ax,%ax # Segment number zero
...
...
@@ -53,18 +54,19 @@ seta20.2:
# Jump to next instruction, but in 32-bit code segment.
# Switches processor into 32-bit mode.
ljmp $
CSEG32
, $start32
ljmp $
(SEG_KCODE<<3)
, $start32
.code32 # Assemble for 32-bit mode
start32:
# Set up the protected-mode data segment registers
movw $
DSEG32, %ax
# Our data segment selector
movw $
(SEG_KDATA<<3), %ax
# Our data segment selector
movw %ax, %ds # -> DS: Data Segment
movw %ax, %es # -> ES: Extra Segment
movw %ax, %ss # -> SS: Stack Segment
movw $(SEG_KCPU<<3), %ax # Our per-cpu segment selector
movw %ax, %fs # -> FS
movw %ax, %gs # -> GS
movw %ax, %ss # -> SS: Stack Segment
# Set up the stack pointer and call into C.
movl $start, %esp
call bootmain
...
...
@@ -85,7 +87,8 @@ gdt:
SEG_NULLASM # null seg
SEG_ASM(STA_X|STA_R, 0x0, 0xffffffff) # code 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:
.word 0x1
7
# sizeof(gdt) - 1
.word 0x1
f
# sizeof(gdt) - 1
.long gdt # address gdt
trapasm.S
浏览文件 @
e97519a6
.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
...
...
vectors.pl
浏览文件 @
e97519a6
...
...
@@ -7,7 +7,6 @@
print
"# generated by vectors.pl - do not edit\n"
;
print
"# handlers\n"
;
print
".text\n"
;
print
".globl alltraps\n"
;
for
(
my
$i
=
0
;
$i
<
256
;
$i
++
){
print
".globl vector$i\n"
;
...
...
@@ -29,7 +28,6 @@ for(my $i = 0; $i < 256; $i++){
# sample output:
# # handlers
# .text
# .globl alltraps
# .globl vector0
# vector0:
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论