Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
rcore-os
RCore Tutorial V3
提交
136e26ae
R
RCore Tutorial V3
项目概览
rcore-os
/
RCore Tutorial V3
上一次同步 1 年多
通知
15
Star
793
Fork
260
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
RCore Tutorial V3
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
136e26ae
编写于
10月 03, 2021
作者:
Y
Yifan Wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
User base from 0x0->0x10000; user image size limit from 128MB->16MB; trigger race condition on k210
上级
24b3c82b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
18 addition
and
14 deletion
+18
-14
easy-fs-fuse/src/main.rs
easy-fs-fuse/src/main.rs
+3
-3
os/Makefile
os/Makefile
+2
-2
os/src/timer.rs
os/src/timer.rs
+1
-1
user/src/bin/race_adder.rs
user/src/bin/race_adder.rs
+10
-6
user/src/linker.ld
user/src/linker.ld
+2
-2
未找到文件。
easy-fs-fuse/src/main.rs
浏览文件 @
136e26ae
...
@@ -56,13 +56,13 @@ fn easy_fs_pack() -> std::io::Result<()> {
...
@@ -56,13 +56,13 @@ fn easy_fs_pack() -> std::io::Result<()> {
.write
(
true
)
.write
(
true
)
.create
(
true
)
.create
(
true
)
.open
(
format!
(
"{}{}"
,
target_path
,
"fs.img"
))
?
;
.open
(
format!
(
"{}{}"
,
target_path
,
"fs.img"
))
?
;
f
.set_len
(
1
28
*
2048
*
512
)
.unwrap
();
f
.set_len
(
1
6
*
2048
*
512
)
.unwrap
();
f
f
})));
})));
// 1
28
MiB, at most 4095 files
// 1
6
MiB, at most 4095 files
let
efs
=
EasyFileSystem
::
create
(
let
efs
=
EasyFileSystem
::
create
(
block_file
.clone
(),
block_file
.clone
(),
1
28
*
2048
,
1
6
*
2048
,
1
,
1
,
);
);
let
root_inode
=
Arc
::
new
(
EasyFileSystem
::
root_inode
(
&
efs
));
let
root_inode
=
Arc
::
new
(
EasyFileSystem
::
root_inode
(
&
efs
));
...
...
os/Makefile
浏览文件 @
136e26ae
...
@@ -49,7 +49,7 @@ env:
...
@@ -49,7 +49,7 @@ env:
sdcard
:
fs-img
sdcard
:
fs-img
@
echo
"Are you sure write to
$(SDCARD)
? [y/N] "
&&
read
ans
&&
[
$
${
ans
:-
N
}
=
y
]
@
echo
"Are you sure write to
$(SDCARD)
? [y/N] "
&&
read
ans
&&
[
$
${
ans
:-
N
}
=
y
]
@
sudo dd
if
=
/dev/zero
of
=
$(SDCARD)
bs
=
1048576
count
=
256
@
sudo dd
if
=
/dev/zero
of
=
$(SDCARD)
bs
=
1048576
count
=
32
@
sudo dd
if
=
$(FS_IMG)
of
=
$(SDCARD)
@
sudo dd
if
=
$(FS_IMG)
of
=
$(SDCARD)
$(KERNEL_BIN)
:
kernel
$(KERNEL_BIN)
:
kernel
...
@@ -57,7 +57,7 @@ $(KERNEL_BIN): kernel
...
@@ -57,7 +57,7 @@ $(KERNEL_BIN): kernel
fs-img
:
$(APPS)
fs-img
:
$(APPS)
@
cd
../user
&&
make build
@
cd
../user
&&
make build
@
rm
$(FS_IMG)
@
rm
$(FS_IMG)
-f
@
cd
../easy-fs-fuse
&&
cargo run
--release
--
-s
../user/src/bin/
-t
../user/target/riscv64gc-unknown-none-elf/release/
@
cd
../easy-fs-fuse
&&
cargo run
--release
--
-s
../user/src/bin/
-t
../user/target/riscv64gc-unknown-none-elf/release/
$(APPS)
:
$(APPS)
:
...
...
os/src/timer.rs
浏览文件 @
136e26ae
...
@@ -15,4 +15,4 @@ pub fn get_time_ms() -> usize {
...
@@ -15,4 +15,4 @@ pub fn get_time_ms() -> usize {
pub
fn
set_next_trigger
()
{
pub
fn
set_next_trigger
()
{
set_timer
(
get_time
()
+
CLOCK_FREQ
/
TICKS_PER_SEC
);
set_timer
(
get_time
()
+
CLOCK_FREQ
/
TICKS_PER_SEC
);
}
}
\ No newline at end of file
user/src/bin/race_adder.rs
浏览文件 @
136e26ae
...
@@ -5,20 +5,21 @@
...
@@ -5,20 +5,21 @@
extern
crate
user_lib
;
extern
crate
user_lib
;
extern
crate
alloc
;
extern
crate
alloc
;
use
user_lib
::{
exit
,
thread_create
,
waittid
};
use
user_lib
::{
exit
,
thread_create
,
waittid
,
get_time
};
use
alloc
::
vec
::
Vec
;
use
alloc
::
vec
::
Vec
;
static
mut
A
:
usize
=
0
;
static
mut
A
:
usize
=
0
;
const
PER_THREAD
:
usize
=
10
000000
;
const
PER_THREAD
:
usize
=
2
000000
;
const
THREAD_COUNT
:
usize
=
50
;
const
THREAD_COUNT
:
usize
=
8
;
unsafe
fn
f
()
->
!
{
unsafe
fn
f
()
->
!
{
let
start
=
get_time
();
for
_
in
0
..
PER_THREAD
{
for
_
in
0
..
PER_THREAD
{
let
a
=
&
mut
A
as
*
mut
usize
;
let
a
=
&
mut
A
as
*
mut
usize
;
let
cur
=
a
.read_volatile
();
let
cur
=
a
.read_volatile
();
a
.write_volatile
(
cur
+
1
);
a
.write_volatile
(
cur
+
1
);
}
}
exit
(
0
)
exit
(
(
get_time
()
-
start
)
as
i32
)
}
}
#[no_mangle]
#[no_mangle]
...
@@ -27,10 +28,13 @@ pub fn main() -> i32 {
...
@@ -27,10 +28,13 @@ pub fn main() -> i32 {
for
_
in
0
..
THREAD_COUNT
{
for
_
in
0
..
THREAD_COUNT
{
v
.push
(
thread_create
(
f
as
usize
)
as
usize
);
v
.push
(
thread_create
(
f
as
usize
)
as
usize
);
}
}
let
mut
time_cost
=
Vec
::
new
();
for
tid
in
v
.iter
()
{
for
tid
in
v
.iter
()
{
waittid
(
*
tid
);
time_cost
.push
(
waittid
(
*
tid
));
}
for
(
i
,
cost
)
in
time_cost
.iter
()
.enumerate
()
{
println!
(
"cost of thread#{} is {}ms"
,
i
,
cost
);
}
}
assert_eq!
(
unsafe
{
A
},
PER_THREAD
*
THREAD_COUNT
);
assert_eq!
(
unsafe
{
A
},
PER_THREAD
*
THREAD_COUNT
);
println!
(
"total = {}"
,
unsafe
{
A
});
0
0
}
}
user/src/linker.ld
浏览文件 @
136e26ae
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
OUTPUT_ARCH(riscv)
OUTPUT_ARCH(riscv)
ENTRY(_start)
ENTRY(_start)
BASE_ADDRESS = 0x0;
BASE_ADDRESS = 0x
1000
0;
SECTIONS
SECTIONS
{
{
...
@@ -29,4 +29,4 @@ SECTIONS
...
@@ -29,4 +29,4 @@ SECTIONS
*(.eh_frame)
*(.eh_frame)
*(.debug*)
*(.debug*)
}
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录