Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
2391829d
提交
2391829d
3月 25, 2012
创建
作者:
Frans Kaashoek
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'scale-amd64' of
ssh://amsterdam.csail.mit.edu/home/am0/6.828/xv6
into scale-amd64
上级
747717be
431d5f17
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
88 行增加
和
37 行删除
+88
-37
mktree.cc
bin/mktree.cc
+1
-1
filetable.hh
include/filetable.hh
+1
-0
kernel.hh
include/kernel.hh
+0
-1
proc.hh
include/proc.hh
+15
-7
exec.cc
kernel/exec.cc
+0
-1
proc.cc
kernel/proc.cc
+18
-12
sysfile.cc
kernel/sysfile.cc
+1
-2
sysproc.cc
kernel/sysproc.cc
+1
-1
uwq.cc
kernel/uwq.cc
+4
-3
printf.cc
lib/printf.cc
+45
-7
param.h
param.h
+2
-2
没有找到文件。
bin/mktree.cc
浏览文件 @
2391829d
...
...
@@ -12,7 +12,7 @@ dolevel(int fd, int depth)
{
if
(
depth
>
0
)
{
int
it
=
0
;
wq_for
_serial
<
int
>
(
it
,
wq_for
<
int
>
(
it
,
[](
int
&
it
)
->
bool
{
return
it
<
branch
;
},
[
&
fd
,
&
depth
](
int
i
)
->
void
{
...
...
include/filetable.hh
浏览文件 @
2391829d
...
...
@@ -54,6 +54,7 @@ public:
}
}
release
(
&
lock_
);
cprintf
(
"filetable::allocfd: failed
\n
"
);
return
-
1
;
}
...
...
include/kernel.hh
浏览文件 @
2391829d
...
...
@@ -173,7 +173,6 @@ void finishproc(struct proc*);
void
exit
(
void
);
int
fork
(
int
);
int
growproc
(
int
);
int
kill
(
int
);
void
pinit
(
void
);
void
procdumpall
(
void
);
void
scheduler
(
void
)
__noret__
;
...
...
include/proc.hh
浏览文件 @
2391829d
...
...
@@ -41,7 +41,13 @@ struct mtrace_stacks {
};
#endif
enum
procstate
{
EMBRYO
,
SLEEPING
,
RUNNABLE
,
RUNNING
,
ZOMBIE
};
typedef
enum
procstate
{
EMBRYO
,
SLEEPING
,
RUNNABLE
,
RUNNING
,
ZOMBIE
}
procstate_t
;;
// Per-process state
struct
proc
:
public
rcu_freed
{
...
...
@@ -80,12 +86,14 @@ struct proc : public rcu_freed {
LIST_ENTRY
(
proc
)
cv_sleep
;
// Linked list of processes sleeping on a cv
u64
user_fs_
;
virtual
void
do_gc
(
void
)
{
delete
this
;
}
void
set_state
(
enum
procstate
s
);
enum
procstate
get_state
(
void
)
const
{
return
state_
;
}
int
set_cpu_pin
(
int
cpu
);
static
proc
*
alloc
();
void
set_state
(
procstate_t
s
);
procstate_t
get_state
(
void
)
const
{
return
state_
;
}
int
set_cpu_pin
(
int
cpu
);
static
int
kill
(
int
pid
);
int
kill
();
virtual
void
do_gc
(
void
)
{
delete
this
;
}
private
:
proc
(
int
npid
);
...
...
@@ -94,5 +102,5 @@ private:
proc
(
const
proc
&
x
);
NEW_DELETE_OPS
(
proc
);
enum
procstate
state_
;
// Process state
procstate_t
state_
;
// Process state
};
kernel/exec.cc
浏览文件 @
2391829d
...
...
@@ -15,7 +15,6 @@
#include "wq.hh"
#include "cilk.hh"
#define USTACKPAGES 2
#define BRK (USERTOP >> 1)
struct
eargs
{
...
...
kernel/proc.cc
浏览文件 @
2391829d
...
...
@@ -264,18 +264,11 @@ initproc(void)
// Process won't exit until it returns
// to user space (see trap in trap.c).
int
kill
(
int
p
id
)
proc
::
kill
(
vo
id
)
{
struct
proc
*
p
;
p
=
xnspid
->
lookup
(
pid
);
if
(
p
==
0
)
{
panic
(
"kill"
);
return
-
1
;
}
acquire
(
&
p
->
lock
);
p
->
killed
=
1
;
if
(
p
->
get_state
()
==
SLEEPING
){
acquire
(
&
lock
);
killed
=
1
;
if
(
get_state
()
==
SLEEPING
)
{
// XXX
// we need to wake p up if it is cv_sleep()ing.
// can't change p from SLEEPING to RUNNABLE since that
...
...
@@ -287,10 +280,23 @@ kill(int pid)
// cv might be deallocated while we're using it
// (pipes dynamically allocate condvars).
}
release
(
&
p
->
lock
);
release
(
&
lock
);
return
0
;
}
int
proc
::
kill
(
int
pid
)
{
struct
proc
*
p
;
p
=
xnspid
->
lookup
(
pid
);
if
(
p
==
0
)
{
panic
(
"kill"
);
return
-
1
;
}
return
p
->
kill
();
}
// Print a process listing to console. For debugging.
// Runs when user types ^P on console.
// No lock to avoid wedging a stuck machine further.
...
...
kernel/sysfile.cc
浏览文件 @
2391829d
...
...
@@ -275,9 +275,8 @@ sys_openat(int dirfd, const char *path, int omode)
if
(
dirfd
==
AT_FDCWD
)
{
cwd
=
myproc
()
->
cwd
;
}
else
if
(
dirfd
<
0
||
dirfd
>=
NOFILE
)
{
return
-
1
;
}
else
{
// XXX(sbw) do we need the sref while we touch fdir->ip?
sref
<
file
>
fdir
;
if
(
!
getfile
(
dirfd
,
&
fdir
)
||
fdir
->
type
!=
file
::
FD_INODE
)
return
-
1
;
...
...
kernel/sysproc.cc
浏览文件 @
2391829d
...
...
@@ -33,7 +33,7 @@ sys_wait(void)
long
sys_kill
(
int
pid
)
{
return
kill
(
pid
);
return
proc
::
kill
(
pid
);
}
long
...
...
kernel/uwq.cc
浏览文件 @
2391829d
...
...
@@ -277,18 +277,19 @@ uwq::allocworker(void)
p
->
ftable
=
ftable_
;
struct
vmnode
*
vmn
;
if
((
vmn
=
new
vmnode
(
U
WQ
STACKPAGES
))
==
nullptr
)
{
if
((
vmn
=
new
vmnode
(
USTACKPAGES
))
==
nullptr
)
{
finishproc
(
p
);
return
nullptr
;
}
uptr
stacktop
=
ustack_
+
(
U
WQ
STACKPAGES
*
PGSIZE
);
uptr
stacktop
=
ustack_
+
(
USTACKPAGES
*
PGSIZE
);
if
(
vmap_
->
insert
(
vmn
,
ustack_
,
1
)
<
0
)
{
delete
vmn
;
finishproc
(
p
);
return
nullptr
;
}
ustack_
+=
(
UWQSTACKPAGES
*
PGSIZE
);
// Include a bumper page
ustack_
+=
(
USTACKPAGES
*
PGSIZE
)
+
PGSIZE
;
p
->
tf
->
rsp
=
stacktop
-
8
;
p
->
tf
->
rip
=
uentry
;
...
...
lib/printf.cc
浏览文件 @
2391829d
...
...
@@ -3,33 +3,67 @@
#include "user.h"
#include <stdarg.h>
#include "fmt.hh"
#include "lib.h"
struct
outbuf
{
char
b
[
128
];
int
n
;
int
fd
;
};
static
void
flushoutbuf
(
struct
outbuf
*
b
)
{
int
i
=
0
;
int
r
;
while
(
b
->
n
!=
0
)
{
r
=
write
(
b
->
fd
,
&
b
->
b
[
i
],
b
->
n
);
if
(
r
==
0
||
r
<
0
)
{
b
->
n
=
0
;
}
else
{
b
->
n
-=
r
;
i
+=
r
;
}
}
}
// Print to the given fd.
static
void
write
c
(
int
c
,
void
*
arg
)
write
outbuf
(
int
c
,
void
*
arg
)
{
int
fd
=
(
int
)
(
u64
)
arg
;
write
(
fd
,
&
c
,
1
);
struct
outbuf
*
b
=
(
struct
outbuf
*
)
arg
;
if
(
b
->
n
==
NELEM
(
b
->
b
))
flushoutbuf
(
b
);
b
->
b
[
b
->
n
]
=
c
;
b
->
n
++
;
}
void
fprintf
(
int
fd
,
const
char
*
fmt
,
...)
{
struct
outbuf
b
;
va_list
ap
;
b
.
n
=
0
;
b
.
fd
=
fd
;
va_start
(
ap
,
fmt
);
vprintfmt
(
write
c
,
(
void
*
)
(
u64
)
fd
,
fmt
,
ap
);
vprintfmt
(
write
outbuf
,
(
void
*
)
&
b
,
fmt
,
ap
);
va_end
(
ap
);
flushoutbuf
(
&
b
);
}
void
printf
(
const
char
*
fmt
,
...)
{
struct
outbuf
b
;
va_list
ap
;
b
.
n
=
0
;
b
.
fd
=
1
;
va_start
(
ap
,
fmt
);
vprintfmt
(
write
c
,
(
void
*
)
1
,
fmt
,
ap
);
vprintfmt
(
write
outbuf
,
(
void
*
)
&
b
,
fmt
,
ap
);
va_end
(
ap
);
flushoutbuf
(
&
b
);
}
// Print to a buffer.
...
...
@@ -69,11 +103,15 @@ snprintf(char *buf, u32 n, const char *fmt, ...)
void
__attribute__
((
noreturn
))
die
(
const
char
*
errstr
,
...)
{
struct
outbuf
b
;
va_list
ap
;
b
.
n
=
0
;
b
.
fd
=
2
;
va_start
(
ap
,
errstr
);
vprintfmt
(
write
c
,
(
void
*
)
(
u64
)
1
,
errstr
,
ap
);
vprintfmt
(
write
outbuf
,
(
void
*
)
&
b
,
errstr
,
ap
);
va_end
(
ap
);
flushoutbuf
(
&
b
);
fprintf
(
2
,
"
\n
"
);
exit
();
}
param.h
浏览文件 @
2391829d
...
...
@@ -2,7 +2,7 @@
#define DEBUG 0
#define NPROC 64 // maximum number of processes
#define KSTACKSIZE 8192 // size of per-process kernel stack
#define NOFILE
16
// open files per process
#define NOFILE
64
// open files per process
#define NFILE 100 // open files per system
#define NBUF 10000 // size of disk block cache
#define NINODE 5000 // maximum number of active i-nodes
...
...
@@ -24,7 +24,7 @@
#define ALLOC_MEMSET DEBUG
#define KSHAREDSIZE (32 << 10)
#define USERWQSIZE (1 << 14)
#define U
WQSTACKPAGES 2
#define U
STACKPAGES 4
#define WQSHIFT 7
#define CILKENABLE 0
#if defined(HW_josmp)
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论