Commit 98c60c35 authored by 4lDO2's avatar 4lDO2 🖖
Browse files

Merge branch 'update_toolchain' into 'master'

Update toolchain

See merge request !338
parents b472cb87 9eeb7331
Pipeline #9420 failed with stages
in 1 minute and 52 seconds
This diff is collapsed.
......@@ -19,7 +19,7 @@ cc = "1.0.25"
[dependencies]
cbitset = "0.1.0"
core_io = { path = "core_io", features = ["collections"] }
lazy_static = { version = "1.2.0", features = ["nightly", "spin_no_std"] }
lazy_static = { version = "1.4.0", default-features = false, features = ["spin_no_std"] }
memoffset = "0.5.1"
posix-regex = { path = "posix-regex", features = ["no_std"] }
rand = { version = "0.5.5", default-features = false }
......@@ -39,8 +39,8 @@ optional = true
sc = "0.2.3"
[target.'cfg(target_os = "redox")'.dependencies]
redox_syscall = "0.2.7"
spin = "0.4.10"
redox_syscall = "0.2.9"
spin = "0.9.0"
[features]
default = []
......
......@@ -2,7 +2,7 @@ TARGET?=$(shell rustc -Z unstable-options --print target-spec-json | grep llvm-t
CARGO?=cargo
CARGO_TEST?=$(CARGO)
CARGOFLAGS?=
CARGOFLAGS?=-Z build-std=core,alloc,compiler_builtins
RUSTCFLAGS?=
export OBJCOPY?=objcopy
......
Subproject commit 23118bedb028808c69ccd0f378160723fbbca586
Subproject commit b120854ab81b86d2b52bd8a8b620fbdeed6d0bad
nightly-2020-07-27
nightly-2021-03-15
......@@ -11,16 +11,16 @@ global_asm!(
.section .init
.global _init
_init:
push %rbp
movq %rsp, %rbp
push rbp
mov rbp, rsp
// Created a new stack frame and updated the stack pointer
// Body will be filled in by gcc and ended by crtn.o
.section .fini
.global _fini
_fini:
push %rbp
movq %rsp, %rbp
push rbp
mov rbp, rsp
// Created a new stack frame and updated the stack pointer
// Body will be filled in by gcc and ended by crtn.o
"#
......
......@@ -11,13 +11,13 @@ global_asm!(
.section .init
// This happens after crti.o and gcc has inserted code
// Pop the stack frame
pop %rbp
pop rbp
ret
.section .fini
// This happens after crti.o and gcc has inserted code
// Pop the stack frame
pop %rbp
pop rbp
ret
"#
);
......
......@@ -5,18 +5,18 @@
.type longjmp,@function
_longjmp:
longjmp:
mov %rsi,%rax /* val will be longjmp return */
test %rax,%rax
mov rax,rsi /* val will be longjmp return */
test rax,rax
jnz 1f
inc %rax /* if val==0, val=1 per longjmp semantics */
inc rax /* if val==0, val=1 per longjmp semantics */
1:
mov (%rdi),%rbx /* rdi is the jmp_buf, restore regs from it */
mov 8(%rdi),%rbp
mov 16(%rdi),%r12
mov 24(%rdi),%r13
mov 32(%rdi),%r14
mov 40(%rdi),%r15
mov 48(%rdi),%rdx /* this ends up being the stack pointer */
mov %rdx,%rsp
mov 56(%rdi),%rdx /* this is the instruction pointer */
jmp *%rdx /* goto saved address without altering rsp */
mov rbx, [rdi] /* rdi is the jmp_buf, restore regs from it */
mov rbp, [rdi + 8]
mov r12, [rdi + 16]
mov r13, [rdi + 24]
mov r14, [rdi + 32]
mov r15, [rdi + 40]
mov rdx, [rdi + 48] /* this ends up being the stack pointer */
mov rsp, rdx
mov rdx, [rdi + 56] /* this is the instruction pointer */
jmp rdx /* goto saved address without altering rsp */
......@@ -8,15 +8,15 @@
__setjmp:
_setjmp:
setjmp:
mov %rbx,(%rdi) /* rdi is jmp_buf, move registers onto it */
mov %rbp,8(%rdi)
mov %r12,16(%rdi)
mov %r13,24(%rdi)
mov %r14,32(%rdi)
mov %r15,40(%rdi)
lea 8(%rsp),%rdx /* this is our rsp WITHOUT current ret addr */
mov %rdx,48(%rdi)
mov (%rsp),%rdx /* save return addr ptr for new rip */
mov %rdx,56(%rdi)
xor %rax,%rax /* always return 0 */
mov [rdi], rbx /* rdi is jmp_buf, move registers onto it */
mov [rdi + 8], rbp
mov [rdi + 16], r12
mov [rdi + 24], r13
mov [rdi + 32], r14
mov [rdi + 40], r15
lea rdx, [rsp + 8] /* this is our rsp WITHOUT current ret addr */
mov [rdi + 48], rdx
mov rdx, [rsp] /* save return addr ptr for new rip */
mov [rdi + 56], rdx
xor rax, rax /* always return 0 */
ret
......@@ -5,7 +5,7 @@ global_asm!(
"
.global __restore_rt
__restore_rt:
mov $15, %rax
mov rax, 15
syscall
"
);
......
......@@ -5,7 +5,7 @@ global_asm!(
"
.global __restore_rt
__restore_rt:
mov $119, %rax
mov rax, 119
syscall
"
);
......
......@@ -88,9 +88,14 @@ pub unsafe extern "C" fn chdir(path: *const c_char) -> c_int {
Sys::chdir(path)
}
// #[no_mangle]
#[no_mangle]
pub extern "C" fn chroot(path: *const c_char) -> c_int {
unimplemented!();
// TODO: Implement
unsafe {
platform::errno = crate::header::errno::EPERM;
}
-1
}
#[no_mangle]
......
......@@ -10,9 +10,39 @@ use crate::{
use super::mbstate_t;
// Based on
// https://github.com/rust-lang/rust/blob/f24ce9b/library/core/src/str/validations.rs#L232-L257,
// because apparently somebody removed the `pub use` statement from `core::str`.
// https://tools.ietf.org/html/rfc3629
static UTF8_CHAR_WIDTH: [u8; 256] = [
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, // 0x1F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, // 0x3F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, // 0x5F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, // 0x7F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, // 0x9F
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, // 0xBF
0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, // 0xDF
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xEF
4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xFF
];
// Given a first byte, determines how many bytes are in this UTF-8 character.
#[inline]
fn utf8_char_width(b: u8) -> usize {
UTF8_CHAR_WIDTH[usize::from(b)].into()
}
//It's guaranteed that we don't have any nullpointers here
pub unsafe fn mbrtowc(pwc: *mut wchar_t, s: *const c_char, n: usize, ps: *mut mbstate_t) -> usize {
let size = str::utf8_char_width(*s as u8);
let size = utf8_char_width(*s as u8);
if size > n {
platform::errno = errno::EILSEQ;
return -2isize as usize;
......
......@@ -6,7 +6,6 @@
#![feature(asm)]
#![feature(box_into_pin)]
#![feature(c_variadic)]
#![feature(const_fn)]
#![feature(const_raw_ptr_deref)]
#![feature(core_intrinsics)]
#![feature(global_asm)]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment