aboutsummaryrefslogtreecommitdiff
path: root/libphobos
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gcc.gnu.org>2018-12-09 23:46:45 +0000
committerIain Buclaw <ibuclaw@gcc.gnu.org>2018-12-09 23:46:45 +0000
commit899b398116b48b9bcc8ab00f56a01569ddd2f554 (patch)
tree1c6ba8e797a8a063b2968d22fc5df9fbe425e310 /libphobos
parent54f397919ae47f9c2433be93fcc14288899beb8c (diff)
downloadgcc-899b398116b48b9bcc8ab00f56a01569ddd2f554.zip
gcc-899b398116b48b9bcc8ab00f56a01569ddd2f554.tar.gz
gcc-899b398116b48b9bcc8ab00f56a01569ddd2f554.tar.bz2
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
Diffstat (limited to 'libphobos')
-rw-r--r--libphobos/libdruntime/core/stdc/fenv.d48
-rw-r--r--libphobos/libdruntime/core/sys/posix/aio.d68
-rw-r--r--libphobos/libdruntime/core/sys/posix/ucontext.d88
3 files changed, 198 insertions, 6 deletions
diff --git a/libphobos/libdruntime/core/stdc/fenv.d b/libphobos/libdruntime/core/stdc/fenv.d
index 00b99af..abfdcde 100644
--- a/libphobos/libdruntime/core/stdc/fenv.d
+++ b/libphobos/libdruntime/core/stdc/fenv.d
@@ -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)
diff --git a/libphobos/libdruntime/core/sys/posix/aio.d b/libphobos/libdruntime/core/sys/posix/aio.d
index 372152a..99bd0b3 100644
--- a/libphobos/libdruntime/core/sys/posix/aio.d
+++ b/libphobos/libdruntime/core/sys/posix/aio.d
@@ -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
diff --git a/libphobos/libdruntime/core/sys/posix/ucontext.d b/libphobos/libdruntime/core/sys/posix/ucontext.d
index 964b77c..9e7d643 100644
--- a/libphobos/libdruntime/core/sys/posix/ucontext.d
+++ b/libphobos/libdruntime/core/sys/posix/ucontext.d
@@ -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;