From patchwork Sun Dec 9 23:49:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1010188 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-491976-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gdcproject.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="mKfgi12O"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43CjcY4bbqz9s5c for ; Mon, 10 Dec 2018 10:50:03 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:cc:content-type; q=dns; s=default; b=sWs262EF/h1nf4vEoJU4zblgYt89Ujq3RKZqjZ5wlkm vanA7bhUcZS/120iyXZef/AJAWG3dV3B+6KglY8vAy2ZFXz2/dDmW+urz10cXwT2 SPR/CQ58l/yqg5Hu1qAPkKTeRAp/x3b8ssixjxQIJw8e8PqEm5XIeHGqqfb4s6ks = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:cc:content-type; s=default; bh=JtjWe8yyfGAh8Xp8l9pvlNB09yM=; b=mKfgi12O6NSm9DyDC /sn0U9+7Zm3GGQRTg5ZEFAVEYcRi+d5xIzzNFHeRyP5waSAatIrlsqz141aNjBsl VnrW+ydjiXkAmEEyzFiyxLdXTmamkYTt37omFDawZDwfOF65JFdZ4SVK00oPayBk 8zFQzXP45nN9BjKy7/gBpFwNH4= Received: (qmail 118074 invoked by alias); 9 Dec 2018 23:49:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 117974 invoked by uid 89); 9 Dec 2018 23:49:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Operation, 0x20, bindings X-HELO: mail-qt1-f176.google.com Received: from mail-qt1-f176.google.com (HELO mail-qt1-f176.google.com) (209.85.160.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 09 Dec 2018 23:49:47 +0000 Received: by mail-qt1-f176.google.com with SMTP id z16so10478063qtq.4 for ; Sun, 09 Dec 2018 15:49:47 -0800 (PST) MIME-Version: 1.0 From: Iain Buclaw Date: Mon, 10 Dec 2018 00:49:34 +0100 Message-ID: Subject: [PATCH, libphobos] Committed added druntime bindings for sparc/solaris To: gcc-patches Cc: ro@cebitec.uni-bielefeld.de X-IsSubscribed: yes Hi, This patch is backported from druntime master, adding initial libdruntime bindings support for SPARC/Solaris. Though I suspect there's still plenty that's been missed out. Bootstrapped and tested on x86_64-linux-gnu, not that it checks anything except all changes are properly scoped. Committed to trunk as r266935. diff --git a/libphobos/libdruntime/core/stdc/fenv.d b/libphobos/libdruntime/core/stdc/fenv.d index 00b99af97a2..abfdcde5330 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 372152ab063..99bd0b3475b 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 964b77cc50d..9e7d6436e7e 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;