Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
c54c7926
提交
c54c7926
7月 17, 2006
创建
作者:
rsc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
nitpicks
上级
564f787e
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
29 行增加
和
32 行删除
+29
-32
console.c
console.c
+5
-5
defs.h
defs.h
+2
-2
fd.c
fd.c
+2
-2
kalloc.c
kalloc.c
+1
-1
lapic.c
lapic.c
+2
-2
mp.c
mp.c
+2
-2
proc.c
proc.c
+1
-1
trap.c
trap.c
+4
-4
user1.c
user1.c
+1
-1
userfs.c
userfs.c
+1
-1
usertests.c
usertests.c
+8
-11
没有找到文件。
console.c
浏览文件 @
c54c7926
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
#include "spinlock.h"
#include "spinlock.h"
struct
spinlock
console_lock
;
struct
spinlock
console_lock
;
int
paniced
=
0
;
int
panic
k
ed
=
0
;
int
use_console_lock
=
0
;
int
use_console_lock
=
0
;
/*
/*
...
@@ -31,9 +31,9 @@ real_cons_putc(int c)
...
@@ -31,9 +31,9 @@ real_cons_putc(int c)
unsigned
short
*
crt
=
(
unsigned
short
*
)
0xB8000
;
// base of CGA memory
unsigned
short
*
crt
=
(
unsigned
short
*
)
0xB8000
;
// base of CGA memory
int
ind
;
int
ind
;
if
(
paniced
){
if
(
panic
k
ed
){
cli
();
cli
();
while
(
1
)
for
(;;
)
;
;
}
}
...
@@ -161,7 +161,7 @@ panic(char *s)
...
@@ -161,7 +161,7 @@ panic(char *s)
cprintf
(
"panic: "
);
cprintf
(
"panic: "
);
cprintf
(
s
,
0
);
cprintf
(
s
,
0
);
cprintf
(
"
\n
"
,
0
);
cprintf
(
"
\n
"
,
0
);
paniced
=
1
;
// freeze other CPU
panic
k
ed
=
1
;
// freeze other CPU
while
(
1
)
for
(;;
)
;
;
}
}
defs.h
浏览文件 @
c54c7926
...
@@ -79,8 +79,8 @@ int pipe_write(struct pipe *p, char *addr, int n);
...
@@ -79,8 +79,8 @@ int pipe_write(struct pipe *p, char *addr, int n);
int
pipe_read
(
struct
pipe
*
p
,
char
*
addr
,
int
n
);
int
pipe_read
(
struct
pipe
*
p
,
char
*
addr
,
int
n
);
// fd.c
// fd.c
int
fd_ualloc
();
int
fd_ualloc
(
void
);
struct
fd
*
fd_alloc
();
struct
fd
*
fd_alloc
(
void
);
void
fd_close
(
struct
fd
*
);
void
fd_close
(
struct
fd
*
);
int
fd_read
(
struct
fd
*
fd
,
char
*
addr
,
int
n
);
int
fd_read
(
struct
fd
*
fd
,
char
*
addr
,
int
n
);
int
fd_write
(
struct
fd
*
fd
,
char
*
addr
,
int
n
);
int
fd_write
(
struct
fd
*
fd
,
char
*
addr
,
int
n
);
...
...
fd.c
浏览文件 @
c54c7926
...
@@ -15,7 +15,7 @@ struct fd fds[NFD];
...
@@ -15,7 +15,7 @@ struct fd fds[NFD];
* allocate a file descriptor number for curproc.
* allocate a file descriptor number for curproc.
*/
*/
int
int
fd_ualloc
()
fd_ualloc
(
void
)
{
{
int
fd
;
int
fd
;
struct
proc
*
p
=
curproc
[
cpu
()];
struct
proc
*
p
=
curproc
[
cpu
()];
...
@@ -29,7 +29,7 @@ fd_ualloc()
...
@@ -29,7 +29,7 @@ fd_ualloc()
* allocate a file descriptor structure
* allocate a file descriptor structure
*/
*/
struct
fd
*
struct
fd
*
fd_alloc
()
fd_alloc
(
void
)
{
{
int
i
;
int
i
;
...
...
kalloc.c
浏览文件 @
c54c7926
...
@@ -23,7 +23,7 @@ struct run {
...
@@ -23,7 +23,7 @@ struct run {
};
};
struct
run
*
freelist
;
struct
run
*
freelist
;
void
ktest
();
void
ktest
(
void
);
/*
/*
* initialize free list of physical pages. this code
* initialize free list of physical pages. this code
...
...
lapic.c
浏览文件 @
c54c7926
...
@@ -108,7 +108,7 @@ lapic_write(int r, int data)
...
@@ -108,7 +108,7 @@ lapic_write(int r, int data)
void
void
lapic_timerinit
()
lapic_timerinit
(
void
)
{
{
cprintf
(
"%d: init timer
\n
"
,
cpu
());
cprintf
(
"%d: init timer
\n
"
,
cpu
());
lapic_write
(
LAPIC_TDCR
,
LAPIC_X1
);
lapic_write
(
LAPIC_TDCR
,
LAPIC_X1
);
...
@@ -118,7 +118,7 @@ lapic_timerinit()
...
@@ -118,7 +118,7 @@ lapic_timerinit()
}
}
void
void
lapic_timerintr
()
lapic_timerintr
(
void
)
{
{
cprintf
(
"%d: timer interrupt!
\n
"
,
cpu
());
cprintf
(
"%d: timer interrupt!
\n
"
,
cpu
());
lapic_write
(
LAPIC_EOI
,
0
);
lapic_write
(
LAPIC_EOI
,
0
);
...
...
mp.c
浏览文件 @
c54c7926
...
@@ -117,7 +117,7 @@ mp_detect(void)
...
@@ -117,7 +117,7 @@ mp_detect(void)
}
}
void
void
mp_init
()
mp_init
(
void
)
{
{
int
r
;
int
r
;
uint8_t
*
p
,
*
e
;
uint8_t
*
p
,
*
e
;
...
@@ -193,7 +193,7 @@ mp_bcpu(void)
...
@@ -193,7 +193,7 @@ mp_bcpu(void)
extern
void
mpmain
(
void
);
extern
void
mpmain
(
void
);
void
void
mp_startthem
()
mp_startthem
(
void
)
{
{
extern
uint8_t
_binary_bootother_start
[],
_binary_bootother_size
[];
extern
uint8_t
_binary_bootother_start
[],
_binary_bootother_size
[];
extern
int
main
();
extern
int
main
();
...
...
proc.c
浏览文件 @
c54c7926
...
@@ -311,7 +311,7 @@ proc_kill(int pid)
...
@@ -311,7 +311,7 @@ proc_kill(int pid)
// Exited processes remain in the zombie state
// Exited processes remain in the zombie state
// until their parent calls wait() to find out they exited.
// until their parent calls wait() to find out they exited.
void
void
proc_exit
()
proc_exit
(
void
)
{
{
struct
proc
*
p
;
struct
proc
*
p
;
struct
proc
*
cp
=
curproc
[
cpu
()];
struct
proc
*
cp
=
curproc
[
cpu
()];
...
...
trap.c
浏览文件 @
c54c7926
...
@@ -10,11 +10,11 @@
...
@@ -10,11 +10,11 @@
struct
Gatedesc
idt
[
256
];
struct
Gatedesc
idt
[
256
];
extern
unsigned
vectors
[];
/* vectors.S, array of 256 entry point addresses */
extern
unsigned
vectors
[];
/* vectors.S, array of 256 entry point addresses */
extern
void
trapenter
();
extern
void
trapenter
(
void
);
extern
void
trapenter1
();
extern
void
trapenter1
(
void
);
void
void
tvinit
()
tvinit
(
void
)
{
{
int
i
;
int
i
;
...
@@ -25,7 +25,7 @@ tvinit()
...
@@ -25,7 +25,7 @@ tvinit()
}
}
void
void
idtinit
()
idtinit
(
void
)
{
{
lidt
(
idt
,
sizeof
idt
);
lidt
(
idt
,
sizeof
idt
);
}
}
...
...
user1.c
浏览文件 @
c54c7926
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
char
buf
[
32
];
char
buf
[
32
];
int
int
main
()
main
(
void
)
{
{
int
pid
,
fds
[
2
],
n
;
int
pid
,
fds
[
2
],
n
;
...
...
userfs.c
浏览文件 @
c54c7926
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
char
buf
[
1024
];
char
buf
[
1024
];
int
int
main
()
main
(
void
)
{
{
puts
(
"userfs running
\n
"
);
puts
(
"userfs running
\n
"
);
block
();
block
();
...
...
usertests.c
浏览文件 @
c54c7926
...
@@ -5,7 +5,7 @@ char buf[2048];
...
@@ -5,7 +5,7 @@ char buf[2048];
// simple fork and pipe read/write
// simple fork and pipe read/write
void
void
pipe1
()
pipe1
(
void
)
{
{
int
fds
[
2
],
pid
;
int
fds
[
2
],
pid
;
int
seq
=
0
,
i
,
n
,
cc
,
total
;
int
seq
=
0
,
i
,
n
,
cc
,
total
;
...
@@ -27,10 +27,7 @@ pipe1()
...
@@ -27,10 +27,7 @@ pipe1()
close
(
fds
[
1
]);
close
(
fds
[
1
]);
total
=
0
;
total
=
0
;
cc
=
1
;
cc
=
1
;
while
(
1
){
while
((
n
=
read
(
fds
[
0
],
buf
,
cc
))
>
0
){
n
=
read
(
fds
[
0
],
buf
,
cc
);
if
(
n
<
1
)
break
;
for
(
i
=
0
;
i
<
n
;
i
++
){
for
(
i
=
0
;
i
<
n
;
i
++
){
if
((
buf
[
i
]
&
0xff
)
!=
(
seq
++
&
0xff
)){
if
((
buf
[
i
]
&
0xff
)
!=
(
seq
++
&
0xff
)){
panic
(
"pipe1 oops 2
\n
"
);
panic
(
"pipe1 oops 2
\n
"
);
...
@@ -52,19 +49,19 @@ pipe1()
...
@@ -52,19 +49,19 @@ pipe1()
// meant to be run w/ at most two CPUs
// meant to be run w/ at most two CPUs
void
void
preempt
()
preempt
(
void
)
{
{
int
pid1
,
pid2
,
pid3
;
int
pid1
,
pid2
,
pid3
;
int
pfds
[
2
];
int
pfds
[
2
];
pid1
=
fork
();
pid1
=
fork
();
if
(
pid1
==
0
)
if
(
pid1
==
0
)
while
(
1
)
for
(;;
)
;
;
pid2
=
fork
();
pid2
=
fork
();
if
(
pid2
==
0
)
if
(
pid2
==
0
)
while
(
1
)
for
(;;
)
;
;
pipe
(
pfds
);
pipe
(
pfds
);
...
@@ -74,7 +71,7 @@ preempt()
...
@@ -74,7 +71,7 @@ preempt()
if
(
write
(
pfds
[
1
],
"x"
,
1
)
!=
1
)
if
(
write
(
pfds
[
1
],
"x"
,
1
)
!=
1
)
panic
(
"preempt write error"
);
panic
(
"preempt write error"
);
close
(
pfds
[
1
]);
close
(
pfds
[
1
]);
while
(
1
)
for
(;;
)
;
;
}
}
...
@@ -95,7 +92,7 @@ preempt()
...
@@ -95,7 +92,7 @@ preempt()
// try to find any races between exit and wait
// try to find any races between exit and wait
void
void
exitwait
()
exitwait
(
void
)
{
{
int
i
,
pid
;
int
i
,
pid
;
...
@@ -118,7 +115,7 @@ exitwait()
...
@@ -118,7 +115,7 @@ exitwait()
}
}
int
int
main
()
main
(
void
)
{
{
puts
(
"usertests starting
\n
"
);
puts
(
"usertests starting
\n
"
);
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论