Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
4638cabf
提交
4638cabf
8月 29, 2017
创建
作者:
Robert Morris
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix runoff complaints about pagination and long lines
上级
164f4bae
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
25 行增加
和
33 行删除
+25
-33
README
README
+10
-16
elf.h
elf.h
+0
-3
file.h
file.h
+0
-3
fs.c
fs.c
+2
-2
kalloc.c
kalloc.c
+0
-1
lapic.c
lapic.c
+1
-1
main.c
main.c
+4
-0
mmu.h
mmu.h
+0
-1
proc.c
proc.c
+2
-2
trap.c
trap.c
+4
-3
vm.c
vm.c
+2
-1
没有找到文件。
README
浏览文件 @
4638cabf
...
...
@@ -34,22 +34,16 @@ Copyright 2006-2016 Frans Kaashoek, Robert Morris, and Russ Cox.
ERROR REPORTS
If you spot errors or have suggestions for improvement, please send email to
Frans Kaashoek and Robert Morris (kaashoek,rtm@csail.mit.edu). If you have
suggestions for improvements, please keep in mind that the main purpose of xv6
is as a teaching operating system for MIT's 6.828. For example, we are in
particular interested in simplifications and clarifications, instead of
suggestions for new systems calls, more portability, etc.
Please send errors and suggestions to Frans Kaashoek and Robert Morris
(kaashoek,rtm@mit.edu). The main purpose of xv6 is as a teaching
operating system for MIT's 6.828, so we are more interested in
simplifications and clarifications than new features.
BUILDING AND RUNNING XV6
To build xv6 on an x86 ELF machine (like Linux or FreeBSD), run "make".
On non-x86 or non-ELF machines (like OS X, even on x86), you will
need to install a cross-compiler gcc suite capable of producing x86 ELF
binaries. See http://pdos.csail.mit.edu/6.828/2016/tools.html.
Then run "make TOOLPREFIX=i386-jos-elf-".
To run xv6, install the QEMU PC simulators. To run in QEMU, run "make qemu".
To create a typeset version of the code, run "make xv6.pdf". This
requires the "mpage" utility. See http://www.mesa.nl/pub/mpage/.
To build xv6 on an x86 ELF machine (like Linux or FreeBSD), run
"make". On non-x86 or non-ELF machines (like OS X, even on x86), you
will need to install a cross-compiler gcc suite capable of producing
x86 ELF binaries. See http://pdos.csail.mit.edu/6.828/2016/tools.html.
Then run "make TOOLPREFIX=i386-jos-elf-". Now install the QEMU PC
simulator and run "make qemu".
elf.h
浏览文件 @
4638cabf
...
...
@@ -40,6 +40,3 @@ struct proghdr {
#define ELF_PROG_FLAG_EXEC 1
#define ELF_PROG_FLAG_WRITE 2
#define ELF_PROG_FLAG_READ 4
//PAGEBREAK!
// Blank page.
file.h
浏览文件 @
4638cabf
...
...
@@ -35,6 +35,3 @@ struct devsw {
extern
struct
devsw
devsw
[];
#define CONSOLE 1
//PAGEBREAK!
// Blank page.
fs.c
浏览文件 @
4638cabf
...
...
@@ -155,12 +155,12 @@ bfree(int dev, uint b)
// have locked the inodes involved; this lets callers create
// multi-step atomic operations.
//
// The icache.lock spin-lock
defend
s the allocation of icache
// The icache.lock spin-lock
protect
s the allocation of icache
// entries. Since ip->ref indicates whether an entry is free,
// and ip->dev and ip->inum indicate which i-node an entry
// holds, one must hold icache.lock while using any of those fields.
//
// An ip->lock sleep-lock
defend
s all ip-> fields other than ref,
// An ip->lock sleep-lock
protect
s all ip-> fields other than ref,
// dev, and inum. One must hold ip->lock in order to
// read or write that inode's ip->valid, ip->size, ip->type, &c.
...
...
kalloc.c
浏览文件 @
4638cabf
...
...
@@ -51,7 +51,6 @@ freerange(void *vstart, void *vend)
for
(;
p
+
PGSIZE
<=
(
char
*
)
vend
;
p
+=
PGSIZE
)
kfree
(
p
);
}
//PAGEBREAK: 21
// Free the page of physical memory pointed at by v,
// which normally should have been returned by a
...
...
lapic.c
浏览文件 @
4638cabf
...
...
@@ -43,13 +43,13 @@
volatile
uint
*
lapic
;
// Initialized in mp.c
//PAGEBREAK!
static
void
lapicw
(
int
index
,
int
value
)
{
lapic
[
index
]
=
value
;
lapic
[
ID
];
// wait for write to finish, by reading
}
//PAGEBREAK!
void
lapicinit
(
void
)
...
...
main.c
浏览文件 @
4638cabf
...
...
@@ -110,3 +110,7 @@ pde_t entrypgdir[NPDENTRIES] = {
//PAGEBREAK!
// Blank page.
//PAGEBREAK!
// Blank page.
//PAGEBREAK!
// Blank page.
mmu.h
浏览文件 @
4638cabf
...
...
@@ -49,7 +49,6 @@
// cpu->gdt[NSEGS] holds the above segments.
#define NSEGS 6
//PAGEBREAK!
#ifndef __ASSEMBLER__
// Segment Descriptor
struct
segdesc
{
...
...
proc.c
浏览文件 @
4638cabf
...
...
@@ -32,8 +32,8 @@ cpuid() {
return
mycpu
()
-
cpus
;
}
// Must be called with interrupts disabled to avoid the caller being
rescheduled
// between reading lapicid and running through the loop.
// Must be called with interrupts disabled to avoid the caller being
//
rescheduled
between reading lapicid and running through the loop.
struct
cpu
*
mycpu
(
void
)
{
...
...
trap.c
浏览文件 @
4638cabf
...
...
@@ -89,8 +89,8 @@ trap(struct trapframe *tf)
// In user space, assume process misbehaved.
cprintf
(
"pid %d %s: trap %d err %d on cpu %d "
"eip 0x%x addr 0x%x--kill proc
\n
"
,
myproc
()
->
pid
,
myproc
()
->
name
,
tf
->
trapno
,
tf
->
err
,
cpuid
(),
tf
->
eip
,
rcr2
());
myproc
()
->
pid
,
myproc
()
->
name
,
tf
->
trapno
,
tf
->
err
,
cpuid
(),
tf
->
eip
,
rcr2
());
myproc
()
->
killed
=
1
;
}
...
...
@@ -102,7 +102,8 @@ trap(struct trapframe *tf)
// Force process to give up CPU on clock tick.
// If interrupts were on while locks held, would need to check nlock.
if
(
myproc
()
&&
myproc
()
->
state
==
RUNNING
&&
tf
->
trapno
==
T_IRQ0
+
IRQ_TIMER
)
if
(
myproc
()
&&
myproc
()
->
state
==
RUNNING
&&
tf
->
trapno
==
T_IRQ0
+
IRQ_TIMER
)
yield
();
// Check if the process has been killed since we yielded
...
...
vm.c
浏览文件 @
4638cabf
...
...
@@ -164,7 +164,8 @@ switchuvm(struct proc *p)
panic
(
"switchuvm: no pgdir"
);
pushcli
();
mycpu
()
->
gdt
[
SEG_TSS
]
=
SEG16
(
STS_T32A
,
&
mycpu
()
->
ts
,
sizeof
(
mycpu
()
->
ts
)
-
1
,
0
);
mycpu
()
->
gdt
[
SEG_TSS
]
=
SEG16
(
STS_T32A
,
&
mycpu
()
->
ts
,
sizeof
(
mycpu
()
->
ts
)
-
1
,
0
);
mycpu
()
->
gdt
[
SEG_TSS
].
s
=
0
;
mycpu
()
->
ts
.
ss0
=
SEG_KDATA
<<
3
;
mycpu
()
->
ts
.
esp0
=
(
uint
)
p
->
kstack
+
KSTACKSIZE
;
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论