Commit 899b3981 by Iain Buclaw

libphobos: Add druntime bindings for SPARC/Solaris

Backported from upstream druntime master.

Initial patch by Rainer Orth.

Reviewed-on: https://github.com/dlang/druntime/pull/2344

From-SVN: r266935
parent 54f39791
...@@ -457,6 +457,54 @@ version (CRuntime_Microsoft) ...@@ -457,6 +457,54 @@ version (CRuntime_Microsoft)
FE_TOWARDZERO = 0x300, /// FE_TOWARDZERO = 0x300, ///
} }
} }
else version (Solaris)
{
version (SPARC_Any)
{
enum
{
FE_TONEAREST = 0,
FE_TOWARDZERO = 1,
FE_UPWARD = 2,
FE_DOWNWARD = 3,
}
enum
{
FE_INEXACT = 0x01,
FE_DIVBYZERO = 0x02,
FE_UNDERFLOW = 0x04,
FE_OVERFLOW = 0x08,
FE_INVALID = 0x10,
FE_ALL_EXCEPT = 0x1f,
}
}
else version (X86_Any)
{
enum
{
FE_TONEAREST = 0,
FE_DOWNWARD = 1,
FE_UPWARD = 2,
FE_TOWARDZERO = 3,
}
enum
{
FE_INVALID = 0x01,
FE_DIVBYZERO = 0x04,
FE_OVERFLOW = 0x08,
FE_UNDERFLOW = 0x10,
FE_INEXACT = 0x20,
FE_ALL_EXCEPT = 0x3d,
}
}
else
{
static assert(0, "Unimplemented architecture");
}
}
else else
{ {
version (X86) version (X86)
......
...@@ -123,15 +123,58 @@ else version (DragonFlyBSD) ...@@ -123,15 +123,58 @@ else version (DragonFlyBSD)
version = BSD_Posix; version = BSD_Posix;
} }
else version (Solaris)
{
struct aio_result_t
{
ssize_t aio_return;
int aio_errno;
}
struct aiocb
{
int aio_fildes;
void* aio_buf; // volatile
size_t aio_nbytes;
off_t aio_offset;
int aio_reqprio;
sigevent aio_sigevent;
int aio_lio_opcode;
aio_result_t aio_resultp;
int aio_state;
int[1] aio__pad;
}
}
else else
static assert(false, "Unsupported platform"); static assert(false, "Unsupported platform");
/* Return values of cancelation function. */ /* Return values of cancelation function. */
enum version (CRuntime_Glibc)
{ {
AIO_CANCELED, enum
AIO_NOTCANCELED, {
AIO_ALLDONE AIO_CANCELED,
AIO_NOTCANCELED,
AIO_ALLDONE
}
}
else version (Solaris)
{
enum
{
AIO_CANCELED,
AIO_ALLDONE,
AIO_NOTCANCELED
}
}
else version (BSD_Posix)
{
enum
{
AIO_CANCELED,
AIO_NOTCANCELED,
AIO_ALLDONE
}
} }
/* Operation codes for `aio_lio_opcode'. */ /* Operation codes for `aio_lio_opcode'. */
...@@ -144,6 +187,15 @@ version (CRuntime_Glibc) ...@@ -144,6 +187,15 @@ version (CRuntime_Glibc)
LIO_NOP LIO_NOP
} }
} }
else version (Solaris)
{
enum
{
LIO_NOP,
LIO_READ,
LIO_WRITE,
}
}
else version (BSD_Posix) else version (BSD_Posix)
{ {
enum enum
...@@ -163,6 +215,14 @@ version (CRuntime_Glibc) ...@@ -163,6 +215,14 @@ version (CRuntime_Glibc)
LIO_NOWAIT LIO_NOWAIT
} }
} }
else version (Solaris)
{
enum
{
LIO_NOWAIT,
LIO_WAIT
}
}
else version (BSD_Posix) else version (BSD_Posix)
{ {
enum enum
......
...@@ -989,7 +989,17 @@ else version (Solaris) ...@@ -989,7 +989,17 @@ else version (Solaris)
{ {
alias uint[4] upad128_t; alias uint[4] upad128_t;
version (X86_64) version (SPARC64)
{
enum _NGREG = 21;
alias long greg_t;
}
else version (SPARC)
{
enum _NGREG = 19;
alias int greg_t;
}
else version (X86_64)
{ {
enum _NGREG = 28; enum _NGREG = 28;
alias long greg_t; alias long greg_t;
...@@ -999,10 +1009,81 @@ else version (Solaris) ...@@ -999,10 +1009,81 @@ else version (Solaris)
enum _NGREG = 19; enum _NGREG = 19;
alias int greg_t; alias int greg_t;
} }
else
static assert(0, "unimplemented");
alias greg_t[_NGREG] gregset_t; alias greg_t[_NGREG] gregset_t;
version (X86_64) version (SPARC64)
{
private
{
struct _fpq
{
uint *fpq_addr;
uint fpq_instr;
}
struct fq
{
union
{
double whole;
_fpq fpq;
}
}
}
struct fpregset_t
{
union
{
uint[32] fpu_regs;
double[32] fpu_dregs;
real[16] fpu_qregs;
}
fq *fpu_q;
ulong fpu_fsr;
ubyte fpu_qcnt;
ubyte fpu_q_entrysize;
ubyte fpu_en;
}
}
else version (SPARC)
{
private
{
struct _fpq
{
uint *fpq_addr;
uint fpq_instr;
}
struct fq
{
union
{
double whole;
_fpq fpq;
}
}
}
struct fpregset_t
{
union
{
uint[32] fpu_regs;
double[16] fpu_dregs;
};
fq *fpu_q;
uint fpu_fsr;
ubyte fpu_qcnt;
ubyte fpu_q_entrysize;
ubyte fpu_en;
}
}
else version (X86_64)
{ {
union _u_st union _u_st
{ {
...@@ -1063,6 +1144,9 @@ else version (Solaris) ...@@ -1063,6 +1144,9 @@ else version (Solaris)
u_fp_reg_set fp_reg_set; u_fp_reg_set fp_reg_set;
} }
} }
else
static assert(0, "unimplemented");
struct mcontext_t struct mcontext_t
{ {
gregset_t gregs; gregset_t gregs;
......
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