Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
8e1d1ec9
提交
8e1d1ec9
9月 08, 2006
创建
作者:
kaashoek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
some comment changes
上级
50f88503
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
15 行增加
和
16 行删除
+15
-16
bootasm.S
bootasm.S
+1
-1
buf.h
buf.h
+2
-2
fs.c
fs.c
+1
-1
init.c
init.c
+2
-2
kalloc.c
kalloc.c
+1
-1
main.c
main.c
+2
-2
spinlock.c
spinlock.c
+6
-7
没有找到文件。
bootasm.S
浏览文件 @
8e1d1ec9
...
...
@@ -5,7 +5,7 @@
.set CR0_PE_ON,0x1 # protected mode enable flag
#########################################################################
# ENTRY POINT
# ENTRY POINT
for the bootstrap processor
# This code should be stored in the first sector of the hard disk.
# After the BIOS initializes the hardware on startup or system reset,
# it loads this code at physical address 0x7c00 - 0x7d00 (512 bytes).
...
...
buf.h
浏览文件 @
8e1d1ec9
...
...
@@ -6,5 +6,5 @@ struct buf {
struct
buf
*
next
;
uchar
data
[
512
];
};
#define B_BUSY 0x1
#define B_VALID 0x2
#define B_BUSY 0x1
// buffer is locked by some process
#define B_VALID 0x2
// buffer contains the data of the sector
fs.c
浏览文件 @
8e1d1ec9
...
...
@@ -160,7 +160,7 @@ iget(uint dev, uint inum)
return
nip
;
}
// Copy i
p->d
, which has changed, to disk.
// Copy i
node in memory
, which has changed, to disk.
// Caller must have locked ip.
void
iupdate
(
struct
inode
*
ip
)
...
...
init.c
浏览文件 @
8e1d1ec9
...
...
@@ -17,8 +17,8 @@ main(void)
mknod
(
"console"
,
T_DEV
,
1
,
1
);
open
(
"console"
,
O_RDWR
);
}
dup
(
0
);
dup
(
0
);
dup
(
0
);
// stdout
dup
(
0
);
// stderr
for
(;;){
pid
=
fork
();
...
...
kalloc.c
浏览文件 @
8e1d1ec9
...
...
@@ -35,7 +35,7 @@ kinit(void)
initlock
(
&
kalloc_lock
,
"kalloc"
);
start
=
(
char
*
)
&
end
;
start
=
(
char
*
)
(((
uint
)
start
+
PAGE
)
&
~
(
PAGE
-
1
));
mem
=
256
;
// assume 256 pages of RAM
mem
=
256
;
// assume
computer has
256 pages of RAM
cprintf
(
"mem = %d
\n
"
,
mem
*
PAGE
);
kfree
(
start
,
mem
*
PAGE
);
}
...
...
main.c
浏览文件 @
8e1d1ec9
...
...
@@ -15,7 +15,7 @@ extern uchar _binary__init_start[], _binary__init_size[];
void
process0
();
//
CPU 0
starts running C code here.
//
Bootstrap processor
starts running C code here.
// This is called main0 not main so that it can have
// a void return type. Gcc can't handle functions named
// main that don't return int. Really.
...
...
@@ -28,7 +28,7 @@ main0(void)
// clear BSS
memset
(
edata
,
0
,
end
-
edata
);
// switch to
cpu0's cpu
stack
// switch to
bootstrap processor's
stack
asm
volatile
(
"movl %0, %%esp"
:
:
"r"
(
cpus
[
0
].
mpstack
+
MPSTACK
-
32
));
asm
volatile
(
"movl %0, %%ebp"
:
:
"r"
(
cpus
[
0
].
mpstack
+
MPSTACK
));
...
...
spinlock.c
浏览文件 @
8e1d1ec9
...
...
@@ -51,10 +51,9 @@ acquire(struct spinlock *lock)
while
(
cmpxchg
(
0
,
1
,
&
lock
->
locked
)
==
1
)
;
// Now that lock is acquired, make sure
// we wait for all pending writes from other
// processors.
cpuid
(
0
,
0
,
0
,
0
,
0
);
// memory barrier
// Serialize instructions: now that lock is acquired, make sure
// we wait for all pending writes from other processors.
cpuid
(
0
,
0
,
0
,
0
,
0
);
// memory barrier (see Ch 7 of IA-32 manual, vol 3)
// Record info about lock acquisition for debugging.
// The +10 is only so that we can tell the difference
...
...
@@ -74,9 +73,9 @@ release(struct spinlock *lock)
lock
->
pcs
[
0
]
=
0
;
lock
->
cpu
=
0xffffffff
;
//
Before unlocking the lock, make sure to flush
// any pending memory writes from this processor.
cpuid
(
0
,
0
,
0
,
0
,
0
);
// memory barrier
//
Serialize instructions: before unlocking the lock, make sure
//
to flush
any pending memory writes from this processor.
cpuid
(
0
,
0
,
0
,
0
,
0
);
// memory barrier
(see Ch 7 of IA-32 manual, vol 3)
lock
->
locked
=
0
;
if
(
--
cpus
[
cpu
()].
nlock
==
0
)
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论