Update rust, use redox branch to prepare for libstd
This commit is contained in:
parent
097a40d109
commit
3cd846a756
2
.gitmodules
vendored
2
.gitmodules
vendored
|
@ -1,3 +1,3 @@
|
||||||
[submodule "rust"]
|
[submodule "rust"]
|
||||||
path = rust
|
path = rust
|
||||||
url = https://github.com/rust-lang/rust.git
|
url = https://github.com/redox-os/rust.git
|
||||||
|
|
3
Makefile
3
Makefile
|
@ -82,4 +82,5 @@ qemu: build/harddrive.bin
|
||||||
endif
|
endif
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf build/* target/*
|
cargo clean
|
||||||
|
rm -rf build/*
|
||||||
|
|
|
@ -202,23 +202,26 @@ pub unsafe extern fn kstart_ap(stack_start: usize, stack_end: usize) -> ! {
|
||||||
kmain_ap(ap_number);
|
kmain_ap(ap_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn usermode(ip: usize, sp: usize) {
|
pub unsafe fn usermode(ip: usize, sp: usize) -> ! {
|
||||||
// Test usermode
|
// Go to usermode
|
||||||
asm!("mov rax, 0x2B
|
asm!("mov rax, 0x2B # Set segment pointers
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov es, ax
|
mov es, ax
|
||||||
mov fs, ax
|
mov fs, ax
|
||||||
mov gs, ax
|
mov gs, ax
|
||||||
|
|
||||||
push rax
|
push rax # Push stack segment
|
||||||
push rbx
|
push rbx # Push stack pointer
|
||||||
pushfq
|
mov rax, 3 << 12 | 1 << 9 # Set IOPL and interrupt enable flag
|
||||||
|
push rax # Push rflags
|
||||||
mov rax, 0x23
|
mov rax, 0x23
|
||||||
push rax
|
push rax # Push code segment
|
||||||
push rcx
|
push rcx # Push rip
|
||||||
|
xchg bx, bx
|
||||||
iretq"
|
iretq"
|
||||||
:
|
:
|
||||||
: "{rbx}"(sp), "{rcx}"(ip)
|
: "{rbx}"(sp), "{rcx}"(ip)
|
||||||
: "rax", "rbx", "rcx", "sp"
|
: "rax", "sp"
|
||||||
: "intel", "volatile");
|
: "intel", "volatile");
|
||||||
|
unreachable!();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ use syscall::{exit, write};
|
||||||
pub unsafe extern fn _start() {
|
pub unsafe extern fn _start() {
|
||||||
let string = b"Hello, World!\n";
|
let string = b"Hello, World!\n";
|
||||||
write(1, string);
|
write(1, string);
|
||||||
exit(1);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
|
@ -22,6 +22,8 @@ extern "C" fn eh_personality() {}
|
||||||
/// Required to handle panics
|
/// Required to handle panics
|
||||||
#[lang = "panic_fmt"]
|
#[lang = "panic_fmt"]
|
||||||
extern "C" fn panic_fmt(_fmt: ::core::fmt::Arguments, _file: &str, _line: u32) -> ! {
|
extern "C" fn panic_fmt(_fmt: ::core::fmt::Arguments, _file: &str, _line: u32) -> ! {
|
||||||
|
write(2, b"panic\n");
|
||||||
|
exit(127);
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
rust
2
rust
|
@ -1 +1 @@
|
||||||
Subproject commit a23064af5ec7f52b287e2c60823fed92a4763502
|
Subproject commit 46a90c60ab79d65a09330448becd01c78511ea77
|
Loading…
Reference in a new issue