public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/iains/heads/d-for-darwin)] D, Darwin, PPC : Implement thread interfaces.
@ 2020-12-13 17:44 Iain D Sandoe
0 siblings, 0 replies; 7+ messages in thread
From: Iain D Sandoe @ 2020-12-13 17:44 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:6adbab09ad2bc89ca2608d7bdda483f03c1c2b94
commit 6adbab09ad2bc89ca2608d7bdda483f03c1c2b94
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Fri Dec 11 00:55:38 2020 +0000
D, Darwin, PPC : Implement thread interfaces.
This provides the implementation for the threads and fibres
interfaces for PowerPC Darwin (32 and 64 bit).
Diff:
---
libphobos/libdruntime/core/thread.d | 140 +++++++++++++++++++++++++++++++++++-
1 file changed, 137 insertions(+), 3 deletions(-)
diff --git a/libphobos/libdruntime/core/thread.d b/libphobos/libdruntime/core/thread.d
index 98b781eb945..9927430444d 100644
--- a/libphobos/libdruntime/core/thread.d
+++ b/libphobos/libdruntime/core/thread.d
@@ -26,6 +26,11 @@ else version (TVOS)
version = Darwin;
else version (WatchOS)
version = Darwin;
+version (Darwin)
+{
+ version (PPC) version = Darwin_AnyPPC;
+ version (PPC64) version = Darwin_AnyPPC;
+}
private
{
@@ -1669,6 +1674,17 @@ private:
ulong[16] m_reg; // rdi,rsi,rbp,rsp,rbx,rdx,rcx,rax
// r8,r9,r10,r11,r12,r13,r14,r15
}
+ else version (PPC)
+ {
+ // Make the assumption that we only care about non-fp and non-vr regs.
+ // ??? : it seems plausible that a valid address can be copied into a VR.
+ uint[32] m_reg; // r0-31
+ }
+ else version (PPC64)
+ {
+ // As above.
+ ulong[32] m_reg; // r0-31
+ }
else
{
static assert(false, "Architecture not supported." );
@@ -2468,6 +2484,63 @@ body
regs[0] = cast(void*)®s[0];
fn (regs[0]);
}
+ else version (PPC)
+ {
+ void*[20] regs = void;
+ asm pure nothrow @nogc
+ {
+ "stw r13, %0" : "=m" (regs[ 1]);
+ "stw r14, %0" : "=m" (regs[ 2]);
+ "stw r15, %0" : "=m" (regs[ 3]);
+ "stw r16, %0" : "=m" (regs[ 4]);
+ "stw r17, %0" : "=m" (regs[ 5]);
+ "stw r18, %0" : "=m" (regs[ 6]);
+ "stw r19, %0" : "=m" (regs[ 7]);
+ "stw r20, %0" : "=m" (regs[ 8]);
+ "stw r21, %0" : "=m" (regs[ 9]);
+ "stw r22, %0" : "=m" (regs[10]);
+ "stw r23, %0" : "=m" (regs[11]);
+ "stw r24, %0" : "=m" (regs[12]);
+ "stw r25, %0" : "=m" (regs[13]);
+ "stw r26, %0" : "=m" (regs[14]);
+ "stw r27, %0" : "=m" (regs[15]);
+ "stw r28, %0" : "=m" (regs[16]);
+ "stw r29, %0" : "=m" (regs[17]);
+ "stw r30, %0" : "=m" (regs[18]);
+ "stw r31, %0" : "=m" (regs[19]);
+ }
+ regs[0] = cast(void*)®s[0];
+ fn(regs[0]);
+ }
+ else version (PPC64)
+ {
+ void*[20] regs = void;
+ asm pure nothrow @nogc
+ {
+ "std r13, %0" : "=m" (regs[ 1]);
+ "std r14, %0" : "=m" (regs[ 2]);
+ "std r15, %0" : "=m" (regs[ 3]);
+ "std r16, %0" : "=m" (regs[ 4]);
+ "std r17, %0" : "=m" (regs[ 5]);
+ "std r18, %0" : "=m" (regs[ 6]);
+ "std r19, %0" : "=m" (regs[ 7]);
+ "std r20, %0" : "=m" (regs[ 8]);
+ "std r21, %0" : "=m" (regs[ 9]);
+ "std r22, %0" : "=m" (regs[10]);
+ "std r23, %0" : "=m" (regs[11]);
+ "std r24, %0" : "=m" (regs[12]);
+ "std r25, %0" : "=m" (regs[13]);
+ "std r26, %0" : "=m" (regs[14]);
+ "std r27, %0" : "=m" (regs[15]);
+ "std r28, %0" : "=m" (regs[16]);
+ "std r29, %0" : "=m" (regs[17]);
+ "std r30, %0" : "=m" (regs[18]);
+ "std r31, %0" : "=m" (regs[19]);
+ }
+ regs[0] = cast(void*)®s[0];
+ fn(regs[0]);
+ }
+ else static assert(false, "Darwin Architecture not supported.");
}
else
{
@@ -2695,6 +2768,28 @@ private bool suspend( Thread t ) nothrow
t.m_reg[14] = state.r14;
t.m_reg[15] = state.r15;
}
+ else version (PPC)
+ {
+ ppc_thread_state_t state = void;
+ mach_msg_type_number_t count = PPC_THREAD_STATE_COUNT;
+
+ if ( thread_get_state( t.m_tmach, PPC_THREAD_STATE, &state, &count ) != KERN_SUCCESS )
+ onThreadError( "Unable to load thread state" );
+ if ( !t.m_lock )
+ t.m_curr.tstack = cast(void*) state.r[1];
+ t.m_reg[] = state.r[];
+ }
+ else version (PPC64)
+ {
+ ppc_thread_state64_t state = void;
+ mach_msg_type_number_t count = PPC_THREAD_STATE64_COUNT;
+
+ if ( thread_get_state( t.m_tmach, PPC_THREAD_STATE64, &state, &count ) != KERN_SUCCESS )
+ onThreadError( "Unable to load thread state" );
+ if ( !t.m_lock )
+ t.m_curr.tstack = cast(void*) state.r[1];
+ t.m_reg[] = state.r[];
+ }
else
{
static assert(false, "Architecture not supported." );
@@ -3639,7 +3734,8 @@ private
}
else version (X86)
{
- version = AlignFiberStackTo16Byte;
+ version (Darwin)
+ version = AlignFiberStackTo16Byte;
version (CET)
{
@@ -3691,7 +3787,12 @@ private
}
else version (PPC)
{
- version (Posix)
+ version (Darwin)
+ {
+ version = AlignFiberStackTo16Byte;
+ version = AsmPPC_External_Darwin;
+ }
+ else version (Posix)
{
version = AsmPPC_Posix;
version = AsmExternal;
@@ -3699,9 +3800,15 @@ private
}
else version (PPC64)
{
- version (Posix)
+ version (Darwin)
{
version = AlignFiberStackTo16Byte;
+ version = AsmPPC_External_Darwin;
+ }
+ else version (Posix)
+ {
+ version = AsmPPC64_Posix;
+ version = AlignFiberStackTo16Byte;
}
}
else version (MIPS_O32)
@@ -3747,6 +3854,7 @@ private
version (AsmX86_Posix) {} else
version (AsmX86_64_Windows) {} else
version (AsmX86_64_Posix) {} else
+ version (AsmPPC_External_Darwin) {} else
version (AsmExternal) {} else
{
// NOTE: The ucontext implementation requires architecture specific
@@ -3826,6 +3934,10 @@ private
version (AArch64)
extern (C) void fiber_trampoline() nothrow;
}
+ else version (AsmPPC_External_Darwin)
+ {
+ extern (C) void fiber_switchContext( void** oldp, void* newp ) nothrow @nogc;
+ }
else
extern (C) void fiber_switchContext( void** oldp, void* newp ) nothrow @nogc
{
@@ -5051,6 +5163,28 @@ private:
assert( (cast(size_t) pstack & 0x0f) == 0 );
}
+ else version (AsmPPC_External_Darwin)
+ {
+ version (StackGrowsDown) {}
+ else static assert(false, "PowerPC Darwin only supports decrementing stacks");
+
+ uint wsize = size_t.sizeof;
+
+ // linkage + regs + FPRs + VRs
+ uint space = 8 * wsize + 20 * wsize + 18 * 8 + 12 * 16;
+ (cast(ubyte*)pstack - space)[0 .. space] = 0;
+
+ pstack -= wsize * 6;
+ *cast(size_t*)pstack = cast(size_t) &fiber_entryPoint; // LR
+ pstack -= wsize * 22;
+
+ // On Darwin PPC64 pthread self is in R13 (which is reserved).
+ // At present, it is not safe to migrate fibres between threads, but if that
+ // changes, then updating the value of R13 will also need to be handled.
+ version (PPC64)
+ *cast(size_t*)(pstack + wsize) = cast(size_t) Thread.getThis().m_addr;
+ assert( (cast(size_t) pstack & 0x0f) == 0 );
+ }
else version (AsmMIPS_O32_Posix)
{
version (StackGrowsDown) {}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gcc(refs/users/iains/heads/d-for-darwin)] D, Darwin, PPC : Implement thread interfaces.
@ 2020-12-21 20:38 Iain D Sandoe
0 siblings, 0 replies; 7+ messages in thread
From: Iain D Sandoe @ 2020-12-21 20:38 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a9b0c26c5531e3029642b063ea6e346143a285cb
commit a9b0c26c5531e3029642b063ea6e346143a285cb
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Fri Dec 11 00:55:38 2020 +0000
D, Darwin, PPC : Implement thread interfaces.
This provides the implementation for the threads and fibres
interfaces for PowerPC Darwin (32 and 64 bit).
Diff:
---
libphobos/libdruntime/core/thread.d | 140 +++++++++++++++++++++++++++++++++++-
1 file changed, 137 insertions(+), 3 deletions(-)
diff --git a/libphobos/libdruntime/core/thread.d b/libphobos/libdruntime/core/thread.d
index 98b781eb945..9927430444d 100644
--- a/libphobos/libdruntime/core/thread.d
+++ b/libphobos/libdruntime/core/thread.d
@@ -26,6 +26,11 @@ else version (TVOS)
version = Darwin;
else version (WatchOS)
version = Darwin;
+version (Darwin)
+{
+ version (PPC) version = Darwin_AnyPPC;
+ version (PPC64) version = Darwin_AnyPPC;
+}
private
{
@@ -1669,6 +1674,17 @@ private:
ulong[16] m_reg; // rdi,rsi,rbp,rsp,rbx,rdx,rcx,rax
// r8,r9,r10,r11,r12,r13,r14,r15
}
+ else version (PPC)
+ {
+ // Make the assumption that we only care about non-fp and non-vr regs.
+ // ??? : it seems plausible that a valid address can be copied into a VR.
+ uint[32] m_reg; // r0-31
+ }
+ else version (PPC64)
+ {
+ // As above.
+ ulong[32] m_reg; // r0-31
+ }
else
{
static assert(false, "Architecture not supported." );
@@ -2468,6 +2484,63 @@ body
regs[0] = cast(void*)®s[0];
fn (regs[0]);
}
+ else version (PPC)
+ {
+ void*[20] regs = void;
+ asm pure nothrow @nogc
+ {
+ "stw r13, %0" : "=m" (regs[ 1]);
+ "stw r14, %0" : "=m" (regs[ 2]);
+ "stw r15, %0" : "=m" (regs[ 3]);
+ "stw r16, %0" : "=m" (regs[ 4]);
+ "stw r17, %0" : "=m" (regs[ 5]);
+ "stw r18, %0" : "=m" (regs[ 6]);
+ "stw r19, %0" : "=m" (regs[ 7]);
+ "stw r20, %0" : "=m" (regs[ 8]);
+ "stw r21, %0" : "=m" (regs[ 9]);
+ "stw r22, %0" : "=m" (regs[10]);
+ "stw r23, %0" : "=m" (regs[11]);
+ "stw r24, %0" : "=m" (regs[12]);
+ "stw r25, %0" : "=m" (regs[13]);
+ "stw r26, %0" : "=m" (regs[14]);
+ "stw r27, %0" : "=m" (regs[15]);
+ "stw r28, %0" : "=m" (regs[16]);
+ "stw r29, %0" : "=m" (regs[17]);
+ "stw r30, %0" : "=m" (regs[18]);
+ "stw r31, %0" : "=m" (regs[19]);
+ }
+ regs[0] = cast(void*)®s[0];
+ fn(regs[0]);
+ }
+ else version (PPC64)
+ {
+ void*[20] regs = void;
+ asm pure nothrow @nogc
+ {
+ "std r13, %0" : "=m" (regs[ 1]);
+ "std r14, %0" : "=m" (regs[ 2]);
+ "std r15, %0" : "=m" (regs[ 3]);
+ "std r16, %0" : "=m" (regs[ 4]);
+ "std r17, %0" : "=m" (regs[ 5]);
+ "std r18, %0" : "=m" (regs[ 6]);
+ "std r19, %0" : "=m" (regs[ 7]);
+ "std r20, %0" : "=m" (regs[ 8]);
+ "std r21, %0" : "=m" (regs[ 9]);
+ "std r22, %0" : "=m" (regs[10]);
+ "std r23, %0" : "=m" (regs[11]);
+ "std r24, %0" : "=m" (regs[12]);
+ "std r25, %0" : "=m" (regs[13]);
+ "std r26, %0" : "=m" (regs[14]);
+ "std r27, %0" : "=m" (regs[15]);
+ "std r28, %0" : "=m" (regs[16]);
+ "std r29, %0" : "=m" (regs[17]);
+ "std r30, %0" : "=m" (regs[18]);
+ "std r31, %0" : "=m" (regs[19]);
+ }
+ regs[0] = cast(void*)®s[0];
+ fn(regs[0]);
+ }
+ else static assert(false, "Darwin Architecture not supported.");
}
else
{
@@ -2695,6 +2768,28 @@ private bool suspend( Thread t ) nothrow
t.m_reg[14] = state.r14;
t.m_reg[15] = state.r15;
}
+ else version (PPC)
+ {
+ ppc_thread_state_t state = void;
+ mach_msg_type_number_t count = PPC_THREAD_STATE_COUNT;
+
+ if ( thread_get_state( t.m_tmach, PPC_THREAD_STATE, &state, &count ) != KERN_SUCCESS )
+ onThreadError( "Unable to load thread state" );
+ if ( !t.m_lock )
+ t.m_curr.tstack = cast(void*) state.r[1];
+ t.m_reg[] = state.r[];
+ }
+ else version (PPC64)
+ {
+ ppc_thread_state64_t state = void;
+ mach_msg_type_number_t count = PPC_THREAD_STATE64_COUNT;
+
+ if ( thread_get_state( t.m_tmach, PPC_THREAD_STATE64, &state, &count ) != KERN_SUCCESS )
+ onThreadError( "Unable to load thread state" );
+ if ( !t.m_lock )
+ t.m_curr.tstack = cast(void*) state.r[1];
+ t.m_reg[] = state.r[];
+ }
else
{
static assert(false, "Architecture not supported." );
@@ -3639,7 +3734,8 @@ private
}
else version (X86)
{
- version = AlignFiberStackTo16Byte;
+ version (Darwin)
+ version = AlignFiberStackTo16Byte;
version (CET)
{
@@ -3691,7 +3787,12 @@ private
}
else version (PPC)
{
- version (Posix)
+ version (Darwin)
+ {
+ version = AlignFiberStackTo16Byte;
+ version = AsmPPC_External_Darwin;
+ }
+ else version (Posix)
{
version = AsmPPC_Posix;
version = AsmExternal;
@@ -3699,9 +3800,15 @@ private
}
else version (PPC64)
{
- version (Posix)
+ version (Darwin)
{
version = AlignFiberStackTo16Byte;
+ version = AsmPPC_External_Darwin;
+ }
+ else version (Posix)
+ {
+ version = AsmPPC64_Posix;
+ version = AlignFiberStackTo16Byte;
}
}
else version (MIPS_O32)
@@ -3747,6 +3854,7 @@ private
version (AsmX86_Posix) {} else
version (AsmX86_64_Windows) {} else
version (AsmX86_64_Posix) {} else
+ version (AsmPPC_External_Darwin) {} else
version (AsmExternal) {} else
{
// NOTE: The ucontext implementation requires architecture specific
@@ -3826,6 +3934,10 @@ private
version (AArch64)
extern (C) void fiber_trampoline() nothrow;
}
+ else version (AsmPPC_External_Darwin)
+ {
+ extern (C) void fiber_switchContext( void** oldp, void* newp ) nothrow @nogc;
+ }
else
extern (C) void fiber_switchContext( void** oldp, void* newp ) nothrow @nogc
{
@@ -5051,6 +5163,28 @@ private:
assert( (cast(size_t) pstack & 0x0f) == 0 );
}
+ else version (AsmPPC_External_Darwin)
+ {
+ version (StackGrowsDown) {}
+ else static assert(false, "PowerPC Darwin only supports decrementing stacks");
+
+ uint wsize = size_t.sizeof;
+
+ // linkage + regs + FPRs + VRs
+ uint space = 8 * wsize + 20 * wsize + 18 * 8 + 12 * 16;
+ (cast(ubyte*)pstack - space)[0 .. space] = 0;
+
+ pstack -= wsize * 6;
+ *cast(size_t*)pstack = cast(size_t) &fiber_entryPoint; // LR
+ pstack -= wsize * 22;
+
+ // On Darwin PPC64 pthread self is in R13 (which is reserved).
+ // At present, it is not safe to migrate fibres between threads, but if that
+ // changes, then updating the value of R13 will also need to be handled.
+ version (PPC64)
+ *cast(size_t*)(pstack + wsize) = cast(size_t) Thread.getThis().m_addr;
+ assert( (cast(size_t) pstack & 0x0f) == 0 );
+ }
else version (AsmMIPS_O32_Posix)
{
version (StackGrowsDown) {}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gcc(refs/users/iains/heads/d-for-darwin)] D, Darwin, PPC : Implement thread interfaces.
@ 2021-01-11 21:27 Iain D Sandoe
0 siblings, 0 replies; 7+ messages in thread
From: Iain D Sandoe @ 2021-01-11 21:27 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:17215a929ad539435d2c27550bad44d9e65ca07b
commit 17215a929ad539435d2c27550bad44d9e65ca07b
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Fri Dec 11 00:55:38 2020 +0000
D, Darwin, PPC : Implement thread interfaces.
This provides the implementation for the threads and fibres
interfaces for PowerPC Darwin (32 and 64 bit).
Diff:
---
libphobos/libdruntime/core/thread.d | 140 +++++++++++++++++++++++++++++++++++-
1 file changed, 137 insertions(+), 3 deletions(-)
diff --git a/libphobos/libdruntime/core/thread.d b/libphobos/libdruntime/core/thread.d
index 98b781eb945..9927430444d 100644
--- a/libphobos/libdruntime/core/thread.d
+++ b/libphobos/libdruntime/core/thread.d
@@ -26,6 +26,11 @@ else version (TVOS)
version = Darwin;
else version (WatchOS)
version = Darwin;
+version (Darwin)
+{
+ version (PPC) version = Darwin_AnyPPC;
+ version (PPC64) version = Darwin_AnyPPC;
+}
private
{
@@ -1669,6 +1674,17 @@ private:
ulong[16] m_reg; // rdi,rsi,rbp,rsp,rbx,rdx,rcx,rax
// r8,r9,r10,r11,r12,r13,r14,r15
}
+ else version (PPC)
+ {
+ // Make the assumption that we only care about non-fp and non-vr regs.
+ // ??? : it seems plausible that a valid address can be copied into a VR.
+ uint[32] m_reg; // r0-31
+ }
+ else version (PPC64)
+ {
+ // As above.
+ ulong[32] m_reg; // r0-31
+ }
else
{
static assert(false, "Architecture not supported." );
@@ -2468,6 +2484,63 @@ body
regs[0] = cast(void*)®s[0];
fn (regs[0]);
}
+ else version (PPC)
+ {
+ void*[20] regs = void;
+ asm pure nothrow @nogc
+ {
+ "stw r13, %0" : "=m" (regs[ 1]);
+ "stw r14, %0" : "=m" (regs[ 2]);
+ "stw r15, %0" : "=m" (regs[ 3]);
+ "stw r16, %0" : "=m" (regs[ 4]);
+ "stw r17, %0" : "=m" (regs[ 5]);
+ "stw r18, %0" : "=m" (regs[ 6]);
+ "stw r19, %0" : "=m" (regs[ 7]);
+ "stw r20, %0" : "=m" (regs[ 8]);
+ "stw r21, %0" : "=m" (regs[ 9]);
+ "stw r22, %0" : "=m" (regs[10]);
+ "stw r23, %0" : "=m" (regs[11]);
+ "stw r24, %0" : "=m" (regs[12]);
+ "stw r25, %0" : "=m" (regs[13]);
+ "stw r26, %0" : "=m" (regs[14]);
+ "stw r27, %0" : "=m" (regs[15]);
+ "stw r28, %0" : "=m" (regs[16]);
+ "stw r29, %0" : "=m" (regs[17]);
+ "stw r30, %0" : "=m" (regs[18]);
+ "stw r31, %0" : "=m" (regs[19]);
+ }
+ regs[0] = cast(void*)®s[0];
+ fn(regs[0]);
+ }
+ else version (PPC64)
+ {
+ void*[20] regs = void;
+ asm pure nothrow @nogc
+ {
+ "std r13, %0" : "=m" (regs[ 1]);
+ "std r14, %0" : "=m" (regs[ 2]);
+ "std r15, %0" : "=m" (regs[ 3]);
+ "std r16, %0" : "=m" (regs[ 4]);
+ "std r17, %0" : "=m" (regs[ 5]);
+ "std r18, %0" : "=m" (regs[ 6]);
+ "std r19, %0" : "=m" (regs[ 7]);
+ "std r20, %0" : "=m" (regs[ 8]);
+ "std r21, %0" : "=m" (regs[ 9]);
+ "std r22, %0" : "=m" (regs[10]);
+ "std r23, %0" : "=m" (regs[11]);
+ "std r24, %0" : "=m" (regs[12]);
+ "std r25, %0" : "=m" (regs[13]);
+ "std r26, %0" : "=m" (regs[14]);
+ "std r27, %0" : "=m" (regs[15]);
+ "std r28, %0" : "=m" (regs[16]);
+ "std r29, %0" : "=m" (regs[17]);
+ "std r30, %0" : "=m" (regs[18]);
+ "std r31, %0" : "=m" (regs[19]);
+ }
+ regs[0] = cast(void*)®s[0];
+ fn(regs[0]);
+ }
+ else static assert(false, "Darwin Architecture not supported.");
}
else
{
@@ -2695,6 +2768,28 @@ private bool suspend( Thread t ) nothrow
t.m_reg[14] = state.r14;
t.m_reg[15] = state.r15;
}
+ else version (PPC)
+ {
+ ppc_thread_state_t state = void;
+ mach_msg_type_number_t count = PPC_THREAD_STATE_COUNT;
+
+ if ( thread_get_state( t.m_tmach, PPC_THREAD_STATE, &state, &count ) != KERN_SUCCESS )
+ onThreadError( "Unable to load thread state" );
+ if ( !t.m_lock )
+ t.m_curr.tstack = cast(void*) state.r[1];
+ t.m_reg[] = state.r[];
+ }
+ else version (PPC64)
+ {
+ ppc_thread_state64_t state = void;
+ mach_msg_type_number_t count = PPC_THREAD_STATE64_COUNT;
+
+ if ( thread_get_state( t.m_tmach, PPC_THREAD_STATE64, &state, &count ) != KERN_SUCCESS )
+ onThreadError( "Unable to load thread state" );
+ if ( !t.m_lock )
+ t.m_curr.tstack = cast(void*) state.r[1];
+ t.m_reg[] = state.r[];
+ }
else
{
static assert(false, "Architecture not supported." );
@@ -3639,7 +3734,8 @@ private
}
else version (X86)
{
- version = AlignFiberStackTo16Byte;
+ version (Darwin)
+ version = AlignFiberStackTo16Byte;
version (CET)
{
@@ -3691,7 +3787,12 @@ private
}
else version (PPC)
{
- version (Posix)
+ version (Darwin)
+ {
+ version = AlignFiberStackTo16Byte;
+ version = AsmPPC_External_Darwin;
+ }
+ else version (Posix)
{
version = AsmPPC_Posix;
version = AsmExternal;
@@ -3699,9 +3800,15 @@ private
}
else version (PPC64)
{
- version (Posix)
+ version (Darwin)
{
version = AlignFiberStackTo16Byte;
+ version = AsmPPC_External_Darwin;
+ }
+ else version (Posix)
+ {
+ version = AsmPPC64_Posix;
+ version = AlignFiberStackTo16Byte;
}
}
else version (MIPS_O32)
@@ -3747,6 +3854,7 @@ private
version (AsmX86_Posix) {} else
version (AsmX86_64_Windows) {} else
version (AsmX86_64_Posix) {} else
+ version (AsmPPC_External_Darwin) {} else
version (AsmExternal) {} else
{
// NOTE: The ucontext implementation requires architecture specific
@@ -3826,6 +3934,10 @@ private
version (AArch64)
extern (C) void fiber_trampoline() nothrow;
}
+ else version (AsmPPC_External_Darwin)
+ {
+ extern (C) void fiber_switchContext( void** oldp, void* newp ) nothrow @nogc;
+ }
else
extern (C) void fiber_switchContext( void** oldp, void* newp ) nothrow @nogc
{
@@ -5051,6 +5163,28 @@ private:
assert( (cast(size_t) pstack & 0x0f) == 0 );
}
+ else version (AsmPPC_External_Darwin)
+ {
+ version (StackGrowsDown) {}
+ else static assert(false, "PowerPC Darwin only supports decrementing stacks");
+
+ uint wsize = size_t.sizeof;
+
+ // linkage + regs + FPRs + VRs
+ uint space = 8 * wsize + 20 * wsize + 18 * 8 + 12 * 16;
+ (cast(ubyte*)pstack - space)[0 .. space] = 0;
+
+ pstack -= wsize * 6;
+ *cast(size_t*)pstack = cast(size_t) &fiber_entryPoint; // LR
+ pstack -= wsize * 22;
+
+ // On Darwin PPC64 pthread self is in R13 (which is reserved).
+ // At present, it is not safe to migrate fibres between threads, but if that
+ // changes, then updating the value of R13 will also need to be handled.
+ version (PPC64)
+ *cast(size_t*)(pstack + wsize) = cast(size_t) Thread.getThis().m_addr;
+ assert( (cast(size_t) pstack & 0x0f) == 0 );
+ }
else version (AsmMIPS_O32_Posix)
{
version (StackGrowsDown) {}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gcc(refs/users/iains/heads/d-for-darwin)] D, Darwin, PPC : Implement thread interfaces.
@ 2021-10-11 20:35 Iain D Sandoe
0 siblings, 0 replies; 7+ messages in thread
From: Iain D Sandoe @ 2021-10-11 20:35 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e55830a8903f43cdebf3d67bb7ba10fcde8b8963
commit e55830a8903f43cdebf3d67bb7ba10fcde8b8963
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Fri Dec 11 00:55:38 2020 +0000
D, Darwin, PPC : Implement thread interfaces.
This provides the implementation for the threads and fibres
interfaces for PowerPC Darwin (32 and 64 bit).
Diff:
---
libphobos/libdruntime/core/thread/fiber.d | 1 +
libphobos/libdruntime/core/thread/osthread.d | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/libphobos/libdruntime/core/thread/fiber.d b/libphobos/libdruntime/core/thread/fiber.d
index 4ae0d033be1..b61bc065c9c 100644
--- a/libphobos/libdruntime/core/thread/fiber.d
+++ b/libphobos/libdruntime/core/thread/fiber.d
@@ -147,6 +147,7 @@ private
}
else version (Posix)
{
+ version = AsmPPC64_Posix;
version = AlignFiberStackTo16Byte;
}
}
diff --git a/libphobos/libdruntime/core/thread/osthread.d b/libphobos/libdruntime/core/thread/osthread.d
index 9fcd30e50fb..9fe791dbe96 100644
--- a/libphobos/libdruntime/core/thread/osthread.d
+++ b/libphobos/libdruntime/core/thread/osthread.d
@@ -37,6 +37,11 @@ else version (TVOS)
version = Darwin;
else version (WatchOS)
version = Darwin;
+version (Darwin)
+{
+ version (PPC) version = Darwin_AnyPPC;
+ version (PPC64) version = Darwin_AnyPPC;
+}
version (Shared)
version (GNU)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gcc(refs/users/iains/heads/d-for-darwin)] D, Darwin, PPC : Implement thread interfaces.
@ 2021-10-13 8:31 Iain D Sandoe
0 siblings, 0 replies; 7+ messages in thread
From: Iain D Sandoe @ 2021-10-13 8:31 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:0b4ba3707d6ef4fc5f0eb8d973cef1b429b3b1f0
commit 0b4ba3707d6ef4fc5f0eb8d973cef1b429b3b1f0
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Fri Dec 11 00:55:38 2020 +0000
D, Darwin, PPC : Implement thread interfaces.
This provides the implementation for the threads and fibres
interfaces for PowerPC Darwin (32 and 64 bit).
Diff:
---
libphobos/libdruntime/core/thread/fiber.d | 1 +
libphobos/libdruntime/core/thread/osthread.d | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/libphobos/libdruntime/core/thread/fiber.d b/libphobos/libdruntime/core/thread/fiber.d
index 4ae0d033be1..b61bc065c9c 100644
--- a/libphobos/libdruntime/core/thread/fiber.d
+++ b/libphobos/libdruntime/core/thread/fiber.d
@@ -147,6 +147,7 @@ private
}
else version (Posix)
{
+ version = AsmPPC64_Posix;
version = AlignFiberStackTo16Byte;
}
}
diff --git a/libphobos/libdruntime/core/thread/osthread.d b/libphobos/libdruntime/core/thread/osthread.d
index 9fcd30e50fb..9fe791dbe96 100644
--- a/libphobos/libdruntime/core/thread/osthread.d
+++ b/libphobos/libdruntime/core/thread/osthread.d
@@ -37,6 +37,11 @@ else version (TVOS)
version = Darwin;
else version (WatchOS)
version = Darwin;
+version (Darwin)
+{
+ version (PPC) version = Darwin_AnyPPC;
+ version (PPC64) version = Darwin_AnyPPC;
+}
version (Shared)
version (GNU)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gcc(refs/users/iains/heads/d-for-darwin)] D, Darwin, PPC : Implement thread interfaces.
@ 2021-10-15 19:34 Iain D Sandoe
0 siblings, 0 replies; 7+ messages in thread
From: Iain D Sandoe @ 2021-10-15 19:34 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:9b9b5f5748259ae5d5df6b8d91bf173fc13864d5
commit 9b9b5f5748259ae5d5df6b8d91bf173fc13864d5
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Fri Dec 11 00:55:38 2020 +0000
D, Darwin, PPC : Implement thread interfaces.
This provides the implementation for the threads and fibres
interfaces for PowerPC Darwin (32 and 64 bit).
Diff:
---
libphobos/libdruntime/core/thread/fiber.d | 1 +
libphobos/libdruntime/core/thread/osthread.d | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/libphobos/libdruntime/core/thread/fiber.d b/libphobos/libdruntime/core/thread/fiber.d
index 4ae0d033be1..b61bc065c9c 100644
--- a/libphobos/libdruntime/core/thread/fiber.d
+++ b/libphobos/libdruntime/core/thread/fiber.d
@@ -147,6 +147,7 @@ private
}
else version (Posix)
{
+ version = AsmPPC64_Posix;
version = AlignFiberStackTo16Byte;
}
}
diff --git a/libphobos/libdruntime/core/thread/osthread.d b/libphobos/libdruntime/core/thread/osthread.d
index 9fcd30e50fb..9fe791dbe96 100644
--- a/libphobos/libdruntime/core/thread/osthread.d
+++ b/libphobos/libdruntime/core/thread/osthread.d
@@ -37,6 +37,11 @@ else version (TVOS)
version = Darwin;
else version (WatchOS)
version = Darwin;
+version (Darwin)
+{
+ version (PPC) version = Darwin_AnyPPC;
+ version (PPC64) version = Darwin_AnyPPC;
+}
version (Shared)
version (GNU)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gcc(refs/users/iains/heads/d-for-darwin)] D, Darwin, PPC : Implement thread interfaces.
@ 2021-10-18 15:54 Iain D Sandoe
0 siblings, 0 replies; 7+ messages in thread
From: Iain D Sandoe @ 2021-10-18 15:54 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:45f4704ecd85db974c9626c3ed05cf8e944fb336
commit 45f4704ecd85db974c9626c3ed05cf8e944fb336
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Fri Dec 11 00:55:38 2020 +0000
D, Darwin, PPC : Implement thread interfaces.
This provides the implementation for the threads and fibres
interfaces for PowerPC Darwin (32 and 64 bit).
Diff:
---
libphobos/libdruntime/core/thread/fiber.d | 1 +
libphobos/libdruntime/core/thread/osthread.d | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/libphobos/libdruntime/core/thread/fiber.d b/libphobos/libdruntime/core/thread/fiber.d
index 4ae0d033be1..b61bc065c9c 100644
--- a/libphobos/libdruntime/core/thread/fiber.d
+++ b/libphobos/libdruntime/core/thread/fiber.d
@@ -147,6 +147,7 @@ private
}
else version (Posix)
{
+ version = AsmPPC64_Posix;
version = AlignFiberStackTo16Byte;
}
}
diff --git a/libphobos/libdruntime/core/thread/osthread.d b/libphobos/libdruntime/core/thread/osthread.d
index 9fcd30e50fb..9fe791dbe96 100644
--- a/libphobos/libdruntime/core/thread/osthread.d
+++ b/libphobos/libdruntime/core/thread/osthread.d
@@ -37,6 +37,11 @@ else version (TVOS)
version = Darwin;
else version (WatchOS)
version = Darwin;
+version (Darwin)
+{
+ version (PPC) version = Darwin_AnyPPC;
+ version (PPC64) version = Darwin_AnyPPC;
+}
version (Shared)
version (GNU)
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-10-18 15:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-13 17:44 [gcc(refs/users/iains/heads/d-for-darwin)] D, Darwin, PPC : Implement thread interfaces Iain D Sandoe
2020-12-21 20:38 Iain D Sandoe
2021-01-11 21:27 Iain D Sandoe
2021-10-11 20:35 Iain D Sandoe
2021-10-13 8:31 Iain D Sandoe
2021-10-15 19:34 Iain D Sandoe
2021-10-18 15:54 Iain D Sandoe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).