Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit a0ad8c4

Browse files
ibuclawdlang-bot
authored andcommitted
Issue 22689: core.sys.posix.ucontext: Separate OS-specific types from C runtime functions
1 parent f32d477 commit a0ad8c4

File tree

1 file changed

+5
-317
lines changed

1 file changed

+5
-317
lines changed

src/core/sys/posix/ucontext.d

Lines changed: 5 additions & 317 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,8 @@ struct ucontext_t
6363
}
6464
*/
6565

66-
version (CRuntime_Glibc)
66+
version (linux)
6767
{
68-
6968
version (X86_64)
7069
{
7170
enum
@@ -146,7 +145,8 @@ version (CRuntime_Glibc)
146145
mcontext_t uc_mcontext;
147146
sigset_t uc_sigmask;
148147
_libc_fpstate __fpregs_mem;
149-
ulong[4] __ssp;
148+
version (CRuntime_Glibc)
149+
ulong[4] __ssp;
150150
}
151151
}
152152
else version (X86)
@@ -218,7 +218,8 @@ version (CRuntime_Glibc)
218218
mcontext_t uc_mcontext;
219219
sigset_t uc_sigmask;
220220
_libc_fpstate __fpregs_mem;
221-
c_ulong[4] __ssp;
221+
version (CRuntime_Glibc)
222+
c_ulong[4] __ssp;
222223
}
223224
}
224225
else version (HPPA)
@@ -788,139 +789,6 @@ version (CRuntime_Glibc)
788789
else
789790
static assert(0, "unimplemented");
790791
}
791-
else version (CRuntime_Musl)
792-
{
793-
version (AArch64)
794-
{
795-
struct mcontext_t
796-
{
797-
real[18+256] __regs;
798-
}
799-
800-
struct ucontext_t
801-
{
802-
c_ulong uc_flags;
803-
ucontext_t* uc_link;
804-
stack_t uc_stack;
805-
sigset_t uc_sigmask;
806-
mcontext_t uc_mcontext;
807-
}
808-
}
809-
else version (ARM)
810-
{
811-
struct mcontext_t
812-
{
813-
c_ulong[21] __regs;
814-
}
815-
816-
struct ucontext_t
817-
{
818-
c_ulong uc_flags;
819-
ucontext_t* uc_link;
820-
stack_t uc_stack;
821-
mcontext_t uc_mcontext;
822-
sigset_t uc_sigmask;
823-
ulong[64] uc_regspace;
824-
}
825-
}
826-
else version (IBMZ_Any)
827-
{
828-
struct mcontext_t
829-
{
830-
c_ulong[18] __regs1;
831-
uint[18] __regs2;
832-
double[16] __regs3;
833-
}
834-
835-
struct ucontext_t
836-
{
837-
c_ulong uc_flags;
838-
ucontext_t* uc_link;
839-
stack_t uc_stack;
840-
mcontext_t uc_mcontext;
841-
sigset_t uc_sigmask;
842-
}
843-
}
844-
else version (MIPS_Any)
845-
{
846-
version (MIPS_N32)
847-
{
848-
struct mcontext_t
849-
{
850-
ulong[32] __mc1;
851-
double[32] __mc2;
852-
ulong[9] __mc3;
853-
uint[4] __mc4;
854-
}
855-
}
856-
else version (MIPS64)
857-
{
858-
struct mcontext_t
859-
{
860-
ulong[32] __mc1;
861-
double[32] __mc2;
862-
ulong[9] __mc3;
863-
uint[4] __mc4;
864-
}
865-
}
866-
else
867-
{
868-
struct mcontext_t
869-
{
870-
uint[2] __mc1;
871-
ulong[65] __mc2;
872-
uint[5] __mc3;
873-
ulong[2] __mc4;
874-
uint[6] __mc5;
875-
}
876-
}
877-
878-
struct ucontext_t
879-
{
880-
c_ulong uc_flags;
881-
ucontext_t* uc_link;
882-
stack_t uc_stack;
883-
mcontext_t uc_mcontext;
884-
sigset_t uc_sigmask;
885-
}
886-
}
887-
else version (X86)
888-
{
889-
struct mcontext_t
890-
{
891-
uint[22] __space;
892-
}
893-
894-
struct ucontext_t
895-
{
896-
c_ulong uc_flags;
897-
ucontext_t* uc_link;
898-
stack_t uc_stack;
899-
mcontext_t uc_mcontext;
900-
sigset_t uc_sigmask;
901-
c_ulong[28] __fpregs_mem;
902-
}
903-
}
904-
else version (X86_64)
905-
{
906-
struct mcontext_t
907-
{
908-
ulong[32] __space;
909-
}
910-
911-
struct ucontext_t
912-
{
913-
c_ulong uc_flags;
914-
ucontext_t* uc_link;
915-
stack_t uc_stack;
916-
mcontext_t uc_mcontext;
917-
sigset_t uc_sigmask;
918-
ulong[64] __fpregs_mem;
919-
}
920-
}
921-
else
922-
static assert(0, "unimplemented");
923-
}
924792
else version (Darwin)
925793
{
926794
private
@@ -1722,186 +1590,6 @@ else version (Solaris)
17221590
}
17231591
}
17241592
}
1725-
else version (CRuntime_UClibc)
1726-
{
1727-
version (X86_64)
1728-
{
1729-
enum
1730-
{
1731-
REG_R8 = 0,
1732-
REG_R9,
1733-
REG_R10,
1734-
REG_R11,
1735-
REG_R12,
1736-
REG_R13,
1737-
REG_R14,
1738-
REG_R15,
1739-
REG_RDI,
1740-
REG_RSI,
1741-
REG_RBP,
1742-
REG_RBX,
1743-
REG_RDX,
1744-
REG_RAX,
1745-
REG_RCX,
1746-
REG_RSP,
1747-
REG_RIP,
1748-
REG_EFL,
1749-
REG_CSGSFS, /* Actually short cs, gs, fs, __pad0. */
1750-
REG_ERR,
1751-
REG_TRAPNO,
1752-
REG_OLDMASK,
1753-
REG_CR2
1754-
}
1755-
1756-
alias sigcontext mcontext_t;
1757-
1758-
struct ucontext_t
1759-
{
1760-
c_ulong uc_flags;
1761-
ucontext_t* uc_link;
1762-
stack_t uc_stack;
1763-
mcontext_t uc_mcontext;
1764-
sigset_t uc_sigmask;
1765-
}
1766-
}
1767-
else version (MIPS32)
1768-
{
1769-
alias greg_t = ulong;
1770-
enum NGREG = 32;
1771-
enum NFPREG = 32;
1772-
alias gregset_t = greg_t[NGREG];
1773-
1774-
struct fpregset_t
1775-
{
1776-
union fp_r
1777-
{
1778-
double[NFPREG] fp_dregs;
1779-
struct _fp_fregs
1780-
{
1781-
float _fp_fregs;
1782-
uint _fp_pad;
1783-
}
1784-
_fp_fregs[NFPREG] fp_fregs;
1785-
}
1786-
}
1787-
1788-
version (MIPS_O32)
1789-
{
1790-
struct mcontext_t
1791-
{
1792-
uint regmask;
1793-
uint status;
1794-
greg_t pc;
1795-
gregset_t gregs;
1796-
fpregset_t fpregs;
1797-
uint fp_owned;
1798-
uint fpc_csr;
1799-
uint fpc_eir;
1800-
uint used_math;
1801-
uint dsp;
1802-
greg_t mdhi;
1803-
greg_t mdlo;
1804-
c_ulong hi1;
1805-
c_ulong lo1;
1806-
c_ulong hi2;
1807-
c_ulong lo2;
1808-
c_ulong hi3;
1809-
c_ulong lo3;
1810-
}
1811-
}
1812-
else
1813-
{
1814-
struct mcontext_t
1815-
{
1816-
gregset_t gregs;
1817-
fpregset_t fpregs;
1818-
greg_t mdhi;
1819-
greg_t hi1;
1820-
greg_t hi2;
1821-
greg_t hi3;
1822-
greg_t mdlo;
1823-
greg_t lo1;
1824-
greg_t lo2;
1825-
greg_t lo3;
1826-
greg_t pc;
1827-
uint fpc_csr;
1828-
uint used_math;
1829-
uint dsp;
1830-
uint reserved;
1831-
}
1832-
}
1833-
1834-
struct ucontext_t
1835-
{
1836-
c_ulong uc_flags;
1837-
ucontext_t* uc_link;
1838-
stack_t uc_stack;
1839-
mcontext_t uc_mcontext;
1840-
sigset_t uc_sigmask;
1841-
}
1842-
}
1843-
else version (ARM)
1844-
{
1845-
enum
1846-
{
1847-
R0 = 0,
1848-
R1 = 1,
1849-
R2 = 2,
1850-
R3 = 3,
1851-
R4 = 4,
1852-
R5 = 5,
1853-
R6 = 6,
1854-
R7 = 7,
1855-
R8 = 8,
1856-
R9 = 9,
1857-
R10 = 10,
1858-
R11 = 11,
1859-
R12 = 12,
1860-
R13 = 13,
1861-
R14 = 14,
1862-
R15 = 15
1863-
}
1864-
1865-
struct sigcontext
1866-
{
1867-
c_ulong trap_no;
1868-
c_ulong error_code;
1869-
c_ulong oldmask;
1870-
c_ulong arm_r0;
1871-
c_ulong arm_r1;
1872-
c_ulong arm_r2;
1873-
c_ulong arm_r3;
1874-
c_ulong arm_r4;
1875-
c_ulong arm_r5;
1876-
c_ulong arm_r6;
1877-
c_ulong arm_r7;
1878-
c_ulong arm_r8;
1879-
c_ulong arm_r9;
1880-
c_ulong arm_r10;
1881-
c_ulong arm_fp;
1882-
c_ulong arm_ip;
1883-
c_ulong arm_sp;
1884-
c_ulong arm_lr;
1885-
c_ulong arm_pc;
1886-
c_ulong arm_cpsr;
1887-
c_ulong fault_address;
1888-
}
1889-
1890-
alias sigcontext mcontext_t;
1891-
1892-
struct ucontext_t
1893-
{
1894-
c_ulong uc_flags;
1895-
ucontext_t* uc_link;
1896-
stack_t uc_stack;
1897-
mcontext_t uc_mcontext;
1898-
sigset_t uc_sigmask;
1899-
align(8) c_ulong[128] uc_regspace;
1900-
}
1901-
}
1902-
else
1903-
static assert(0, "unimplemented");
1904-
}
19051593

19061594
//
19071595
// Obsolescent (OB)

0 commit comments

Comments
 (0)