Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
a64fdf99
提交
a64fdf99
3月 21, 2012
创建
作者:
Austin Clements
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
asharing: Annotate sharing in sys_map, sys_unmap, pagefault, and sys_openat
上级
9275cbb6
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
39 行增加
和
0 行删除
+39
-0
fs.cc
kernel/fs.cc
+12
-0
sysfile.cc
kernel/sysfile.cc
+8
-0
sysproc.cc
kernel/sysproc.cc
+13
-0
vm.cc
kernel/vm.cc
+6
-0
没有找到文件。
kernel/fs.cc
浏览文件 @
a64fdf99
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "buf.hh"
#include "buf.hh"
#include "file.hh"
#include "file.hh"
#include "cpu.hh"
#include "cpu.hh"
#include "kmtrace.hh"
#define min(a, b) ((a) < (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
static
void
itrunc
(
struct
inode
*
);
static
void
itrunc
(
struct
inode
*
);
...
@@ -757,6 +758,16 @@ namex(inode *cwd, const char *path, int nameiparent, char *name)
...
@@ -757,6 +758,16 @@ namex(inode *cwd, const char *path, int nameiparent, char *name)
ip
=
idup
(
cwd
);
ip
=
idup
(
cwd
);
while
((
r
=
skipelem
(
&
path
,
name
))
==
1
){
while
((
r
=
skipelem
(
&
path
,
name
))
==
1
){
// XXX Doing this here requires some annoying reasoning about all
// of the callers of namei/nameiparent. Also, since the abstract
// scope is implicit, it might be wrong (or non-existent) and
// documenting the abstract object sets of each scope becomes
// difficult and probably unmaintainable. We have to compute this
// information here because it's the only place that's canonical.
// Maybe this should return the set of inodes traversed and let
// the caller declare the variables? Would it help for the caller
// to pass in an abstract scope?
mtreadavar
(
"inode:%x.%x"
,
ip
->
dev
,
ip
->
inum
);
next
=
0
;
next
=
0
;
if
(
next
==
0
){
if
(
next
==
0
){
if
(
ip
->
type
==
0
)
if
(
ip
->
type
==
0
)
...
@@ -785,6 +796,7 @@ namex(inode *cwd, const char *path, int nameiparent, char *name)
...
@@ -785,6 +796,7 @@ namex(inode *cwd, const char *path, int nameiparent, char *name)
gc_end_epoch
();
gc_end_epoch
();
return
0
;
return
0
;
}
}
mtreadavar
(
"inode:%x.%x"
,
ip
->
dev
,
ip
->
inum
);
gc_end_epoch
();
gc_end_epoch
();
return
ip
;
return
ip
;
}
}
...
...
kernel/sysfile.cc
浏览文件 @
a64fdf99
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#include "fcntl.h"
#include "fcntl.h"
#include "cpu.hh"
#include "cpu.hh"
#include "net.hh"
#include "net.hh"
#include "kmtrace.hh"
static
bool
static
bool
getfile
(
int
fd
,
sref
<
file
>
*
f
)
getfile
(
int
fd
,
sref
<
file
>
*
f
)
...
@@ -280,6 +281,12 @@ sys_openat(int dirfd, const char *path, int omode)
...
@@ -280,6 +281,12 @@ sys_openat(int dirfd, const char *path, int omode)
if
(
argcheckstr
(
path
)
<
0
)
if
(
argcheckstr
(
path
)
<
0
)
return
-
1
;
return
-
1
;
// Reads the dirfd FD, dirfd's inode, the inodes of all files in
// path; writes the returned FD
mt_ascope
ascope
(
"%s(%d,%s,%d)"
,
__func__
,
dirfd
,
path
,
omode
);
mtreadavar
(
"inode:%x.%x"
,
cwd
->
dev
,
cwd
->
inum
);
if
(
omode
&
O_CREATE
){
if
(
omode
&
O_CREATE
){
if
((
ip
=
create
(
cwd
,
path
,
T_FILE
,
0
,
0
))
==
0
)
if
((
ip
=
create
(
cwd
,
path
,
T_FILE
,
0
,
0
))
==
0
)
return
-
1
;
return
-
1
;
...
@@ -309,6 +316,7 @@ sys_openat(int dirfd, const char *path, int omode)
...
@@ -309,6 +316,7 @@ sys_openat(int dirfd, const char *path, int omode)
return
-
1
;
return
-
1
;
}
}
iunlock
(
ip
);
iunlock
(
ip
);
mtwriteavar
(
"fd:%x.%x"
,
myproc
()
->
pid
,
fd
);
f
->
type
=
file
::
FD_INODE
;
f
->
type
=
file
::
FD_INODE
;
f
->
ip
=
ip
;
f
->
ip
=
ip
;
...
...
kernel/sysproc.cc
浏览文件 @
a64fdf99
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include "cpu.hh"
#include "cpu.hh"
#include "vm.hh"
#include "vm.hh"
#include "sperf.hh"
#include "sperf.hh"
#include "kmtrace.hh"
long
long
sys_fork
(
int
flags
)
sys_fork
(
int
flags
)
...
@@ -87,6 +88,12 @@ sys_map(uptr addr, u64 len)
...
@@ -87,6 +88,12 @@ sys_map(uptr addr, u64 len)
{
{
ANON_REGION
(
__func__
,
&
perfgroup
);
ANON_REGION
(
__func__
,
&
perfgroup
);
#if MTRACE
mt_ascope
ascope
(
"%s(%p,%lx)"
,
__func__
,
addr
,
len
);
for
(
uptr
i
=
PGROUNDDOWN
(
addr
);
i
<
PGROUNDUP
(
addr
+
len
);
i
+=
PGSIZE
)
mtwriteavar
(
"page:%016x"
,
i
);
#endif
vmnode
*
vmn
=
new
vmnode
(
PGROUNDUP
(
len
)
/
PGSIZE
);
vmnode
*
vmn
=
new
vmnode
(
PGROUNDUP
(
len
)
/
PGSIZE
);
if
(
vmn
==
0
)
if
(
vmn
==
0
)
return
-
1
;
return
-
1
;
...
@@ -104,6 +111,12 @@ sys_unmap(uptr addr, u64 len)
...
@@ -104,6 +111,12 @@ sys_unmap(uptr addr, u64 len)
{
{
ANON_REGION
(
__func__
,
&
perfgroup
);
ANON_REGION
(
__func__
,
&
perfgroup
);
#if MTRACE
mt_ascope
ascope
(
"%s(%p,%lx)"
,
__func__
,
addr
,
len
);
for
(
uptr
i
=
PGROUNDDOWN
(
addr
);
i
<
PGROUNDUP
(
addr
+
len
);
i
+=
PGSIZE
)
mtwriteavar
(
"page:%016x"
,
i
);
#endif
uptr
align_addr
=
PGROUNDDOWN
(
addr
);
uptr
align_addr
=
PGROUNDDOWN
(
addr
);
uptr
align_len
=
PGROUNDUP
(
addr
+
len
)
-
align_addr
;
uptr
align_len
=
PGROUNDUP
(
addr
+
len
)
-
align_addr
;
if
(
myproc
()
->
vmap
->
remove
(
align_addr
,
align_len
)
<
0
)
if
(
myproc
()
->
vmap
->
remove
(
align_addr
,
align_len
)
<
0
)
...
...
kernel/vm.cc
浏览文件 @
a64fdf99
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
#include "crange.hh"
#include "crange.hh"
#include "cpputil.hh"
#include "cpputil.hh"
#include "sperf.hh"
#include "sperf.hh"
#include "kmtrace.hh"
enum
{
vm_debug
=
0
};
enum
{
vm_debug
=
0
};
...
@@ -555,6 +556,11 @@ vmap::pagefault(uptr va, u32 err)
...
@@ -555,6 +556,11 @@ vmap::pagefault(uptr va, u32 err)
int
int
pagefault
(
struct
vmap
*
vmap
,
uptr
va
,
u32
err
)
pagefault
(
struct
vmap
*
vmap
,
uptr
va
,
u32
err
)
{
{
#if MTRACE
mt_ascope
ascope
(
"%s(%p)"
,
__func__
,
va
);
mtwriteavar
(
"page:%016x"
,
PGROUNDDOWN
(
va
));
#endif
return
vmap
->
pagefault
(
va
,
err
);
return
vmap
->
pagefault
(
va
,
err
);
}
}
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论