Skip to content
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
2 changes: 1 addition & 1 deletion dev_tests/src/ratchet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn ratchet_globals() -> Result<()> {
("litebox/", 9),
("litebox_platform_linux_kernel/", 6),
("litebox_platform_linux_userland/", 5),
("litebox_platform_lvbs/", 26),
("litebox_platform_lvbs/", 23),
("litebox_platform_multiplex/", 1),
("litebox_platform_windows_userland/", 7),
("litebox_runner_linux_userland/", 1),
Expand Down
14 changes: 5 additions & 9 deletions litebox_platform_lvbs/src/arch/x86/gdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

//! Global Descriptor Table (GDT) and Task State Segment (TSS)

use crate::host::per_cpu_variables::{
PerCpuVariablesAsm, with_per_cpu_variables_asm, with_per_cpu_variables_mut,
};
use crate::host::per_cpu_variables::with_per_cpu_variables;
use alloc::boxed::Box;
use x86_64::{
PrivilegeLevel, VirtAddr,
Expand Down Expand Up @@ -82,10 +80,8 @@ impl Default for GdtWrapper {
}

fn setup_gdt_tss() {
let double_fault_stack_top =
with_per_cpu_variables_asm(PerCpuVariablesAsm::get_double_fault_stack_ptr);
let exception_stack_top =
with_per_cpu_variables_asm(PerCpuVariablesAsm::get_exception_stack_ptr);
let double_fault_stack_top = with_per_cpu_variables(|pcv| pcv.asm.get_double_fault_stack_ptr());
let exception_stack_top = with_per_cpu_variables(|pcv| pcv.asm.get_exception_stack_ptr());

let mut tss = Box::new(AlignedTss(TaskStateSegment::new()));
// TSS.IST1: dedicated stack for double faults
Expand Down Expand Up @@ -123,8 +119,8 @@ fn setup_gdt_tss() {
load_tss(gdt.selectors.tss);
}

with_per_cpu_variables_mut(|per_cpu_variables| {
per_cpu_variables.gdt = Some(gdt);
with_per_cpu_variables(|per_cpu_variables| {
per_cpu_variables.gdt.set(Some(gdt));
});
}

Expand Down
10 changes: 5 additions & 5 deletions litebox_platform_lvbs/src/host/lvbs_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use crate::{
Errno, HostInterface, arch::ioport::serial_print_string,
host::per_cpu_variables::with_per_cpu_variables_mut,
host::per_cpu_variables::with_per_cpu_variables,
};

pub type LvbsLinuxKernel = crate::LinuxKernel<HostLvbsInterface>;
Expand Down Expand Up @@ -87,14 +87,14 @@ impl LvbsLinuxKernel {

unsafe impl litebox::platform::ThreadLocalStorageProvider for LvbsLinuxKernel {
fn get_thread_local_storage() -> *mut () {
let tls = with_per_cpu_variables_mut(|pcv| pcv.tls);
let tls = with_per_cpu_variables(|pcv| pcv.tls.get());
tls.as_mut_ptr::<()>()
}

unsafe fn replace_thread_local_storage(value: *mut ()) -> *mut () {
with_per_cpu_variables_mut(|pcv| {
let old = pcv.tls;
pcv.tls = x86_64::VirtAddr::new(value as u64);
with_per_cpu_variables(|pcv| {
let old = pcv.tls.get();
pcv.tls.set(x86_64::VirtAddr::new(value as u64));
old.as_u64() as *mut ()
})
}
Expand Down
Loading