Start on support for aarch64
- Add aarch64 support
- crt0 - add support to _start
- platform - aarch64 does not have the open syscall. Instead most
libc implementations use openat() with AT_FDCWD
- Use sc instead of syscall. sc is the maintained fork of syscall.
This commit is contained in:
committed by
Dan Robertson
parent
3855e4c4b9
commit
d9d2ec1992
@@ -1,5 +1,7 @@
|
||||
use types::*;
|
||||
|
||||
const AT_FDCWD: c_int = -100;
|
||||
|
||||
pub fn close(fildes: c_int) -> c_int {
|
||||
unsafe {
|
||||
syscall!(CLOSE, fildes) as c_int
|
||||
@@ -13,12 +15,21 @@ pub fn exit(status: c_int) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub fn open(path: *const c_char, oflag: c_int, mode: mode_t) -> c_int {
|
||||
unsafe {
|
||||
syscall!(OPEN, path, oflag, mode) as c_int
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
pub fn open(path: *const c_char, oflag: c_int, mode: mode_t) -> c_int {
|
||||
unsafe {
|
||||
syscall!(OPENAT, AT_FDCWD, path, oflag, mode) as c_int
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub fn write(fildes: c_int, buf: &[u8]) -> ssize_t {
|
||||
unsafe {
|
||||
syscall!(WRITE, fildes, buf.as_ptr(), buf.len()) as ssize_t
|
||||
|
||||
Reference in New Issue
Block a user