/*===========================================================================*
* delivermsg *
*===========================================================================*/
-int delivermsg(struct proc *rp)
+PUBLIC void delivermsg(struct proc *rp)
{
phys_bytes addr;
int r;
assert(rp->p_misc_flags & MF_DELIVERMSG);
assert(rp->p_delivermsg.m_source != NONE);
- assert(rp->p_delivermsg_lin);
- assert(rp->p_delivermsg_lin == umap_local(rp, D, rp->p_delivermsg_vir, sizeof(message)));
-
- PHYS_COPY_CATCH(vir2phys(&rp->p_delivermsg),
- rp->p_delivermsg_lin, sizeof(message), addr);
-
- if(addr) {
- vm_suspend(rp, rp, rp->p_delivermsg_lin, sizeof(message),
- VMSTYPE_DELIVERMSG);
- r = VMSUSPEND;
+ if (copy_msg_to_user(rp, &rp->p_delivermsg,
+ (message *) rp->p_delivermsg_vir)) {
+ printf("WARNING wrong user pointer 0x%08x from "
+ "process %s / %d\n",
+ rp->p_delivermsg_vir,
+ rp->p_name,
+ rp->p_endpoint);
+ r = EFAULT;
} else {
/* Indicate message has been delivered; address is 'used'. */
rp->p_delivermsg.m_source = NONE;
- rp->p_delivermsg_lin = 0;
-
rp->p_misc_flags &= ~MF_DELIVERMSG;
r = OK;
}
- return r;
+ rp->p_reg.retreg = r;
}
PRIVATE char *flagstr(u32_t e, const int dir)
if (newmap(caller, caller, ep_data.mem_map) != OK)
panic("arch_enable_paging: newmap failed");
- FIXLINMSG(caller);
- assert(caller->p_delivermsg_lin == umap_local(caller, D,
- caller->p_delivermsg_vir, sizeof(message)));
-
#ifdef CONFIG_APIC
/* if local APIC is enabled */
if (lapic_addr) {
else if (proc_ptr->p_misc_flags & MF_DELIVERMSG) {
TRACE(VF_SCHEDULING, printf("delivering to %s / %d\n",
proc_ptr->p_name, proc_ptr->p_endpoint););
- if(delivermsg(proc_ptr) == VMSUSPEND) {
- TRACE(VF_SCHEDULING,
- printf("suspending %s / %d\n",
- proc_ptr->p_name,
- proc_ptr->p_endpoint););
- assert(!proc_is_runnable(proc_ptr));
- }
+ delivermsg(proc_ptr);
}
else if (proc_ptr->p_misc_flags & MF_SC_DEFER) {
/* Perform the system call that we deferred earlier. */
/*===========================================================================*
* mini_receive *
*===========================================================================*/
-PRIVATE int mini_receive(
- register struct proc *caller_ptr, /* process trying to get message */
- endpoint_t src_e, /* which message source is wanted */
- message *m_ptr, /* pointer to message buffer */
- const int flags
-)
+PRIVATE int mini_receive(struct proc * caller_ptr,
+ int src_e, /* which message source is wanted */
+ message * m_buff_usr, /* pointer to message buffer */
+ const int flags)
{
/* A process or task wants to get a message. If a message is already queued,
* acquire it and deblock the sender. If no message from the desired source
sys_map_t *map;
bitchunk_t *chunk;
int i, r, src_id, src_proc_nr, src_p;
- phys_bytes linaddr;
assert(!(caller_ptr->p_misc_flags & MF_DELIVERMSG));
- if(!(linaddr = umap_local(caller_ptr, D, (vir_bytes) m_ptr,
- sizeof(message)))) {
- return EFAULT;
- }
-
/* This is where we want our message. */
- caller_ptr->p_delivermsg_lin = linaddr;
- caller_ptr->p_delivermsg_vir = (vir_bytes) m_ptr;
+ caller_ptr->p_delivermsg_vir = (vir_bytes) m_buff_usr;
if(src_e == ANY) src_p = ANY;
else
message p_sendmsg; /* Message from this process if SENDING */
message p_delivermsg; /* Message for this process if MF_DELIVERMSG */
vir_bytes p_delivermsg_vir; /* Virtual addr this proc wants message at */
- vir_bytes p_delivermsg_lin; /* Linear addr this proc wants message at */
/* If handler functions detect a process wants to do something with
* memory that isn't present, VM has to fix it. Until it has asked
_PROTOTYPE( int vm_contiguous, (const struct proc *targetproc, vir_bytes vir_buf, size_t count));
_PROTOTYPE( void proc_stacktrace, (struct proc *proc) );
_PROTOTYPE( int vm_lookup, (const struct proc *proc, vir_bytes virtual, vir_bytes *result, u32_t *ptent));
-_PROTOTYPE( int delivermsg, (struct proc *target));
+_PROTOTYPE( void delivermsg, (struct proc *target));
_PROTOTYPE( void arch_do_syscall, (struct proc *proc) );
_PROTOTYPE( int arch_phys_map, (int index, phys_bytes *addr,
phys_bytes *len, int *flags));
if(rp->p_misc_flags & MF_DELIVERMSG) {
rp->p_misc_flags &= ~MF_DELIVERMSG;
- rp->p_delivermsg_lin = 0;
}
/* Save command name for debugging, ps(1) output, etc. */
/* Install new map */
r = newmap(caller, rpc, map_ptr);
- FIXLINMSG(rpc);
/* Don't schedule process in VM mode until it has a new pagetable. */
if(m_ptr->PR_FORK_FLAGS & PFF_VMINHIBIT) {
#define EFAULT_SRC (-995)
#define EFAULT_DST (-994)
-#define FIXLINMSG(prp) { prp->p_delivermsg_lin = umap_local(prp, D, prp->p_delivermsg_vir, sizeof(message)); }
-
#define PHYS_COPY_CATCH(src, dst, size, a) { \
catch_pagefaults++; \
a = phys_copy(src, dst, size); \