Skip to content

fix examples and publish as v0.9.0 #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 26, 2022
Merged
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
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: nightly-2022-01-20
override: true
components: rustfmt, clippy
- name: Check code format
Expand All @@ -38,7 +38,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: nightly-2022-01-20
target: ${{ matrix.target }}
components: clippy
- name: Build
Expand All @@ -64,7 +64,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: nightly-2022-01-20
components: rust-src
- name: Build
uses: actions-rs/cargo@v1
Expand All @@ -88,7 +88,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: nightly-2022-01-20
override: true
- name: Test
uses: actions-rs/cargo@v1
Expand All @@ -104,7 +104,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: nightly-2022-01-20
target: aarch64-unknown-linux-gnu
override: true
- uses: actions-rs/cargo@v1
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.9.0] - 2022-02-26

- **[Breaking]** Fix dependencies and asm macros for new nightly.

## [0.8.0] - 2021-07-26

- **[Breaking]** Fix dependencies for new nightly.
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "trapframe"
version = "0.8.0"
version = "0.9.0"
authors = [
"Runji Wang <[email protected]>",
"Jiajie Chen <[email protected]>",
"Hoblovski <[email protected]>",
"Ben Pig Chu <[email protected]>",
]
edition = "2018"
edition = "2021"
description = "Handle Trap Frame across kernel and user space on multiple ISAs."
homepage = "https://github.com/rcore-os/trapframe-rs"
documentation = "https://docs.rs/trapframe"
Expand All @@ -23,8 +23,8 @@ exclude = ["docs", ".idea"]
[dependencies]

[target.'cfg(target_arch = "x86_64")'.dependencies]
x86_64 = "0.14"
raw-cpuid = "9.0"
x86_64 = "0.14.8"
raw-cpuid = "10"

[features]
default = []
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ Handle Trap Frame across kernel and user space on multiple ISAs.

Supported ISA: x86_64, aarch64, riscv32, riscv64, mipsel

## info
- Ver 0.8.0 was tested for x86_64 ISA by rustc 1.55+ nightly

## Example

### Go to user space
Expand Down
3 changes: 1 addition & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ fn gen_vector_asm() -> Result<()> {

writeln!(f, "# generated by build.rs - do not edit")?;
writeln!(f, ".section .text")?;
writeln!(f, ".intel_syntax noprefix")?;
for i in 0..256 {
writeln!(f, "vector{}:", i)?;
if !(i == 8 || (i >= 10 && i <= 14) || i == 17) {
if !(i == 8 || (10..=14).contains(&i) || i == 17) {
writeln!(f, "\tpush 0")?;
}
writeln!(f, "\tpush {}", i)?;
Expand Down
4 changes: 2 additions & 2 deletions examples/riscv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ edition = "2018"

[dependencies]
log = "0.4"
riscv = "0.5"
opensbi-rt = { git = "https://github.com/rcore-os/opensbi-rt.git", rev = "52f0041" }
riscv = "0.7"
opensbi-rt = { git = "https://github.com/rcore-os/opensbi-rt.git", rev = "abdfeb7" }
trapframe = { path = "../.." }
5 changes: 2 additions & 3 deletions examples/riscv/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#![no_std]
#![no_main]
#![feature(asm)]

#[macro_use]
extern crate opensbi_rt;

use riscv::register::scause::{Exception as E, Scause, Trap};
use riscv::register::scause::{Exception as E, Trap};
use riscv::register::{scause, stval};
use trapframe::{GeneralRegs, TrapFrame, UserContext};
use core::arch::asm;
Expand Down Expand Up @@ -92,5 +91,5 @@ extern "C" fn trap_handler(tf: &mut TrapFrame) {
}

unsafe extern "C" fn user_entry() {
opensbi_rt::sbi::console_putchar(1);
opensbi_rt::sbi::legacy::console_putchar(1);
}
6 changes: 3 additions & 3 deletions examples/uefi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2018"

[dependencies]
log = "0.4"
x86_64 = "0.13"
uefi = "0.7"
uefi-services = "0.4"
x86_64 = "0.14"
uefi = "0.14"
uefi-services = "0.11"
trapframe = { path = "../.." }
1 change: 0 additions & 1 deletion examples/uefi/rust-toolchain

This file was deleted.

7 changes: 3 additions & 4 deletions examples/uefi/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
#![no_std]
#![no_main]
#![feature(asm)]
#![feature(abi_efiapi)]
#![feature(core_intrinsics)]
#![feature(naked_functions)]
#![deny(warnings)]

extern crate alloc;

use core::arch::asm;
use core::intrinsics::breakpoint;
use log::*;
use trapframe::{GeneralRegs, TrapFrame, UserContext};
use uefi::prelude::*;
use x86_64::registers::control::*;
use x86_64::structures::paging::{PageTable, PageTableFlags};
use core::arch::asm;

#[entry]
fn efi_main(_image: Handle, st: SystemTable<Boot>) -> uefi::Status {
uefi_services::init(&st).expect_success("Failed to initialize utilities");
fn efi_main(_image: Handle, mut st: SystemTable<Boot>) -> uefi::Status {
uefi_services::init(&mut st).expect_success("Failed to initialize utilities");
check_and_set_cpu_features();
allow_user_access(user_entry as usize);
unsafe {
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly
nightly-2022-01-20
2 changes: 0 additions & 2 deletions src/arch/x86_64/syscall.S
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.intel_syntax noprefix

.text
# extern "sysv64" fn syscall_return(&mut GeneralRegs)
.global syscall_return
Expand Down
2 changes: 1 addition & 1 deletion src/arch/x86_64/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub fn init() {
unsafe {
// enable `syscall` instruction
assert!(cpuid
.get_extended_function_info()
.get_extended_processor_and_feature_identifiers()
.unwrap()
.has_syscall_sysret());
Efer::update(|efer| {
Expand Down
2 changes: 0 additions & 2 deletions src/arch/x86_64/trap.S
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.intel_syntax noprefix

.text
.global __alltraps
__alltraps:
Expand Down