#include "gencgc.h"
#endif
\f
+
+#ifdef sparc
+int early_kernel = 0;
+#endif
void os_init(void)
{
/* Early versions of Linux don't support the mmap(..) functionality
{
struct utsname name;
int major_version;
+#ifdef sparc
+ int minor_version;
+#endif
uname(&name);
major_version = atoi(name.release);
if (major_version < 2) {
lose("linux major version=%d (can't run in version < 2.0.0)",
major_version);
}
+#ifdef sparc
+ /* KLUDGE: This will break if Linux moves to a uname() version number
+ * that has more than one digit initially -- CSR, 2002-02-12 */
+ minor_version = atoi(name.release+2);
+ if (minor_version < 4) {
+ fprintf(stderr,"linux minor version=%d;\n enabling workarounds for SPARC kernel bugs in signal handling.\n", minor_version);
+ early_kernel = 1;
+ }
+#endif
}
os_vm_page_size = getpagesize();
MAP_PRIVATE | MAP_FILE | MAP_FIXED,
fd, (off_t) offset);
- if(addr == MAP_FAILED) {
+ if (addr == MAP_FAILED) {
perror("mmap");
lose("unexpected mmap(..) failure");
}
void
sigsegv_handler(int signal, siginfo_t *info, void* void_context)
{
- os_context_t *context = (os_context_t*)void_context;
+ os_context_t *context = arch_os_get_context(&void_context);
void* fault_addr = (void*)context->uc_mcontext.cr2;
if (!gencgc_handle_wp_violation(fault_addr)) {
interrupt_handle_now(signal, info, void_context);
static void
sigsegv_handler(int signal, siginfo_t *info, void* void_context)
{
- os_context_t *context = (os_context_t*)void_context;
+ os_context_t *context = arch_os_get_context(&void_context);
os_vm_address_t addr;
#ifdef __i386__
addr = arch_get_bad_addr(signal,info,context);
- if(addr != NULL &&
+ if (addr != NULL &&
*os_context_register_addr(context,reg_ALLOC) & (1L<<63)){
/* This is the end of a pseudo-atomic section during which
* a signal was received. We must deal with the pending interrupt