--- coroutine/universal/Context.h.orig	2022-02-18 17:42:25.000000000 +0800
+++ coroutine/universal/Context.h	2022-05-08 08:00:38.000000000 +0800
@@ -6,8 +6,10 @@
 # include "coroutine/amd64/Context.h"
 #elif defined __i386__
 # include "coroutine/x86/Context.h"
+#elif defined __ppc__
+# include "coroutine/ppc/Context.h"
 #elif defined __ppc64__
-# include "coroutine/ppc64le/Context.h"
+# include "coroutine/ppc64/Context.h"
 #elif defined __arm64__
 # include "coroutine/arm64/Context.h"
 #else

--- coroutine/universal/Context.S.orig	2022-02-18 17:42:25.000000000 +0800
+++ coroutine/universal/Context.S	2022-05-08 08:01:11.000000000 +0800
@@ -3,8 +3,10 @@
 # include "coroutine/amd64/Context.S"
 #elif defined __i386__
 # include "coroutine/x86/Context.S"
+#elif defined __ppc__
+# include "coroutine/ppc/Context.S"
 #elif defined __ppc64__
-# include "coroutine/ppc64le/Context.S"
+# include "coroutine/ppc64/Context.S"
 #elif defined __arm64__
 # include "coroutine/arm64/Context.S"
 #else

--- coroutine/ppc/Context.h.orig	2022-02-18 17:42:25.000000000 +0800
+++ coroutine/ppc/Context.h	2022-05-16 03:31:40.000000000 +0800
@@ -1,5 +1,5 @@
-#ifndef COROUTINE_PPC64LE_CONTEXT_H
-#define COROUTINE_PPC64LE_CONTEXT_H 1
+#ifndef COROUTINE_PPC_CONTEXT_H
+#define COROUTINE_PPC_CONTEXT_H 1
 
 #pragma once
 
@@ -12,7 +12,7 @@
 
 enum {
   COROUTINE_REGISTERS =
-  19  /* 18 general purpose registers (r14-r31) and 1 return address */
+  20  /* 19 general purpose registers (r13–r31) and 1 return address */
   + 4  /* space for fiber_entry() to store the link register */
 };
 
@@ -44,7 +44,7 @@
     memset(context->stack_pointer, 0, sizeof(void*) * COROUTINE_REGISTERS);
 
     /* Skip a global prologue that sets the TOC register */
-    context->stack_pointer[18] = ((char*)start) + 8;
+    context->stack_pointer[19] = ((char*)start) + 8;
 }
 
 struct coroutine_context * coroutine_transfer(struct coroutine_context * current, struct coroutine_context * target);
@@ -54,4 +54,4 @@
     context->stack_pointer = NULL;
 }
 
-#endif /* COROUTINE_PPC64LE_CONTEXT_H */
+#endif /* COROUTINE_PPC_CONTEXT_H */

--- coroutine/ppc/Context.S.orig	2022-02-18 17:42:25.000000000 +0800
+++ coroutine/ppc/Context.S	2022-05-16 03:09:49.000000000 +0800
@@ -5,71 +5,69 @@
 .align 2
 
 .globl PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer)
-.type   PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer), @function
 PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer):
 	# Make space on the stack for caller registers
-	addi 1,1,-152
+	addi r1,r1,-80
 
 	# Save caller registers
-	std 14,0(1)
-	std 15,8(1)
-	std 16,16(1)
-	std 17,24(1)
-	std 18,32(1)
-	std 19,40(1)
-	std 20,48(1)
-	std 21,56(1)
-	std 22,64(1)
-	std 23,72(1)
-	std 24,80(1)
-	std 25,88(1)
-	std 26,96(1)
-	std 27,104(1)
-	std 28,112(1)
-	std 29,120(1)
-	std 30,128(1)
-	std 31,136(1)
+	stw r13,0(r1)
+	stw r14,4(r1)
+	stw r15,8(r1)
+	stw r16,12(r1)
+	stw r17,16(r1)
+	stw r18,20(r1)
+	stw r19,24(r1)
+	stw r20,28(r1)
+	stw r21,32(r1)
+	stw r22,36(r1)
+	stw r23,40(r1)
+	stw r24,44(r1)
+	stw r25,48(r1)
+	stw r26,52(r1)
+	stw r27,56(r1)
+	stw r28,60(r1)
+	stw r29,64(r1)
+	stw r30,68(r1)
+	stw r31,72(r1)
 
 	# Save return address
-	mflr 0
-	std 0,144(1)
+	mflr r0
+	stw r0,76(r1)
 
 	# Save stack pointer to first argument
-	std 1,0(3)
+	stw r1,0(r3)
 
 	# Load stack pointer from second argument
-	ld 1,0(4)
+	lwz r1,0(r4)
 
 	# Restore caller registers
-	ld 14,0(1)
-	ld 15,8(1)
-	ld 16,16(1)
-	ld 17,24(1)
-	ld 18,32(1)
-	ld 19,40(1)
-	ld 20,48(1)
-	ld 21,56(1)
-	ld 22,64(1)
-	ld 23,72(1)
-	ld 24,80(1)
-	ld 25,88(1)
-	ld 26,96(1)
-	ld 27,104(1)
-	ld 28,112(1)
-	ld 29,120(1)
-	ld 30,128(1)
-	ld 31,136(1)
+	lwz r13,0(r1)
+	lwz r14,4(r1)
+	lwz r15,8(r1)
+	lwz r16,12(r1)
+	lwz r17,16(r1)
+	lwz r18,20(r1)
+	lwz r19,24(r1)
+	lwz r20,28(r1)
+	lwz r21,32(r1)
+	lwz r22,36(r1)
+	lwz r23,40(r1)
+	lwz r24,44(r1)
+	lwz r25,48(r1)
+	lwz r26,52(r1)
+	lwz r27,56(r1)
+	lwz r28,60(r1)
+	lwz r29,64(r1)
+	lwz r30,68(r1)
+	lwz r31,72(r1)
 
 	# Load return address
-	ld 0,144(1)
-	mtlr 0
+	lwz r0,76(r1)
+	mtlr r0
 
 	# Pop stack frame
-	addi 1,1,152
+	addi r1,r1,80
 
 	# Jump to return address
 	blr
 
-#if defined(__linux__) && defined(__ELF__)
-.section .note.GNU-stack,"",%progbits
-#endif

--- coroutine/ppc64/Context.h.orig	2022-02-18 17:42:25.000000000 +0800
+++ coroutine/ppc64/Context.h	2022-05-08 06:42:30.000000000 +0800
@@ -1,5 +1,5 @@
-#ifndef COROUTINE_PPC64LE_CONTEXT_H
-#define COROUTINE_PPC64LE_CONTEXT_H 1
+#ifndef COROUTINE_PPC64_CONTEXT_H
+#define COROUTINE_PPC64_CONTEXT_H 1
 
 #pragma once
 
@@ -12,7 +12,7 @@
 
 enum {
   COROUTINE_REGISTERS =
-  19  /* 18 general purpose registers (r14-r31) and 1 return address */
+  19  /* 18 general purpose registers (r14–r31) and 1 return address */
   + 4  /* space for fiber_entry() to store the link register */
 };
 
@@ -54,4 +54,4 @@
     context->stack_pointer = NULL;
 }
 
-#endif /* COROUTINE_PPC64LE_CONTEXT_H */
+#endif /* COROUTINE_PPC64_CONTEXT_H */


--- coroutine/ppc64/Context.S.orig	2022-02-18 17:42:25.000000000 +0800
+++ coroutine/ppc64/Context.S	2022-05-08 06:40:54.000000000 +0800
@@ -2,74 +2,69 @@
 #define PREFIXED_SYMBOL(prefix,name) TOKEN_PASTE(prefix,name)
 
 .text
-.align 2
+.align 3
 
 .globl PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer)
-.type   PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer), @function
 PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer):
 	# Make space on the stack for caller registers
-	addi 1,1,-152
+	addi r1,r1,-152
 
 	# Save caller registers
-	std 14,0(1)
-	std 15,8(1)
-	std 16,16(1)
-	std 17,24(1)
-	std 18,32(1)
-	std 19,40(1)
-	std 20,48(1)
-	std 21,56(1)
-	std 22,64(1)
-	std 23,72(1)
-	std 24,80(1)
-	std 25,88(1)
-	std 26,96(1)
-	std 27,104(1)
-	std 28,112(1)
-	std 29,120(1)
-	std 30,128(1)
-	std 31,136(1)
+	std r14,0(r1)
+	std r15,8(r1)
+	std r16,16(r1)
+	std r17,24(r1)
+	std r18,32(r1)
+	std r19,40(r1)
+	std r20,48(r1)
+	std r21,56(r1)
+	std r22,64(r1)
+	std r23,72(r1)
+	std r24,80(r1)
+	std r25,88(r1)
+	std r26,96(r1)
+	std r27,104(r1)
+	std r28,112(r1)
+	std r29,120(r1)
+	std r30,128(r1)
+	std r31,136(r1)
 
 	# Save return address
-	mflr 0
-	std 0,144(1)
+	mflr r0
+	std r0,144(r1)
 
 	# Save stack pointer to first argument
-	std 1,0(3)
+	std r1,0(r3)
 
 	# Load stack pointer from second argument
-	ld 1,0(4)
+	ld r1,0(r4)
 
 	# Restore caller registers
-	ld 14,0(1)
-	ld 15,8(1)
-	ld 16,16(1)
-	ld 17,24(1)
-	ld 18,32(1)
-	ld 19,40(1)
-	ld 20,48(1)
-	ld 21,56(1)
-	ld 22,64(1)
-	ld 23,72(1)
-	ld 24,80(1)
-	ld 25,88(1)
-	ld 26,96(1)
-	ld 27,104(1)
-	ld 28,112(1)
-	ld 29,120(1)
-	ld 30,128(1)
-	ld 31,136(1)
+	ld r14,0(r1)
+	ld r15,8(r1)
+	ld r16,16(r1)
+	ld r17,24(r1)
+	ld r18,32(r1)
+	ld r19,40(r1)
+	ld r20,48(r1)
+	ld r21,56(r1)
+	ld r22,64(r1)
+	ld r23,72(r1)
+	ld r24,80(r1)
+	ld r25,88(r1)
+	ld r26,96(r1)
+	ld r27,104(r1)
+	ld r28,112(r1)
+	ld r29,120(r1)
+	ld r30,128(r1)
+	ld r31,136(r1)
 
 	# Load return address
-	ld 0,144(1)
-	mtlr 0
+	ld r0,144(r1)
+	mtlr r0
 
 	# Pop stack frame
-	addi 1,1,152
+	addi r1,r1,152
 
 	# Jump to return address
 	blr
-
-#if defined(__linux__) && defined(__ELF__)
-.section .note.GNU-stack,"",%progbits
-#endif
