mcexec forward signal to MIC process.

This commit is contained in:
Tomoki Shirasawa
2013-08-19 12:17:23 +09:00
parent 591f398768
commit 1d69225532
14 changed files with 148 additions and 37 deletions

View File

@@ -7,6 +7,7 @@
#define MCEXEC_UP_WAIT_SYSCALL 0x30a02903
#define MCEXEC_UP_RET_SYSCALL 0x30a02904
#define MCEXEC_UP_LOAD_SYSCALL 0x30a02905
#define MCEXEC_UP_SEND_SIGNAL 0x30a02906
#define MCEXEC_UP_PREPARE_DMA 0x30a02910
#define MCEXEC_UP_FREE_DMA 0x30a02911

View File

@@ -209,6 +209,22 @@ static long mcexec_start_image(ihk_os_t os,
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)
{
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:
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:
return mcexec_pin_region(os, (unsigned long *)arg);

View File

@@ -31,6 +31,7 @@ static struct ihk_os_user_call_handler mcctrl_uchs[] = {
{ .request = MCEXEC_UP_WAIT_SYSCALL, .func = mcctrl_ioctl },
{ .request = MCEXEC_UP_RET_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_FREE_DMA, .func = mcctrl_ioctl },
};

View File

@@ -16,6 +16,7 @@
#define SCD_MSG_INIT_CHANNEL_ACKED 0x6
#define SCD_MSG_SYSCALL_ONESIDE 0x4
#define SCD_MSG_SEND_SIGNAL 0x8
#define DMA_PIN_SHIFT 21

View File

@@ -80,6 +80,8 @@ struct kernel_termios {
int main_loop(int fd, int cpu, pthread_mutex_t *lock);
static int fd;
struct program_load_desc *load_elf(FILE *fp)
{
Elf64_Ehdr hdr;
@@ -332,9 +334,22 @@ static void *main_loop_thread_func(void *arg)
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 fd;
// int fd;
#if 0
int fdm;
long r;
@@ -489,6 +504,11 @@ int main(int argc, char **argv)
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) {
pthread_join(thread_data[i].thread_id, NULL);
}