Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

Expand All @@ -19,7 +19,7 @@ jobs:

test:
needs: build
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
base-img: [slim]
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Fixes on usage of CLINT peripheral, thanks to @duskmoon314
- Numerous fixes to HSM module implementation, more documents

## [0.1.1] - 2025-04-22

### Modified
- Replaced #[naked] with #[unsafe(naked)] across all relevant functions.
- Removed `#![feature(naked_functions, asm_const)]` as they are no longer needed.
- Switched to the `naked_asm!` macro to comply with new naked function requirements.
- Removed `options(noreturn)`, which is not allowed in `naked_asm!`.
- Updated implementations of `put_char` and `put_str` in
`impl rcore_console::Console for Console` to avoid errors caused by
creating shared references to mutable statics.
- Updated GitHub Actions YAML workflow files to replace `ubuntu-20.04` with
`ubuntu-22.04` for CI compatibility.
- Updated GitHub Actions YAML workflow files to replace `ubuntu-20.04` with
`ubuntu-22.04` for CI test.

[Unreleased]: https://github.com/rustsbi/rustsbi-qemu/compare/v0.1.1...HEAD
[0.1.1]: https://github.com/rustsbi/rustsbi-qemu/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/rustsbi/rustsbi-qemu/releases/tag/v0.1.0
16 changes: 10 additions & 6 deletions bench-kernel/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#![no_std]
#![no_main]
#![feature(naked_functions, asm_const)]
#![deny(warnings)]

use rcore_console::log;
use riscv::register::*;
use sbi_rt::*;
use uart16550::Uart16550;

#[naked]
#[unsafe(naked)]
#[no_mangle]
#[link_section = ".text.entry"]
unsafe extern "C" fn _start(hartid: usize, device_tree_paddr: usize) -> ! {
Expand All @@ -17,13 +16,12 @@ unsafe extern "C" fn _start(hartid: usize, device_tree_paddr: usize) -> ! {
#[link_section = ".bss.uninit"]
static mut STACK: [u8; STACK_SIZE] = [0u8; STACK_SIZE];

core::arch::asm!(
core::arch::naked_asm!(
"la sp, {stack} + {stack_size}",
"j {main}",
stack_size = const STACK_SIZE,
stack = sym STACK,
main = sym rust_main,
options(noreturn),
)
}

Expand Down Expand Up @@ -127,11 +125,17 @@ impl Uart16550Map {
impl rcore_console::Console for Console {
#[inline]
fn put_char(&self, c: u8) {
unsafe { UART.get().write(core::slice::from_ref(&c)) };
unsafe {
let mut_ref_uart = (*(&raw mut UART)).get();
mut_ref_uart.write(core::slice::from_ref(&c))
};
}

#[inline]
fn put_str(&self, s: &str) {
unsafe { UART.get().write(s.as_bytes()) };
unsafe {
let mut_ref_uart = (*(&raw mut UART)).get();
mut_ref_uart.write(s.as_bytes())
};
}
}