summaryrefslogtreecommitdiff
path: root/arm64/include
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2019-05-03 20:57:30 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2019-05-03 20:57:30 +0200
commit9920ecc04b87cab3968f7f0c286b264bd31e132f (patch)
treee38cf67b782df089075d9c34269cc88d313fea2b /arm64/include
parent59ff04ddb1b845bfd8542c886bb42c5cb3112a0b (diff)
libc: initial arm64 support
Diffstat (limited to 'arm64/include')
-rw-r--r--arm64/include/u.h77
-rw-r--r--arm64/include/ureg.h40
2 files changed, 117 insertions, 0 deletions
diff --git a/arm64/include/u.h b/arm64/include/u.h
new file mode 100644
index 000000000..94d9cc3b7
--- /dev/null
+++ b/arm64/include/u.h
@@ -0,0 +1,77 @@
+#define nil ((void*)0)
+
+typedef unsigned short ushort;
+typedef unsigned char uchar;
+typedef unsigned long ulong;
+typedef unsigned int uint;
+typedef signed char schar;
+typedef long long vlong;
+typedef unsigned long long uvlong;
+typedef vlong intptr;
+typedef uvlong uintptr;
+typedef unsigned long usize;
+typedef uint Rune;
+typedef union FPdbleword FPdbleword;
+typedef uintptr jmp_buf[2];
+#define JMPBUFSP 0
+#define JMPBUFPC 1
+#define JMPBUFDPC 0
+typedef unsigned int mpdigit; /* for /sys/include/mp.h */
+typedef unsigned char u8int;
+typedef unsigned short u16int;
+typedef unsigned int u32int;
+typedef unsigned long long u64int;
+typedef signed char s8int;
+typedef signed short s16int;
+typedef signed int s32int;
+typedef signed long long s64int;
+
+/* FPCR (control) */
+#define FPINEX (1<<12)
+#define FPUNFL (1<<11)
+#define FPOVFL (1<<10)
+#define FPZDIV (1<<9)
+#define FPINVAL (1<<8)
+
+#define FPRNR (0<<22)
+#define FPRPINF (1<<22)
+#define FPRNINF (2<<22)
+#define FPRZ (3<<22)
+
+#define FPRMASK (3<<22)
+
+/* FPSR (status) */
+#define FPPEXT 0
+#define FPPSGL 0
+#define FPPDBL 0
+#define FPPMASK 0
+#define FPAINEX (1<<4)
+#define FPAUNFL (1<<3)
+#define FPAOVFL (1<<2)
+#define FPAZDIV (1<<1)
+#define FPAINVAL (1<<0)
+
+union FPdbleword
+{
+ double x;
+ struct { /* little endian */
+ ulong lo;
+ ulong hi;
+ };
+};
+
+typedef char* va_list;
+#define va_start(list, start) list =\
+ (sizeof(start) < 8?\
+ (char*)((vlong*)&(start)+1):\
+ (char*)(&(start)+1))
+#define va_end(list)\
+ USED(list)
+#define va_arg(list, mode)\
+ ((sizeof(mode) == 1)?\
+ ((list += 8), (mode*)list)[-8]:\
+ (sizeof(mode) == 2)?\
+ ((list += 8), (mode*)list)[-4]:\
+ (sizeof(mode) == 4)?\
+ ((list += 8), (mode*)list)[-2]:\
+ ((list += sizeof(mode)), (mode*)list)[-1])
diff --git a/arm64/include/ureg.h b/arm64/include/ureg.h
new file mode 100644
index 000000000..02aae42de
--- /dev/null
+++ b/arm64/include/ureg.h
@@ -0,0 +1,40 @@
+typedef struct Ureg {
+ u64int r0;
+ u64int r1;
+ u64int r2;
+ u64int r3;
+ u64int r4;
+ u64int r5;
+ u64int r6;
+ u64int r7;
+ u64int r8;
+ u64int r9;
+ u64int r10;
+ u64int r11;
+ u64int r12;
+ u64int r13;
+ u64int r14;
+ u64int r15;
+ u64int r16;
+ u64int r17;
+ u64int r18;
+ u64int r19;
+ u64int r20;
+ u64int r21;
+ u64int r22;
+ u64int r23;
+ u64int r24;
+ u64int r25;
+ u64int r26;
+ u64int r27;
+ u64int r28; /* sb */
+ u64int r29;
+ union {
+ u64int r30;
+ u64int link;
+ };
+ u64int sp;
+ u64int pc; /* interrupted addr */
+ u64int psr;
+ u64int type; /* of exception */
+} Ureg;