Update rust

This commit is contained in:
Jeremy Soller 2016-12-15 13:40:26 -07:00
parent f9530fc348
commit 8c632d572f
5 changed files with 4 additions and 117 deletions

View file

@ -2,7 +2,6 @@
#![allow(non_camel_case_types)]
#![feature(asm)]
#![feature(const_fn)]
#![feature(naked_functions)]
#![feature(thread_local)]
#![cfg_attr(stdbuild, feature(no_std, core, core_slice_ext, staged_api, custom_attribute, cfg_target_vendor))]
@ -15,14 +14,11 @@
pub use types::*;
pub use funcs::*;
pub use start::*;
pub use syscall::*;
/// Basic types (not usually system specific)
mod types;
/// Basic functions (not system specific)
mod funcs;
/// Start function and call in to libstd
mod start;
/// Conversion for syscall library (specific to Redox)
mod syscall;

View file

@ -1,40 +0,0 @@
use super::exit;
#[no_mangle]
#[naked]
#[cfg(target_arch = "x86")]
pub unsafe fn _start() {
asm!("push esp
call _start_stack
pop esp"
:
:
: "memory"
: "intel", "volatile");
let _ = exit(0);
}
#[no_mangle]
#[naked]
#[cfg(target_arch = "x86_64")]
pub unsafe fn _start() {
asm!("mov rdi, rsp
and rsp, 0xFFFFFFFFFFFFFFF0
call _start_stack"
:
:
: "memory"
: "intel", "volatile");
let _ = exit(0);
}
#[no_mangle]
pub unsafe extern "C" fn _start_stack(stack: *const usize){
extern "C" {
fn main(argc: usize, argv: *const *const u8) -> usize;
}
let argc = *stack as usize;
let argv = stack.offset(1) as *const *const u8;
let _ = exit(main(argc, argv));
}