diff --git a/src/arch/aarch64/kernel/scheduler.rs b/src/arch/aarch64/kernel/scheduler.rs index 1517e23a5e..63d564643e 100644 --- a/src/arch/aarch64/kernel/scheduler.rs +++ b/src/arch/aarch64/kernel/scheduler.rs @@ -13,7 +13,7 @@ use crate::arch::aarch64::kernel::CURRENT_STACK_ADDRESS; use crate::arch::aarch64::mm::paging::{BasePageSize, PageSize, PageTableEntryFlags}; use crate::arch::aarch64::mm::{PhysAddr, VirtAddr}; use crate::scheduler::task::{Task, TaskFrame}; -use crate::{env, DEFAULT_STACK_SIZE, KERNEL_STACK_SIZE}; +use crate::{kernel, DEFAULT_STACK_SIZE, KERNEL_STACK_SIZE}; #[derive(Debug)] #[repr(C, packed)] @@ -264,21 +264,21 @@ pub struct TaskTLS { impl TaskTLS { fn from_environment() -> Option> { - if env::get_tls_memsz() == 0 { + if kernel::get_tls_memsz() == 0 { return None; } // Get TLS initialization image let tls_init_image = { - let tls_init_data = env::get_tls_start().as_ptr::(); - let tls_init_len = env::get_tls_filesz(); + let tls_init_data = kernel::get_tls_start().as_ptr::(); + let tls_init_len = kernel::get_tls_filesz(); // SAFETY: We will have to trust the environment here. unsafe { slice::from_raw_parts(tls_init_data, tls_init_len) } }; - let off = core::cmp::max(16, env::get_tls_align()) - 16; - let block_len = env::get_tls_memsz() + off; + let off = core::cmp::max(16, kernel::get_tls_align()) - 16; + let block_len = kernel::get_tls_memsz() + off; let len = block_len + mem::size_of::>(); let layout = Layout::from_size_align(len, 16).unwrap(); diff --git a/src/arch/x86_64/kernel/scheduler.rs b/src/arch/x86_64/kernel/scheduler.rs index 75b6835b5e..52e330108e 100644 --- a/src/arch/x86_64/kernel/scheduler.rs +++ b/src/arch/x86_64/kernel/scheduler.rs @@ -14,7 +14,7 @@ use crate::arch::x86_64::mm::paging::{ }; use crate::arch::x86_64::mm::{PhysAddr, VirtAddr}; use crate::config::*; -use crate::env; +use crate::kernel; use crate::scheduler::task::{Task, TaskFrame}; #[repr(C, packed)] @@ -241,16 +241,16 @@ impl TaskTLS { // “ELF Handling For Thread-Local Storage” Section 3.4.6: x86-64 Specific Definitions for Run-Time Handling of TLS // https://akkadia.org/drepper/tls.pdf - let tls_len = env::get_tls_memsz(); + let tls_len = kernel::get_tls_memsz(); - if env::get_tls_memsz() == 0 { + if kernel::get_tls_memsz() == 0 { return None; } // Get TLS initialization image let tls_init_image = { - let tls_init_data = env::get_tls_start().as_ptr::(); - let tls_init_len = env::get_tls_filesz(); + let tls_init_data = kernel::get_tls_start().as_ptr::(); + let tls_init_len = kernel::get_tls_filesz(); // SAFETY: We will have to trust the environment here. unsafe { slice::from_raw_parts(tls_init_data, tls_init_len) } @@ -258,7 +258,7 @@ impl TaskTLS { // Allocate TLS block let mut block = { - let tls_align = env::get_tls_align(); + let tls_align = kernel::get_tls_align(); // As described in “ELF Handling For Thread-Local Storage” let tls_offset = tls_len.align_up(tls_align); diff --git a/src/env.rs b/src/env.rs index 5a1e4efd23..0582b90d11 100644 --- a/src/env.rs +++ b/src/env.rs @@ -11,8 +11,7 @@ use hermit_entry::boot_info::PlatformInfo; use hermit_sync::OnceCell; pub use crate::arch::kernel::{ - get_base_address, get_cmdline, get_cmdsize, get_image_size, get_ram_address, get_tls_align, - get_tls_filesz, get_tls_memsz, get_tls_start, + get_base_address, get_cmdline, get_cmdsize, get_image_size, get_ram_address, }; use crate::kernel::boot_info; diff --git a/src/lib.rs b/src/lib.rs index 23fd6ecb4b..9baf39fe6a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -316,8 +316,8 @@ fn boot_processor_main() -> ! { }); info!( "TLS starts at {:p} (size {} Bytes)", - env::get_tls_start(), - env::get_tls_memsz() + kernel::get_tls_start(), + kernel::get_tls_memsz() ); arch::boot_processor_init(); scheduler::add_current_core();