1 #include "../includes/ghcconfig.h"
3 #if defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH)
4 #if !(defined(powerpc_HOST_ARCH) && defined(linux_HOST_OS))
5 /* The following code applies, with some differences,
6 to all powerpc platforms except for powerpc32-linux,
7 whose calling convention is annoyingly complex.
11 /* The code is "almost" the same for
14 #if defined(powerpc64_HOST_ARCH)
24 /* Some info about stack frame layout */
25 #define LINK_SLOT (2*WS)
26 #define LINKAGE_AREA_SIZE (6*WS)
28 /* The following defines mirror struct AdjustorStub
29 from Adjustor.c. Make sure to keep these in sync.
31 #if defined(powerpc_HOST_ARCH) && defined(darwin_HOST_OS)
32 #define HEADER_WORDS 6
33 #elif defined(powerpc64_HOST_ARCH) && defined(darwin_HOST_OS)
35 #define HEADER_WORDS 3
38 #define HPTR_OFF ((HEADER_WORDS )*WS)
39 #define WPTR_OFF ((HEADER_WORDS + 1)*WS)
40 #define FRAMESIZE_OFF ((HEADER_WORDS + 2)*WS)
41 #define EXTRA_WORDS_OFF ((HEADER_WORDS + 3)*WS)
43 /* Darwin insists on register names, everyone else prefers
45 #if !defined(darwin_HOST_OS)
66 #if LEADING_UNDERSCORE
71 /* Note that we don't build a function descriptor
72 for AIX-derived ABIs here. This will happen at runtime
77 /* On entry, r2 will point to the AdjustorStub data structure. */
81 STORE r0, LINK_SLOT(r1)
83 /* set up stack frame */
84 LOAD r12, FRAMESIZE_OFF(r2)
85 #ifdef powerpc64_HOST_ARCH
91 /* Save some regs so that we can use them.
92 Note that we use the "Red Zone" below the stack pointer.
100 LOAD r12, EXTRA_WORDS_OFF(r2)
104 LOAD r0, LINKAGE_AREA_SIZE + 8*WS(r30)
105 STORE r0, LINKAGE_AREA_SIZE + 10*WS(r31)
111 /* Restore r30 and r31 now.
116 STORE r10, LINKAGE_AREA_SIZE + 9*WS(r1)
117 STORE r9, LINKAGE_AREA_SIZE + 8*WS(r1)
125 LOAD r3, HPTR_OFF(r2)
127 LOAD r12, WPTR_OFF(r2)
128 #if defined(darwin_HOST_OS)
132 /* The function we're calling will never be a nested function,
133 so we don't load r11.
141 LOAD r0, LINK_SLOT(r1)