Raw instruction code on sparc64?

Mark Glines mark at glines.org
Tue Feb 3 16:25:03 UTC 2009


Hi,

There's some code at the top of trace_system_areas() in src/gc/system.c
to flush the register windows on sparc.  The code in question:

        /* Flush the register windows. For sparc systems, we use hand-coded
           assembly language to create a small function that flushes the
           register windows. Store the code in a union with a double to
           ensure proper memory alignment. */
        static union {
            unsigned int insns[4];
            double align_hack[2];
        } u = { {
#  ifdef __sparcv9
                            0x81580000, /* flushw */
#  else
                            0x91d02003, /* ta ST_FLUSH_WINDOWS */
#  endif
                            0x81c3e008, /* retl */
                            0x01000000  /* nop */
        } };

        /* Turn the array of machine code values above into a function
pointer.
           Call the new function pointer to flush the register windows. */
        static void (*fn_ptr)(void) = (void (*)(void))&u.align_hack[0];
        fn_ptr();




According to "svn blame", some of this code dates all the way back to
2002, so I'm not really sure who to ask.  We have reports of failed
builds on sparc64/openbsd (see Trac #271) which raised the question:
will this code work on sparc64?


More information about the parrot-dev mailing list