Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
93f8127a
提交
93f8127a
3月 06, 2012
创建
作者:
Silas Boyd-Wickizer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Start of wq for xv6 userspace
上级
920a2be3
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
114 行增加
和
9 行删除
+114
-9
Makefrag
bin/Makefrag
+2
-1
xls.cc
bin/xls.cc
+1
-0
uspinlock.h
include/uspinlock.h
+6
-0
wq.hh
include/wq.hh
+2
-1
wquser.hh
include/wquser.hh
+87
-1
Makefrag
lib/Makefrag
+1
-1
crt.S
lib/crt.S
+1
-0
ulib.c
lib/ulib.c
+12
-0
wq.cc
lib/wq.cc
+2
-3
wqlinux.hh
user/wqlinux.hh
+0
-2
没有找到文件。
bin/Makefrag
浏览文件 @
93f8127a
...
...
@@ -23,7 +23,8 @@ UPROGS= \
preadtest \
scripttest \
ftest \
perf
perf \
xls
# pdu
# pls
...
...
bin/xls.cc
浏览文件 @
93f8127a
...
...
@@ -21,6 +21,7 @@
#include "fs.h"
#include "lib.h"
#include "dirit.hh"
#include "wq.hh"
#define ST_SIZE(st) (st).size
#define ST_TYPE(st) (st).type
#define ST_INO(st) (st).ino
...
...
include/uspinlock.h
浏览文件 @
93f8127a
...
...
@@ -17,3 +17,9 @@ release(struct uspinlock *lk)
{
xchg32
(
&
lk
->
locked
,
0
);
}
static
int
inline
tryacquire
(
struct
uspinlock
*
lk
)
{
return
xchg32
(
&
lk
->
locked
,
1
)
==
0
;
}
include/wq.hh
浏览文件 @
93f8127a
...
...
@@ -38,7 +38,8 @@ struct cwork : public work {
#define xmalloc(n) kmalloc(n)
#define xfree(p, sz) kmfree(p, sz)
#else
#warning "Unknown wq implementation"
#define xmalloc(n) malloc(n)
#define xfree(p, sz) free(p)
#endif
#include "wqfor.hh"
include/wquser.hh
浏览文件 @
93f8127a
// XXX(sbw)
#include "types.h"
#include "uspinlock.h"
#include "amd64.h"
#include "user.h"
#include "wq.hh"
#include "pthread.h"
typedef
struct
uspinlock
wqlock_t
;
static
pthread_key_t
idkey
;
int
mycpuid
(
void
)
{
return
(
int
)(
u64
)
pthread_getspecific
(
idkey
);
}
static
inline
void
*
allocwq
(
void
)
{
return
malloc
(
WQSIZE
);
}
static
inline
void
wqlock_acquire
(
wqlock_t
*
lock
)
{
acquire
(
lock
);
}
static
inline
int
wqlock_tryacquire
(
wqlock_t
*
lock
)
{
return
tryacquire
(
lock
);
}
static
inline
void
wqlock_release
(
wqlock_t
*
lock
)
{
release
(
lock
);
}
static
inline
void
wqlock_init
(
wqlock_t
*
lock
)
{
lock
->
locked
=
0
;
}
static
void
setaffinity
(
int
c
)
{
// XXX(sbw)
}
static
void
*
workerth
(
void
*
x
)
{
u64
c
=
(
u64
)
x
;
setaffinity
(
c
);
pthread_setspecific
(
idkey
,
(
void
*
)
c
);
while
(
1
)
wq_trywork
();
return
0
;
}
static
inline
void
wqarch_init
(
void
)
{
pthread_t
th
;
int
r
;
if
(
pthread_key_create
(
&
idkey
,
0
))
die
(
"wqarch_init: pthread_key_create"
);
pthread_setspecific
(
idkey
,
0
);
setaffinity
(
0
);
for
(
int
i
=
1
;
i
<
NCPU
;
i
++
)
{
r
=
pthread_create
(
&
th
,
0
,
workerth
,
(
void
*
)(
u64
)
i
);
if
(
r
<
0
)
die
(
"wqarch_init: pthread_create"
);
}
}
#define xprintf printf
#define pushcli()
#define popcli()
lib/Makefrag
浏览文件 @
93f8127a
...
...
@@ -2,7 +2,7 @@ $(O)/lib/%.o: CFLAGS:=$(CFLAGS)
$(O)/lib/%.o: CXXFLAGS:=$(CXXFLAGS)
ULIB = ulib.o usys.o printf.o umalloc.o uthread.o fmt.o stream.o ipc.o \
threads.o crt.o
threads.o crt.o
wq.o
ULIB := $(addprefix $(O)/lib/, $(ULIB))
.PRECIOUS: $(O)/lib/%.o
...
...
lib/crt.S
浏览文件 @
93f8127a
...
...
@@ -2,6 +2,7 @@
.align 8
.globl _start
_start:
call usetup
pop %rdi
mov %rsp, %rsi
call main
...
...
lib/ulib.c
浏览文件 @
93f8127a
...
...
@@ -150,3 +150,15 @@ open(const char *path, int omode)
{
return
openat
(
AT_FDCWD
,
path
,
omode
);
}
extern
void
__cxa_pure_virtual
(
void
);
void
__cxa_pure_virtual
(
void
)
{
die
(
"__cxa_pure_virtual"
);
}
void
usetup
(
void
)
{
forkt_setup
(
getpid
());
}
lib/wq.cc
浏览文件 @
93f8127a
#if defined(LINUX)
#include "user/wqlinux.hh"
#include "percpu.hh"
#elif defined(XV6_KERNEL)
#include "wqkernel.hh"
#include "percpu.hh"
#else
#
warning "Unknown wq implementation
"
#
include "wquser.hh
"
#endif
#include "percpu.hh"
#define NSLOTS (1 << WQSHIFT)
...
...
user/wqlinux.hh
浏览文件 @
93f8127a
...
...
@@ -84,7 +84,5 @@ wqarch_init(void)
}
#define xprintf printf
#define xmalloc(n) malloc(n)
#define xfree(p, sz) free(p)
#define pushcli()
#define popcli()
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论