Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
5e083578
提交
5e083578
8月 30, 2011
创建
作者:
Robert Morris
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enterpgdir -> entrypgdir
上级
1ddfbbb1
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
24 行增加
和
11 行删除
+24
-11
entry.S
entry.S
+2
-2
main.c
main.c
+5
-5
usertests.c
usertests.c
+17
-4
没有找到文件。
entry.S
浏览文件 @
5e083578
...
@@ -44,11 +44,11 @@ entry:
...
@@ -44,11 +44,11 @@ entry:
orl $(CR4_PSE), %eax
orl $(CR4_PSE), %eax
movl %eax, %cr4
movl %eax, %cr4
# Set page directory
# Set page directory
movl $(V2P_WO(ent
er
pgdir)), %eax
movl $(V2P_WO(ent
ry
pgdir)), %eax
movl %eax, %cr3
movl %eax, %cr3
# Turn on paging.
# Turn on paging.
movl %cr0, %eax
movl %cr0, %eax
orl $(CR0_P
E|CR0_P
G|CR0_WP), %eax
orl $(CR0_PG|CR0_WP), %eax
movl %eax, %cr0
movl %eax, %cr0
# now switch to using addresses above KERNBASE
# now switch to using addresses above KERNBASE
...
...
main.c
浏览文件 @
5e083578
...
@@ -60,7 +60,7 @@ mpmain(void)
...
@@ -60,7 +60,7 @@ mpmain(void)
scheduler
();
// start running processes
scheduler
();
// start running processes
}
}
pde_t
ent
er
pgdir
[];
// For entry.S
pde_t
ent
ry
pgdir
[];
// For entry.S
// Start the non-boot (AP) processors.
// Start the non-boot (AP) processors.
static
void
static
void
...
@@ -83,15 +83,15 @@ startothers(void)
...
@@ -83,15 +83,15 @@ startothers(void)
// Tell entryother.S what stack to use, the address of mpenter and pgdir;
// Tell entryother.S what stack to use, the address of mpenter and pgdir;
// We cannot use kpgdir yet, because the AP processor is running in low
// We cannot use kpgdir yet, because the AP processor is running in low
// memory, so we use ent
er
pgdir for the APs too. kalloc can return addresses
// memory, so we use ent
ry
pgdir for the APs too. kalloc can return addresses
// above 4Mbyte (the machine may have much more physical memory than 4Mbyte), which
// above 4Mbyte (the machine may have much more physical memory than 4Mbyte), which
// aren't mapped by ent
er
pgdir, so we must allocate a stack using enter_alloc();
// aren't mapped by ent
ry
pgdir, so we must allocate a stack using enter_alloc();
// This introduces the constraint that xv6 cannot use kalloc until after these
// This introduces the constraint that xv6 cannot use kalloc until after these
// last enter_alloc invocations.
// last enter_alloc invocations.
stack
=
enter_alloc
();
stack
=
enter_alloc
();
*
(
void
**
)(
code
-
4
)
=
stack
+
KSTACKSIZE
;
*
(
void
**
)(
code
-
4
)
=
stack
+
KSTACKSIZE
;
*
(
void
**
)(
code
-
8
)
=
mpenter
;
*
(
void
**
)(
code
-
8
)
=
mpenter
;
*
(
int
**
)(
code
-
12
)
=
(
void
*
)
v2p
(
ent
er
pgdir
);
*
(
int
**
)(
code
-
12
)
=
(
void
*
)
v2p
(
ent
ry
pgdir
);
lapicstartap
(
c
->
id
,
v2p
(
code
));
lapicstartap
(
c
->
id
,
v2p
(
code
));
...
@@ -106,7 +106,7 @@ startothers(void)
...
@@ -106,7 +106,7 @@ startothers(void)
// hence the "__aligned__" attribute.
// hence the "__aligned__" attribute.
// Use PTE_PS in page directory entry to enable 4Mbyte pages.
// Use PTE_PS in page directory entry to enable 4Mbyte pages.
__attribute__
((
__aligned__
(
PGSIZE
)))
__attribute__
((
__aligned__
(
PGSIZE
)))
pde_t
ent
er
pgdir
[
NPDENTRIES
]
=
{
pde_t
ent
ry
pgdir
[
NPDENTRIES
]
=
{
// Map VA's [0, 4MB) to PA's [0, 4MB)
// Map VA's [0, 4MB) to PA's [0, 4MB)
[
0
]
=
(
0
)
+
PTE_P
+
PTE_W
+
PTE_PS
,
[
0
]
=
(
0
)
+
PTE_P
+
PTE_W
+
PTE_PS
,
// Map VA's [KERNBASE, KERNBASE+4MB) to PA's [0, 4MB)
// Map VA's [KERNBASE, KERNBASE+4MB) to PA's [0, 4MB)
...
...
usertests.c
浏览文件 @
5e083578
#include "param.h"
#include "types.h"
#include "types.h"
#include "stat.h"
#include "stat.h"
#include "user.h"
#include "user.h"
...
@@ -240,8 +241,10 @@ pipe1(void)
...
@@ -240,8 +241,10 @@ pipe1(void)
if
(
cc
>
sizeof
(
buf
))
if
(
cc
>
sizeof
(
buf
))
cc
=
sizeof
(
buf
);
cc
=
sizeof
(
buf
);
}
}
if
(
total
!=
5
*
1033
)
if
(
total
!=
5
*
1033
)
{
printf
(
1
,
"pipe1 oops 3 total %d
\n
"
,
total
);
printf
(
1
,
"pipe1 oops 3 total %d
\n
"
,
total
);
exit
();
}
close
(
fds
[
0
]);
close
(
fds
[
0
]);
wait
();
wait
();
}
else
{
}
else
{
...
@@ -401,10 +404,12 @@ sharedfd(void)
...
@@ -401,10 +404,12 @@ sharedfd(void)
}
}
close
(
fd
);
close
(
fd
);
unlink
(
"sharedfd"
);
unlink
(
"sharedfd"
);
if
(
nc
==
10000
&&
np
==
10000
)
if
(
nc
==
10000
&&
np
==
10000
)
{
printf
(
1
,
"sharedfd ok
\n
"
);
printf
(
1
,
"sharedfd ok
\n
"
);
else
}
else
{
printf
(
1
,
"sharedfd oops %d %d
\n
"
,
nc
,
np
);
printf
(
1
,
"sharedfd oops %d %d
\n
"
,
nc
,
np
);
exit
();
}
}
}
// two processes write two different files at the same
// two processes write two different files at the same
...
@@ -423,7 +428,7 @@ twofiles(void)
...
@@ -423,7 +428,7 @@ twofiles(void)
pid
=
fork
();
pid
=
fork
();
if
(
pid
<
0
){
if
(
pid
<
0
){
printf
(
1
,
"fork failed
\n
"
);
printf
(
1
,
"fork failed
\n
"
);
return
;
exit
()
;
}
}
fname
=
pid
?
"f1"
:
"f2"
;
fname
=
pid
?
"f1"
:
"f2"
;
...
@@ -1582,6 +1587,14 @@ fsfull()
...
@@ -1582,6 +1587,14 @@ fsfull()
printf
(
1
,
"fsfull test finished
\n
"
);
printf
(
1
,
"fsfull test finished
\n
"
);
}
}
unsigned
long
randstate
=
1
;
unsigned
int
rand
()
{
randstate
=
randstate
*
1664525
+
1013904223
;
return
randstate
;
}
int
int
main
(
int
argc
,
char
*
argv
[])
main
(
int
argc
,
char
*
argv
[])
{
{
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论