continue...

This commit is contained in:
cinap_lenrek 2011-03-30 15:08:40 +00:00
parent 55613b56d7
commit 9b675a9941
42 changed files with 1941 additions and 0 deletions

72
amd64/include/u.h Normal file
View file

@ -0,0 +1,72 @@
#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 unsigned long long uintptr;
typedef unsigned long usize;
typedef ushort Rune;
typedef union FPdbleword FPdbleword;
typedef uvlong 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;
/* MXCSR */
/* fcr */
#define FPFTZ (1<<15) /* amd64 */
#define FPINEX (1<<12)
#define FPUNFL (1<<11)
#define FPOVFL (1<<10)
#define FPZDIV (1<<9)
#define FPDNRM (1<<8) /* amd64 */
#define FPINVAL (1<<7)
#define FPDAZ (1<<6) /* amd64 */
#define FPRNR (0<<13)
#define FPRZ (3<<13)
#define FPRPINF (2<<13)
#define FPRNINF (1<<13)
#define FPRMASK (3<<13)
#define FPPEXT 0
#define FPPSGL 0
#define FPPDBL 0
#define FPPMASK 0
/* fsr */
#define FPAINEX (1<<5)
#define FPAUNFL (1<<4)
#define FPAOVFL (1<<3)
#define FPAZDIV (1<<2)
#define FPADNRM (1<<1) /* not in plan 9 */
#define FPAINVAL (1<<0)
union FPdbleword
{
double x;
struct { /* little endian */
uint lo;
uint 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])

30
amd64/include/ureg.h Normal file
View file

@ -0,0 +1,30 @@
struct Ureg {
u64int ax;
u64int bx;
u64int cx;
u64int dx;
u64int si;
u64int di;
u64int bp;
u64int r8;
u64int r9;
u64int r10;
u64int r11;
u64int r12;
u64int r13;
u64int r14;
u64int r15;
u16int ds;
u16int es;
u16int fs;
u16int gs;
u64int type;
u64int error; /* error code (or zero) */
u64int ip; /* pc */
u64int cs; /* old context */
u64int flags; /* old flags */
u64int sp; /* sp */
u64int ss; /* old stack segment */
};

6
amd64/mkfile Normal file
View file

@ -0,0 +1,6 @@
</sys/src/mkfile.proto
CC=6c
LD=6l
O=6
AS=6a

73
arm/include/ape/float.h Normal file
View file

@ -0,0 +1,73 @@
#ifndef __FLOAT
#define __FLOAT
/* IEEE, default rounding */
#define FLT_ROUNDS 1
#define FLT_RADIX 2
#define FLT_DIG 6
#define FLT_EPSILON 1.19209290e-07
#define FLT_MANT_DIG 24
#define FLT_MAX 3.40282347e+38
#define FLT_MAX_10_EXP 38
#define FLT_MAX_EXP 128
#define FLT_MIN 1.17549435e-38
#define FLT_MIN_10_EXP -37
#define FLT_MIN_EXP -125
#define DBL_DIG 15
#define DBL_EPSILON 2.2204460492503131e-16
#define DBL_MANT_DIG 53
#define DBL_MAX 1.797693134862315708145e+308
#define DBL_MAX_10_EXP 308
#define DBL_MAX_EXP 1024
#define DBL_MIN 2.225073858507201383090233e-308
#define DBL_MIN_10_EXP -307
#define DBL_MIN_EXP -1021
#define LDBL_MANT_DIG DBL_MANT_DIG
#define LDBL_EPSILON DBL_EPSILON
#define LDBL_DIG DBL_DIG
#define LDBL_MIN_EXP DBL_MIN_EXP
#define LDBL_MIN DBL_MIN
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
#define LDBL_MAX_EXP DBL_MAX_EXP
#define LDBL_MAX DBL_MAX
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
typedef union FPdbleword FPdbleword;
union FPdbleword
{
double x;
struct { /* little endian */
long lo;
long hi;
};
};
#ifdef _RESEARCH_SOURCE
/* define stuff needed for floating conversion */
#define IEEE_8087 1
#define Sudden_Underflow 1
#endif
#ifdef _PLAN9_SOURCE
/* FCR */
#define FPINEX (1<<5)
#define FPOVFL (1<<3)
#define FPUNFL ((1<<4)|(1<<1))
#define FPZDIV (1<<2)
#define FPRNR (0<<10)
#define FPRZ (3<<10)
#define FPRPINF (2<<10)
#define FPRNINF (1<<10)
#define FPRMASK (3<<10)
#define FPPEXT (3<<8)
#define FPPSGL (0<<8)
#define FPPDBL (2<<8)
#define FPPMASK (3<<8)
/* FSR */
#define FPAINEX FPINEX
#define FPAOVFL FPOVFL
#define FPAUNFL FPUNFL
#define FPAZDIV FPZDIV
#endif
#endif /* __FLOAT */

77
arm/include/ape/math.h Normal file
View file

@ -0,0 +1,77 @@
#ifndef __MATH
#define __MATH
#pragma lib "/$M/lib/ape/libap.a"
/* a HUGE_VAL appropriate for IEEE double-precision */
/* the correct value, 1.797693134862316e+308, causes a ken overflow */
#define HUGE_VAL 1.79769313486231e+308
#ifdef __cplusplus
extern "C" {
#endif
extern double acos(double);
extern double asin(double);
extern double atan(double);
extern double atan2(double, double);
extern double cos(double);
extern double sin(double);
extern double tan(double);
extern double cosh(double);
extern double sinh(double);
extern double tanh(double);
extern double exp(double);
extern double frexp(double, int *);
extern double ldexp(double, int);
extern double log(double);
extern double log10(double);
extern double modf(double, double *);
extern double pow(double, double);
extern double sqrt(double);
extern double ceil(double);
extern double fabs(double);
extern double floor(double);
extern double fmod(double, double);
extern double NaN(void);
extern int isNaN(double);
extern double Inf(int);
extern int isInf(double, int);
#ifdef _RESEARCH_SOURCE
/* does >> treat left operand as unsigned ? */
#define Unsigned_Shifts 1
#define M_E 2.7182818284590452354 /* e */
#define M_LOG2E 1.4426950408889634074 /* log 2e */
#define M_LOG10E 0.43429448190325182765 /* log 10e */
#define M_LN2 0.69314718055994530942 /* log e2 */
#define M_LN10 2.30258509299404568402 /* log e10 */
#define M_PI 3.14159265358979323846 /* pi */
#define M_PI_2 1.57079632679489661923 /* pi/2 */
#define M_PI_4 0.78539816339744830962 /* pi/4 */
#define M_1_PI 0.31830988618379067154 /* 1/pi */
#define M_2_PI 0.63661977236758134308 /* 2/pi */
#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
extern double hypot(double, double);
extern double erf(double);
extern double erfc(double);
extern double j0(double);
extern double y0(double);
extern double j1(double);
extern double y1(double);
extern double jn(int, double);
extern double yn(int, double);
#endif
#ifdef __cplusplus
}
#endif
#define isnan(x) isNaN(x)
#define isinf(x) isInf(x)
#endif /* __MATH */

11
arm/include/ape/stdarg.h Normal file
View file

@ -0,0 +1,11 @@
#ifndef __STDARG
#define __STDARG
typedef char *va_list;
#define va_start(list, start) list = (sizeof(start)<4 ? (char *)((int *)&(start)+1) : \
(char *)(&(start)+1))
#define va_end(list)
#define va_arg(list, mode) ((mode*)(list += sizeof(mode)))[-1]
#endif /* __STDARG */

35
arm/include/ape/ureg.h Normal file
View file

@ -0,0 +1,35 @@
#ifndef __UREG_H
#define __UREG_H
#if !defined(_PLAN9_SOURCE)
This header file is an extension to ANSI/POSIX
#endif
struct Ureg
{
unsigned long r0;
unsigned long r1;
unsigned long r2;
unsigned long r3;
unsigned long r4;
unsigned long r5;
unsigned long r6;
unsigned long r7;
unsigned long r8;
unsigned long r9;
unsigned long r10;
unsigned long r11;
unsigned long r12; /* sb */
union {
unsigned long r13;
unsigned long sp;
};
union {
unsigned long r14;
unsigned long link;
};
unsigned long type; /* of exception */
unsigned long psr;
unsigned long pc; /* interrupted addr */
};
#endif

66
arm/include/u.h Normal file
View file

@ -0,0 +1,66 @@
#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 unsigned long uintptr;
typedef unsigned long usize;
typedef ushort Rune;
typedef union FPdbleword FPdbleword;
typedef long 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;
/* FCR */
#define FPINEX (1<<20)
#define FPUNFL (1<<19)
#define FPOVFL (1<<18)
#define FPZDIV (1<<17)
#define FPINVAL (1<<16)
#define FPRNR (0<<0)
#define FPRZ (1<<0)
#define FPRPINF (2<<0)
#define FPRNINF (3<<0)
#define FPRMASK (3<<0)
#define FPPEXT 0
#define FPPSGL 0
#define FPPDBL 0
#define FPPMASK 0
/* FSR */
#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) < 4?\
(char*)((int*)&(start)+1):\
(char*)(&(start)+1))
#define va_end(list)\
USED(list)
#define va_arg(list, mode)\
((sizeof(mode) == 1)?\
((list += 4), (mode*)list)[-4]:\
(sizeof(mode) == 2)?\
((list += 4), (mode*)list)[-2]:\
((list += sizeof(mode)), (mode*)list)[-1])

26
arm/include/ureg.h Normal file
View file

@ -0,0 +1,26 @@
typedef struct Ureg {
ulong r0;
ulong r1;
ulong r2;
ulong r3;
ulong r4;
ulong r5;
ulong r6;
ulong r7;
ulong r8;
ulong r9;
ulong r10;
ulong r11;
ulong r12; /* sb */
union {
ulong r13;
ulong sp;
};
union {
ulong r14;
ulong link;
};
ulong type; /* of exception */
ulong psr;
ulong pc; /* interrupted addr */
} Ureg;

6
arm/mkfile Normal file
View file

@ -0,0 +1,6 @@
</sys/src/mkfile.proto
CC=5c
LD=5l
O=5
AS=5a

73
mips/include/ape/float.h Normal file
View file

@ -0,0 +1,73 @@
#ifndef __FLOAT
#define __FLOAT
/* IEEE, default rounding */
#define FLT_ROUNDS 1
#define FLT_RADIX 2
#define FLT_DIG 6
#define FLT_EPSILON 1.19209290e-07
#define FLT_MANT_DIG 24
#define FLT_MAX 3.40282347e+38
#define FLT_MAX_10_EXP 38
#define FLT_MAX_EXP 128
#define FLT_MIN 1.17549435e-38
#define FLT_MIN_10_EXP -37
#define FLT_MIN_EXP -125
#define DBL_DIG 15
#define DBL_EPSILON 2.2204460492503131e-16
#define DBL_MANT_DIG 53
#define DBL_MAX 1.797693134862315708145e+308
#define DBL_MAX_10_EXP 308
#define DBL_MAX_EXP 1024
#define DBL_MIN 2.225073858507201383090233e-308
#define DBL_MIN_10_EXP -307
#define DBL_MIN_EXP -1021
#define LDBL_MANT_DIG DBL_MANT_DIG
#define LDBL_EPSILON DBL_EPSILON
#define LDBL_DIG DBL_DIG
#define LDBL_MIN_EXP DBL_MIN_EXP
#define LDBL_MIN DBL_MIN
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
#define LDBL_MAX_EXP DBL_MAX_EXP
#define LDBL_MAX DBL_MAX
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
typedef union FPdbleword FPdbleword;
union FPdbleword
{
double x;
struct { /* big endian */
long hi;
long lo;
};
};
#ifdef _RESEARCH_SOURCE
/* define stuff needed for floating conversion */
#define IEEE_MC68k 1
#define Sudden_Underflow 1
#endif
#ifdef _PLAN9_SOURCE
/* FCR */
#define FPINEX (1<<7)
#define FPOVFL (1<<9)
#define FPUNFL (1<<8)
#define FPZDIV (1<<10)
#define FPRNR (0<<0)
#define FPRZ (1<<0)
#define FPRPINF (2<<0)
#define FPRNINF (3<<0)
#define FPRMASK (3<<0)
#define FPPEXT 0
#define FPPSGL 0
#define FPPDBL 0
#define FPPMASK 0
/* FSR */
#define FPAINEX (1<<2)
#define FPAOVFL (1<<4)
#define FPAUNFL (1<<3)
#define FPAZDIV (1<<5)
#endif
#endif /* __FLOAT */

77
mips/include/ape/math.h Normal file
View file

@ -0,0 +1,77 @@
#ifndef __MATH
#define __MATH
#pragma lib "/$M/lib/ape/libap.a"
/* a HUGE_VAL appropriate for IEEE double-precision */
/* the correct value, 1.797693134862316e+308, causes a ken overflow */
#define HUGE_VAL 1.79769313486231e+308
#ifdef __cplusplus
extern "C" {
#endif
extern double acos(double);
extern double asin(double);
extern double atan(double);
extern double atan2(double, double);
extern double cos(double);
extern double sin(double);
extern double tan(double);
extern double cosh(double);
extern double sinh(double);
extern double tanh(double);
extern double exp(double);
extern double frexp(double, int *);
extern double ldexp(double, int);
extern double log(double);
extern double log10(double);
extern double modf(double, double *);
extern double pow(double, double);
extern double sqrt(double);
extern double ceil(double);
extern double fabs(double);
extern double floor(double);
extern double fmod(double, double);
extern double NaN(void);
extern int isNaN(double);
extern double Inf(int);
extern int isInf(double, int);
#ifdef _RESEARCH_SOURCE
/* does >> treat left operand as unsigned ? */
#define Unsigned_Shifts 1
#define M_E 2.7182818284590452354 /* e */
#define M_LOG2E 1.4426950408889634074 /* log 2e */
#define M_LOG10E 0.43429448190325182765 /* log 10e */
#define M_LN2 0.69314718055994530942 /* log e2 */
#define M_LN10 2.30258509299404568402 /* log e10 */
#define M_PI 3.14159265358979323846 /* pi */
#define M_PI_2 1.57079632679489661923 /* pi/2 */
#define M_PI_4 0.78539816339744830962 /* pi/4 */
#define M_1_PI 0.31830988618379067154 /* 1/pi */
#define M_2_PI 0.63661977236758134308 /* 2/pi */
#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
extern double hypot(double, double);
extern double erf(double);
extern double erfc(double);
extern double j0(double);
extern double y0(double);
extern double j1(double);
extern double y1(double);
extern double jn(int, double);
extern double yn(int, double);
#endif
#ifdef __cplusplus
}
#endif
#define isnan(x) isNaN(x)
#define isinf(x) isInf(x)
#endif /* __MATH */

11
mips/include/ape/stdarg.h Normal file
View file

@ -0,0 +1,11 @@
#ifndef __STDARG
#define __STDARG
typedef char *va_list;
#define va_start(list, start) list = (char *)(&(start)+1)
#define va_end(list)
#define va_arg(list, mode) (sizeof(mode)==1 ? ((mode *) (list += 4))[-4] : \
sizeof(mode)==2 ? ((mode *) (list += 4))[-2] : ((mode *) (list += sizeof(mode)))[-1])
#endif /* __STDARG */

52
mips/include/ape/ureg.h Normal file
View file

@ -0,0 +1,52 @@
#ifndef __UREG_H
#define __UREG_H
#if !defined(_PLAN9_SOURCE)
This header file is an extension to ANSI/POSIX
#endif
struct Ureg
{
unsigned long status;
unsigned long pc;
union{
unsigned long sp; /* r29 */
unsigned long usp; /* r29 */
};
unsigned long cause;
unsigned long badvaddr;
unsigned long tlbvirt;
unsigned long hi;
unsigned long lo;
unsigned long r31;
unsigned long r30;
unsigned long r28;
unsigned long r27; /* unused */
unsigned long r26; /* unused */
unsigned long r25;
unsigned long r24;
unsigned long r23;
unsigned long r22;
unsigned long r21;
unsigned long r20;
unsigned long r19;
unsigned long r18;
unsigned long r17;
unsigned long r16;
unsigned long r15;
unsigned long r14;
unsigned long r13;
unsigned long r12;
unsigned long r11;
unsigned long r10;
unsigned long r9;
unsigned long r8;
unsigned long r7;
unsigned long r6;
unsigned long r5;
unsigned long r4;
unsigned long r3;
unsigned long r2;
unsigned long r1;
};
#endif

53
mips/include/mips2ureg.h Normal file
View file

@ -0,0 +1,53 @@
struct Ureg
{
ulong status;
long pc;
union
{
struct
{
long sp; /* r29 */
ulong cause;
};
struct
{
long usp; /* r29 */
ulong ucause;
};
};
ulong badvaddr;
ulong tlbvirt;
long hhi; long hi;
long hlo; long lo;
long hr31; long r31;
long hr30; long r30;
long hr28; long r28;
long hr27; long r27;
long hr26; long r26;
long hr25; long r25;
long hr24; long r24;
long hr23; long r23;
long hr22; long r22;
long hr21; long r21;
long hr20; long r20;
long hr19; long r19;
long hr18; long r18;
long hr17; long r17;
long hr16; long r16;
long hr15; long r15;
long hr14; long r14;
long hr13; long r13;
long hr12; long r12;
long hr11; long r11;
long hr10; long r10;
long hr9; long r9;
long hr8; long r8;
long hr7; long r7;
long hr6; long r6;
long hr5; long r5;
long hr4; long r4;
long hr3; long r3;
long hr2; long r2;
long hr1; long r1;
};

66
mips/include/u.h Normal file
View file

@ -0,0 +1,66 @@
#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 unsigned long uintptr;
typedef unsigned long usize;
typedef ushort Rune;
typedef union FPdbleword FPdbleword;
typedef long 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;
/* FCR */
#define FPINEX (1<<7)
#define FPUNFL (1<<8)
#define FPOVFL (1<<9)
#define FPZDIV (1<<10)
#define FPINVAL (1<<11)
#define FPRNR (0<<0)
#define FPRZ (1<<0)
#define FPRPINF (2<<0)
#define FPRNINF (3<<0)
#define FPRMASK (3<<0)
#define FPPEXT 0
#define FPPSGL 0
#define FPPDBL 0
#define FPPMASK 0
/* FSR */
#define FPAINEX (1<<2)
#define FPAOVFL (1<<4)
#define FPAUNFL (1<<3)
#define FPAZDIV (1<<5)
#define FPAINVAL (1<<6)
union FPdbleword
{
double x;
struct { /* big endian */
ulong hi;
ulong lo;
};
};
/* stdarg */
typedef char* va_list;
#define va_start(list, start) list =\
(sizeof(start) < 4?\
(char*)((int*)&(start)+1):\
(char*)(&(start)+1))
#define va_end(list)\
USED(list)
#define va_arg(list, mode)\
((sizeof(mode) == 1)?\
((list += 4), (mode*)list)[-1]:\
(sizeof(mode) == 2)?\
((list += 4), (mode*)list)[-1]:\
((list += sizeof(mode)), (mode*)list)[-1])

44
mips/include/ureg.h Normal file
View file

@ -0,0 +1,44 @@
struct Ureg
{
ulong status;
ulong pc;
union{
ulong sp; /* r29 */
ulong usp; /* r29 */
};
ulong cause;
ulong badvaddr;
ulong tlbvirt;
ulong hi;
ulong lo;
ulong r31;
ulong r30;
ulong r28;
ulong r27; /* unused */
ulong r26; /* unused */
ulong r25;
ulong r24;
ulong r23;
ulong r22;
ulong r21;
ulong r20;
ulong r19;
ulong r18;
ulong r17;
ulong r16;
ulong r15;
ulong r14;
ulong r13;
ulong r12;
ulong r11;
ulong r10;
ulong r9;
ulong r8;
ulong r7;
ulong r6;
ulong r5;
ulong r4;
ulong r3;
ulong r2;
ulong r1;
};

6
mips/mkfile Normal file
View file

@ -0,0 +1,6 @@
</sys/src/mkfile.proto
CC=vc
LD=vl
O=v
AS=va

73
power/include/ape/float.h Normal file
View file

@ -0,0 +1,73 @@
#ifndef __FLOAT
#define __FLOAT
/* IEEE, default rounding */
#define FLT_ROUNDS 1
#define FLT_RADIX 2
#define FLT_DIG 6
#define FLT_EPSILON 1.19209290e-07
#define FLT_MANT_DIG 24
#define FLT_MAX 3.40282347e+38
#define FLT_MAX_10_EXP 38
#define FLT_MAX_EXP 128
#define FLT_MIN 1.17549435e-38
#define FLT_MIN_10_EXP -37
#define FLT_MIN_EXP -125
#define DBL_DIG 15
#define DBL_EPSILON 2.2204460492503131e-16
#define DBL_MANT_DIG 53
#define DBL_MAX 1.797693134862315708145e+308
#define DBL_MAX_10_EXP 308
#define DBL_MAX_EXP 1024
#define DBL_MIN 2.225073858507201383090233e-308
#define DBL_MIN_10_EXP -307
#define DBL_MIN_EXP -1021
#define LDBL_MANT_DIG DBL_MANT_DIG
#define LDBL_EPSILON DBL_EPSILON
#define LDBL_DIG DBL_DIG
#define LDBL_MIN_EXP DBL_MIN_EXP
#define LDBL_MIN DBL_MIN
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
#define LDBL_MAX_EXP DBL_MAX_EXP
#define LDBL_MAX DBL_MAX
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
typedef union FPdbleword FPdbleword;
union FPdbleword
{
double x;
struct { /* big endian */
long hi;
long lo;
};
};
#ifdef _RESEARCH_SOURCE
/* define stuff needed for floating conversion */
#define IEEE_MC68k 1
#define Sudden_Underflow 1
#endif
#ifdef _PLAN9_SOURCE
/* FCR */
#define FPINEX (1<<7)
#define FPOVFL (1<<9)
#define FPUNFL (1<<8)
#define FPZDIV (1<<10)
#define FPRNR (0<<0)
#define FPRZ (1<<0)
#define FPRPINF (2<<0)
#define FPRNINF (3<<0)
#define FPRMASK (3<<0)
#define FPPEXT 0
#define FPPSGL 0
#define FPPDBL 0
#define FPPMASK 0
/* FSR */
#define FPAINEX (1<<2)
#define FPAOVFL (1<<4)
#define FPAUNFL (1<<3)
#define FPAZDIV (1<<5)
#endif
#endif /* __FLOAT */

77
power/include/ape/math.h Normal file
View file

@ -0,0 +1,77 @@
#ifndef __MATH
#define __MATH
#pragma lib "/$M/lib/ape/libap.a"
/* a HUGE_VAL appropriate for IEEE double-precision */
/* the correct value, 1.797693134862316e+308, causes a ken overflow */
#define HUGE_VAL 1.79769313486231e+308
#ifdef __cplusplus
extern "C" {
#endif
extern double acos(double);
extern double asin(double);
extern double atan(double);
extern double atan2(double, double);
extern double cos(double);
extern double sin(double);
extern double tan(double);
extern double cosh(double);
extern double sinh(double);
extern double tanh(double);
extern double exp(double);
extern double frexp(double, int *);
extern double ldexp(double, int);
extern double log(double);
extern double log10(double);
extern double modf(double, double *);
extern double pow(double, double);
extern double sqrt(double);
extern double ceil(double);
extern double fabs(double);
extern double floor(double);
extern double fmod(double, double);
extern double NaN(void);
extern int isNaN(double);
extern double Inf(int);
extern int isInf(double, int);
#ifdef _RESEARCH_SOURCE
/* does >> treat left operand as unsigned ? */
#define Unsigned_Shifts 1
#define M_E 2.7182818284590452354 /* e */
#define M_LOG2E 1.4426950408889634074 /* log 2e */
#define M_LOG10E 0.43429448190325182765 /* log 10e */
#define M_LN2 0.69314718055994530942 /* log e2 */
#define M_LN10 2.30258509299404568402 /* log e10 */
#define M_PI 3.14159265358979323846 /* pi */
#define M_PI_2 1.57079632679489661923 /* pi/2 */
#define M_PI_4 0.78539816339744830962 /* pi/4 */
#define M_1_PI 0.31830988618379067154 /* 1/pi */
#define M_2_PI 0.63661977236758134308 /* 2/pi */
#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
extern double hypot(double, double);
extern double erf(double);
extern double erfc(double);
extern double j0(double);
extern double y0(double);
extern double j1(double);
extern double y1(double);
extern double jn(int, double);
extern double yn(int, double);
#endif
#ifdef __cplusplus
}
#endif
#define isnan(x) isNaN(x)
#define isinf(x) isInf(x)
#endif /* __MATH */

View file

@ -0,0 +1,11 @@
#ifndef __STDARG
#define __STDARG
typedef char *va_list;
#define va_start(list, start) list = (char *)(&(start)+1)
#define va_end(list)
#define va_arg(list, mode) (sizeof(mode)==1 ? ((mode *) (list += 4))[-4] : \
sizeof(mode)==2 ? ((mode *) (list += 4))[-2] : ((mode *) (list += sizeof(mode)))[-1])
#endif /* __STDARG */

50
power/include/ape/ureg.h Normal file
View file

@ -0,0 +1,50 @@
#ifndef __UREG_H
#define __UREG_H
#if !defined(_PLAN9_SOURCE)
This header file is an extension to ANSI/POSIX
#endif
struct Ureg
{ unsigned long cause;
union { unsigned long srr1; unsigned long status;};
unsigned long pc; /* SRR0 */
unsigned long pad;
unsigned long lr;
unsigned long cr;
unsigned long xer;
unsigned long ctr;
unsigned long r0;
union{ unsigned long r1; unsigned long sp; unsigned long usp; };
unsigned long r2;
unsigned long r3;
unsigned long r4;
unsigned long r5;
unsigned long r6;
unsigned long r7;
unsigned long r8;
unsigned long r9;
unsigned long r10;
unsigned long r11;
unsigned long r12;
unsigned long r13;
unsigned long r14;
unsigned long r15;
unsigned long r16;
unsigned long r17;
unsigned long r18;
unsigned long r19;
unsigned long r20;
unsigned long r21;
unsigned long r22;
unsigned long r23;
unsigned long r24;
unsigned long r25;
unsigned long r26;
unsigned long r27;
unsigned long r28;
unsigned long r29;
unsigned long r30;
unsigned long r31;
};
#endif

85
power/include/u.h Normal file
View file

@ -0,0 +1,85 @@
#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 unsigned long uintptr;
typedef unsigned long usize;
typedef ushort Rune;
typedef union FPdbleword FPdbleword;
typedef long 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;
/* FPSCR */
#define FPSFX (1<<31) /* exception summary (sticky) */
#define FPSEX (1<<30) /* enabled exception summary */
#define FPSVX (1<<29) /* invalid operation exception summary */
#define FPSOX (1<<28) /* overflow exception OX (sticky) */
#define FPSUX (1<<27) /* underflow exception UX (sticky) */
#define FPSZX (1<<26) /* zero divide exception ZX (sticky) */
#define FPSXX (1<<25) /* inexact exception XX (sticky) */
#define FPSVXSNAN (1<<24) /* invalid operation exception for SNaN (sticky) */
#define FPSVXISI (1<<23) /* invalid operation exception for ∞-∞ (sticky) */
#define FPSVXIDI (1<<22) /* invalid operation exception for ∞/∞ (sticky) */
#define FPSVXZDZ (1<<21) /* invalid operation exception for 0/0 (sticky) */
#define FPSVXIMZ (1<<20) /* invalid operation exception for ∞*0 (sticky) */
#define FPSVXVC (1<<19) /* invalid operation exception for invalid compare (sticky) */
#define FPSFR (1<<18) /* fraction rounded */
#define FPSFI (1<<17) /* fraction inexact */
#define FPSFPRF (1<<16) /* floating point result class */
#define FPSFPCC (0xF<<12) /* <, >, =, unordered */
#define FPVXCVI (1<<8) /* enable exception for invalid integer convert (sticky) */
#define FPVE (1<<7) /* invalid operation exception enable */
#define FPOVFL (1<<6) /* enable overflow exceptions */
#define FPUNFL (1<<5) /* enable underflow */
#define FPZDIV (1<<4) /* enable zero divide */
#define FPINEX (1<<3) /* enable inexact exceptions */
#define FPRMASK (3<<0) /* rounding mode */
#define FPRNR (0<<0)
#define FPRZ (1<<0)
#define FPRPINF (2<<0)
#define FPRNINF (3<<0)
#define FPPEXT 0
#define FPPSGL 0
#define FPPDBL 0
#define FPPMASK 0
#define FPINVAL FPVE
#define FPAOVFL FPSOX
#define FPAINEX FPSXX
#define FPAUNFL FPSUX
#define FPAZDIV FPSZX
#define FPAINVAL FPSVX
union FPdbleword
{
double x;
struct { /* big endian */
ulong hi;
ulong lo;
};
};
typedef char* va_list;
#define va_start(list, start) list =\
(sizeof(start) < 4?\
(char*)((int*)&(start)+1):\
(char*)(&(start)+1))
#define va_end(list)\
USED(list)
#define va_arg(list, mode)\
((sizeof(mode) == 1)?\
((list += 4), (mode*)list)[-1]:\
(sizeof(mode) == 2)?\
((list += 4), (mode*)list)[-1]:\
((list += sizeof(mode)), (mode*)list)[-1])

51
power/include/ureg.h Normal file
View file

@ -0,0 +1,51 @@
struct Ureg
{
/* 0*/ ulong cause;
/* 4*/ union { ulong srr1; ulong status;};
/* 8*/ ulong pc; /* SRR0 */
/* 12*/ ulong pad;
/* 16*/ ulong lr;
/* 20*/ ulong cr;
/* 24*/ ulong xer;
/* 28*/ ulong ctr;
/* 32*/ ulong r0;
/* 36*/ union{ ulong r1; ulong sp; ulong usp; };
/* 40*/ ulong r2;
/* 44*/ ulong r3;
/* 48*/ ulong r4;
/* 52*/ ulong r5;
/* 56*/ ulong r6;
/* 60*/ ulong r7;
/* 64*/ ulong r8;
/* 68*/ ulong r9;
/* 72*/ ulong r10;
/* 76*/ ulong r11;
/* 80*/ ulong r12;
/* 84*/ ulong r13;
/* 88*/ ulong r14;
/* 92*/ ulong r15;
/* 96*/ ulong r16;
/*100*/ ulong r17;
/*104*/ ulong r18;
/*108*/ ulong r19;
/*112*/ ulong r20;
/*116*/ ulong r21;
/*120*/ ulong r22;
/*124*/ ulong r23;
/*128*/ ulong r24;
/*132*/ ulong r25;
/*136*/ ulong r26;
/*140*/ ulong r27;
/*144*/ ulong r28;
/*148*/ ulong r29;
/*152*/ ulong r30;
/*156*/ ulong r31;
/*160*/ ulong dcmp;
/*164*/ ulong icmp;
/*168*/ ulong dmiss;
/*172*/ ulong imiss;
/*176*/ ulong hash1;
/*180*/ ulong hash2;
/*184*/ ulong dar;
/*188*/ ulong dsisr;
};

6
power/mkfile Normal file
View file

@ -0,0 +1,6 @@
</sys/src/mkfile.proto
CC=qc
LD=ql
O=q
AS=qa

87
power64/include/u.h Normal file
View file

@ -0,0 +1,87 @@
#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 unsigned long long uintptr;
typedef unsigned long usize;
typedef ushort 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;
/* FPSCR */
#define FPSFX (1<<31) /* exception summary (sticky) */
#define FPSEX (1<<30) /* enabled exception summary */
#define FPSVX (1<<29) /* invalid operation exception summary */
#define FPSOX (1<<28) /* overflow exception OX (sticky) */
#define FPSUX (1<<27) /* underflow exception UX (sticky) */
#define FPSZX (1<<26) /* zero divide exception ZX (sticky) */
#define FPSXX (1<<25) /* inexact exception XX (sticky) */
#define FPSVXSNAN (1<<24) /* invalid operation exception for SNaN (sticky) */
#define FPSVXISI (1<<23) /* invalid operation exception for ∞-∞ (sticky) */
#define FPSVXIDI (1<<22) /* invalid operation exception for ∞/∞ (sticky) */
#define FPSVXZDZ (1<<21) /* invalid operation exception for 0/0 (sticky) */
#define FPSVXIMZ (1<<20) /* invalid operation exception for ∞*0 (sticky) */
#define FPSVXVC (1<<19) /* invalid operation exception for invalid compare (sticky) */
#define FPSFR (1<<18) /* fraction rounded */
#define FPSFI (1<<17) /* fraction inexact */
#define FPSFPRF (1<<16) /* floating point result class */
#define FPSFPCC (0xF<<12) /* <, >, =, unordered */
#define FPVXCVI (1<<8) /* enable exception for invalid integer convert (sticky) */
#define FPVE (1<<7) /* invalid operation exception enable */
#define FPOVFL (1<<6) /* enable overflow exceptions */
#define FPUNFL (1<<5) /* enable underflow */
#define FPZDIV (1<<4) /* enable zero divide */
#define FPINEX (1<<3) /* enable inexact exceptions */
#define FPRMASK (3<<0) /* rounding mode */
#define FPRNR (0<<0)
#define FPRZ (1<<0)
#define FPRPINF (2<<0)
#define FPRNINF (3<<0)
#define FPPEXT 0
#define FPPSGL 0
#define FPPDBL 0
#define FPPMASK 0
#define FPINVAL FPVE
#define FPAOVFL FPSOX
#define FPAINEX FPSXX
#define FPAUNFL FPSUX
#define FPAZDIV FPSZX
#define FPAINVAL FPSVX
union FPdbleword
{
double x;
struct { /* big endian */
ulong hi;
ulong lo;
};
};
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)?\
((mode*)(list += 8))[-1]:\
(sizeof(mode) == 2)?\
((mode*)(list += 8))[-1]:\
(sizeof(mode) == 4)?\
((mode*)(list += 8))[-1]:\
((mode*)(list += sizeof(mode)))[-1])

44
power64/include/ureg.h Normal file
View file

@ -0,0 +1,44 @@
struct Ureg
{
/* 0*/ u64int cause; /* trap or interrupt vector */
/* 8*/ u64int msr; /* SRR1 */
/* 16*/ u64int pc; /* SRR0 */
/* 24*/ u64int unused;
/* 32*/ u64int lr;
/* 36*/ u32int pad;
/* 40*/ u32int cr;
/* 48*/ u64int xer;
/* 56*/ u64int ctr;
/* 64*/ u64int r0;
/* 72*/ union{ u64int r1; u64int sp; u64int usp; };
/* 80*/ u64int r2;
/* 88*/ u64int r3;
/* 96*/ u64int r4;
/*104*/ u64int r5;
/*112*/ u64int r6;
/*120*/ u64int r7;
/*128*/ u64int r8;
/*136*/ u64int r9;
/*144*/ u64int r10;
/*152*/ u64int r11;
/*160*/ u64int r12;
/*168*/ u64int r13;
/*176*/ u64int r14;
/*184*/ u64int r15;
/*192*/ u64int r16;
/*200*/ u64int r17;
/*208*/ u64int r18;
/*216*/ u64int r19;
/*224*/ u64int r20;
/*232*/ u64int r21;
/*240*/ u64int r22;
/*248*/ u64int r23;
/*256*/ u64int r24;
/*264*/ u64int r25;
/*272*/ u64int r26;
/*280*/ u64int r27;
/*288*/ u64int r28;
/*296*/ u64int r29;
/*304*/ u64int r30;
/*312*/ u64int r31;
};

6
power64/mkfile Normal file
View file

@ -0,0 +1,6 @@
</sys/src/mkfile.proto
CC=9c
LD=9l
O=9
AS=9a

73
sparc/include/ape/float.h Normal file
View file

@ -0,0 +1,73 @@
#ifndef __FLOAT
#define __FLOAT
/* IEEE, default rounding */
#define FLT_ROUNDS 1
#define FLT_RADIX 2
#define FLT_DIG 6
#define FLT_EPSILON 1.19209290e-07
#define FLT_MANT_DIG 24
#define FLT_MAX 3.40282347e+38
#define FLT_MAX_10_EXP 38
#define FLT_MAX_EXP 128
#define FLT_MIN 1.17549435e-38
#define FLT_MIN_10_EXP -37
#define FLT_MIN_EXP -125
#define DBL_DIG 15
#define DBL_EPSILON 2.2204460492503131e-16
#define DBL_MANT_DIG 53
#define DBL_MAX 1.797693134862315708145e+308
#define DBL_MAX_10_EXP 308
#define DBL_MAX_EXP 1024
#define DBL_MIN 2.225073858507201383090233e-308
#define DBL_MIN_10_EXP -307
#define DBL_MIN_EXP -1021
#define LDBL_MANT_DIG DBL_MANT_DIG
#define LDBL_EPSILON DBL_EPSILON
#define LDBL_DIG DBL_DIG
#define LDBL_MIN_EXP DBL_MIN_EXP
#define LDBL_MIN DBL_MIN
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
#define LDBL_MAX_EXP DBL_MAX_EXP
#define LDBL_MAX DBL_MAX
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
typedef union FPdbleword FPdbleword;
union FPdbleword
{
double x;
struct { /* big endian */
long hi;
long lo;
};
};
#ifdef _RESEARCH_SOURCE
/* define order of longs in IEEE double: little endian */
#define IEEE_MC68k 1
#define Sudden_Underflow 1
#endif
#ifdef _PLAN9_SOURCE
/* FCR */
#define FPINEX (1<<23)
#define FPOVFL (1<<26)
#define FPUNFL (1<<25)
#define FPZDIV (1<<24)
#define FPRNR (0<<30)
#define FPRZ (1<<30)
#define FPRPINF (2<<30)
#define FPRNINF (3<<30)
#define FPRMASK (3<<30)
#define FPPEXT 0
#define FPPSGL 0
#define FPPDBL 0
#define FPPMASK 0
/* FSR */
#define FPAINEX (1<<5)
#define FPAOVFL (1<<8)
#define FPAUNFL (1<<7)
#define FPAZDIV (1<<6)
#endif
#endif /* __FLOAT */

77
sparc/include/ape/math.h Normal file
View file

@ -0,0 +1,77 @@
#ifndef __MATH
#define __MATH
#pragma lib "/$M/lib/ape/libap.a"
/* a HUGE_VAL appropriate for IEEE double-precision */
/* the correct value, 1.797693134862316e+308, causes a ken overflow */
#define HUGE_VAL 1.79769313486231e+308
#ifdef __cplusplus
extern "C" {
#endif
extern double acos(double);
extern double asin(double);
extern double atan(double);
extern double atan2(double, double);
extern double cos(double);
extern double sin(double);
extern double tan(double);
extern double cosh(double);
extern double sinh(double);
extern double tanh(double);
extern double exp(double);
extern double frexp(double, int *);
extern double ldexp(double, int);
extern double log(double);
extern double log10(double);
extern double modf(double, double *);
extern double pow(double, double);
extern double sqrt(double);
extern double ceil(double);
extern double fabs(double);
extern double floor(double);
extern double fmod(double, double);
extern double NaN(void);
extern int isNaN(double);
extern double Inf(int);
extern int isInf(double, int);
#ifdef _RESEARCH_SOURCE
/* does >> treat left operand as unsigned ? */
#define Unsigned_Shifts 1
#define M_E 2.7182818284590452354 /* e */
#define M_LOG2E 1.4426950408889634074 /* log 2e */
#define M_LOG10E 0.43429448190325182765 /* log 10e */
#define M_LN2 0.69314718055994530942 /* log e2 */
#define M_LN10 2.30258509299404568402 /* log e10 */
#define M_PI 3.14159265358979323846 /* pi */
#define M_PI_2 1.57079632679489661923 /* pi/2 */
#define M_PI_4 0.78539816339744830962 /* pi/4 */
#define M_1_PI 0.31830988618379067154 /* 1/pi */
#define M_2_PI 0.63661977236758134308 /* 2/pi */
#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
extern double hypot(double, double);
extern double erf(double);
extern double erfc(double);
extern double j0(double);
extern double y0(double);
extern double j1(double);
extern double y1(double);
extern double jn(int, double);
extern double yn(int, double);
#endif
#ifdef __cplusplus
}
#endif
#define isnan(x) isNaN(x)
#define isinf(x) isInf(x)
#endif /* __MATH */

View file

@ -0,0 +1,11 @@
#ifndef __STDARG
#define __STDARG
typedef char *va_list;
#define va_start(list, start) list = (char *)(&(start)+1)
#define va_end(list)
#define va_arg(list, mode) (sizeof(mode)==1 ? ((mode *) (list += 4))[-4] : \
sizeof(mode)==2 ? ((mode *) (list += 4))[-2] : ((mode *) (list += sizeof(mode)))[-1])
#endif /* __STDARG */

53
sparc/include/ape/ureg.h Normal file
View file

@ -0,0 +1,53 @@
#ifndef __UREG_H
#define __UREG_H
#if !defined(_PLAN9_SOURCE)
This header file is an extension to ANSI/POSIX
#endif
struct Ureg
{
unsigned long r0; /* unnecessary; just for symmetry */
union{
unsigned long sp; /* r1 */
unsigned long usp; /* r1 */
unsigned long r1;
};
unsigned long r2;
unsigned long r3;
unsigned long r4;
unsigned long r5;
unsigned long r6;
unsigned long r7;
unsigned long r8;
unsigned long r9;
unsigned long r10;
unsigned long r11;
unsigned long r12;
unsigned long r13;
unsigned long r14;
unsigned long r15;
unsigned long r16;
unsigned long r17;
unsigned long r18;
unsigned long r19;
unsigned long r20;
unsigned long r21;
unsigned long r22;
unsigned long r23;
unsigned long r24;
unsigned long r25;
unsigned long r26;
unsigned long r27;
unsigned long r28;
unsigned long r29;
unsigned long r30;
unsigned long r31;
unsigned long y;
unsigned long tbr;
unsigned long psr;
unsigned long npc;
unsigned long pc;
unsigned long pad; /* so structure is double word aligned */
};
#endif

65
sparc/include/u.h Normal file
View file

@ -0,0 +1,65 @@
#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 unsigned long uintptr;
typedef unsigned long usize;
typedef ushort Rune;
typedef union FPdbleword FPdbleword;
typedef long jmp_buf[2];
#define JMPBUFSP 0
#define JMPBUFPC 1
#define JMPBUFDPC (-8)
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;
/* FCR */
#define FPINEX (1<<23)
#define FPOVFL (1<<26)
#define FPUNFL (1<<25)
#define FPZDIV (1<<24)
#define FPRNR (0<<30)
#define FPRZ (1<<30)
#define FPINVAL (1<<27)
#define FPRPINF (2<<30)
#define FPRNINF (3<<30)
#define FPRMASK (3<<30)
#define FPPEXT 0
#define FPPSGL 0
#define FPPDBL 0
#define FPPMASK 0
/* FSR */
#define FPAINEX (1<<5)
#define FPAZDIV (1<<6)
#define FPAUNFL (1<<7)
#define FPAOVFL (1<<8)
#define FPAINVAL (1<<9)
union FPdbleword
{
double x;
struct { /* big endian */
ulong hi;
ulong lo;
};
};
typedef char* va_list;
#define va_start(list, start) list =\
(sizeof(start) < 4?\
(char*)((int*)&(start)+1):\
(char*)(&(start)+1))
#define va_end(list)\
USED(list)
#define va_arg(list, mode)\
((sizeof(mode) == 1)?\
((list += 4), (mode*)list)[-1]:\
(sizeof(mode) == 2)?\
((list += 4), (mode*)list)[-1]:\
((list += sizeof(mode)), (mode*)list)[-1])

45
sparc/include/ureg.h Normal file
View file

@ -0,0 +1,45 @@
struct Ureg
{
ulong r0; /* unnecessary; just for symmetry */
union{
ulong sp; /* r1 */
ulong usp; /* r1 */
ulong r1;
};
ulong r2;
ulong r3;
ulong r4;
ulong r5;
ulong r6;
ulong r7;
ulong r8;
ulong r9;
ulong r10;
ulong r11;
ulong r12;
ulong r13;
ulong r14;
ulong r15;
ulong r16;
ulong r17;
ulong r18;
ulong r19;
ulong r20;
ulong r21;
ulong r22;
ulong r23;
ulong r24;
ulong r25;
ulong r26;
ulong r27;
ulong r28;
ulong r29;
ulong r30;
ulong r31;
ulong y;
ulong tbr;
ulong psr;
ulong npc;
ulong pc;
ulong pad; /* so structure is double word aligned */
};

7
sparc/mkfile Normal file
View file

@ -0,0 +1,7 @@
</sys/src/mkfile.proto
CC=kc
LD=kl
O=k
RL=rl
AS=ka

View file

@ -0,0 +1,73 @@
#ifndef __FLOAT
#define __FLOAT
/* IEEE, default rounding */
#define FLT_ROUNDS 1
#define FLT_RADIX 2
#define FLT_DIG 6
#define FLT_EPSILON 1.19209290e-07
#define FLT_MANT_DIG 24
#define FLT_MAX 3.40282347e+38
#define FLT_MAX_10_EXP 38
#define FLT_MAX_EXP 128
#define FLT_MIN 1.17549435e-38
#define FLT_MIN_10_EXP -37
#define FLT_MIN_EXP -125
#define DBL_DIG 15
#define DBL_EPSILON 2.2204460492503131e-16
#define DBL_MANT_DIG 53
#define DBL_MAX 1.797693134862315708145e+308
#define DBL_MAX_10_EXP 308
#define DBL_MAX_EXP 1024
#define DBL_MIN 2.225073858507201383090233e-308
#define DBL_MIN_10_EXP -307
#define DBL_MIN_EXP -1021
#define LDBL_MANT_DIG DBL_MANT_DIG
#define LDBL_EPSILON DBL_EPSILON
#define LDBL_DIG DBL_DIG
#define LDBL_MIN_EXP DBL_MIN_EXP
#define LDBL_MIN DBL_MIN
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
#define LDBL_MAX_EXP DBL_MAX_EXP
#define LDBL_MAX DBL_MAX
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
typedef union FPdbleword FPdbleword;
union FPdbleword
{
double x;
struct { /* big endian */
long hi;
long lo;
};
};
#ifdef _RESEARCH_SOURCE
/* define order of longs in IEEE double: little endian */
#define IEEE_MC68k 1
#define Sudden_Underflow 1
#endif
#ifdef _PLAN9_SOURCE
/* FCR */
#define FPINEX (1<<23)
#define FPOVFL (1<<26)
#define FPUNFL (1<<25)
#define FPZDIV (1<<24)
#define FPRNR (0<<30)
#define FPRZ (1<<30)
#define FPRPINF (2<<30)
#define FPRNINF (3<<30)
#define FPRMASK (3<<30)
#define FPPEXT 0
#define FPPSGL 0
#define FPPDBL 0
#define FPPMASK 0
/* FSR */
#define FPAINEX (1<<5)
#define FPAOVFL (1<<8)
#define FPAUNFL (1<<7)
#define FPAZDIV (1<<6)
#endif
#endif /* __FLOAT */

View file

@ -0,0 +1,77 @@
#ifndef __MATH
#define __MATH
#pragma lib "/$M/lib/ape/libap.a"
/* a HUGE_VAL appropriate for IEEE double-precision */
/* the correct value, 1.797693134862316e+308, causes a ken overflow */
#define HUGE_VAL 1.79769313486231e+308
#ifdef __cplusplus
extern "C" {
#endif
extern double acos(double);
extern double asin(double);
extern double atan(double);
extern double atan2(double, double);
extern double cos(double);
extern double sin(double);
extern double tan(double);
extern double cosh(double);
extern double sinh(double);
extern double tanh(double);
extern double exp(double);
extern double frexp(double, int *);
extern double ldexp(double, int);
extern double log(double);
extern double log10(double);
extern double modf(double, double *);
extern double pow(double, double);
extern double sqrt(double);
extern double ceil(double);
extern double fabs(double);
extern double floor(double);
extern double fmod(double, double);
extern double NaN(void);
extern int isNaN(double);
extern double Inf(int);
extern int isInf(double, int);
#ifdef _RESEARCH_SOURCE
/* does >> treat left operand as unsigned ? */
#define Unsigned_Shifts 1
#define M_E 2.7182818284590452354 /* e */
#define M_LOG2E 1.4426950408889634074 /* log 2e */
#define M_LOG10E 0.43429448190325182765 /* log 10e */
#define M_LN2 0.69314718055994530942 /* log e2 */
#define M_LN10 2.30258509299404568402 /* log e10 */
#define M_PI 3.14159265358979323846 /* pi */
#define M_PI_2 1.57079632679489661923 /* pi/2 */
#define M_PI_4 0.78539816339744830962 /* pi/4 */
#define M_1_PI 0.31830988618379067154 /* 1/pi */
#define M_2_PI 0.63661977236758134308 /* 2/pi */
#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
extern double hypot(double, double);
extern double erf(double);
extern double erfc(double);
extern double j0(double);
extern double y0(double);
extern double j1(double);
extern double y1(double);
extern double jn(int, double);
extern double yn(int, double);
#endif
#ifdef __cplusplus
}
#endif
#define isnan(x) isNaN(x)
#define isinf(x) isInf(x)
#endif /* __MATH */

View file

@ -0,0 +1,11 @@
#ifndef __STDARG
#define __STDARG
typedef char *va_list;
#define va_start(list, start) list = (char *)(&(start)+1)
#define va_end(list)
#define va_arg(list, mode) (sizeof(mode)==1 ? ((mode *) (list += 4))[-4] : \
sizeof(mode)==2 ? ((mode *) (list += 4))[-2] : ((mode *) (list += sizeof(mode)))[-1])
#endif /* __STDARG */

View file

@ -0,0 +1,53 @@
#ifndef __UREG_H
#define __UREG_H
#if !defined(_PLAN9_SOURCE)
This header file is an extension to ANSI/POSIX
#endif
struct Ureg
{
unsigned long r0; /* unnecessary; just for symmetry */
union{
unsigned long sp; /* r1 */
unsigned long usp; /* r1 */
unsigned long r1;
};
unsigned long r2;
unsigned long r3;
unsigned long r4;
unsigned long r5;
unsigned long r6;
unsigned long r7;
unsigned long r8;
unsigned long r9;
unsigned long r10;
unsigned long r11;
unsigned long r12;
unsigned long r13;
unsigned long r14;
unsigned long r15;
unsigned long r16;
unsigned long r17;
unsigned long r18;
unsigned long r19;
unsigned long r20;
unsigned long r21;
unsigned long r22;
unsigned long r23;
unsigned long r24;
unsigned long r25;
unsigned long r26;
unsigned long r27;
unsigned long r28;
unsigned long r29;
unsigned long r30;
unsigned long r31;
unsigned long y;
unsigned long tt;
unsigned long pstate;
unsigned long npc;
unsigned long pc;
unsigned long pad; /* so structure is double word aligned */
};
#endif

65
sparc64/include/u.h Normal file
View file

@ -0,0 +1,65 @@
#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 unsigned long uintptr;
typedef unsigned long usize;
typedef ushort Rune;
typedef union FPdbleword FPdbleword;
typedef long jmp_buf[2];
#define JMPBUFSP 0
#define JMPBUFPC 1
#define JMPBUFDPC (-8)
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;
/* FCR */
#define FPINEX (1<<23)
#define FPOVFL (1<<26)
#define FPUNFL (1<<25)
#define FPZDIV (1<<24)
#define FPRNR (0<<30)
#define FPRZ (1<<30)
#define FPINVAL (1<<27)
#define FPRPINF (2<<30)
#define FPRNINF (3<<30)
#define FPRMASK (3<<30)
#define FPPEXT 0
#define FPPSGL 0
#define FPPDBL 0
#define FPPMASK 0
/* FSR */
#define FPAINEX (1<<5)
#define FPAZDIV (1<<6)
#define FPAUNFL (1<<7)
#define FPAOVFL (1<<8)
#define FPAINVAL (1<<9)
union FPdbleword
{
double x;
struct { /* big endian */
ulong hi;
ulong lo;
};
};
typedef char* va_list;
#define va_start(list, start) list =\
(sizeof(start) < 4?\
(char*)((int*)&(start)+1):\
(char*)(&(start)+1))
#define va_end(list)\
USED(list)
#define va_arg(list, mode)\
((sizeof(mode) == 1)?\
((list += 4), (mode*)list)[-1]:\
(sizeof(mode) == 2)?\
((list += 4), (mode*)list)[-1]:\
((list += sizeof(mode)), (mode*)list)[-1])

51
sparc64/include/ureg.h Normal file
View file

@ -0,0 +1,51 @@
/*
* sparc64 registers.
* Currently just 32-bit registers (also somewhat compatible with
* the sparc32 ureg).
*/
struct Ureg
{
ulong r0; /* unnecessary; just for symmetry */
union{
ulong sp; /* r1 */
ulong usp; /* r1 */
ulong r1;
};
ulong r2;
ulong r3;
ulong r4;
ulong r5;
ulong r6;
ulong r7;
ulong r8;
ulong r9;
ulong r10;
ulong r11;
ulong r12;
ulong r13;
ulong r14;
ulong r15;
ulong r16;
ulong r17;
ulong r18;
ulong r19;
ulong r20;
ulong r21;
ulong r22;
ulong r23;
ulong r24;
ulong r25;
ulong r26;
ulong r27;
ulong r28;
ulong r29;
ulong r30;
ulong r31;
ulong y;
ulong tt;
ulong pstate;
ulong npc;
ulong pc;
ulong pad; /* so structure is double word aligned */
};

6
sparc64/mkfile Normal file
View file

@ -0,0 +1,6 @@
</sys/src/mkfile.proto
CC=uc
LD=ul
O=u
AS=ua