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
This commit is contained in:
Iain Buclaw 2018-12-09 23:46:45 +00:00
parent 54f397919a
commit 899b398116
3 changed files with 198 additions and 6 deletions

View File

@ -457,6 +457,54 @@ version (CRuntime_Microsoft)
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
{
version (X86)

View File

@ -123,15 +123,58 @@ else version (DragonFlyBSD)
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
static assert(false, "Unsupported platform");
/* Return values of cancelation function. */
enum
version (CRuntime_Glibc)
{
AIO_CANCELED,
AIO_NOTCANCELED,
AIO_ALLDONE
enum
{
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'. */
@ -144,6 +187,15 @@ version (CRuntime_Glibc)
LIO_NOP
}
}
else version (Solaris)
{
enum
{
LIO_NOP,
LIO_READ,
LIO_WRITE,
}
}
else version (BSD_Posix)
{
enum
@ -163,6 +215,14 @@ version (CRuntime_Glibc)
LIO_NOWAIT
}
}
else version (Solaris)
{
enum
{
LIO_NOWAIT,
LIO_WAIT
}
}
else version (BSD_Posix)
{
enum

View File

@ -989,7 +989,17 @@ else version (Solaris)
{
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;
alias long greg_t;
@ -999,10 +1009,81 @@ else version (Solaris)
enum _NGREG = 19;
alias int greg_t;
}
else
static assert(0, "unimplemented");
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
{
@ -1063,6 +1144,9 @@ else version (Solaris)
u_fp_reg_set fp_reg_set;
}
}
else
static assert(0, "unimplemented");
struct mcontext_t
{
gregset_t gregs;