Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
rcore-os
RCore Tutorial V3
提交
e4e089f2
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,发现更多精彩内容 >>
提交
e4e089f2
编写于
12月 31, 2022
作者:
chyyuu1972
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix rust-analyzer warning
上级
07c6cb36
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
14 addition
and
13 deletion
+14
-13
.vscode/settings.json
.vscode/settings.json
+3
-3
easy-fs-fuse/Cargo.toml
easy-fs-fuse/Cargo.toml
+3
-3
user/Cargo.toml
user/Cargo.toml
+3
-3
user/src/bin/stackful_coroutine.rs
user/src/bin/stackful_coroutine.rs
+5
-4
未找到文件。
.vscode/settings.json
浏览文件 @
e4e089f2
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
//
For
Rust
Analyzer
plugin
users:
//
For
Rust
Analyzer
plugin
users:
"rust-analyzer.cargo.target"
:
"riscv64gc-unknown-none-elf"
,
"rust-analyzer.cargo.target"
:
"riscv64gc-unknown-none-elf"
,
"rust-analyzer.checkOnSave.allTargets"
:
false
,
"rust-analyzer.checkOnSave.allTargets"
:
false
,
"rust-analyzer.cargo.features"
:
[
//
"rust-analyzer.cargo.features"
:
[
"board_qemu"
//
"board_qemu"
]
//
]
}
}
\ No newline at end of file
easy-fs-fuse/Cargo.toml
浏览文件 @
e4e089f2
...
@@ -11,6 +11,6 @@ clap = "2.33.3"
...
@@ -11,6 +11,6 @@ clap = "2.33.3"
easy-fs
=
{
path
=
"../easy-fs"
}
easy-fs
=
{
path
=
"../easy-fs"
}
rand
=
"0.8.0"
rand
=
"0.8.0"
[features]
# [features]
board_qemu
=
[]
# board_qemu = []
board_k210
=
[]
# board_k210 = []
\ No newline at end of file
\ No newline at end of file
user/Cargo.toml
浏览文件 @
e4e089f2
...
@@ -14,6 +14,6 @@ riscv = { git = "https://github.com/rcore-os/riscv", features = ["inline-asm"] }
...
@@ -14,6 +14,6 @@ riscv = { git = "https://github.com/rcore-os/riscv", features = ["inline-asm"] }
[profile.release]
[profile.release]
debug
=
true
debug
=
true
[features]
# [features]
board_qemu
=
[]
# board_qemu = []
board_k210
=
[]
# board_k210 = []
\ No newline at end of file
\ No newline at end of file
user/src/bin/stackful_coroutine.rs
浏览文件 @
e4e089f2
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
#![no_std]
#![no_std]
#![no_main]
#![no_main]
#![feature(naked_functions)]
#![feature(naked_functions)]
#![feature(asm)]
//
#![feature(asm)]
extern
crate
alloc
;
extern
crate
alloc
;
#[macro_use]
#[macro_use]
...
@@ -12,7 +12,7 @@ extern crate user_lib;
...
@@ -12,7 +12,7 @@ extern crate user_lib;
use
core
::
arch
::
asm
;
use
core
::
arch
::
asm
;
#[macro_use]
//
#[macro_use]
use
alloc
::
vec
;
use
alloc
::
vec
;
use
alloc
::
vec
::
Vec
;
use
alloc
::
vec
::
Vec
;
...
@@ -69,7 +69,7 @@ impl Task {
...
@@ -69,7 +69,7 @@ impl Task {
// we can allocate memory for it later, but it keeps complexity down and lets us focus on more interesting parts
// we can allocate memory for it later, but it keeps complexity down and lets us focus on more interesting parts
// to do it here. The important part is that once allocated it MUST NOT move in memory.
// to do it here. The important part is that once allocated it MUST NOT move in memory.
Task
{
Task
{
id
,
id
:
id
,
stack
:
vec!
[
0_u8
;
DEFAULT_STACK_SIZE
],
stack
:
vec!
[
0_u8
;
DEFAULT_STACK_SIZE
],
ctx
:
TaskContext
::
default
(),
ctx
:
TaskContext
::
default
(),
state
:
State
::
Available
,
state
:
State
::
Available
,
...
@@ -185,6 +185,7 @@ impl Runtime {
...
@@ -185,6 +185,7 @@ impl Runtime {
.find
(|
t
|
t
.state
==
State
::
Available
)
.find
(|
t
|
t
.state
==
State
::
Available
)
.expect
(
"no available task."
);
.expect
(
"no available task."
);
println!
(
"RUNTIME: spawning task {}
\n
"
,
available
.id
);
let
size
=
available
.stack
.len
();
let
size
=
available
.stack
.len
();
unsafe
{
unsafe
{
let
s_ptr
=
available
.stack
.as_mut_ptr
()
.offset
(
size
as
isize
);
let
s_ptr
=
available
.stack
.as_mut_ptr
()
.offset
(
size
as
isize
);
...
@@ -259,7 +260,7 @@ pub fn yield_task() {
...
@@ -259,7 +260,7 @@ pub fn yield_task() {
/// see: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html
/// see: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html
#[naked]
#[naked]
#[no_mangle]
#[no_mangle]
unsafe
fn
switch
(
old
:
*
mut
TaskContext
,
new
:
*
const
TaskContext
)
{
unsafe
extern
"C"
fn
switch
(
old
:
*
mut
TaskContext
,
new
:
*
const
TaskContext
)
{
// a0: _old, a1: _new
// a0: _old, a1: _new
asm!
(
asm!
(
"
"
...
...
Miykael_xxm
🚴
@xiongjiamu
mentioned in commit
d8ffb3b2
·
1月 10, 2023
mentioned in commit
d8ffb3b2
mentioned in commit d8ffb3b294a7539780b397057fc2fe342a94df43
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录