Ticket #648: gcpatch.txt

File gcpatch.txt, 2.4 KB (added by rrauenza, 5 years ago)
Line 
1Index: src/gc/system.c
2===================================================================
3--- src/gc/system.c     (revision 38492)
4+++ src/gc/system.c     (working copy)
5@@ -93,6 +93,34 @@
6 
7 #elif defined(__ia64__)
8 
9+
10+#if defined(__hpux)
11+       /* This is untested, but should be functionally equivalent to the ia64
12+          code below, which must be IA64 Linux code?  It did not compile on HPUX. */
13+        ucontext_t ucp;
14+        void *current_regstore_top;
15+
16+        getcontext(&ucp);
17+        _Asm_flushrs();
18+
19+#if defined(_LP64)
20+        current_regstore_top = (void*)(uint64_t)_Asm_mov_from_ar(_AREG_BSP);
21+#else
22+        current_regstore_top = (void*)(uint32_t)_Asm_mov_from_ar(_AREG_BSP);
23+#endif
24+
25+        size_t base = 0;
26+        struct pst_vm_status buf;
27+        int i = 0;
28+
29+        while(pstat_getprocvm (&buf, sizeof(buf), 0, i++) == 1) {
30+           if (buf.pst_type == PS_RSESTACK) {
31+              base = (size_t)buf.pst_vaddr;
32+              break;
33+           }
34+        }
35+
36+#else /* is this code for ia64 linux?  This doesn't seem portable.  Is this better? http://www.mail-archive.com/guile-devel@gnu.org/msg01299.html */
37         /* On IA64 systems, we use the function getcontext() to get the current
38            processor context. This function is located in <ucontext.h>, included
39            above. */
40@@ -110,8 +138,13 @@
41            is separate from the normal system stack. The register backing
42            stack starts at memory address 0x80000FFF80000000 and ends at
43            current_regstore_top. */
44-        trace_mem_block(interp, 0x80000fff80000000,
45+        size_t base = 0x80000fff80000000;
46+
47+#endif
48+
49+        trace_mem_block(interp, base,
50                 (size_t)current_regstore_top);
51+
52 #else
53 
54 #  ifdef PARROT_HAS_HEADER_SETJMP
55Index: src/gc/gc_private.h
56===================================================================
57--- src/gc/gc_private.h (revision 38492)
58+++ src/gc/gc_private.h (working copy)
59@@ -29,8 +29,13 @@
60 extern void *flush_reg_store(void);
61 #  define BACKING_STORE_BASE 0x80000fff80000000
62 
63+#ifdef __hpux
64+#include <sys/pstat.h>
65+#include <ia64/sys/inline.h>
66 #endif
67 
68+#endif
69+
70 /* We're using this here to add an additional pointer to a PObj without
71    having to actually add an entire pointer to every PObj-alike structure
72    in Parrot. Astute observers may notice that if the PObj is comprised of