rt: Namespace all C functions under rust_
This commit is contained in:
@@ -21,8 +21,8 @@ pub mod rustrt {
|
|||||||
use super::Tm;
|
use super::Tm;
|
||||||
|
|
||||||
extern {
|
extern {
|
||||||
pub fn get_time(sec: &mut i64, nsec: &mut i32);
|
pub fn rust_get_time(sec: &mut i64, nsec: &mut i32);
|
||||||
pub fn precise_time_ns(ns: &mut u64);
|
pub fn rust_precise_time_ns(ns: &mut u64);
|
||||||
pub fn rust_tzset();
|
pub fn rust_tzset();
|
||||||
pub fn rust_gmtime(sec: i64, nsec: i32, result: &mut Tm);
|
pub fn rust_gmtime(sec: i64, nsec: i32, result: &mut Tm);
|
||||||
pub fn rust_localtime(sec: i64, nsec: i32, result: &mut Tm);
|
pub fn rust_localtime(sec: i64, nsec: i32, result: &mut Tm);
|
||||||
@@ -66,7 +66,7 @@ pub fn get_time() -> Timespec {
|
|||||||
unsafe {
|
unsafe {
|
||||||
let mut sec = 0i64;
|
let mut sec = 0i64;
|
||||||
let mut nsec = 0i32;
|
let mut nsec = 0i32;
|
||||||
rustrt::get_time(&mut sec, &mut nsec);
|
rustrt::rust_get_time(&mut sec, &mut nsec);
|
||||||
return Timespec::new(sec, nsec);
|
return Timespec::new(sec, nsec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ pub fn get_time() -> Timespec {
|
|||||||
pub fn precise_time_ns() -> u64 {
|
pub fn precise_time_ns() -> u64 {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut ns = 0u64;
|
let mut ns = 0u64;
|
||||||
rustrt::precise_time_ns(&mut ns);
|
rustrt::rust_precise_time_ns(&mut ns);
|
||||||
ns
|
ns
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -241,11 +241,11 @@ impl Drop for BasicPausible {
|
|||||||
|
|
||||||
fn time() -> Time {
|
fn time() -> Time {
|
||||||
extern {
|
extern {
|
||||||
fn get_time(sec: &mut i64, nsec: &mut i32);
|
fn rust_get_time(sec: &mut i64, nsec: &mut i32);
|
||||||
}
|
}
|
||||||
let mut sec = 0;
|
let mut sec = 0;
|
||||||
let mut nsec = 0;
|
let mut nsec = 0;
|
||||||
unsafe { get_time(&mut sec, &mut nsec) }
|
unsafe { rust_get_time(&mut sec, &mut nsec) }
|
||||||
|
|
||||||
Time { sec: sec as u64, nsec: nsec as u64 }
|
Time { sec: sec as u64, nsec: nsec as u64 }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ impl Context {
|
|||||||
// which we will then modify to call the given function when restored
|
// which we will then modify to call the given function when restored
|
||||||
let mut regs = new_regs();
|
let mut regs = new_regs();
|
||||||
unsafe {
|
unsafe {
|
||||||
swap_registers(transmute_mut_region(&mut *regs), transmute_region(&*regs));
|
rust_swap_registers(transmute_mut_region(&mut *regs), transmute_region(&*regs));
|
||||||
};
|
};
|
||||||
|
|
||||||
initialize_call_frame(&mut *regs, fp, argp, sp);
|
initialize_call_frame(&mut *regs, fp, argp, sp);
|
||||||
@@ -104,8 +104,8 @@ impl Context {
|
|||||||
// stack limit in the OS-specified TLS slot. This also means that
|
// stack limit in the OS-specified TLS slot. This also means that
|
||||||
// we cannot call any more rust functions after record_stack_bounds
|
// we cannot call any more rust functions after record_stack_bounds
|
||||||
// returns because they would all likely fail due to the limit being
|
// returns because they would all likely fail due to the limit being
|
||||||
// invalid for the current task. Lucky for us `swap_registers` is a
|
// invalid for the current task. Lucky for us `rust_swap_registers`
|
||||||
// C function so we don't have to worry about that!
|
// is a C function so we don't have to worry about that!
|
||||||
match in_context.stack_bounds {
|
match in_context.stack_bounds {
|
||||||
Some((lo, hi)) => record_stack_bounds(lo, hi),
|
Some((lo, hi)) => record_stack_bounds(lo, hi),
|
||||||
// If we're going back to one of the original contexts or
|
// If we're going back to one of the original contexts or
|
||||||
@@ -113,13 +113,13 @@ impl Context {
|
|||||||
// the stack limit to 0 to make morestack never fail
|
// the stack limit to 0 to make morestack never fail
|
||||||
None => record_stack_bounds(0, uint::max_value),
|
None => record_stack_bounds(0, uint::max_value),
|
||||||
}
|
}
|
||||||
swap_registers(out_regs, in_regs)
|
rust_swap_registers(out_regs, in_regs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern {
|
extern {
|
||||||
fn swap_registers(out_regs: *mut Registers, in_regs: *Registers);
|
fn rust_swap_registers(out_regs: *mut Registers, in_regs: *Registers);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register contexts used in various architectures
|
// Register contexts used in various architectures
|
||||||
@@ -142,7 +142,7 @@ extern {
|
|||||||
//
|
//
|
||||||
// These structures/functions are roughly in-sync with the source files inside
|
// These structures/functions are roughly in-sync with the source files inside
|
||||||
// of src/rt/arch/$arch. The only currently used function from those folders is
|
// of src/rt/arch/$arch. The only currently used function from those folders is
|
||||||
// the `swap_registers` function, but that's only because for now segmented
|
// the `rust_swap_registers` function, but that's only because for now segmented
|
||||||
// stacks are disabled.
|
// stacks are disabled.
|
||||||
|
|
||||||
#[cfg(target_arch = "x86")]
|
#[cfg(target_arch = "x86")]
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
.align
|
.align
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
.globl swap_registers
|
.globl rust_swap_registers
|
||||||
swap_registers:
|
rust_swap_registers:
|
||||||
str r0, [r0, #0]
|
str r0, [r0, #0]
|
||||||
str r3, [r0, #12]
|
str r3, [r0, #12]
|
||||||
str r4, [r0, #16]
|
str r4, [r0, #16]
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ The registers_t variable is in (%esp)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__APPLE__) || defined(_WIN32)
|
#if defined(__APPLE__) || defined(_WIN32)
|
||||||
#define SWAP_REGISTERS _swap_registers
|
#define SWAP_REGISTERS _rust_swap_registers
|
||||||
#else
|
#else
|
||||||
#define SWAP_REGISTERS swap_registers
|
#define SWAP_REGISTERS rust_swap_registers
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// swap_registers(registers_t *oregs, registers_t *regs)
|
// swap_registers(registers_t *oregs, registers_t *regs)
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
.text
|
.text
|
||||||
.globl swap_registers
|
.globl rust_swap_registers
|
||||||
.align 2
|
.align 2
|
||||||
.set nomips16
|
.set nomips16
|
||||||
.ent swap_registers
|
.ent rust_swap_registers
|
||||||
swap_registers:
|
rust_swap_registers:
|
||||||
.set noreorder
|
.set noreorder
|
||||||
.set nomacro
|
.set nomacro
|
||||||
.set noat
|
.set noat
|
||||||
@@ -85,4 +85,4 @@ swap_registers:
|
|||||||
|
|
||||||
jr $31
|
jr $31
|
||||||
nop
|
nop
|
||||||
.end swap_registers
|
.end rust_swap_registers
|
||||||
|
|||||||
@@ -55,9 +55,9 @@ First four arguments:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#define SWAP_REGISTERS _swap_registers
|
#define SWAP_REGISTERS _rust_swap_registers
|
||||||
#else
|
#else
|
||||||
#define SWAP_REGISTERS swap_registers
|
#define SWAP_REGISTERS rust_swap_registers
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// swap_registers(registers_t *oregs, registers_t *regs)
|
// swap_registers(registers_t *oregs, registers_t *regs)
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ extern "C" CDECL FILE* rust_get_stderr() {return stderr;}
|
|||||||
|
|
||||||
#if defined(__WIN32__)
|
#if defined(__WIN32__)
|
||||||
extern "C" CDECL void
|
extern "C" CDECL void
|
||||||
get_time(int64_t *sec, int32_t *nsec) {
|
rust_get_time(int64_t *sec, int32_t *nsec) {
|
||||||
FILETIME fileTime;
|
FILETIME fileTime;
|
||||||
GetSystemTimeAsFileTime(&fileTime);
|
GetSystemTimeAsFileTime(&fileTime);
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ get_time(int64_t *sec, int32_t *nsec) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
extern "C" CDECL void
|
extern "C" CDECL void
|
||||||
get_time(int64_t *sec, int32_t *nsec) {
|
rust_get_time(int64_t *sec, int32_t *nsec) {
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
@@ -205,7 +205,7 @@ get_time(int64_t *sec, int32_t *nsec) {
|
|||||||
const int64_t ns_per_s = 1000000000LL;
|
const int64_t ns_per_s = 1000000000LL;
|
||||||
|
|
||||||
extern "C" CDECL void
|
extern "C" CDECL void
|
||||||
precise_time_ns(uint64_t *ns) {
|
rust_precise_time_ns(uint64_t *ns) {
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
uint64_t time = mach_absolute_time();
|
uint64_t time = mach_absolute_time();
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ rust_dbg_abi_1
|
|||||||
rust_dbg_abi_2
|
rust_dbg_abi_2
|
||||||
rust_dbg_static_mut
|
rust_dbg_static_mut
|
||||||
rust_dbg_static_mut_check_four
|
rust_dbg_static_mut_check_four
|
||||||
get_time
|
rust_get_time
|
||||||
rust_tzset
|
rust_tzset
|
||||||
rust_gmtime
|
rust_gmtime
|
||||||
rust_localtime
|
rust_localtime
|
||||||
rust_timegm
|
rust_timegm
|
||||||
rust_mktime
|
rust_mktime
|
||||||
precise_time_ns
|
rust_precise_time_ns
|
||||||
rust_path_is_dir
|
rust_path_is_dir
|
||||||
rust_path_is_dir_u16
|
rust_path_is_dir_u16
|
||||||
rust_path_exists
|
rust_path_exists
|
||||||
@@ -43,7 +43,7 @@ rust_signal_little_lock
|
|||||||
rust_wait_little_lock
|
rust_wait_little_lock
|
||||||
tdefl_compress_mem_to_heap
|
tdefl_compress_mem_to_heap
|
||||||
tinfl_decompress_mem_to_heap
|
tinfl_decompress_mem_to_heap
|
||||||
swap_registers
|
rust_swap_registers
|
||||||
rust_readdir
|
rust_readdir
|
||||||
rust_opendir
|
rust_opendir
|
||||||
rust_dbg_extern_identity_u32
|
rust_dbg_extern_identity_u32
|
||||||
|
|||||||
Reference in New Issue
Block a user