Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
00d05f0d
提交
00d05f0d
2月 29, 2012
创建
作者:
Silas Boyd-Wickizer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
A hokey cilk abort -- enough to abort exec
上级
b589989b
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
37 行增加
和
17 行删除
+37
-17
kernel.hh
include/kernel.hh
+8
-6
proc.hh
include/proc.hh
+1
-0
cilk.cc
kernel/cilk.cc
+20
-5
exec.cc
kernel/exec.cc
+8
-6
没有找到文件。
include/kernel.hh
浏览文件 @
00d05f0d
...
...
@@ -263,23 +263,25 @@ struct work * allocwork(void);
void
freework
(
struct
work
*
w
);
// cilk.c
void
initcilkframe
(
struct
cilkframe
*
);
#if CILKENABLE
void
cilk_push
(
void
(
*
fn
)(
uptr
,
uptr
),
u64
arg0
,
u64
arg1
);
void
cilk_start
(
void
);
void
cilk_end
(
void
);
u64
cilk_end
(
void
);
void
cilk_dump
(
void
);
int
cilk_trywork
(
void
);
void
initcilkframe
(
struct
cilkframe
*
wq
);
void
cilk_abort
(
u64
val
);
#else
#define cilk_push(rip, arg0, arg1) do { \
void (*fn)(uptr, uptr) = rip; \
fn(arg0, arg1); \
} while(0)
#define cilk_start() do { } while(0)
#define cilk_end() do { } while(0)
#define cilk_end() (myproc()->cilkframe.abort)
#define cilk_dump() do { } while(0)
#define cilk_trywork() 0
#define initcilkframe(x) do { } while (0)
#define cilk_abort(val) do { \
cmpxch(&myproc()->cilkframe.abort, (u64)0, (u64)val); \
} while (0)
#endif
// other exported/imported functions
...
...
include/proc.hh
浏览文件 @
00d05f0d
...
...
@@ -19,6 +19,7 @@ struct context {
// Work queue frame
struct
cilkframe
{
volatile
std
::
atomic
<
u64
>
ref
;
volatile
std
::
atomic
<
u64
>
abort
;
};
// Per-process, per-stack meta data for mtrace
...
...
kernel/cilk.cc
浏览文件 @
00d05f0d
...
...
@@ -24,7 +24,6 @@
// cprintf("%c %c\n", arg[0], arg[1]);
// }
#if CILKENABLE
#include "types.h"
#include "kernel.hh"
#include "amd64.h"
...
...
@@ -34,6 +33,8 @@
#include "condvar.h"
#include "queue.h"
#include "proc.hh"
#if CILKENABLE
#include "mtrace.h"
#include "wq.hh"
#include "percpu.hh"
...
...
@@ -62,7 +63,8 @@ __cilk_run(struct work *w, void *xfn, void *arg0, void *arg1, void *xframe)
stat
->
steal
++
;
mycpu
()
->
cilkframe
=
frame
;
fn
((
uptr
)
arg0
,
(
uptr
)
arg1
);
if
(
frame
->
abort
==
0
)
fn
((
uptr
)
arg0
,
(
uptr
)
arg1
);
mycpu
()
->
cilkframe
=
old
;
frame
->
ref
--
;
}
...
...
@@ -110,14 +112,26 @@ cilk_start(void)
// End of the current work queue frame.
// The core works while the reference count of the current
// work queue frame is not 0.
void
u64
cilk_end
(
void
)
{
u64
r
;
while
(
cilk_frame
()
->
ref
!=
0
)
wq_trywork
();
r
=
cilk_frame
()
->
abort
;
mycpu
()
->
cilkframe
=
0
;
popcli
();
return
r
;
}
void
cilk_abort
(
u64
val
)
{
cmpxch
(
&
cilk_frame
()
->
abort
,
(
u64
)
0
,
val
);
}
void
...
...
@@ -161,10 +175,11 @@ testcilk(void)
}
popcli
();
}
#endif // CILKENABLE
void
initcilkframe
(
struct
cilkframe
*
cilk
)
{
memset
(
cilk
,
0
,
sizeof
(
*
cilk
));
cilk
->
ref
=
0
;
cilk
->
abort
=
0
;
}
#endif // CILKENABLE
kernel/exec.cc
浏览文件 @
00d05f0d
...
...
@@ -65,10 +65,10 @@ dosegment(uptr a0, u64 a1)
}
bad:
panic
(
"dosegment: Oops"
);
cilk_abort
(
-
1
);
}
static
void
dostack
(
uptr
a0
,
u64
a1
)
static
void
__attribute__
((
unused
))
dostack
(
uptr
a0
,
u64
a1
)
{
struct
vmnode
*
vmn
=
nullptr
;
struct
eargs
*
args
=
(
eargs
*
)
a0
;
...
...
@@ -112,16 +112,17 @@ static void dostack(uptr a0, u64 a1)
last
=
s
+
1
;
safestrcpy
(
args
->
proc
->
name
,
last
,
sizeof
(
args
->
proc
->
name
));
// XXX(sbw) Oops, don't want to do this, unless we have abort
args
->
proc
->
tf
->
rsp
=
sp
;
prof_end
(
dostack_prof
);
return
;
bad:
panic
(
"dostack: Oops"
);
cilk_abort
(
-
1
);
}
static
void
doheap
(
uptr
a0
,
u64
a1
)
static
void
__attribute__
((
unused
))
doheap
(
uptr
a0
,
u64
a1
)
{
struct
vmnode
*
vmn
=
nullptr
;
struct
eargs
*
args
=
(
eargs
*
)
a0
;
...
...
@@ -138,7 +139,7 @@ static void doheap(uptr a0, u64 a1)
return
;
bad:
panic
(
"doheap: Oops"
);
cilk_abort
(
-
1
);
}
int
...
...
@@ -204,7 +205,8 @@ exec(const char *path, char **argv)
//cilk_push(dostack, (uptr)&args, (uptr)0);
dostack
((
uptr
)
&
args
,
(
uptr
)
0
);
cilk_end
();
if
(
cilk_end
())
goto
bad
;
// Commit to the user image.
oldvmap
=
myproc
()
->
vmap
;
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论