Skip to content

Commit

Permalink
add mips64 port
Browse files Browse the repository at this point in the history
patch by Mahesh Bodapati and Jaydeep Patil of Imagination
Technologies.
  • Loading branch information
richfelker committed Mar 6, 2016
1 parent 71392a9 commit 8393357
Show file tree
Hide file tree
Showing 47 changed files with 2,546 additions and 1 deletion.
50 changes: 50 additions & 0 deletions arch/mips64/atomic_arch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#define a_ll a_ll
static inline int a_ll(volatile int *p)
{
int v;
__asm__ __volatile__ (
"ll %0, %1"
: "=r"(v) : "m"(*p));
return v;
}

#define a_sc a_sc
static inline int a_sc(volatile int *p, int v)
{
int r;
__asm__ __volatile__ (
"sc %0, %1"
: "=r"(r), "=m"(*p) : "0"(v) : "memory");
return r;
}

#define a_ll_p a_ll_p
static inline void *a_ll_p(volatile long *p)
{
void *v;
__asm__ __volatile__ (
"lld %0, %1"
: "=r"(v) : "m"(*p));
return v;
}

#define a_sc_p a_sc_p
static inline int a_sc_p(volatile long *p, void *v)
{
int r;
__asm__ __volatile__ (
"scd %0, %1"
: "=r"(r), "=m"(*p) : "0"(v) : "memory");
return r;
}

#define a_barrier a_barrier
static inline void a_barrier()
{
/* mips2 sync, but using too many directives causes
* gcc not to inline it, so encode with .long instead. */
__asm__ __volatile__ (".long 0xf" : : : "memory");
}

#define a_pre_llsc a_barrier
#define a_post_llsc a_barrier
28 changes: 28 additions & 0 deletions arch/mips64/bits/alltypes.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#define _Addr long
#define _Int64 long
#define _Reg long

TYPEDEF __builtin_va_list va_list;
TYPEDEF __builtin_va_list __isoc_va_list;

#ifndef __cplusplus
TYPEDEF int wchar_t;
#endif

TYPEDEF float float_t;
TYPEDEF double double_t;

TYPEDEF struct { long long __ll; long double __ld; } max_align_t;

TYPEDEF long time_t;
TYPEDEF long suseconds_t;

TYPEDEF unsigned nlink_t;

TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; unsigned long __s[7]; } __u; } pthread_attr_t;
TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } mtx_t;
TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } cnd_t;
TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; void *__p[7]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[4]; } __u; } pthread_barrier_t;
5 changes: 5 additions & 0 deletions arch/mips64/bits/endian.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#if _MIPSEL || __MIPSEL || __MIPSEL__
#define __BYTE_ORDER __LITTLE_ENDIAN
#else
#define __BYTE_ORDER __BIG_ENDIAN
#endif
134 changes: 134 additions & 0 deletions arch/mips64/bits/errno.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
#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 EAGAIN 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 ENOMSG 35
#define EIDRM 36
#define ECHRNG 37
#define EL2NSYNC 38
#define EL3HLT 39
#define EL3RST 40
#define ELNRNG 41
#define EUNATCH 42
#define ENOCSI 43
#define EL2HLT 44
#define EDEADLK 45
#define ENOLCK 46
#define EBADE 50
#define EBADR 51
#define EXFULL 52
#define ENOANO 53
#define EBADRQC 54
#define EBADSLT 55
#define EDEADLOCK 56
#define EBFONT 59
#define ENOSTR 60
#define ENODATA 61
#define ETIME 62
#define ENOSR 63
#define ENONET 64
#define ENOPKG 65
#define EREMOTE 66
#define ENOLINK 67
#define EADV 68
#define ESRMNT 69
#define ECOMM 70
#define EPROTO 71
#define EDOTDOT 73
#define EMULTIHOP 74
#define EBADMSG 77
#define ENAMETOOLONG 78
#define EOVERFLOW 79
#define ENOTUNIQ 80
#define EBADFD 81
#define EREMCHG 82
#define ELIBACC 83
#define ELIBBAD 84
#define ELIBSCN 85
#define ELIBMAX 86
#define ELIBEXEC 87
#define EILSEQ 88
#define ENOSYS 89
#define ELOOP 90
#define ERESTART 91
#define ESTRPIPE 92
#define ENOTEMPTY 93
#define EUSERS 94
#define ENOTSOCK 95
#define EDESTADDRREQ 96
#define EMSGSIZE 97
#define EPROTOTYPE 98
#define ENOPROTOOPT 99
#define EPROTONOSUPPORT 120
#define ESOCKTNOSUPPORT 121
#define EOPNOTSUPP 122
#define ENOTSUP EOPNOTSUPP
#define EPFNOSUPPORT 123
#define EAFNOSUPPORT 124
#define EADDRINUSE 125
#define EADDRNOTAVAIL 126
#define ENETDOWN 127
#define ENETUNREACH 128
#define ENETRESET 129
#define ECONNABORTED 130
#define ECONNRESET 131
#define ENOBUFS 132
#define EISCONN 133
#define ENOTCONN 134
#define EUCLEAN 135
#define ENOTNAM 137
#define ENAVAIL 138
#define EISNAM 139
#define EREMOTEIO 140
#define ESHUTDOWN 143
#define ETOOMANYREFS 144
#define ETIMEDOUT 145
#define ECONNREFUSED 146
#define EHOSTDOWN 147
#define EHOSTUNREACH 148
#define EWOULDBLOCK EAGAIN
#define EALREADY 149
#define EINPROGRESS 150
#define ESTALE 151
#define ECANCELED 158
#define ENOMEDIUM 159
#define EMEDIUMTYPE 160
#define ENOKEY 161
#define EKEYEXPIRED 162
#define EKEYREVOKED 163
#define EKEYREJECTED 164
#define EOWNERDEAD 165
#define ENOTRECOVERABLE 166
#define ERFKILL 167
#define EHWPOISON 168
#define EDQUOT 1133
40 changes: 40 additions & 0 deletions arch/mips64/bits/fcntl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#define O_CREAT 0400
#define O_EXCL 02000
#define O_NOCTTY 04000
#define O_TRUNC 01000
#define O_APPEND 0010
#define O_NONBLOCK 0200
#define O_DSYNC 0020
#define O_SYNC 040020
#define O_RSYNC 040020
#define O_DIRECTORY 0200000
#define O_NOFOLLOW 0400000
#define O_CLOEXEC 02000000

#define O_ASYNC 010000
#define O_DIRECT 0100000
#define O_LARGEFILE 0
#define O_NOATIME 01000000
#define O_PATH 010000000
#define O_TMPFILE 020200000
#define O_NDELAY O_NONBLOCK

#define F_DUPFD 0
#define F_GETFD 1
#define F_SETFD 2
#define F_GETFL 3
#define F_SETFL 4

#define F_SETOWN 24
#define F_GETOWN 23
#define F_SETSIG 10
#define F_GETSIG 11

#define F_GETLK 14
#define F_SETLK 6
#define F_SETLKW 7

#define F_SETOWN_EX 15
#define F_GETOWN_EX 16

#define F_GETOWNER_UIDS 17
25 changes: 25 additions & 0 deletions arch/mips64/bits/fenv.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifdef __mips_soft_float
#define FE_ALL_EXCEPT 0
#define FE_TONEAREST 0
#else
#define FE_INEXACT 4
#define FE_UNDERFLOW 8
#define FE_OVERFLOW 16
#define FE_DIVBYZERO 32
#define FE_INVALID 64

#define FE_ALL_EXCEPT 124

#define FE_TONEAREST 0
#define FE_TOWARDZERO 1
#define FE_UPWARD 2
#define FE_DOWNWARD 3
#endif

typedef unsigned short fexcept_t;

typedef struct {
unsigned __cw;
} fenv_t;

#define FE_DFL_ENV ((const fenv_t *) -1)
16 changes: 16 additions & 0 deletions arch/mips64/bits/float.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#define FLT_EVAL_METHOD 0

#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L

#define LDBL_MANT_DIG 113
#define LDBL_MIN_EXP (-16381)
#define LDBL_MAX_EXP 16384

#define LDBL_DIG 33
#define LDBL_MIN_10_EXP (-4931)
#define LDBL_MAX_10_EXP 4932

#define DECIMAL_DIG 36
Loading

0 comments on commit 8393357

Please sign in to comment.