Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
411ee741
提交
411ee741
9月 15, 2007
创建
作者:
rtm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix comments
上级
e9f8419f
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
8 行增加
和
10 行删除
+8
-10
bootasm.S
bootasm.S
+1
-1
bootmain.c
bootmain.c
+5
-7
mkfs.c
mkfs.c
+2
-2
没有找到文件。
bootasm.S
浏览文件 @
411ee741
...
@@ -44,7 +44,7 @@ seta20.2:
...
@@ -44,7 +44,7 @@ seta20.2:
//PAGEBREAK!
//PAGEBREAK!
# Switch from real to protected mode, using a bootstrap GDT
# Switch from real to protected mode, using a bootstrap GDT
# and segment translation that makes virtual addresses
# and segment translation that makes virtual addresses
# identical to
their
physical addresses, so that the
# identical to physical addresses, so that the
# 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
...
...
bootmain.c
浏览文件 @
411ee741
// Boot loader.
// Boot loader.
//
//
// The BIOS loads boot sector (bootasm.S) from sector 0 of the disk
// Part of the boot sector, along with bootasm.S, which calls bootmain().
// into memory and executes it. The boot sector puts the processor
// bootasm.S has put the processor into protected 32-bit mode.
// in 32-bit mode and calls bootmain below, which loads an ELF kernel
// bootmain() loads an ELF kernel image from the disk starting at
// image from the disk starting at sector 1 and then jumps to the
// sector 1 and then jumps to the kernel entry routine.
// kernel entry routine.
#include "types.h"
#include "types.h"
#include "elf.h"
#include "elf.h"
...
@@ -34,7 +33,7 @@ bootmain(void)
...
@@ -34,7 +33,7 @@ bootmain(void)
ph
=
(
struct
proghdr
*
)((
uchar
*
)
elf
+
elf
->
phoff
);
ph
=
(
struct
proghdr
*
)((
uchar
*
)
elf
+
elf
->
phoff
);
eph
=
ph
+
elf
->
phnum
;
eph
=
ph
+
elf
->
phnum
;
for
(;
ph
<
eph
;
ph
++
)
for
(;
ph
<
eph
;
ph
++
)
readseg
(
ph
->
va
,
ph
->
memsz
,
ph
->
offset
);
readseg
(
ph
->
va
&
0xFFFFFF
,
ph
->
memsz
,
ph
->
offset
);
// Call the entry point from the ELF header.
// Call the entry point from the ELF header.
// Does not return!
// Does not return!
...
@@ -81,7 +80,6 @@ readseg(uint va, uint count, uint offset)
...
@@ -81,7 +80,6 @@ readseg(uint va, uint count, uint offset)
{
{
uint
eva
;
uint
eva
;
va
&=
0xFFFFFF
;
eva
=
va
+
count
;
eva
=
va
+
count
;
// Round down to sector boundary.
// Round down to sector boundary.
...
...
mkfs.c
浏览文件 @
411ee741
...
@@ -81,7 +81,7 @@ main(int argc, char *argv[])
...
@@ -81,7 +81,7 @@ main(int argc, char *argv[])
usedblocks
=
ninodes
/
IPB
+
3
+
bitblocks
;
usedblocks
=
ninodes
/
IPB
+
3
+
bitblocks
;
freeblock
=
usedblocks
;
freeblock
=
usedblocks
;
printf
(
"used %d (bit %d ninode %
d) free %d
total %d
\n
"
,
usedblocks
,
printf
(
"used %d (bit %d ninode %
lu) free %u
total %d
\n
"
,
usedblocks
,
bitblocks
,
ninodes
/
IPB
+
1
,
freeblock
,
nblocks
+
usedblocks
);
bitblocks
,
ninodes
/
IPB
+
1
,
freeblock
,
nblocks
+
usedblocks
);
assert
(
nblocks
+
usedblocks
==
size
);
assert
(
nblocks
+
usedblocks
==
size
);
...
@@ -229,7 +229,7 @@ balloc(int used)
...
@@ -229,7 +229,7 @@ balloc(int used)
for
(
i
=
0
;
i
<
used
;
i
++
)
{
for
(
i
=
0
;
i
<
used
;
i
++
)
{
buf
[
i
/
8
]
=
buf
[
i
/
8
]
|
(
0x1
<<
(
i
%
8
));
buf
[
i
/
8
]
=
buf
[
i
/
8
]
|
(
0x1
<<
(
i
%
8
));
}
}
printf
(
"balloc: write bitmap block at sector %
d
\n
"
,
ninodes
/
IPB
+
3
);
printf
(
"balloc: write bitmap block at sector %
lu
\n
"
,
ninodes
/
IPB
+
3
);
wsect
(
ninodes
/
IPB
+
3
,
buf
);
wsect
(
ninodes
/
IPB
+
3
,
buf
);
}
}
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论