Skip to content

Commit 54bf600

Browse files
committed
publish: bump to 0.1.0
Signed-off-by: YdrMaster <ydrml@hotmail.com>
1 parent 8cbb773 commit 54bf600

File tree

7 files changed

+44
-48
lines changed

7 files changed

+44
-48
lines changed

.github/workflows/workflow.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
name: CI
1111

1212
on:
13-
push:
14-
branches: [ "main" ]
1513
pull_request:
16-
branches: [ "main" ]
14+
push:
15+
paths-ignore:
16+
- '**.md'
17+
- 'LICENSE'
1718

1819
jobs:
1920
rust-clippy-analyze:
@@ -23,22 +24,16 @@ jobs:
2324
security-events: write
2425
steps:
2526
- name: Checkout code
26-
uses: actions/checkout@v3
27+
uses: actions/checkout@v4
2728

2829
- name: Check format
2930
run: cargo fmt --check
3031

31-
- name: Install clippy-sarif
32-
uses: actions-rs/install@v0.1
33-
with:
34-
crate: clippy-sarif
35-
version: latest
32+
- name: Run test
33+
run: cargo test
3634

37-
- name: Install sarif-fmt
38-
uses: actions-rs/install@v0.1
39-
with:
40-
crate: sarif-fmt
41-
version: latest
35+
- name: Install required cargo
36+
run: cargo install clippy-sarif sarif-fmt
4237

4338
- name: Run rust-clippy
4439
run: |
@@ -47,7 +42,7 @@ jobs:
4742
continue-on-error: true
4843

4944
- name: Upload analysis results to GitHub
50-
uses: github/codeql-action/upload-sarif@v2
45+
uses: github/codeql-action/upload-sarif@v3
5146
with:
5247
sarif_file: rust-clippy-results.sarif
5348
wait-for-processing: true

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright © 2022 YdrMaster
3+
Copyright © 2025 YdrMaster
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

README.md

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

3-
[![CI](https://github.com/YdrMaster/fast-trap/actions/workflows/workflow.yml/badge.svg?branch=main)](https://github.com/YdrMaster/fast-trap/actions)
3+
[![CI](https://github.com/rustsbi/fast-trap/actions/workflows/workflow.yml/badge.svg?branch=main)](https://github.com/rustsbi/fast-trap/actions)
44
[![Latest version](https://img.shields.io/crates/v/fast-trap.svg)](https://crates.io/crates/fast-trap)
5-
[![issue](https://img.shields.io/github/issues/YdrMaster/fast-trap)](https://github.com/YdrMaster/fast-trap/issues)
5+
[![issue](https://img.shields.io/github/issues/rustsbi/fast-trap)](https://github.com/rustsbi/fast-trap/issues)
66
[![Documentation](https://docs.rs/fast-trap/badge.svg)](https://docs.rs/fast-trap)
7-
![license](https://img.shields.io/github/license/YdrMaster/fast-trap)
7+
![license](https://img.shields.io/github/license/rustsbi/fast-trap)
88

99
这个库提供一套裸机应用程序陷入处理流程的框架,旨在保证处理性能的同时尽量复用代码。
1010

@@ -311,7 +311,7 @@ trap Lv.2 (trap3)-->{o} (tr
311311

312312
## 设计解释
313313

314-
- [为什么陷入必须换栈](https://github.com/YdrMaster/notebook/blob/main/%E9%9A%8F%E7%AC%94/20230130-trap-to-a-new-stack.md)
314+
- [为什么陷入必须换栈](https://github.com/rustsbi/notebook/blob/main/%E9%9A%8F%E7%AC%94/20230130-trap-to-a-new-stack.md)
315315

316316
## 使用说明
317317

@@ -351,7 +351,7 @@ trap Lv.2 (trap3)-->{o} (tr
351351

352352
### 性能测试
353353

354-
本项目现以 RISC-V64 M 模式用于 [rustsbi-qemu](https://github.com/YdrMaster/rustsbi-qemu)[rustsbi-d1](https://github.com/rustsbi/rustsbi-d1)。这两个项目可以提供使用本库前后的性能对比。
354+
本项目现以 RISC-V64 M 模式用于 [rustsbi-qemu](https://github.com/rustsbi/rustsbi-qemu)[rustsbi-d1](https://github.com/rustsbi/rustsbi-d1)。这两个项目可以提供使用本库前后的性能对比。
355355

356356
#### qemu
357357

fast-trap/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[package]
22
name = "fast-trap"
33
description = "Provide a framework for bare-metal trap handling, aiming at ensuring performance while reusing code."
4-
version = "0.0.1"
4+
version = "0.1.0"
55
edition.workspace = true
66
authors = ["YdrMaster <ydrml@hotmail.com>"]
7-
repository = "https://github.com/YdrMaster/fast-trap.git"
7+
repository = "https://github.com/rustsbi/fast-trap.git"
88
documentation = "https://docs.rs/fast-trap"
99
license = "MulanPSL-2.0 OR MIT"
1010
readme = "../README.md"

test-app/src/main.rs

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#![no_std]
22
#![no_main]
3-
#![feature(naked_functions, asm_const)]
3+
#![feature(naked_functions)]
44
#![deny(warnings)]
55

66
use core::{
7-
arch::asm,
7+
arch::{asm, naked_asm},
88
mem::{MaybeUninit, forget},
99
ptr::{NonNull, null},
1010
unreachable,
@@ -19,44 +19,45 @@ use riscv::register::*;
1919
use sifive_test_device::SifiveTestDevice;
2020
use uart_16550::MmioSerialPort;
2121

22-
#[link_section = ".bss.uninit"]
22+
#[unsafe(link_section = ".bss.uninit")]
2323
static mut ROOT_STACK: Stack = Stack([0; 4096]);
2424
static mut FREE_STACK: Stack = Stack([0; 4096]);
2525
static mut ROOT_CONTEXT: FlowContext = FlowContext::ZERO;
2626

2727
#[naked]
28-
#[no_mangle]
29-
#[link_section = ".text.entry"]
28+
#[unsafe(no_mangle)]
29+
#[unsafe(link_section = ".text.entry")]
3030
unsafe extern "C" fn _start() -> ! {
31-
asm!(
32-
" la sp, {stack} + {stack_size}
31+
unsafe {
32+
naked_asm!(
33+
" la sp, {stack} + {stack_size}
3334
call {move_stack}
3435
call {main}
3536
j {trap}
3637
",
37-
stack_size = const 4096,
38-
stack = sym ROOT_STACK,
39-
move_stack = sym reuse_stack_for_trap,
40-
main = sym rust_main,
41-
trap = sym trap_entry,
42-
options(noreturn),
43-
)
38+
stack_size = const 4096,
39+
stack = sym ROOT_STACK,
40+
move_stack = sym reuse_stack_for_trap,
41+
main = sym rust_main,
42+
trap = sym trap_entry,
43+
)
44+
}
4445
}
4546

4647
#[naked]
4748
unsafe extern "C" fn exception() -> ! {
48-
asm!("unimp", options(noreturn),)
49+
unsafe { naked_asm!("unimp") }
4950
}
5051

5152
extern "C" fn rust_main(_hartid: usize, dtb: *const u8) {
5253
// 清零 bss 段
53-
extern "C" {
54+
unsafe extern "C" {
5455
static mut sbss: u64;
5556
static mut ebss: u64;
5657
}
5758
unsafe {
58-
let mut ptr = (&mut sbss) as *mut u64;
59-
let end = (&mut ebss) as *mut u64;
59+
let mut ptr = &raw mut sbss;
60+
let end = &raw mut ebss;
6061
while ptr < end {
6162
ptr.write_volatile(0);
6263
ptr = ptr.add(1);
@@ -79,7 +80,8 @@ extern "C" fn rust_main(_hartid: usize, dtb: *const u8) {
7980
} else if path.level() == 1 {
8081
#[inline]
8182
unsafe fn parse_address(str: &[u8]) -> usize {
82-
usize::from_str_radix(core::str::from_utf8_unchecked(str), 16).unwrap()
83+
usize::from_str_radix(unsafe { core::str::from_utf8_unchecked(str) }, 16)
84+
.unwrap()
8385
}
8486

8587
if name.starts_with("test") {
@@ -105,7 +107,7 @@ extern "C" fn rust_main(_hartid: usize, dtb: *const u8) {
105107
mscratch::write(0x5050);
106108
#[cfg(feature = "s-mode")]
107109
sscratch::write(0x5050);
108-
let context_ptr = unsafe { NonNull::new_unchecked(&mut ROOT_CONTEXT) };
110+
let context_ptr = unsafe { NonNull::new_unchecked(&raw mut ROOT_CONTEXT) };
109111

110112
// 测试构造和释放
111113
let _ = FreeTrapStack::new(

xtask/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ publish = false
88
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
99

1010
[dependencies]
11-
clap = { version = "4.1", features = ["derive"] }
11+
clap = { version = "4.5", features = ["derive"] }
1212
os-xtask-utils = "0.0.0"
13-
once_cell = "1.17"

xtask/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
extern crate clap;
33

44
use clap::Parser;
5-
use once_cell::sync::Lazy;
65
use os_xtask_utils::{BinUtil, Cargo, CommandExt, Qemu};
76
use std::{
87
fs,
98
path::{Path, PathBuf},
9+
sync::LazyLock,
1010
};
1111

12-
static PROJECT: Lazy<&'static Path> =
13-
Lazy::new(|| Path::new(std::env!("CARGO_MANIFEST_DIR")).parent().unwrap());
12+
static PROJECT: LazyLock<&'static Path> =
13+
LazyLock::new(|| Path::new(std::env!("CARGO_MANIFEST_DIR")).parent().unwrap());
1414

1515
#[derive(Parser)]
1616
#[clap(name = "try-rtos")]

0 commit comments

Comments
 (0)