mcexec forward signal to MIC process.
This commit is contained in:
@ -8,6 +8,7 @@
|
|||||||
#include <registers.h>
|
#include <registers.h>
|
||||||
#include <cpulocal.h>
|
#include <cpulocal.h>
|
||||||
#include <march.h>
|
#include <march.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#define LAPIC_ID 0x020
|
#define LAPIC_ID 0x020
|
||||||
#define LAPIC_TIMER 0x320
|
#define LAPIC_TIMER 0x320
|
||||||
@ -341,6 +342,8 @@ void setup_x86_ap(void (*next_func)(void))
|
|||||||
}
|
}
|
||||||
|
|
||||||
void arch_show_interrupt_context(const void *reg);
|
void arch_show_interrupt_context(const void *reg);
|
||||||
|
void set_signal(int, void *);
|
||||||
|
void check_signal(long, void *);
|
||||||
|
|
||||||
void handle_interrupt(int vector, struct x86_regs *regs)
|
void handle_interrupt(int vector, struct x86_regs *regs)
|
||||||
{
|
{
|
||||||
@ -371,16 +374,17 @@ void handle_interrupt(int vector, struct x86_regs *regs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void sigill(void *);
|
check_signal(0, regs);
|
||||||
|
}
|
||||||
|
|
||||||
void gpe_handler(struct x86_regs *regs)
|
void gpe_handler(struct x86_regs *regs)
|
||||||
{
|
{
|
||||||
kprintf("General protection fault (err: %lx, %lx:%lx)\n",
|
kprintf("General protection fault (err: %lx, %lx:%lx)\n",
|
||||||
regs->error, regs->cs, regs->rip);
|
regs->error, regs->cs, regs->rip);
|
||||||
arch_show_interrupt_context(regs);
|
arch_show_interrupt_context(regs);
|
||||||
sigill(regs);
|
set_signal(SIGILL, regs);
|
||||||
|
check_signal(0, regs);
|
||||||
// panic("GPF");
|
// panic("GPF");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -49,6 +49,11 @@ SYSCALL_DELEGATED(107, geteuid)
|
|||||||
SYSCALL_DELEGATED(108, getegid)
|
SYSCALL_DELEGATED(108, getegid)
|
||||||
SYSCALL_DELEGATED(110, getppid)
|
SYSCALL_DELEGATED(110, getppid)
|
||||||
SYSCALL_DELEGATED(111, getpgrp)
|
SYSCALL_DELEGATED(111, getpgrp)
|
||||||
|
SYSCALL_HANDLED(127, rt_sigpending)
|
||||||
|
SYSCALL_HANDLED(128, rt_sigtimedwait)
|
||||||
|
SYSCALL_HANDLED(129, rt_sigqueueinfo)
|
||||||
|
SYSCALL_HANDLED(130, rt_sigsuspend)
|
||||||
|
SYSCALL_HANDLED(131, sigaltstack)
|
||||||
SYSCALL_HANDLED(158, arch_prctl)
|
SYSCALL_HANDLED(158, arch_prctl)
|
||||||
SYSCALL_DELEGATED(201, time)
|
SYSCALL_DELEGATED(201, time)
|
||||||
SYSCALL_HANDLED(202, futex)
|
SYSCALL_HANDLED(202, futex)
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
#include <syscall.h>
|
#include <syscall.h>
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
void terminate(int, int, ihk_mc_user_context_t *);
|
void terminate(int, int, ihk_mc_user_context_t *);
|
||||||
|
|
||||||
@ -91,8 +92,12 @@ check_signal(unsigned long rc, unsigned long *regs)
|
|||||||
struct k_sigaction *k;
|
struct k_sigaction *k;
|
||||||
int sig = proc->signal;
|
int sig = proc->signal;
|
||||||
|
|
||||||
|
if(proc == NULL || proc->pid == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
proc->signal = 0;
|
proc->signal = 0;
|
||||||
if(sig){
|
if(sig){
|
||||||
|
int irqstate = ihk_mc_spinlock_lock(&proc->sighandler->lock);
|
||||||
if(regs == NULL){ /* call from syscall */
|
if(regs == NULL){ /* call from syscall */
|
||||||
asm volatile ("movq %%gs:132,%0" : "=r" (regs));
|
asm volatile ("movq %%gs:132,%0" : "=r" (regs));
|
||||||
regs -= 16;
|
regs -= 16;
|
||||||
@ -104,6 +109,7 @@ check_signal(unsigned long rc, unsigned long *regs)
|
|||||||
k = proc->sighandler->action + sig - 1;
|
k = proc->sighandler->action + sig - 1;
|
||||||
|
|
||||||
if(k->sa.sa_handler == (void *)1){
|
if(k->sa.sa_handler == (void *)1){
|
||||||
|
ihk_mc_spinlock_unlock(&proc->sighandler->lock, irqstate);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(k->sa.sa_handler){
|
else if(k->sa.sa_handler){
|
||||||
@ -118,8 +124,10 @@ check_signal(unsigned long rc, unsigned long *regs)
|
|||||||
regs[4] = (unsigned long)sig;
|
regs[4] = (unsigned long)sig;
|
||||||
regs[11] = (unsigned long)k->sa.sa_handler;
|
regs[11] = (unsigned long)k->sa.sa_handler;
|
||||||
regs[14] = (unsigned long)usp;
|
regs[14] = (unsigned long)usp;
|
||||||
|
ihk_mc_spinlock_unlock(&proc->sighandler->lock, irqstate);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
ihk_mc_spinlock_unlock(&proc->sighandler->lock, irqstate);
|
||||||
if(sig == SIGCHLD || sig == SIGURG)
|
if(sig == SIGCHLD || sig == SIGURG)
|
||||||
return;
|
return;
|
||||||
terminate(0, sig, (ihk_mc_user_context_t *)regs[14]);
|
terminate(0, sig, (ihk_mc_user_context_t *)regs[14]);
|
||||||
@ -127,20 +135,38 @@ check_signal(unsigned long rc, unsigned long *regs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
extern unsigned long do_kill(int pid, int sig);
|
||||||
sigsegv(unsigned long *regs)
|
|
||||||
|
unsigned long
|
||||||
|
do_kill(int pid, int sig)
|
||||||
{
|
{
|
||||||
struct process *proc = cpu_local_var(current);
|
struct process *proc = cpu_local_var(current);
|
||||||
|
|
||||||
proc->signal = SIGSEGV;
|
if(proc == NULL || proc->pid == 0){
|
||||||
check_signal(0, regs);
|
return -ESRCH;
|
||||||
|
}
|
||||||
|
if(proc->pid == pid){
|
||||||
|
proc->signal = sig;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pid <= 0){
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
if(sig == 0){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return -EPERM;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sigill(unsigned long *regs)
|
set_signal(int sig, unsigned long *regs)
|
||||||
{
|
{
|
||||||
struct process *proc = cpu_local_var(current);
|
struct process *proc = cpu_local_var(current);
|
||||||
|
|
||||||
proc->signal = SIGILL;
|
if(proc == NULL || proc->pid == 0)
|
||||||
check_signal(0, regs);
|
return;
|
||||||
|
proc->signal = sig;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
#define MCEXEC_UP_WAIT_SYSCALL 0x30a02903
|
#define MCEXEC_UP_WAIT_SYSCALL 0x30a02903
|
||||||
#define MCEXEC_UP_RET_SYSCALL 0x30a02904
|
#define MCEXEC_UP_RET_SYSCALL 0x30a02904
|
||||||
#define MCEXEC_UP_LOAD_SYSCALL 0x30a02905
|
#define MCEXEC_UP_LOAD_SYSCALL 0x30a02905
|
||||||
|
#define MCEXEC_UP_SEND_SIGNAL 0x30a02906
|
||||||
|
|
||||||
#define MCEXEC_UP_PREPARE_DMA 0x30a02910
|
#define MCEXEC_UP_PREPARE_DMA 0x30a02910
|
||||||
#define MCEXEC_UP_FREE_DMA 0x30a02911
|
#define MCEXEC_UP_FREE_DMA 0x30a02911
|
||||||
|
|||||||
@ -209,6 +209,22 @@ static long mcexec_start_image(ihk_os_t os,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static long mcexec_send_signal(ihk_os_t os, unsigned long sigparam)
|
||||||
|
{
|
||||||
|
struct ikc_scd_packet isp;
|
||||||
|
struct mcctrl_channel *c;
|
||||||
|
struct mcctrl_usrdata *usrdata = ihk_host_os_get_usrdata(os);
|
||||||
|
|
||||||
|
c = usrdata->channels;
|
||||||
|
isp.msg = SCD_MSG_SEND_SIGNAL;
|
||||||
|
isp.ref = 0;
|
||||||
|
isp.arg = sigparam;
|
||||||
|
|
||||||
|
mcctrl_ikc_send(os, 0, &isp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int mcexec_syscall(struct mcctrl_channel *c, unsigned long arg)
|
int mcexec_syscall(struct mcctrl_channel *c, unsigned long arg)
|
||||||
{
|
{
|
||||||
c->req = 1;
|
c->req = 1;
|
||||||
@ -536,6 +552,9 @@ long __mcctrl_control(ihk_os_t os, unsigned int req, unsigned long arg)
|
|||||||
case MCEXEC_UP_LOAD_SYSCALL:
|
case MCEXEC_UP_LOAD_SYSCALL:
|
||||||
return mcexec_load_syscall(os, (struct syscall_load_desc *)arg);
|
return mcexec_load_syscall(os, (struct syscall_load_desc *)arg);
|
||||||
|
|
||||||
|
case MCEXEC_UP_SEND_SIGNAL:
|
||||||
|
return mcexec_send_signal(os, arg);
|
||||||
|
|
||||||
case MCEXEC_UP_PREPARE_DMA:
|
case MCEXEC_UP_PREPARE_DMA:
|
||||||
return mcexec_pin_region(os, (unsigned long *)arg);
|
return mcexec_pin_region(os, (unsigned long *)arg);
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,7 @@ static struct ihk_os_user_call_handler mcctrl_uchs[] = {
|
|||||||
{ .request = MCEXEC_UP_WAIT_SYSCALL, .func = mcctrl_ioctl },
|
{ .request = MCEXEC_UP_WAIT_SYSCALL, .func = mcctrl_ioctl },
|
||||||
{ .request = MCEXEC_UP_RET_SYSCALL, .func = mcctrl_ioctl },
|
{ .request = MCEXEC_UP_RET_SYSCALL, .func = mcctrl_ioctl },
|
||||||
{ .request = MCEXEC_UP_LOAD_SYSCALL, .func = mcctrl_ioctl },
|
{ .request = MCEXEC_UP_LOAD_SYSCALL, .func = mcctrl_ioctl },
|
||||||
|
{ .request = MCEXEC_UP_SEND_SIGNAL, .func = mcctrl_ioctl },
|
||||||
{ .request = MCEXEC_UP_PREPARE_DMA, .func = mcctrl_ioctl },
|
{ .request = MCEXEC_UP_PREPARE_DMA, .func = mcctrl_ioctl },
|
||||||
{ .request = MCEXEC_UP_FREE_DMA, .func = mcctrl_ioctl },
|
{ .request = MCEXEC_UP_FREE_DMA, .func = mcctrl_ioctl },
|
||||||
};
|
};
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
#define SCD_MSG_INIT_CHANNEL_ACKED 0x6
|
#define SCD_MSG_INIT_CHANNEL_ACKED 0x6
|
||||||
|
|
||||||
#define SCD_MSG_SYSCALL_ONESIDE 0x4
|
#define SCD_MSG_SYSCALL_ONESIDE 0x4
|
||||||
|
#define SCD_MSG_SEND_SIGNAL 0x8
|
||||||
|
|
||||||
#define DMA_PIN_SHIFT 21
|
#define DMA_PIN_SHIFT 21
|
||||||
|
|
||||||
|
|||||||
@ -80,6 +80,8 @@ struct kernel_termios {
|
|||||||
|
|
||||||
int main_loop(int fd, int cpu, pthread_mutex_t *lock);
|
int main_loop(int fd, int cpu, pthread_mutex_t *lock);
|
||||||
|
|
||||||
|
static int fd;
|
||||||
|
|
||||||
struct program_load_desc *load_elf(FILE *fp)
|
struct program_load_desc *load_elf(FILE *fp)
|
||||||
{
|
{
|
||||||
Elf64_Ehdr hdr;
|
Elf64_Ehdr hdr;
|
||||||
@ -332,9 +334,22 @@ static void *main_loop_thread_func(void *arg)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sendsig(int sig)
|
||||||
|
{
|
||||||
|
unsigned long param;
|
||||||
|
|
||||||
|
param = ((unsigned long)sig) << 32 | ((unsigned long)getpid());
|
||||||
|
if (ioctl(fd, MCEXEC_UP_SEND_SIGNAL, param) != 0) {
|
||||||
|
perror("send_signal");
|
||||||
|
close(fd);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int fd;
|
// int fd;
|
||||||
#if 0
|
#if 0
|
||||||
int fdm;
|
int fdm;
|
||||||
long r;
|
long r;
|
||||||
@ -489,6 +504,11 @@ int main(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 1; i <= 64; i++)
|
||||||
|
if (i != SIGCHLD && i != SIGCONT && i != SIGSTOP &&
|
||||||
|
i != SIGTSTP && i != SIGTTIN && i != SIGTTOU)
|
||||||
|
signal(i, sendsig);
|
||||||
|
|
||||||
for (i = 0; i < NUM_HANDLER_THREADS; ++i) {
|
for (i = 0; i < NUM_HANDLER_THREADS; ++i) {
|
||||||
pthread_join(thread_data[i].thread_id, NULL);
|
pthread_join(thread_data[i].thread_id, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -368,6 +368,8 @@ static void syscall_channel_send(struct ihk_ikc_channel_desc *c,
|
|||||||
ihk_ikc_send(c, packet, 0);
|
ihk_ikc_send(c, packet, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern unsigned long do_kill(int, int);
|
||||||
|
|
||||||
static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
|
static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
|
||||||
void *__packet, void *ihk_os)
|
void *__packet, void *ihk_os)
|
||||||
{
|
{
|
||||||
@ -404,6 +406,10 @@ static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
|
|||||||
|
|
||||||
//cpu_local_var(next) = (struct process *)packet->arg;
|
//cpu_local_var(next) = (struct process *)packet->arg;
|
||||||
return 0;
|
return 0;
|
||||||
|
case SCD_MSG_SEND_SIGNAL:
|
||||||
|
rc = do_kill((int)packet->arg, (int)(packet->arg >> 32));
|
||||||
|
kprintf("SCD_MSG_SEND_SIGNAL: %lx, rc=%d\n", packet->arg, rc);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,8 +55,8 @@ struct vm_regions {
|
|||||||
struct process_vm;
|
struct process_vm;
|
||||||
|
|
||||||
struct sig_handler {
|
struct sig_handler {
|
||||||
// TODO: lock;
|
ihk_spinlock_t lock;
|
||||||
int use;
|
ihk_atomic_t use;
|
||||||
struct k_sigaction action[_NSIG];
|
struct k_sigaction action[_NSIG];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -83,9 +83,12 @@ struct process {
|
|||||||
} thread;
|
} thread;
|
||||||
|
|
||||||
int signal;
|
int signal;
|
||||||
|
sigset_t sigpend;
|
||||||
|
sigset_t sigmask;
|
||||||
struct sig_handler *sighandler;
|
struct sig_handler *sighandler;
|
||||||
ihk_mc_kernel_context_t sigctx;
|
ihk_mc_kernel_context_t sigctx;
|
||||||
char sigstack[512];
|
char sigstack[512];
|
||||||
|
// TODO: backup FR and MMX regs
|
||||||
unsigned long sigrc; // return code of rt_sigreturn (x86_64: rax reg.)
|
unsigned long sigrc; // return code of rt_sigreturn (x86_64: rax reg.)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
#define SCD_MSG_INIT_CHANNEL_ACKED 0x6
|
#define SCD_MSG_INIT_CHANNEL_ACKED 0x6
|
||||||
|
|
||||||
#define SCD_MSG_SYSCALL_ONESIDE 0x4
|
#define SCD_MSG_SYSCALL_ONESIDE 0x4
|
||||||
|
#define SCD_MSG_SEND_SIGNAL 0x8
|
||||||
|
|
||||||
#define ARCH_SET_GS 0x1001
|
#define ARCH_SET_GS 0x1001
|
||||||
#define ARCH_SET_FS 0x1002
|
#define ARCH_SET_FS 0x1002
|
||||||
|
|||||||
@ -141,7 +141,8 @@ static struct ihk_mc_interrupt_handler query_free_mem_handler = {
|
|||||||
.priv = NULL,
|
.priv = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
void sigsegv(void *);
|
void set_signal(int, unsigned long *);
|
||||||
|
void check_signal(long, unsigned long *);
|
||||||
|
|
||||||
static void unhandled_page_fault(struct process *proc, void *fault_addr, void *regs)
|
static void unhandled_page_fault(struct process *proc, void *fault_addr, void *regs)
|
||||||
{
|
{
|
||||||
@ -194,7 +195,8 @@ static void unhandled_page_fault(struct process *proc, void *fault_addr, void *r
|
|||||||
#if 0
|
#if 0
|
||||||
panic("mem fault");
|
panic("mem fault");
|
||||||
#endif
|
#endif
|
||||||
sigsegv(regs);
|
set_signal(SIGSEGV, regs);
|
||||||
|
check_signal(0, regs);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -62,7 +62,8 @@ struct process *create_process(unsigned long user_pc)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(proc->sighandler, '\0', sizeof(struct sig_handler));
|
memset(proc->sighandler, '\0', sizeof(struct sig_handler));
|
||||||
proc->sighandler->use = 1;
|
ihk_atomic_set(&proc->sighandler->use, 1);
|
||||||
|
ihk_mc_spinlock_init(&proc->sighandler->lock);
|
||||||
|
|
||||||
ihk_mc_init_user_process(&proc->ctx, &proc->uctx,
|
ihk_mc_init_user_process(&proc->ctx, &proc->uctx,
|
||||||
((char *)proc) +
|
((char *)proc) +
|
||||||
@ -106,9 +107,8 @@ struct process *clone_process(struct process *org, unsigned long pc,
|
|||||||
ihk_atomic_inc(&org->vm->refcount);
|
ihk_atomic_inc(&org->vm->refcount);
|
||||||
proc->vm = org->vm;
|
proc->vm = org->vm;
|
||||||
|
|
||||||
// TODO: lock
|
|
||||||
proc->sighandler = org->sighandler;
|
proc->sighandler = org->sighandler;
|
||||||
org->sighandler->use++;
|
ihk_atomic_inc(&org->sighandler->use);
|
||||||
|
|
||||||
ihk_mc_spinlock_init(&proc->spin_sleep_lock);
|
ihk_mc_spinlock_init(&proc->spin_sleep_lock);
|
||||||
proc->spin_sleep = 0;
|
proc->spin_sleep = 0;
|
||||||
@ -1054,6 +1054,9 @@ void hold_process(struct process *proc)
|
|||||||
|
|
||||||
void destroy_process(struct process *proc)
|
void destroy_process(struct process *proc)
|
||||||
{
|
{
|
||||||
|
if(ihk_atomic_dec_and_test(&proc->sighandler->use)){
|
||||||
|
kfree(proc->sighandler);
|
||||||
|
}
|
||||||
ihk_mc_free_pages(proc, KERNEL_STACK_NR_PAGES);
|
ihk_mc_free_pages(proc, KERNEL_STACK_NR_PAGES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -66,7 +66,7 @@ static char *syscall_name[] MCKERNEL_UNUSED = {
|
|||||||
#undef SYSCALL_DELEGATED
|
#undef SYSCALL_DELEGATED
|
||||||
};
|
};
|
||||||
|
|
||||||
void check_signal(unsigned long rc, unsigned long *regs);
|
void check_signal(long rc, unsigned long *regs);
|
||||||
|
|
||||||
#ifdef DCFA_KMOD
|
#ifdef DCFA_KMOD
|
||||||
static void do_mod_exit(int status);
|
static void do_mod_exit(int status);
|
||||||
@ -830,26 +830,14 @@ SYSCALL_DECLARE(set_tid_address)
|
|||||||
return cpu_local_var(current)->pid;
|
return cpu_local_var(current)->pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern unsigned long do_kill(int pid, int sig);
|
||||||
|
|
||||||
SYSCALL_DECLARE(kill)
|
SYSCALL_DECLARE(kill)
|
||||||
{
|
{
|
||||||
int pid = ihk_mc_syscall_arg0(ctx);
|
int pid = ihk_mc_syscall_arg0(ctx);
|
||||||
int sig = ihk_mc_syscall_arg1(ctx);
|
int sig = ihk_mc_syscall_arg1(ctx);
|
||||||
|
|
||||||
struct process *proc = cpu_local_var(current);
|
return do_kill(pid, sig);
|
||||||
|
|
||||||
if(proc->pid == pid){
|
|
||||||
proc->signal = sig;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(pid <= 0) { return -EINVAL; }
|
|
||||||
// search pid
|
|
||||||
// check kill permission
|
|
||||||
if(sig == 0) {
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
return -EPERM;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// see linux-2.6.34.13/kernel/signal.c
|
// see linux-2.6.34.13/kernel/signal.c
|
||||||
@ -879,14 +867,16 @@ do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
|
|||||||
{
|
{
|
||||||
struct process *proc = cpu_local_var(current);
|
struct process *proc = cpu_local_var(current);
|
||||||
struct k_sigaction *k;
|
struct k_sigaction *k;
|
||||||
// TODO: sigmask
|
int irqstate;
|
||||||
|
|
||||||
|
irqstate = ihk_mc_spinlock_lock(&proc->sighandler->lock);
|
||||||
k = proc->sighandler->action + sig - 1;
|
k = proc->sighandler->action + sig - 1;
|
||||||
if(oact)
|
if(oact)
|
||||||
memcpy(oact, k, sizeof(struct k_sigaction));
|
memcpy(oact, k, sizeof(struct k_sigaction));
|
||||||
if(act){
|
if(act){
|
||||||
memcpy(k, act, sizeof(struct k_sigaction));
|
memcpy(k, act, sizeof(struct k_sigaction));
|
||||||
}
|
}
|
||||||
|
ihk_mc_spinlock_unlock(&proc->sighandler->lock, irqstate);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -913,9 +903,38 @@ SYSCALL_DECLARE(rt_sigaction)
|
|||||||
|
|
||||||
SYSCALL_DECLARE(rt_sigprocmask)
|
SYSCALL_DECLARE(rt_sigprocmask)
|
||||||
{
|
{
|
||||||
// kprintf("sys_rt_sigprocmask called. returning zero...\n");
|
int how = ihk_mc_syscall_arg0(ctx);
|
||||||
return 0;
|
const sigset_t *set = (const sigset_t *)ihk_mc_syscall_arg1(ctx);
|
||||||
|
sigset_t *oldset = (sigset_t *)ihk_mc_syscall_arg2(ctx);
|
||||||
|
// kprintf("sys_rt_sigprocmask called. returning zero...\n");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SYSCALL_DECLARE(rt_sigpending)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SYSCALL_DECLARE(rt_sigtimedwait)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SYSCALL_DECLARE(rt_sigqueueinfo)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SYSCALL_DECLARE(rt_sigsuspend)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SYSCALL_DECLARE(sigaltstack)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
SYSCALL_DECLARE(madvise)
|
SYSCALL_DECLARE(madvise)
|
||||||
{
|
{
|
||||||
// kprintf("sys_madvise called. returning zero...\n");
|
// kprintf("sys_madvise called. returning zero...\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user