Skip to content
Snippets Groups Projects
Verified Commit 618643b2 authored by Jacob Lorentzon's avatar Jacob Lorentzon
Browse files

Work around aarch64 bootstrap crash.

parent 5277f2f6
No related branches found
No related tags found
No related merge requests found
...@@ -95,6 +95,10 @@ pub unsafe fn tcb_activate(tls_end_and_tcb_start: usize, _tls_len: usize) { ...@@ -95,6 +95,10 @@ pub unsafe fn tcb_activate(tls_end_and_tcb_start: usize, _tls_len: usize) {
/// Initialize redox-rt in situations where relibc is not used /// Initialize redox-rt in situations where relibc is not used
pub fn initialize_freestanding() { pub fn initialize_freestanding() {
// TODO: This code is a hack! Integrate the ld_so TCB code into generic-rt, and then use that
// (this function will need pointers to the ELF structs normally passed in auxvs), so the TCB
// is initialized properly.
// TODO: TLS // TODO: TLS
let page = unsafe { let page = unsafe {
&mut *(syscall::fmap(!0, &syscall::Map { &mut *(syscall::fmap(!0, &syscall::Map {
...@@ -108,7 +112,13 @@ pub fn initialize_freestanding() { ...@@ -108,7 +112,13 @@ pub fn initialize_freestanding() {
page.tcb_len = syscall::PAGE_SIZE; page.tcb_len = syscall::PAGE_SIZE;
page.tls_end = (page as *mut Tcb).cast(); page.tls_end = (page as *mut Tcb).cast();
#[cfg(not(target_arch = "aarch64"))]
unsafe { unsafe {
tcb_activate(page as *mut Tcb as usize, 0) tcb_activate(page as *mut Tcb as usize, 0)
} }
#[cfg(target_arch = "aarch64")]
unsafe {
let abi_ptr = core::ptr::addr_of_mut!(page.tcb_ptr);
core::arch::asm!("msr tpidr_el0, {}", in(reg) abi_ptr);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment