add error handling for prepare_process

This commit is contained in:
Tomoki Shirasawa
2013-06-02 13:49:10 +09:00
parent c8b7a853cc
commit 54798253c5
4 changed files with 15 additions and 3 deletions

View File

@ -30,6 +30,7 @@ struct program_load_desc {
int status;
int cpu;
int pid;
int err;
unsigned long entry;
unsigned long user_start;
unsigned long user_end;

View File

@ -87,6 +87,11 @@ static long mcexec_prepare_image(ihk_os_t os,
wait_event_interruptible(usrdata->wq_prepare, pdesc->status);
if(pdesc->err == -1){
ret = -EFAULT;
goto free_out;
}
usrdata->rpgtable = pdesc->rpgtable;
if (copy_to_user(udesc, pdesc, sizeof(struct program_load_desc) +
sizeof(struct program_image_section) * desc.num_sections)) {
@ -517,11 +522,12 @@ long __mcctrl_control(ihk_os_t os, unsigned int req, unsigned long arg)
return -EINVAL;
}
void mcexec_prepare_ack(ihk_os_t os, unsigned long arg)
void mcexec_prepare_ack(ihk_os_t os, unsigned long arg, int err)
{
struct program_load_desc *desc = phys_to_virt(arg);
struct mcctrl_usrdata *usrdata = ihk_host_os_get_usrdata(os);
desc->err = err;
desc->status = 1;
wake_up_all(&usrdata->wq_prepare);

View File

@ -15,7 +15,7 @@
//struct mcctrl_channel *channels;
void mcexec_prepare_ack(ihk_os_t os, unsigned long arg);
void mcexec_prepare_ack(ihk_os_t os, unsigned long arg, int err);
static void mcctrl_ikc_init(ihk_os_t os, int cpu, unsigned long rphys);
int mcexec_syscall(struct mcctrl_channel *c, unsigned long arg);
@ -31,7 +31,11 @@ static int syscall_packet_handler(struct ihk_ikc_channel_desc *c,
break;
case SCD_MSG_PREPARE_PROCESS_ACKED:
mcexec_prepare_ack(__os, pisp->arg);
mcexec_prepare_ack(__os, pisp->arg, 0);
break;
case SCD_MSG_PREPARE_PROCESS_NACKED:
mcexec_prepare_ack(__os, pisp->arg, -1);
break;
case SCD_MSG_SYSCALL_ONESIDE:

View File

@ -89,6 +89,7 @@ struct program_load_desc {
int status;
int cpu;
int pid;
int err;
unsigned long entry;
unsigned long user_start;
unsigned long user_end;