/** Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de.* Distributed under the terms of the MIT License.*/#include <asm_defs.h>#include <commpage_defs.h>#include "asm_offsets.h"#include "syscall_numbers.h"/*! \fn void x86_signal_frame_function_beos(signal_frame_data* frameData)\brief Wrapper function for BeOS-style signal handler functions.\param frameData The signal frame data.*/FUNCTION(x86_signal_frame_function_beos):// set up a stack framepush %ebpmov %esp, %ebp// Move our parameter to %esi, so we can conveniently work with it. Note// that we're free to use non-scratch registers without saving them, since// we don't have any caller to save them for. The caller will restore the// interrupted environment anyway.mov 8(%ebp), %esi// push the parameters for the handler function// make space for the vregs parameterlea -VREGS_sizeof(%esp), %espmov %esp, %edi// copy the vregs via memcpy()pushl $VREGS_sizeoflea SIGNAL_FRAME_DATA_context + UCONTEXT_T_uc_mcontext(%esi), %eaxpush %eaxpush %edimovl SIGNAL_FRAME_DATA_commpage_address(%esi), %eaxaddl 4 * COMMPAGE_ENTRY_X86_MEMCPY(%eax), %eaxcall *%eaxaddl $12, %esp// the vregs are on the stack -- push user data and signal numbermovl SIGNAL_FRAME_DATA_user_data(%esi), %eaxpush %eaxmovl SIGNAL_FRAME_DATA_info+SIGINFO_T_si_signo(%esi), %eaxpush %eax// call the signal handlermovl SIGNAL_FRAME_DATA_handler(%esi), %eaxcall *%eaxaddl $8, %esp // pop only signal number and user data arguments// copy the vregs back to the frameData structurepushl $VREGS_sizeofpush %edilea SIGNAL_FRAME_DATA_context + UCONTEXT_T_uc_mcontext(%esi), %eaxpush %eaxmovl SIGNAL_FRAME_DATA_commpage_address(%esi), %eaxaddl 4 * COMMPAGE_ENTRY_X86_MEMCPY(%eax), %eaxcall *%eaxaddl $12 + VREGS_sizeof, %esp// call the _kern_restore_signal_frame() syscall -- does not return (here)pushl %esipushl $0 // dummy return valuemovl $SYSCALL_RESTORE_SIGNAL_FRAME, %eaxint $99// never gets hereFUNCTION_END(x86_signal_frame_function_beos)