Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
567366af
提交
567366af
3月 31, 2012
创建
作者:
Nickolai Zeldovich
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'scale-amd64' of
git+ssh://pdos.csail.mit.edu/home/am0/6.828/xv6
into scale-amd64
Conflicts: kernel/exec.cc kernel/sysfile.cc
上级
2624d3d1
d4b35e51
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
38 行增加
和
58 行删除
+38
-58
cilk.hh
include/cilk.hh
+0
-32
exec.cc
kernel/exec.cc
+2
-1
syscall.cc
kernel/syscall.cc
+4
-13
sysfile.cc
kernel/sysfile.cc
+16
-10
uaccess.S
kernel/uaccess.S
+16
-2
没有找到文件。
include/cilk.hh
deleted
100644 → 0
浏览文件 @
2624d3d1
#if CILKENABLE
template
<
typename
A1
>
static
void
cilk_call
(
void
(
*
fn
)(
A1
),
A1
a1
)
{
cilk_push
((
void
(
*
)(
uptr
,
uptr
))
fn
,
(
uptr
)
a1
,
(
uptr
)
0
);
}
template
<
typename
A1
,
typename
A2
>
static
void
cilk_call
(
void
(
*
fn
)(
A1
,
A2
),
A1
a1
,
A2
a2
)
{
cilk_push
((
void
(
*
)(
uptr
,
uptr
))
fn
,
(
uptr
)
a1
,
(
uptr
)
a2
);
}
#else // !CILKENABLE
template
<
typename
A1
>
static
void
cilk_call
(
void
(
*
fn
)(
A1
),
A1
a1
)
{
fn
(
a1
);
}
template
<
typename
A1
,
typename
A2
>
static
void
cilk_call
(
void
(
*
fn
)(
A1
,
A2
),
A1
a1
,
A2
a2
)
{
fn
(
a1
,
a2
);
}
#endif
kernel/exec.cc
浏览文件 @
567366af
...
...
@@ -13,7 +13,7 @@
#include "elf.hh"
#include "cpu.hh"
#include "wq.hh"
#include "
cilk
.hh"
#include "
sperf
.hh"
#include "kmtrace.hh"
#define BRK (USERTOP >> 1)
...
...
@@ -152,6 +152,7 @@ exec_cleanup(vmap *oldvmap, uwq *olduwq)
int
exec
(
const
char
*
path
,
char
**
argv
,
void
*
ascopev
)
{
ANON_REGION
(
__func__
,
&
perfgroup
);
struct
inode
*
ip
=
nullptr
;
struct
vmap
*
vmp
=
nullptr
;
uwq
*
newuwq
=
nullptr
;
...
...
kernel/syscall.cc
浏览文件 @
567366af
...
...
@@ -11,6 +11,7 @@
#include "kmtrace.hh"
extern
"C"
int
__fetchstr
(
char
*
dst
,
const
char
*
usrc
,
unsigned
size
);
extern
"C"
int
__fetchint64
(
uptr
addr
,
u64
*
ip
);
int
fetchstr
(
char
*
dst
,
const
char
*
usrc
,
unsigned
size
)
...
...
@@ -20,22 +21,12 @@ fetchstr(char* dst, const char* usrc, unsigned size)
return
__fetchstr
(
dst
,
usrc
,
size
);
}
// User code makes a system call with INT T_SYSCALL.
// System call number in %eax.
// Arguments on the stack, from the user call to the C
// library system call function. The saved user %esp points
// to a saved program counter, and then the first argument.
// Fetch the int at addr from process p.
int
fetchint64
(
uptr
addr
,
u64
*
ip
)
{
if
(
pagefault
(
myproc
()
->
vmap
,
addr
,
0
)
<
0
)
return
-
1
;
if
(
pagefault
(
myproc
()
->
vmap
,
addr
+
sizeof
(
*
ip
)
-
1
,
0
)
<
0
)
return
-
1
;
*
ip
=
*
(
u64
*
)(
addr
);
return
0
;
if
(
mycpu
()
->
ncli
!=
0
)
panic
(
"fetchstr: cli'd"
);
return
__fetchint64
(
addr
,
ip
);
}
// Fetch the nul-terminated string at addr from process p.
...
...
kernel/sysfile.cc
浏览文件 @
567366af
...
...
@@ -423,10 +423,11 @@ long
sys_exec
(
const
char
*
upath
,
u64
uargv
)
{
ANON_REGION
(
__func__
,
&
perfgroup
);
static
const
int
len
=
32
;
char
*
argv
[
MAXARG
];
char
path
[
DIRSIZ
+
1
];
long
r
=
-
1
;
int
i
;
u64
uarg
;
if
(
fetchstr
(
path
,
upath
,
sizeof
(
path
))
<
0
)
return
-
1
;
...
...
@@ -435,19 +436,24 @@ sys_exec(const char *upath, u64 uargv)
memset
(
argv
,
0
,
sizeof
(
argv
));
for
(
i
=
0
;;
i
++
){
u64
uarg
;
if
(
i
>=
NELEM
(
argv
))
return
-
1
;
goto
clean
;
if
(
fetchint64
(
uargv
+
8
*
i
,
&
uarg
)
<
0
)
return
-
1
;
if
(
uarg
==
0
){
argv
[
i
]
=
0
;
goto
clean
;
if
(
uarg
==
0
)
break
;
}
argv
[
i
]
=
(
char
*
)
uarg
;
if
(
argcheckstr
(
argv
[
i
])
<
0
)
return
-
1
;
argv
[
i
]
=
(
char
*
)
kmalloc
(
len
,
"execbuf"
)
;
if
(
argv
[
i
]
==
nullptr
||
fetchstr
(
argv
[
i
],
(
char
*
)
uarg
,
len
)
<
0
)
goto
clean
;
}
return
exec
(
path
,
argv
,
&
ascope
);
argv
[
i
]
=
0
;
r
=
exec
(
path
,
argv
,
&
ascope
);
clean:
for
(
i
=
i
-
i
;
i
>=
0
;
i
--
)
kmfree
(
argv
[
i
],
len
);
return
r
;
}
long
...
...
kernel/uaccess.S
浏览文件 @
567366af
...
...
@@ -2,6 +2,20 @@
#include "asmdefines.h"
.code64
.globl __fetchint64
.align 8
// rdi user src
// rsi kernel dst
// We aren't allowed to touch rbx,rsp,rbp,r12-r15
__fetchint64:
mov %gs:0x8, %r11
movl $1, PROC_UACCESS(%r11)
mov (%rdi), %r10
mov %r10, (%rsi)
mov $0, %rax
jmp __fetch_end
.code64
.globl __fetchstr
.align 8
// rdi kernel dst
...
...
@@ -20,13 +34,13 @@ __fetchstr:
movb %r10b, (%rdi)
// Check for NULL
cmp $0, %r10b
je
done
je
2f
inc %rdi
inc %rsi
loop 1b
// Error
movq $-1, %rax
done:
2: // Done
jmp __fetch_end
.code64
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论