extern int sys_cxipc(long, long, long);
#if FEATURE(POSIX)
extern int sys_posixcall(stack_frame_t*);
-/* extern void _sig_hwint_deliver(const int); */
-#define _sig_hwint_deliver(foo)
+extern void _sig_hwint_deliver(const int);
#endif /* FEATURE(POSIX) */
static const char *_exc_name[] = {
#include <debug.h>
#include <string.h>
+int sys_sigaction(stack_frame_t*);
+
int sys_exit(int status)
{
process_t *proc;
ret_val = sys_outb(stk);
break;
+ case SYS_SIGACTION:
+ ret_val = sys_sigaction(stk);
+ break;
+
#if FEATURE(DEBUG_SYSDEBUG)
case SYS_DEBUG:
ret_val = sys_debug((const char*)stk->ebx, (u32_t)stk->ecx);
return((void*)proc->p_sighandler[signal]);
}
+
+void _process_hwint_deliver(pid_t pid, int irq)
+{
+ process_t *proc;
+
+ proc = process_lookup(pid);
+
+ if(proc) {
+ process_signal_deliver(proc, SIGHWINT);
+ }
+
+ return;
+}
--- /dev/null
+#include <config.h>
+#include <corax/types.h>
+#include <corax/errno.h>
+#include <arch.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <process.h>
+
+struct intq {
+ pid_t handlers[CONFIG_IRQ_QLEN];
+};
+
+struct intq _int_q[32];
+
+void _process_hwint_deliver(pid_t, int);
+
+void _sig_hwint_deliver(const int irq)
+{
+ struct intq *q;
+ int i;
+
+ /* make sure we don't make invalid accesses to _int_q */
+ if(irq < 1 || irq >= (sizeof(_int_q) / sizeof(_int_q[0]))) {
+ return;
+ }
+
+ q = &(_int_q[irq]);
+
+ for(i = 0; i < (sizeof(q->handlers) / sizeof(q->handlers[0])); i++) {
+
+ /* we're at the end of the queue if the entry is invalid */
+ if(q->handlers[i] <= 0) {
+ break;
+ }
+
+ /* deliver hardware interrupt to process */
+ _process_hwint_deliver(q->handlers[i], irq);
+ }
+
+ return;
+}
+
+int sys_sigaction(stack_frame_t *stk)
+{
+ int signum;
+ struct sigaction new;
+ struct sigaction *old;
+ process_t *cproc;
+ int ret_val;
+
+ cproc = process_get_current();
+
+ /* get the user-provided data */
+ signum = (int)stk->ebx;
+ old = (struct sigaction*)stk->edx;
+ process_memcpy_ptok(cproc, &new, (void*)stk->ecx, sizeof(new));
+
+ switch(signum) {
+ case SIGHWINT:
+ /* this is the Corax way to notify processes about hardware interrupts */
+
+ ret_val = 0;
+ break;
+
+ /* filter signals the user is not supposed to override */
+ default:
+ case SIGHUP:
+ case SIGINT:
+ case SIGQUIT:
+ case SIGILL:
+ case SIGTRAP:
+ case SIGABRT:
+ case SIGBUS:
+ case SIGFPE:
+ case SIGKILL:
+ case SIGUSR1:
+ case SIGSEGV:
+ case SIGUSR2:
+ case SIGPIPE:
+ case SIGALRM:
+ case SIGTERM:
+ case SIGSTKFLT:
+ case SIGCHLD:
+ case SIGCONT:
+ case SIGSTOP:
+ case SIGTSTP:
+ case SIGTTIN:
+ case SIGTTOU:
+ case SIGURG:
+ case SIGXCPU:
+ case SIGXFSZ:
+ case SIGVTALRM:
+ case SIGPROF:
+ case SIGWINCH:
+ case SIGIO:
+ case SIGPWR:
+ case SIGSYS:
+ ret_val = -EINVAL;
+ break;
+ }
+
+ return(ret_val);
+}