Update rust, use redox branch to prepare for libstd

This commit is contained in:
Jeremy Soller 2016-09-09 15:48:54 -06:00
parent 097a40d109
commit 3cd846a756
5 changed files with 19 additions and 13 deletions

2
.gitmodules vendored
View file

@ -1,3 +1,3 @@
[submodule "rust"]
path = rust
url = https://github.com/rust-lang/rust.git
url = https://github.com/redox-os/rust.git

View file

@ -82,4 +82,5 @@ qemu: build/harddrive.bin
endif
clean:
rm -rf build/* target/*
cargo clean
rm -rf build/*

View file

@ -202,23 +202,26 @@ pub unsafe extern fn kstart_ap(stack_start: usize, stack_end: usize) -> ! {
kmain_ap(ap_number);
}
pub unsafe fn usermode(ip: usize, sp: usize) {
// Test usermode
asm!("mov rax, 0x2B
pub unsafe fn usermode(ip: usize, sp: usize) -> ! {
// Go to usermode
asm!("mov rax, 0x2B # Set segment pointers
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
push rax
push rbx
pushfq
push rax # Push stack segment
push rbx # Push stack pointer
mov rax, 3 << 12 | 1 << 9 # Set IOPL and interrupt enable flag
push rax # Push rflags
mov rax, 0x23
push rax
push rcx
push rax # Push code segment
push rcx # Push rip
xchg bx, bx
iretq"
:
: "{rbx}"(sp), "{rcx}"(ip)
: "rax", "rbx", "rcx", "sp"
: "rax", "sp"
: "intel", "volatile");
unreachable!();
}

View file

@ -11,7 +11,7 @@ use syscall::{exit, write};
pub unsafe extern fn _start() {
let string = b"Hello, World!\n";
write(1, string);
exit(1);
exit(0);
}
#[cfg(not(test))]
@ -22,6 +22,8 @@ extern "C" fn eh_personality() {}
/// Required to handle panics
#[lang = "panic_fmt"]
extern "C" fn panic_fmt(_fmt: ::core::fmt::Arguments, _file: &str, _line: u32) -> ! {
write(2, b"panic\n");
exit(127);
loop {}
}

2
rust

@ -1 +1 @@
Subproject commit a23064af5ec7f52b287e2c60823fed92a4763502
Subproject commit 46a90c60ab79d65a09330448becd01c78511ea77