[ Home ]
SBCL Internals

The pages on this CLiki-driven site can be edited by anybody at any time. No warranty of any kind can therefore be made; any implied warranties of merchantability or fitness for a particular purpose are expressly disclaimed
[ Home ] [ Recent Changes ] [ About CLiki ] [ Text Formatting ]

Following Daniel Barlow's port to the Alpha, Christophe Rhodes saw a golden opportunity to learn about SPARC assembler, SBCL internals and programming signal handler?s in parallel. Current status: Merged with mainline SBCL, including Solaris support.

The SPARC port was initially targeted for SPARC/Linux. Currently, unresolved questions are:

SPARC/Linux and SA_SIGINFO signal handlers

SBCL uses SA_SIGINFO signal handlers as a way of getting hold of register contents and other important, but unportable, low-level stuff when GCing and at other exceptional moments. POSIX defines SA_SIGINFO-style signal handlers to have a prototype

void sigfoo_handler(int signo, siginfo_t *info, void *context)
where context is castable to a pointer to a ucontext_t.

SPARC Linux doesn't do this, instead it passes a pointer to a struct sigcontext as the context.

For further amusement, note that a sigcontext on SPARC only contains pointers to 19 registers; the SPARC has 32+epsilon (visible to any one procedure - actually, due to the register window architecture, it has 8 + 16 * NWINDOWS). Now, SBCL needs to know the locals and ins as well as the globals and outs, so it's important that we get at them somehow. Magically, CMUCL has in its SPARC assembly:

save_context:
  ta ST_FLUSH_WINDOWS
  ret
  nop
which makes the local and in registers of the caller visible though the saved stack pointer. This works by invoking a trap which flushes all the register windows onto the stack (in the spaces reserved for them by convention in each frame, see The SPARC Architecture Manual, Appendix D.2).

This page is linked from: Christophe Rhodes   CPU   Garbage Collection   Guard   index   tag bit   VOP  

CLiki pages can be edited by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively