Skip to content

Commit b45a025

Browse files
committed
publish: bump to 0.1.0
Signed-off-by: YdrMaster <[email protected]>
1 parent 8cbb773 commit b45a025

File tree

5 files changed

+37
-41
lines changed

5 files changed

+37
-41
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/[email protected]
33-
with:
34-
crate: clippy-sarif
35-
version: latest
32+
- name: Run test
33+
run: cargo test --lib
3634

37-
- name: Install sarif-fmt
38-
uses: actions-rs/[email protected]
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

fast-trap/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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 <[email protected]>"]
77
repository = "https://github.com/YdrMaster/fast-trap.git"

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)