Skip to content
Snippets Groups Projects
Commit aa96ed2c authored by Raymond Toy's avatar Raymond Toy
Browse files

Get rid of more compiler warnings on Linux by making HANDLER_ARGS

match the sa_sigaction argument types.  Adjust code appropriately to
use os_context_t appropriately too.
parent 746b693f
No related branches found
No related tags found
No related merge requests found
......@@ -406,18 +406,19 @@ sigsegv_handler_tramp(void)
void
sigsegv_handler(HANDLER_ARGS)
{
int fault_addr = context->uc_mcontext.cr2;
os_context_t *os_context = (os_context_t *) context;
int fault_addr = os_context->uc_mcontext.cr2;
#ifdef RED_ZONE_HIT
if (os_control_stack_overflow((void *) fault_addr, context))
if (os_control_stack_overflow((void *) fault_addr, os_context))
return;
#endif
if (gc_write_barrier(code->si_addr))
return;
#if defined(__x86_64)
DPRINTF(0, (stderr, "sigsegv: rip: %p\n", context->uc_mcontext.gregs[REG_RIP]));
DPRINTF(0, (stderr, "sigsegv: rip: %p\n", os_context->uc_mcontext.gregs[REG_RIP]));
#else
DPRINTF(0, (stderr, "sigsegv: eip: %x\n", context->uc_mcontext.gregs[REG_EIP]));
DPRINTF(0, (stderr, "sigsegv: eip: %x\n", os_context->uc_mcontext.gregs[REG_EIP]));
#endif
#ifdef RED_ZONE_HIT
......@@ -427,13 +428,13 @@ sigsegv_handler(HANDLER_ARGS)
to the other stack. */
tramp_signal = signal;
tramp_code = *code;
tramp_context = *context;
SC_PC(context) = (unsigned long) sigsegv_handler_tramp;
tramp_context = *os_context;
SC_PC(os_context) = (unsigned long) sigsegv_handler_tramp;
return;
}
#endif
sigsegv_handle_now(signal, code, context);
sigsegv_handle_now(signal, code, os_context);
}
#else
static void
......
......@@ -44,7 +44,7 @@ typedef int os_vm_prot_t; /* like hpux */
void restore_fpu(ucontext_t *);
#define HANDLER_ARGS int signal, siginfo_t *code, ucontext_t *context
#define HANDLER_ARGS int signal, siginfo_t *code, void *context
#define CODE(code) ((code) ? code->si_code : 0)
#define RESTORE_FPU(context) restore_fpu(context)
......
......@@ -406,7 +406,7 @@ interrupt_install_low_level_handler(int signal, void handler(HANDLER_ARGS))
{
struct sigaction sa;
sa.sa_sigaction = handler;
sa.sa_sigaction = (void (*)(HANDLER_ARGS)) handler;
sigemptyset(&sa.sa_mask);
FILLBLOCKSET(&sa.sa_mask);
sa.sa_flags = SA_RESTART | SA_SIGINFO;
......@@ -461,12 +461,12 @@ install_handler(int signal, void handler(HANDLER_ARGS))
if (interrupt_low_level_handlers[signal] == 0) {
if (handler == (void (*)(HANDLER_ARGS)) SIG_DFL
|| handler == (void (*)(HANDLER_ARGS)) SIG_IGN)
sa.sa_sigaction = handler;
sa.sa_sigaction = (void (*)(HANDLER_ARGS)) handler;
else if (sigismember(&new, signal))
sa.sa_sigaction = maybe_now_maybe_later;
sa.sa_sigaction = (void (*)(HANDLER_ARGS)) maybe_now_maybe_later;
else
sa.sa_sigaction = interrupt_handle_now_handler;
sa.sa_sigaction = (void (*)(HANDLER_ARGS)) interrupt_handle_now_handler;
sigemptyset(&sa.sa_mask);
FILLBLOCKSET(&sa.sa_mask);
sa.sa_flags = SA_SIGINFO | SA_RESTART;
......
......@@ -278,11 +278,11 @@ void
sigtrap_handler(HANDLER_ARGS)
{
unsigned int trap;
os_context_t* os_context = (os_context_t *) context;
#if 0
fprintf(stderr, "x86sigtrap: %8x %x\n",
SC_PC(context), *(unsigned char *) (SC_PC(context) - 1));
fprintf(stderr, "sigtrap(%d %d %x)\n", signal, CODE(code), context);
SC_PC(os_os_context), *(unsigned char *) (SC_PC(os_context) - 1));
fprintf(stderr, "sigtrap(%d %d %x)\n", signal, CODE(code), os_context);
#endif
if (single_stepping && (signal == SIGTRAP)) {
......@@ -292,7 +292,7 @@ sigtrap_handler(HANDLER_ARGS)
#ifdef SC_EFLAGS
/* Disable single-stepping */
SC_EFLAGS(context) ^= 0x100;
SC_EFLAGS(os_context) ^= 0x100;
#else
/* Un-install single step helper instructions. */
*(single_stepping - 3) = single_step_save1;
......@@ -304,7 +304,7 @@ sigtrap_handler(HANDLER_ARGS)
/*
* Re-install the breakpoint if possible.
*/
if ((int) SC_PC(context) == (int) single_stepping + 1)
if ((int) SC_PC(os_context) == (int) single_stepping + 1)
fprintf(stderr, "* Breakpoint not re-install\n");
else {
char *ptr = (char *) single_stepping;
......@@ -318,9 +318,9 @@ sigtrap_handler(HANDLER_ARGS)
}
/* This is just for info in case monitor wants to print an approx */
current_control_stack_pointer = (unsigned long *) SC_SP(context);
current_control_stack_pointer = (unsigned long *) SC_SP(os_context);
RESTORE_FPU(context);
RESTORE_FPU(os_context);
/*
* On entry %eip points just after the INT3 byte and aims at the
......@@ -329,13 +329,13 @@ sigtrap_handler(HANDLER_ARGS)
* arguments to follow.
*/
trap = *(unsigned char *) SC_PC(context);
trap = *(unsigned char *) SC_PC(os_context);
switch (trap) {
case trap_PendingInterrupt:
DPRINTF(0, (stderr, "<trap Pending Interrupt.>\n"));
arch_skip_instruction(context);
interrupt_handle_pending(context);
arch_skip_instruction(os_context);
interrupt_handle_pending(os_context);
break;
case trap_Halt:
......@@ -345,59 +345,59 @@ sigtrap_handler(HANDLER_ARGS)
fpu_save(fpu_state);
#endif
fake_foreign_function_call(context);
fake_foreign_function_call(os_context);
lose("%%primitive halt called; the party is over.\n");
undo_fake_foreign_function_call(context);
undo_fake_foreign_function_call(os_context);
#ifndef __linux__
fpu_restore(fpu_state);
#endif
arch_skip_instruction(context);
arch_skip_instruction(os_context);
break;
}
case trap_Error:
case trap_Cerror:
DPRINTF(0, (stderr, "<trap Error %x>\n", CODE(code)));
interrupt_internal_error(signal, code, context, CODE(code) == trap_Cerror);
interrupt_internal_error(signal, code, os_context, CODE(code) == trap_Cerror);
break;
case trap_Breakpoint:
#if 0
fprintf(stderr, "*C break\n");
#endif
SC_PC(context) -= 1;
SC_PC(os_context) -= 1;
handle_breakpoint(signal, CODE(code), context);
handle_breakpoint(signal, CODE(code), os_context);
#if 0
fprintf(stderr, "*C break return\n");
#endif
break;
case trap_FunctionEndBreakpoint:
SC_PC(context) -= 1;
SC_PC(context) =
(int) handle_function_end_breakpoint(signal, CODE(code), context);
SC_PC(os_context) -= 1;
SC_PC(os_context) =
(int) handle_function_end_breakpoint(signal, CODE(code), os_context);
break;
#ifdef trap_DynamicSpaceOverflowWarning
case trap_DynamicSpaceOverflowWarning:
interrupt_handle_space_overflow(SymbolFunction
(DYNAMIC_SPACE_OVERFLOW_WARNING_HIT),
context);
os_context);
break;
#endif
#ifdef trap_DynamicSpaceOverflowError
case trap_DynamicSpaceOverflowError:
interrupt_handle_space_overflow(SymbolFunction
(DYNAMIC_SPACE_OVERFLOW_ERROR_HIT),
context);
os_context);
break;
#endif
default:
DPRINTF(0,
(stderr, "[C--trap default %d %d %p]\n", signal, CODE(code),
context));
interrupt_handle_now(signal, code, context);
os_context));
interrupt_handle_now(signal, code, os_context);
break;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment