commit cff84b4e06fca8136953f5a96ab9ec7fc3a057e7 parent f00ca35c07f74c1ff4c2b97f907d6146a7fcc112 Author: Roberto Vargas <roberto.vargas@arm.com> Date: Fri, 16 Nov 2018 15:59:14 +0000 Merge branch 'master' of ssh://gerrit.oss.arm.com/trusted-firmware/rcode Change-Id: I2651006d8d07e41985134b99e8106a5a11aaeedb Diffstat:
60 files changed, 506 insertions(+), 191 deletions(-)
diff --git a/.gitignore b/.gitignore @@ -6,5 +6,3 @@ *.out bin/ lib/ -src/romfw/rmctbl.c -src/ramfw/rmctbl.c diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile @@ -2,43 +2,22 @@ PROJECTDIR = ../.. include $(PROJECTDIR)/scripts/rules.mk -MORECFLAGS = -DUARTBASE=0x1c0c0000 \ - -DUARTCLK=24000000 \ - -DUARTBAUDRATE=115200 \ - -ROMOBJS = rom-crt-$(SYS).o \ - rom-$(SYS).o \ +ROMOBJS = crt-$(SYS).o \ + rom.o \ arch.o \ - sysreg.o \ $(DLANG) \ - $(DRVDIR)/uart.o \ $(SRCDIR)/romfw/builtin.o \ - cache.o \ -RAMOBJS = ram-crt-$(SYS).o \ - ram-$(SYS).o \ +RAMOBJS = crt-$(SYS).o \ + ram.o \ arch.o \ - sysreg.o \ $(DLANG) \ - $(DRVDIR)/uart.o \ $(SRCDIR)/ramfw/builtin.o \ TARGET = $(BINDIR)/romfw.bin $(BINDIR)/ramfw.bin all: $(TARGET) -ram-crt-none.o rom-crt-none.o: crt-none.s -ram-crt-linux.o rom-crt-linux.o: crt-linux.s - -rom-rmode.o: sysreg.h -cache.o: sysreg.h - -sysreg.h: sysreg.lst - ./gensysreg.sh -h sysreg.lst - -sysreg.s: sysreg.lst - ./gensysreg.sh -s sysreg.lst - $(BINDIR)/romfw.elf: $(ROMOBJS) $(LIBDEP) $(LD) $(RCODE_LDFLAGS) $(ROMOBJS) $(LIBS) -o $@ @@ -47,25 +26,3 @@ $(BINDIR)/ramfw.elf: $(RAMOBJS) $(LIBDEP) clean: rm -f $(TARGET:.bin=.elf) - rm -f $(TARGET:.bin=.tst) - rm -f sysreg.h sysreg.s - -# -# Rules to verify that the binary images doesn't have data or bss -# -.SUFFIXES: .tst - -$(BINDIR)/ramfw.bin: $(BINDIR)/ramfw.tst -$(BINDIR)/romfw.bin: $(BINDIR)/romfw.tst - -.elf.tst: - @test $(SYS) != "rmode" && exit; \ - size $< | \ - awk 'NR == 2 {\ - if ($$2 != 0 || $$3 != 0) {\ - printf("image %s with data section!\n",\ - "$<") > "/dev/stderr";\ - exit 1;\ - }\ - }' - touch $@ diff --git a/arch/arm64/arch.c b/arch/arm64/arch.c @@ -0,0 +1,28 @@ +#include <setjmp.h> +#include <stdio.h> +#include <stdlib.h> + +#include <rcode.h> + +jmp_buf recover; + +_Noreturn void abort(void); +_Noreturn void longjmp(jmp_buf env, int val); + +void +dohalt(void) +{ + abort(); +} + +void +doswtch(struct trapframe *fp) +{ + longjmp(recover, 1); +} + +void +dopanic(void) +{ + trap(NULL); +} diff --git a/arch/arm64/ram-crt-linux.s b/arch/arm64/ram-crt-linux.s @@ -1,2 +0,0 @@ - .file "ram-crt-linux.s" - .include "crt-linux.s" diff --git a/arch/arm64/ram-crt-rmode.s b/arch/arm64/ram-crt-rmode.s @@ -1,2 +0,0 @@ - .file "ram-crt-rmode.s" - .include "crt-rmode.s" diff --git a/arch/arm64/ram.c b/arch/arm64/ram.c @@ -1,6 +1,7 @@ #include <rcode.h> -void -main(void) +int +main(int argc, char *argv[]) { + return 0; } diff --git a/arch/arm64/rom-crt-linux.s b/arch/arm64/rom-crt-linux.s @@ -1,2 +0,0 @@ - .file "rom-crt-linux.s" - .include "crt-linux.s" diff --git a/arch/arm64/rom-crt-rmode.s b/arch/arm64/rom-crt-rmode.s @@ -1,2 +0,0 @@ - .file "rom-crt-rmode.s" - .include "crt-rmode.s" diff --git a/arch/arm64/rom-linux.c b/arch/arm64/rom-linux.c @@ -1,7 +0,0 @@ -#include <rcode.h> - -int -main(int argc, char *argv[]) -{ - return 0; -} diff --git a/arch/arm64/ram-linux.c b/arch/arm64/rom.c diff --git a/arch/arm64/sysreg.lst b/arch/arm64/sysreg.lst @@ -1,9 +0,0 @@ -ACTLR_R S3_6_C1_C0_3 -ID_AA64RMFR0_R S3_6_C0_C7_6 -RCR_R S3_6_C1_C1_6 -RDSCR_R S3_6_C6_C15_6 -SCTLR_R S3_6_C1_C0_6 -RVBAR_EL3 S3_6_C12_C0_1 -CLIDR_EL1 S3_1_C0_C0_1 -CCSIDR_EL1 S3_1_C0_C0_0 -CSSELR_EL1 S3_2_C0_C0_0 diff --git a/arch/arm64/.gitignore b/arch/rmode/.gitignore diff --git a/arch/rmode/Makefile b/arch/rmode/Makefile @@ -0,0 +1,70 @@ +.POSIX: +PROJECTDIR = ../.. +include $(PROJECTDIR)/scripts/rules.mk + +MORECFLAGS = -DUARTBASE=0x1c0c0000 \ + -DUARTCLK=24000000 \ + -DUARTBAUDRATE=115200 \ + +ROMOBJS = rom-crt.o \ + rom.o \ + arch.o \ + sysreg.o \ + $(DLANG) \ + $(DRVDIR)/uart.o \ + $(SRCDIR)/romfw/builtin.o \ + cache.o \ + +RAMOBJS = ram-crt.o \ + ram.o \ + arch.o \ + sysreg.o \ + $(DLANG) \ + $(DRVDIR)/uart.o \ + $(SRCDIR)/ramfw/builtin.o \ + +TARGET = $(BINDIR)/romfw.bin $(BINDIR)/ramfw.bin + +all: $(TARGET) + +ram-crt.o rom-crt.o: crt.s + +rom.o: sysreg.h +cache.o: sysreg.h + +sysreg.h: sysreg.lst + ./gensysreg.sh -h sysreg.lst + +sysreg.s: sysreg.lst + ./gensysreg.sh -s sysreg.lst + +$(BINDIR)/romfw.elf: $(ROMOBJS) $(LIBDEP) + $(LD) $(RCODE_LDFLAGS) $(ROMOBJS) $(LIBS) -o $@ + +$(BINDIR)/ramfw.elf: $(RAMOBJS) $(LIBDEP) + $(LD) $(RCODE_LDFLAGS) $(RAMOBJS) $(LIBS) -o $@ + +clean: + rm -f $(TARGET:.bin=.elf) + rm -f $(TARGET:.bin=.tst) + rm -f sysreg.h sysreg.s + +# +# Rules to verify that the binary images doesn't have data or bss +# +.SUFFIXES: .tst + +$(BINDIR)/ramfw.bin: $(BINDIR)/ramfw.tst +$(BINDIR)/romfw.bin: $(BINDIR)/romfw.tst + +.elf.tst: + @test $(SYS) != "rcode" && exit; \ + size $< | \ + awk 'NR == 2 {\ + if ($$2 != 0 || $$3 != 0) {\ + printf("image %s with data section!\n",\ + "$<") > "/dev/stderr";\ + exit 1;\ + }\ + }' + touch $@ diff --git a/arch/arm64/arch.h b/arch/rmode/arch.h diff --git a/arch/arm64/arch.s b/arch/rmode/arch.s diff --git a/arch/arm64/cache.c b/arch/rmode/cache.c diff --git a/arch/arm64/crt-rmode.s b/arch/rmode/crt.s diff --git a/arch/arm64/gensysreg.sh b/arch/rmode/gensysreg.sh diff --git a/arch/rmode/ram-crt.s b/arch/rmode/ram-crt.s @@ -0,0 +1,2 @@ + .file "ram-crt.s" + .include "crt.s" diff --git a/arch/arm64/ram-rmode.c b/arch/rmode/ram.c diff --git a/arch/rmode/rom-crt.s b/arch/rmode/rom-crt.s @@ -0,0 +1,2 @@ + .file "rom-crt.s" + .include "crt.s" diff --git a/arch/arm64/rom-rmode.c b/arch/rmode/rom.c diff --git a/arch/rmode/sysreg.lst b/arch/rmode/sysreg.lst @@ -0,0 +1,9 @@ +ACTLR_R S3_6_C1_C0_3 +ID_AA64RMFR0_R S3_6_C0_C7_6 +RCR_R S3_6_C1_C1_6 +RDSCR_R S3_6_C6_C15_6 +SCTLR_R S3_6_C1_C0_6 +RVBAR_EL3 S3_6_C12_C0_1 +CLIDR_EL1 S3_1_C0_C0_1 +CCSIDR_EL1 S3_1_C0_C0_0 +CSSELR_EL1 S3_2_C0_C0_0 diff --git a/config/arm64-rmode.ld b/config/arm64-rcode.ld diff --git a/config/arm64-rcode.mk b/config/arm64-rcode.mk @@ -0,0 +1,9 @@ +ARCH = rmode +SYSCFLAGS = -g -static -nostdinc -ffreestanding -std=c99 -mgeneral-regs-only -fno-stack-protector -MD -Wall +SYSLDFLAGS = -static -z nodefaultlib -T $(CONFDIR)/arm64-rcode.ld +CROSS_COMPILE = aarch64-elf- +SYS = rcode +COMP = gcc +ASM = as +LINKER = ld +OBJCOPY = objcopy diff --git a/config/arm64-rmode.mk b/config/arm64-rmode.mk @@ -1,9 +0,0 @@ -ARCH = arm64 -SYSCFLAGS = -g -static -nostdinc -ffreestanding -std=c99 -mgeneral-regs-only -fno-stack-protector -MD -Wall -SYSLDFLAGS = -static -z nodefaultlib -T $(CONFDIR)/arm64-rmode.ld -CROSS_COMPILE = aarch64-elf- -SYS=rmode -COMP = gcc -ASM = as -LINKER = ld -OBJCOPY = objcopy diff --git a/include/bits/netbsd/sys/errno.h b/include/bits/netbsd/sys/errno.h @@ -1,98 +0,0 @@ -#define EWOULDBLOCK EAGAIN -#define EPERM 1 -#define ENOENT 2 -#define ESRCH 3 -#define EINTR 4 -#define EIO 5 -#define ENXIO 6 -#define E2BIG 7 -#define ENOEXEC 8 -#define EBADF 9 -#define ECHILD 10 -#define EDEADLK 11 -#define ENOMEM 12 -#define EACCES 13 -#define EFAULT 14 -#define ENOTBLK 15 -#define EBUSY 16 -#define EEXIST 17 -#define EXDEV 18 -#define ENODEV 19 -#define ENOTDIR 20 -#define EISDIR 21 -#define EINVAL 22 -#define ENFILE 23 -#define EMFILE 24 -#define ENOTTY 25 -#define ETXTBSY 26 -#define EFBIG 27 -#define ENOSPC 28 -#define ESPIPE 29 -#define EROFS 30 -#define EMLINK 31 -#define EPIPE 32 -#define EDOM 33 -#define ERANGE 34 -#define EAGAIN 35 -#define EINPROGRESS 36 -#define EALREADY 37 -#define ENOTSOCK 38 -#define EDESTADDRREQ 39 -#define EMSGSIZE 40 -#define EPROTOTYPE 41 -#define ENOPROTOOPT 42 -#define EPROTONOSUPPORT 43 -#define ESOCKTNOSUPPORT 44 -#define EOPNOTSUPP 45 -#define EPFNOSUPPORT 46 -#define EAFNOSUPPORT 47 -#define EADDRINUSE 48 -#define EADDRNOTAVAIL 49 -#define ENETDOWN 50 -#define ENETUNREACH 51 -#define ENETRESET 52 -#define ECONNABORTED 53 -#define ECONNRESET 54 -#define ENOBUFS 55 -#define EISCONN 56 -#define ENOTCONN 57 -#define ESHUTDOWN 58 -#define ETOOMANYREFS 59 -#define ETIMEDOUT 60 -#define ECONNREFUSED 61 -#define ELOOP 62 -#define ENAMETOOLONG 63 -#define EHOSTDOWN 64 -#define EHOSTUNREACH 65 -#define ENOTEMPTY 66 -#define EPROCLIM 67 -#define EUSERS 68 -#define EDQUOT 69 -#define ESTALE 70 -#define EREMOTE 71 -#define EBADRPC 72 -#define ERPCMISMATCH 73 -#define EPROGUNAVAIL 74 -#define EPROGMISMATCH 75 -#define EPROCUNAVAIL 76 -#define ENOLCK 77 -#define ENOSYS 78 -#define EFTYPE 79 -#define EAUTH 80 -#define ENEEDAUTH 81 -#define EIDRM 82 -#define ENOMSG 83 -#define EOVERFLOW 84 -#define EILSEQ 85 -#define ENOTSUP 86 -#define ECANCELED 87 -#define EBADMSG 88 -#define ENODATA 89 -#define ENOSR 90 -#define ENOSTR 91 -#define ETIME 92 -#define ENOATTR 93 -#define EMULTIHOP 94 -#define ENOLINK 95 -#define ELAST 96 -#define EPROTO 96 diff --git a/include/bits/rmode/sys.h b/include/bits/rcode/sys.h diff --git a/include/bits/rmode/sys/signal.h b/include/bits/rcode/sys/signal.h diff --git a/include/bits/rmode/arch/limits.h b/include/bits/rmode/arch/limits.h @@ -0,0 +1,18 @@ +#define CHAR_BIT 8 +#define SCHAR_MAX 0x7F +#define SCHAR_MIN (-SCHAR_MIN - 1) +#define CHAR_MAX 0x7F +#define CHAR_MIN (-CHAR_MAX - 1) +#define UCHAR_MAX 0xFFU +#define SHRT_MAX 0x7FFF +#define SHRT_MIN (-SHRT_MAX - 1) +#define USHRT_MAX 0xFFFFU +#define INT_MAX 0x7FFFFFFF +#define INT_MIN (-INT_MAX - 1) +#define UINT_MAX 0xFFFFFFFFU +#define LONG_MAX 0x7FFFFFFFFFFFFFFFL +#define LONG_MIN (-LONG_MAX - 1L) +#define ULONG_MAX 0xFFFFFFFFFFFFFFFFUL +#define LLONG_MAX 0x7FFFFFFFFFFFFFFFLL +#define LLONG_MIN (-LLONG_MAX - 1LL) +#define ULLONG_MAX 0xFFFFFFFFFFFFFFFFULL diff --git a/include/bits/rmode/arch/setjmp.h b/include/bits/rmode/arch/setjmp.h @@ -0,0 +1 @@ +typedef unsigned long long jmp_buf[22]; diff --git a/include/bits/rmode/arch/stddef.h b/include/bits/rmode/arch/stddef.h @@ -0,0 +1,9 @@ +#ifndef SIZET_ +typedef unsigned long size_t; +#define SIZET_ +#endif + +#ifndef _PTRDIFF_T +typedef long ptrdiff_t; +#define _PTRDIFF_T +#endif diff --git a/include/bits/rmode/arch/stdint.h b/include/bits/rmode/arch/stdint.h @@ -0,0 +1,109 @@ +#define INT8_MAX 0x7F +#define INT8_MIN (-INT8_MAX - 1) +#define UINT8_MAX 0xFFU + +#define INT16_MAX 0x7FFF +#define INT16_MIN (-INT16_MAX - 1) +#define UINT16_MAX 0xFFFFU + +#define INT32_MAX 0x7FFFFFFF +#define INT32_MIN (-INT32_MAX - 1) +#define UINT32_MAX 0xFFFFFFFFU + +#define INT64_MAX 0x7FFFFFFFFFFFFFFFLL +#define INT64_MIN (-INT64_MAX - 1LL) +#define UINT64_MAX 0xFFFFFFFFFFFFFFFFULL + +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define UINT_LEAST8_MAX UINT8_MAX + +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define UINT_LEAST16_MAX UINT16_MAX + +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define UINT_LEAST32_MAX UINT32_MAX + +#define INT_LEAST64_MIN INT64_MIN +#define INT_LEAST64_MAX INT64_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +#define INT_FAST8_MIN INT32_MIN +#define INT_FAST8_MAX INT32_MAX +#define UINT_FAST8_MAX UINT32_MAX + +#define INT_FAST16_MIN INT32_MIN +#define INT_FAST16_MAX INT32_MAX +#define UINT_FAST16_MAX UINT32_MAX + +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST32_MAX INT32_MAX +#define UINT_FAST32_MAX UINT32_MAX + +#define INT_FAST64_MIN INT64_MIN +#define INT_FAST64_MAX INT64_MAX +#define UINT_FAST64_MAX UINT64_MAX + +#define INTPTR_MIN INT64_MIN +#define INTPTR_MAX INT64_MAX +#define UINTPTR_MAX UINT64_MAX + +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +#define PTRDIFF_MIN INT64_MIN +#define PTRDIFF_MAX INT64_MAX + +#define SIZE_MAX UINT64_MAX + +#define INT8_C(x) x +#define INT16_C(x) x +#define INT32_C(x) x +#define INT64_C(x) x ## LL + +#define UINT8_C(x) x +#define UINT16_C(x) x +#define UINT32_C(x) x ## U +#define UINT64_C(x) x ## ULL + +#define INTMAX_C(x) x ## L +#define UINTMAX_C(x) x ## ULL + +typedef signed char int8_t; +typedef short int16_t; +typedef int int32_t; +typedef long long int64_t; + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; + +typedef signed char int8_least_t; +typedef short int16_least_t; +typedef int int32_least_t; +typedef long long int64_least_t; + +typedef unsigned char uint8_least_t; +typedef unsigned short uint16_least_t; +typedef unsigned int uint32_least_t; +typedef unsigned long long uint64_least_t; + +typedef int int8_fast_t; +typedef int int16_fast_t; +typedef int int32_fast_t; +typedef long long int64_fast_t; + +typedef unsigned int uint8_fast_t; +typedef unsigned int uint16_fast_t; +typedef unsigned int uint32_fast_t; +typedef unsigned long long uint64_fast_t; + +typedef long intptr_t; +typedef unsigned long uintptr_t; + +typedef long intmax_t; +typedef unsigned long uintmax_t; diff --git a/include/bits/rmode/arch/stdio.h b/include/bits/rmode/arch/stdio.h @@ -0,0 +1,15 @@ +#ifndef _SIZET +typedef unsigned long size_t; +#define _SIZET +#endif + +#define BUFSIZ 512 +#define FILENAME_MAX 256 +#define FOPEN_MAX 16 + +#define TMP_MAX 25 +#define L_tmpnam 256 + +#define _TMPNAME "/tmp/tmp.0000000" + +typedef int fpos_t; diff --git a/include/bits/rmode/arch/stdlib.h b/include/bits/rmode/arch/stdlib.h @@ -0,0 +1,14 @@ +#ifndef SIZET_ +typedef unsigned long size_t; +#define SIZET_ +#endif + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 + +#ifndef _WCHAR_T +typedef int wchar_t; +#define _WCHAR_T +#endif + +#define _ALIGNTYPE long double diff --git a/include/bits/rmode/arch/string.h b/include/bits/rmode/arch/string.h @@ -0,0 +1,6 @@ +#ifndef SIZET_ +typedef unsigned long size_t; +#define SIZET_ +#endif + +#define __NUMCHARS 128 diff --git a/include/bits/rmode/arch/time.h b/include/bits/rmode/arch/time.h @@ -0,0 +1,8 @@ +#ifndef _SIZET +typedef unsigned long size_t; +#define _SIZET +#endif + +#define _MAXYEAR 9999 + +typedef long int time_t; diff --git a/scripts/rules.mk b/scripts/rules.mk @@ -1,4 +1,4 @@ -CONF = arm64-rmode +CONF = arm64-rcode include $(PROJECTDIR)/config/$(CONF).mk INCDIR = $(PROJECTDIR)/include diff --git a/src/.gitignore b/src/.gitignore @@ -1 +1,2 @@ ecstr.c +rmctbl.c diff --git a/src/libc/arch/Makefile b/src/libc/arch/Makefile @@ -2,7 +2,7 @@ PROJECTDIR =../../.. include $(PROJECTDIR)/scripts/rules.mk -DIRS = amd64 arm64 +DIRS = amd64 arm64 rmode all: +@cd $(ARCH) && $(MAKE) diff --git a/src/libc/arch/amd64/dragonfly/.gitignore b/src/libc/arch/amd64/dragonfly/.gitignore @@ -1,9 +1,10 @@ _Exit.s -_close.s _brk.s +_close.s _getpid.s _kill.s _lseek.s _open.s _read.s +_sys_errlist.c _write.s diff --git a/src/libc/arch/amd64/linux/.gitignore b/src/libc/arch/amd64/linux/.gitignore @@ -1,11 +1,11 @@ _Exit.s +_brk.s _close.s _getpid.s _kill.s _lseek.s _open.s _read.s -_write.s -_brk.s _sigaction.s _sys_errlist.c +_write.s diff --git a/src/libc/arch/amd64/netbsd/.gitignore b/src/libc/arch/amd64/netbsd/.gitignore @@ -1,9 +1,11 @@ _Exit.s -_close.s _brk.s +_close.s _getpid.s +_gettimeofday.s _kill.s _lseek.s _open.s _read.s +_sys_errlist.c _write.s diff --git a/src/libc/arch/amd64/openbsd/.gitignore b/src/libc/arch/amd64/openbsd/.gitignore @@ -1,9 +1,11 @@ _Exit.s -_close.s _brk.s +_close.s _getpid.s _kill.s _lseek.s _open.s _read.s +_sigaction.s +_sys_errlist.c _write.s diff --git a/src/libc/arch/arm64/Makefile b/src/libc/arch/arm64/Makefile @@ -3,7 +3,7 @@ PROJECTDIR =../../../.. include $(PROJECTDIR)/scripts/rules.mk OBJS = longjmp.o setjmp.o -DIRS = rmode linux +DIRS = linux all: $(OBJS) $(SYS) diff --git a/src/libc/arch/arm64/linux/.gitignore b/src/libc/arch/arm64/linux/.gitignore @@ -1,9 +1,10 @@ _Exit.s -_close.s _brk.s +_close.s _getpid.s _kill.s _lseek.s _openat.s _read.s +_sys_errlist.c _write.s diff --git a/src/libc/arch/arm64/linux/Makefile b/src/libc/arch/arm64/linux/Makefile @@ -1,6 +1,7 @@ .POSIX: PROJECTDIR =../../../../.. include $(PROJECTDIR)/scripts/rules.mk +include ../../rules.mk OBJS = _Exit.o \ _close.o \ diff --git a/src/libc/arch/arm64/linux/errno.lst b/src/libc/arch/arm64/linux/errno.lst @@ -0,0 +1,126 @@ +EPERM 1 Not owner +ENOENT 2 No such file or directory +ESRCH 3 No such process +EINTR 4 Interrupted system call +EIO 5 I/O error +ENXIO 6 No such device or address +E2BIG 7 Arg list too long +ENOEXEC 8 Exec format error +EBADF 9 Bad file number +ECHILD 10 No children +EAGAIN 11 No more processes +ENOMEM 12 Not enough space +EACCES 13 Permission denied +EFAULT 14 Bad address +ENOTBLK 15 Block device required +EBUSY 16 Device or resource busy +EEXIST 17 File exists +EXDEV 18 Cross-device link +ENODEV 19 No such device +ENOTDIR 20 Not a directory +EISDIR 21 Is a directory +EINVAL 22 Invalid argument +ENFILE 23 Too many open files in system +EMFILE 24 File descriptor value too large +ENOTTY 25 Not a character device +ETXTBSY 26 Text file busy +EFBIG 27 File too large +ENOSPC 28 No space left on device +ESPIPE 29 Illegal seek +EROFS 30 Read-only file system +EMLINK 31 Too many links +EPIPE 32 Broken pipe +EDOM 33 Mathematics argument out of domain of function +ERANGE 34 Result too large +ENOMSG 35 No message of desired type +EIDRM 36 Identifier removed +ECHRNG 37 Channel number out of range +EL2NSYNC 38 Level 2 not synchronized +EL3HLT 39 Level 3 halted +EL3RST 40 Level 3 reset +ELNRNG 41 Link number out of range +EUNATCH 42 Protocol driver not attached +ENOCSI 43 No CSI structure available +EL2HLT 44 Level 2 halted +EDEADLK 45 Deadlock +ENOLCK 46 No lock +EBADE 50 Invalid exchange +EBADR 51 Invalid request descriptor +EXFULL 52 Exchange full +ENOANO 53 No anode +EBADRQC 54 Invalid request code +EBADSLT 55 Invalid slot +EDEADLOCK 56 File locking deadlock error +EBFONT 57 Bad font file fmt +ENOSTR 60 Not a stream +ENODATA 61 No data (for no delay io) +ETIME 62 Stream ioctl timeout +ENOSR 63 No stream resources +ENONET 64 Machine is not on the network +ENOPKG 65 Package not installed +EREMOTE 66 The object is remote +ENOLINK 67 Virtual circuit is gone +EADV 68 Advertise error +ESRMNT 69 Srmount error +ECOMM 70 Communication error on send +EPROTO 71 Protocol error +EMULTIHOP 74 Multihop attempted +ELBIN 75 Inode is remote (not really error) +EDOTDOT 76 Cross mount point (not really error) +EBADMSG 77 Bad message +EFTYPE 79 Inappropriate file type or format +ENOTUNIQ 80 Given log. name not unique +EBADFD 81 f.d. invalid for this operation +EREMCHG 82 Remote address changed +ELIBACC 83 Can't access a needed shared lib +ELIBBAD 84 Accessing a corrupted shared lib +ELIBSCN 85 .lib section in a.out corrupted +ELIBMAX 86 Attempting to link in too many libs +ELIBEXEC 87 Attempting to exec a shared library +ENOSYS 88 Function not implemented +ENMFILE 89 No more files +ENOTEMPTY 90 Directory not empty +ENAMETOOLONG 91 File or path name too long +ELOOP 92 Too many symbolic links +EOPNOTSUPP 95 Operation not supported on socket +EPFNOSUPPORT 96 Protocol family not supported +ECONNRESET 104 Connection reset by peer +ENOBUFS 105 No buffer space available +EAFNOSUPPORT 106 Address family not supported by protocol family +EPROTOTYPE 107 Protocol wrong type for socket +ENOTSOCK 108 Socket operation on non-socket +ENOPROTOOPT 109 Protocol not available +ESHUTDOWN 110 Can't send after socket shutdown +ECONNREFUSED 111 Connection refused +EADDRINUSE 112 Address already in use +ECONNABORTED 113 Software caused connection abort +ENETUNREACH 114 Network is unreachable +ENETDOWN 115 Network interface is not configured +ETIMEDOUT 116 Connection timed out +EHOSTDOWN 117 Host is down +EHOSTUNREACH 118 Host is unreachable +EINPROGRESS 119 Connection already in progress +EALREADY 120 Socket already connected +EDESTADDRREQ 121 Destination address required +EMSGSIZE 122 Message too long +EPROTONOSUPPORT 123 Unknown protocol +ESOCKTNOSUPPORT 124 Socket type not supported +EADDRNOTAVAIL 125 Address not available +ENETRESET 126 Connection aborted by network +EISCONN 127 Socket is already connected +ENOTCONN 128 Socket is not connected +ETOOMANYREFS 129 +EPROCLIM 130 +EUSERS 131 +EDQUOT 132 +ESTALE 133 +ENOTSUP 134 Not supported +ENOMEDIUM 135 No medium (in tape drive) +ENOSHARE 136 No such host or network path +ECASECLASH 137 Filename exists with different case +EILSEQ 138 Illegal byte sequence +EOVERFLOW 139 Value too large for defined data type +ECANCELED 140 Operation canceled +ENOTRECOVERABLE 141 State not recoverable +EOWNERDEAD 142 Previous owner died +ESTRPIPE 143 Streams pipe error diff --git a/src/libc/arch/rmode/Makefile b/src/libc/arch/rmode/Makefile @@ -0,0 +1,14 @@ +.POSIX: +PROJECTDIR =../../../.. +include $(PROJECTDIR)/scripts/rules.mk + +OBJS = longjmp.o setjmp.o +DIRS = rcode + +all: $(OBJS) $(SYS) + +$(SYS): FORCE + +@cd $@ && $(MAKE) + +clean: + $(FORALL) diff --git a/src/libc/arch/rmode/longjmp.s b/src/libc/arch/rmode/longjmp.s @@ -0,0 +1,22 @@ + .file "longjmp.s" + + .text + .globl longjmp +longjmp: + ldp x19, x20, [x0,#0] + ldp x21, x22, [x0,#16] + ldp x23, x24, [x0,#32] + ldp x25, x26, [x0,#48] + ldp x27, x28, [x0,#64] + ldp x29, x30, [x0,#80] + ldr x2, [x0,#104] + mov sp, x2 + ldp d8 , d9, [x0,#112] + ldp d10, d11, [x0,#128] + ldp d12, d13, [x0,#144] + ldp d14, d15, [x0,#160] + + mov x0, x1 + cbnz x1, 1f + mov x0, #1 +1: br x30 diff --git a/src/libc/arch/arm64/rmode/.gitignore b/src/libc/arch/rmode/rcode/.gitignore diff --git a/src/libc/arch/arm64/rmode/Makefile b/src/libc/arch/rmode/rcode/Makefile diff --git a/src/libc/arch/arm64/rmode/_Exit.c b/src/libc/arch/rmode/rcode/_Exit.c diff --git a/src/libc/arch/arm64/rmode/_read.c b/src/libc/arch/rmode/rcode/_read.c diff --git a/src/libc/arch/arm64/rmode/_write.c b/src/libc/arch/rmode/rcode/_write.c diff --git a/src/libc/arch/arm64/rmode/errno.lst b/src/libc/arch/rmode/rcode/errno.lst diff --git a/src/libc/arch/arm64/rmode/raise.c b/src/libc/arch/rmode/rcode/raise.c diff --git a/src/libc/arch/rmode/setjmp.s b/src/libc/arch/rmode/setjmp.s @@ -0,0 +1,20 @@ + .file "setjmp.s" + + .text + .globl setjmp +setjmp: + // IHI0055B_aapcs64.pdf 5.1.1, 5.1.2 callee saved registers + stp x19, x20, [x0,#0] + stp x21, x22, [x0,#16] + stp x23, x24, [x0,#32] + stp x25, x26, [x0,#48] + stp x27, x28, [x0,#64] + stp x29, x30, [x0,#80] + mov x2, sp + str x2, [x0,#104] + stp d8, d9, [x0,#112] + stp d10, d11, [x0,#128] + stp d12, d13, [x0,#144] + stp d14, d15, [x0,#160] + mov x0, #0 + ret diff --git a/src/libk/bss-rmode.c b/src/libk/bss-rcode.c diff --git a/src/libk/kgetc-rmode.c b/src/libk/kgetc-rcode.c