#include <arch/x86/interrupts.h>
#include <lunaix/clock.h>
#include <lunaix/mm/mm.h>
+#include <lunaix/signal.h>
#include <lunaix/timer.h>
#include <lunaix/types.h>
#include <stdint.h>
struct mm_region* regions;
};
+struct proc_sig
+{
+ void* signal_handler;
+ int sig_num;
+ isr_param prev_context;
+};
+
+#define PROC_SIG_SIZE sizeof(struct proc_sig) // size=84
+
struct proc_info
{
pid_t pid;
struct proc_info* parent;
- isr_param intr_ctx;
+ isr_param intr_ctx; // size=76
+ uintptr_t ustack_top;
struct llist_header siblings;
struct llist_header children;
+ struct llist_header grp_member;
struct proc_mm mm;
void* page_table;
time_t created;
uint8_t state;
int32_t exit_code;
int32_t k_status;
+ sigset_t sig_pending;
+ sigset_t sig_mask;
+ void* sig_handler[_SIG_NUM];
+ pid_t pgid;
struct lx_timer* timer;
};
#define __SYSCALL__exit 8
#define __SYSCALL_wait 9
#define __SYSCALL_waitpid 10
+#define __SYSCALL_sigreturn 11
+#define __SYSCALL_sigprocmask 12
+#define __SYSCALL_signal 13
+#define __SYSCALL_pause 14
#define __SYSCALL_MAX 0x100
void
syscall_install();
- static void*
- syscall(unsigned int callcode)
- {
- asm volatile("int %0" ::"i"(LUNAIX_SYS_CALL), "D"(callcode) : "eax");
- }
-
#define asmlinkage __attribute__((regparm(0)))
#define __PARAM_MAP1(t1, p1) t1 p1
asmlinkage rettype __lxsys_##name(__PARAM_MAP3(t1, p1, t2, p2, t3, p3))
#define __DEFINE_LXSYSCALL4(rettype, name, t1, p1, t2, p2, t3, p3, t4, p4) \
- asmlinkage rettype __lxsys_##nam( \
+ asmlinkage rettype __lxsys_##name( \
__PARAM_MAP4(t1, p1, t2, p2, t3, p3, t4, p4))
#define __LXSYSCALL(rettype, name) \
#include <arch/x86/interrupts.h>
#include <arch/x86/tss.h>
+
#include <hal/apic.h>
#include <hal/cpu.h>
+
#include <lunaix/mm/kalloc.h>
#include <lunaix/mm/vmm.h>
#include <lunaix/process.h>
#include <lunaix/sched.h>
-
+#include <lunaix/signal.h>
#include <lunaix/spike.h>
#include <lunaix/status.h>
#include <lunaix/syscall.h>
apic_done_servicing();
+ signal_dispatch();
+
asm volatile("pushl %0\n"
"jmp soft_iret\n" ::"r"(&__current->intr_ctx)
: "memory");
return -1;
}
+ wpid = wpid ? wpid : -__current->pgid;
cpu_enable_interrupt();
repeat:
llist_for_each(proc, n, &__current->children, siblings)
{
- if (!~wpid || proc->pid == wpid) {
+ if (!~wpid || proc->pid == wpid || proc->pgid == -wpid) {
if (proc->state == PROC_TERMNAT && !options) {
status_flags |= PROCTERM;
goto done;
process = &sched_ctx._procs[index];
- // make sure the address is in the range of process table
+ // make sure the reference is relative to process table
llist_init_head(&process->children);
+ llist_init_head(&process->grp_member);
+
// every process is the child of first process (pid=1)
if (process->parent) {
llist_append(&process->parent->children, &process->siblings);