* Fire up multiple processors

* Use IPIs to wake up secondary processors

* Much better exception information

* Modifications to show more information on fault

* WIP: Use real libstd

* Add TLS (not complete)

* Add random function, export getpid, cleanup

* Do not spin APs until new context

* Update rust

* Update rust

* Use rd/wrfsbase

* Implement TLS

* Implement compiler builtins and update rust

* Update rust

* Back to Redox libstd

* Update rust
This commit is contained in:
Jeremy Soller 2016-10-31 10:49:00 -06:00 committed by GitHub
parent 25dc44b348
commit 149b0297a4
54 changed files with 1121 additions and 380 deletions

View file

@ -109,7 +109,7 @@ pub unsafe extern fn kstart() -> ! {
}
// Initialize devices
device::init();
device::init(&mut active_table);
// Read ACPI tables, starts APs
acpi::init(&mut active_table);
@ -145,6 +145,9 @@ pub unsafe extern fn kstart_ap(cpu_id: usize, bsp_table: usize, stack_start: usi
assert_eq!(TDATA_TEST_NONZERO, 0xFFFFFFFFFFFFFFFE);
}
// Initialize devices (for AP)
device::init_ap();
AP_READY.store(true, Ordering::SeqCst);
}
@ -155,24 +158,27 @@ pub unsafe extern fn kstart_ap(cpu_id: usize, bsp_table: usize, stack_start: usi
kmain_ap(cpu_id);
}
pub unsafe fn usermode(ip: usize, sp: usize) -> ! {
pub unsafe fn usermode(ip: usize, sp: usize, fs: usize) -> ! {
// Go to usermode
asm!("mov ds, ax
asm!("xchg bx, bx
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
wrfsbase rbx
push rax
push rbx
push rcx
push rdx
push rsi
push rdi
iretq"
: // No output because it never returns
: "{rax}"(gdt::GDT_USER_DATA << 3 | 3), // Stack segment
"{rbx}"(sp), // Stack pointer
"{rcx}"(3 << 12 | 1 << 9), // Flags - Set IOPL and interrupt enable flag
"{rdx}"(gdt::GDT_USER_CODE << 3 | 3), // Code segment
"{rsi}"(ip) // IP
: "{rax}"(gdt::GDT_USER_DATA << 3 | 3), // Data segment
"{rbx}"(fs), // TLS segment
"{rcx}"(sp), // Stack pointer
"{rdx}"(3 << 12 | 1 << 9), // Flags - Set IOPL and interrupt enable flag
"{rsi}"(gdt::GDT_USER_CODE << 3 | 3), // Code segment
"{rdi}"(ip) // IP
: // No clobers because it never returns
: "intel", "volatile");
unreachable!();