Bump version to 0.3.0

This commit is contained in:
Zhang Junyang 2023-12-26 18:16:08 +08:00 committed by Tate, Hongliang Tian
parent 85d4cfdeb7
commit 302b547a0d
14 changed files with 32 additions and 32 deletions

View File

@ -10,9 +10,9 @@ jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10 timeout-minutes: 10
container: asterinas/asterinas:0.2.3 container: asterinas/asterinas:0.3.0
steps: steps:
- run: echo "Running in asterinas/asterinas:0.2.3" - run: echo "Running in asterinas/asterinas:0.3.0"
- uses: actions/checkout@v3 - uses: actions/checkout@v3

View File

@ -10,9 +10,9 @@ jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 30 timeout-minutes: 30
container: asterinas/asterinas:0.2.3 container: asterinas/asterinas:0.3.0
steps: steps:
- run: echo "Running in asterinas/asterinas:0.2.3" - run: echo "Running in asterinas/asterinas:0.3.0"
- uses: actions/checkout@v3 - uses: actions/checkout@v3

View File

@ -10,9 +10,9 @@ jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 15 timeout-minutes: 15
container: asterinas/asterinas:0.2.3 container: asterinas/asterinas:0.3.0
steps: steps:
- run: echo "Running in asterinas/asterinas:0.2.3" - run: echo "Running in asterinas/asterinas:0.3.0"
- uses: actions/checkout@v3 - uses: actions/checkout@v3

2
Cargo.lock generated
View File

@ -371,7 +371,7 @@ dependencies = [
[[package]] [[package]]
name = "asterinas" name = "asterinas"
version = "0.2.3" version = "0.3.0"
dependencies = [ dependencies = [
"aster-frame", "aster-frame",
"aster-framebuffer", "aster-framebuffer",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "asterinas" name = "asterinas"
version = "0.2.3" version = "0.3.0"
edition = "2021" edition = "2021"
[[bin]] [[bin]]

View File

@ -42,12 +42,12 @@ git clone [repository url]
2. After downloading the source code, run the following command to pull the development image. 2. After downloading the source code, run the following command to pull the development image.
```bash ```bash
docker pull asterinas/asterinas:0.2.3 docker pull asterinas/asterinas:0.3.0
``` ```
3. Start the development container. 3. Start the development container.
```bash ```bash
docker run -it --privileged --network=host --device=/dev/kvm -v `pwd`:/root/asterinas asterinas/asterinas:0.2.3 docker run -it --privileged --network=host --device=/dev/kvm -v `pwd`:/root/asterinas asterinas/asterinas:0.3.0
``` ```
**All build and test commands should be run inside the development container.** **All build and test commands should be run inside the development container.**

View File

@ -1 +1 @@
0.2.3 0.3.0

View File

@ -33,7 +33,7 @@ fn get_payload(boot_params: &BootParams) -> &'static [u8] {
let hdr = &boot_params.hdr; let hdr = &boot_params.hdr;
// The payload_offset field is not recorded in the relocation table, so we need to // The payload_offset field is not recorded in the relocation table, so we need to
// calculate the loaded offset manually. // calculate the loaded offset manually.
let loaded_offset = x86::relocation::get_image_loaded_offset(); let loaded_offset = x86::get_image_loaded_offset();
let payload_offset = (loaded_offset + hdr.payload_offset as isize) as usize; let payload_offset = (loaded_offset + hdr.payload_offset as isize) as usize;
let payload_length = hdr.payload_length as usize; let payload_length = hdr.payload_length as usize;
// Safety: the payload_offset and payload_length is valid if we assume that the // Safety: the payload_offset and payload_length is valid if we assume that the

View File

@ -6,7 +6,8 @@ use uefi::{
use linux_boot_params::BootParams; use linux_boot_params::BootParams;
use crate::x86::paging::{Ia32eFlags, PageNumber, PageTableCreator}; use super::paging::{Ia32eFlags, PageNumber, PageTableCreator};
use super::relocation::apply_rela_dyn_relocations;
#[export_name = "efi_stub_entry"] #[export_name = "efi_stub_entry"]
extern "sysv64" fn efi_stub_entry(handle: Handle, mut system_table: SystemTable<Boot>) -> ! { extern "sysv64" fn efi_stub_entry(handle: Handle, mut system_table: SystemTable<Boot>) -> ! {
@ -47,7 +48,7 @@ fn efi_phase_boot(
unsafe { crate::console::init() }; unsafe { crate::console::init() };
// Safety: this is the right time to apply relocations. // Safety: this is the right time to apply relocations.
unsafe { crate::x86::relocation::apply_rela_dyn_relocations() }; unsafe { apply_rela_dyn_relocations() };
uefi_services::println!("[EFI stub] Relocations applied."); uefi_services::println!("[EFI stub] Relocations applied.");

View File

@ -1,4 +1,6 @@
mod efi; mod efi;
mod paging;
mod relocation;
use core::arch::{asm, global_asm}; use core::arch::{asm, global_asm};

View File

@ -1,15 +1,4 @@
// This is enforced in the linker script. use crate::x86::get_image_loaded_offset;
const START_OF_SETUP32_VA: usize = 0x100000;
/// The wrapper is a position-independent executable. We can get the loaded base
/// address from the symbol.
#[inline]
pub fn get_image_loaded_offset() -> isize {
extern "C" {
fn start_of_setup32();
}
start_of_setup32 as isize - START_OF_SETUP32_VA as isize
}
struct Elf64Rela { struct Elf64Rela {
r_offset: u64, r_offset: u64,

View File

@ -17,8 +17,8 @@ extern "cdecl" fn trojan_entry(boot_params_ptr: u32) -> ! {
// println!("[setup] bzImage loaded at {:#x}", x86::relocation::get_image_loaded_offset()); // println!("[setup] bzImage loaded at {:#x}", x86::relocation::get_image_loaded_offset());
unsafe { unsafe {
print_str("[setup] bzImage loaded at "); print_str("[setup] bzImage loaded offset: ");
print_hex(crate::x86::relocation::get_image_loaded_offset() as u64); print_hex(crate::x86::get_image_loaded_offset() as u64);
print_str("\n"); print_str("\n");
} }
@ -32,8 +32,6 @@ extern "cdecl" fn trojan_entry(boot_params_ptr: u32) -> ! {
unsafe { call_aster_entrypoint(ASTER_ENTRY_POINT, boot_params_ptr.try_into().unwrap()) }; unsafe { call_aster_entrypoint(ASTER_ENTRY_POINT, boot_params_ptr.try_into().unwrap()) };
} }
pub const ASTER_ENTRY_POINT: u32 = 0x8001000;
unsafe fn call_aster_entrypoint(entrypoint: u32, boot_params_ptr: u32) -> ! { unsafe fn call_aster_entrypoint(entrypoint: u32, boot_params_ptr: u32) -> ! {
asm!("mov esi, {}", in(reg) boot_params_ptr); asm!("mov esi, {}", in(reg) boot_params_ptr);
asm!("mov eax, {}", in(reg) entrypoint); asm!("mov eax, {}", in(reg) entrypoint);

View File

@ -8,5 +8,15 @@ cfg_if::cfg_if! {
} }
} }
pub mod paging; // This is enforced in the linker script of the wrapper.
pub mod relocation; const START_OF_SETUP32_VA: usize = 0x100000;
/// The wrapper is a position-independent executable. We can get the loaded base
/// address from the symbol.
#[inline]
pub fn get_image_loaded_offset() -> isize {
extern "C" {
fn start_of_setup32();
}
start_of_setup32 as isize - START_OF_SETUP32_VA as isize
}