Skip to content

Commit 0991add

Browse files
committed
publish: version 0.0.0
Signed-off-by: YdrMaster <ydrml@hotmail.com>
1 parent 868e706 commit 0991add

File tree

6 files changed

+125
-9
lines changed

6 files changed

+125
-9
lines changed

LICENSE-MULAN

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
木兰宽松许可证, 第2版
2+
3+
2020年1月 <http://license.coscl.org.cn/MulanPSL2>
4+
5+
您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(“本许可证”)的如下条款的约束:
6+
7+
0. 定义
8+
9+
“软件”是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。
10+
11+
“贡献”是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。
12+
13+
“贡献者”是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。
14+
15+
“法人实体”是指提交贡献的机构及其“关联实体”。
16+
17+
“关联实体”是指,对“本许可证”下的行为方而言,控制、受控制或与其共同受控制的机构,此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。
18+
19+
1. 授予版权许可
20+
21+
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。
22+
23+
2. 授予专利许可
24+
25+
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。
26+
27+
3. 无商标许可
28+
29+
“本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定的声明义务而必须使用除外。
30+
31+
4. 分发限制
32+
33+
您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。
34+
35+
5. 免责声明与责任限制
36+
37+
“软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。
38+
39+
6. 语言
40+
41+
“本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。
42+
43+
条款结束
44+
45+
如何将木兰宽松许可证,第2版,应用到您的软件
46+
47+
如果您希望将木兰宽松许可证,第2版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步:
48+
49+
1,请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字;
50+
51+
2,请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中;
52+
53+
3,请将如下声明文本放入每个源文件的头部注释中。
54+
55+
Copyright (c) 2020 Luo Jia
56+
57+
RustSBI is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: <http://license.coscl.org.cn/MulanPSL2>
58+
59+
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the Mulan PSL v2 for more details.
60+
61+
January 2020 <http://license.coscl.org.cn/MulanPSL2>
62+
63+
Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions:
64+
65+
0. Definition
66+
67+
Software means the program and related documents which are licensed under this License and comprise all Contribution(s).
68+
69+
Contribution means the copyrightable work licensed by a particular Contributor under this License.
70+
71+
Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License.
72+
73+
Legal Entity means the entity making a Contribution and all its Affiliates.
74+
75+
Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, ‘control’ means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity.
76+
77+
1. Grant of Copyright License
78+
79+
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not.
80+
81+
2. Grant of Patent License
82+
83+
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken.
84+
85+
3. No Trademark License
86+
87+
No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in Section 4.
88+
89+
4. Distribution Restriction
90+
91+
You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software.
92+
93+
5. Disclaimer of Warranty and Limitation of Liability
94+
95+
THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT’S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
96+
97+
6. Language
98+
99+
THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL.
100+
101+
END OF THE TERMS AND CONDITIONS

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# 快速陷入处理
22

33
[![CI](https://github.com/YdrMaster/fast-trap/actions/workflows/workflow.yml/badge.svg?branch=main)](https://github.com/YdrMaster/fast-trap/actions)
4+
[![Latest version](https://img.shields.io/crates/v/fast-trap.svg)](https://crates.io/crates/fast-trap)
45
[![issue](https://img.shields.io/github/issues/YdrMaster/fast-trap)](https://github.com/YdrMaster/fast-trap/issues)
6+
[![Documentation](https://docs.rs/fast-trap/badge.svg)](https://docs.rs/fast-trap)
57
![license](https://img.shields.io/github/license/YdrMaster/fast-trap)
68

79
这个库提供一套裸机应用程序陷入处理流程的框架,旨在保证处理性能的同时尽量复用代码。
@@ -87,11 +89,7 @@ trap Lv.2 o------>o o------>o
8789

8890
突发寄存器保存着一个指针,同时这也是陷入发生的第一时间唯一可访问的动态数据。虽然任何静态的数据也都是可以找到和使用的,但出于内聚性考虑,将所有封装需要用到的东西打包放在一起是更好的选择。
8991

90-
这个库将陷入栈设计成一个在地址空间上连续的内存块。当用户预期陷入将会发生之前(例如从内核切换到用户之前或打开中断之前),需要预先分配一个陷入栈对象,然后将其**加载**到突发寄存器。这样,一旦陷入发生,硬件就能在两个控制流之间转移。内存块可以用实现这个特质的类型表示:
91-
92-
```rust
93-
trait TrapStackBlock: 'static + AsRef<[u8]> + AsMut<[u8]> {}
94-
```
92+
这个库将陷入栈设计成一个在地址空间上连续的内存块。当用户预期陷入将会发生之前(例如从内核切换到用户之前或打开中断之前),需要预先分配一个陷入栈对象,然后将其**加载**到突发寄存器。这样,一旦陷入发生,硬件就能在两个控制流之间转移。
9593

9694
陷入栈内部分为 3 个部分,从高地址到低地址,分别是:
9795

@@ -108,7 +106,8 @@ trait TrapStackBlock: 'static + AsRef<[u8]> + AsMut<[u8]> {}
108106

109107
```rust
110108
fn new(
111-
block: impl TrapStackBlock,
109+
range: Range<usize>,
110+
drop: fn(Range<usize>),
112111
context_ptr: NonNull<FlowContext>,
113112
fast_handler: FastHandler,
114113
) -> Result<Self, IllegalStack>

fast-trap/Cargo.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
[package]
22
name = "fast-trap"
3-
version = "0.0.1"
3+
description = "Provide a framework for bare-metal trap handling, aiming at ensuring performance while reusing code."
4+
version = "0.0.0"
45
edition = "2021"
56
authors = ["YdrMaster <ydrml@hotmail.com>"]
7+
repository = "https://github.com/YdrMaster/fast-trap.git"
8+
documentation = "https://docs.rs/fast-trap"
9+
license = "MulanPSL-2.0 OR MIT"
10+
readme = "README.md"
11+
keywords = ["embedded", "trap-handler"]
12+
categories = ["embedded", "hardware-support", "no-std"]
613

714
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
815

test-app/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "test-app"
33
version = "0.0.0"
44
edition = "2021"
55
authors = ["YdrMaster <ydrml@hotmail.com>"]
6+
publish = false
67

78
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
89

@@ -11,7 +12,6 @@ m-mode = ["fast-trap/riscv-m"]
1112
s-mode = ["fast-trap/riscv-s"]
1213

1314
[dependencies]
14-
r0 = "1"
1515
riscv = "0.10.1"
1616
uart_16550 = "0.2"
1717
rcore-console = "0.0.0"

test-app/src/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@ extern "C" fn rust_main(_hartid: usize, dtb: *const u8) {
5454
static mut sbss: u64;
5555
static mut ebss: u64;
5656
}
57-
unsafe { r0::zero_bss(&mut sbss, &mut ebss) };
57+
unsafe {
58+
let mut ptr = (&mut sbss) as *mut u64;
59+
let end = (&mut ebss) as *mut u64;
60+
while ptr < end {
61+
ptr.write_volatile(0);
62+
ptr = ptr.add(1);
63+
}
64+
}
5865
// 初始化打印
5966
unsafe {
6067
Dtb::from_raw_parts_filtered(dtb, |e| {

xtask/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
name = "xtask"
33
version = "0.1.0"
44
edition = "2021"
5+
authors = ["YdrMaster <ydrml@hotmail.com>"]
6+
publish = false
57

68
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
79

0 commit comments

Comments
 (0)