Merge branch 'master' into kernel-refactor-foundations
This commit is contained in:
commit
84ad570bb4
|
|
@ -565,6 +565,7 @@ void hook_ipc_clear(struct proc *p)
|
|||
#if DEBUG_IPCSTATS
|
||||
int slot, i;
|
||||
KASSERT(p);
|
||||
|
||||
proc2slot(p, slot);
|
||||
for(i = 0; i < IPCPROCS; i++)
|
||||
messages[slot][i] = messages[i][slot] = 0;
|
||||
|
|
|
|||
|
|
@ -47,5 +47,6 @@ void *kmemmove(void *dest, const void *src, k_size_t n) {
|
|||
*pd++ = *ps++;
|
||||
}
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,8 +37,7 @@
|
|||
#include <minix/kernel_types.h>
|
||||
#include <sys/kassert.h>
|
||||
|
||||
|
||||
/* dummy for linking */
|
||||
/* FIXME dummy for linking */
|
||||
char *** _penviron;
|
||||
|
||||
/* Prototype declarations for PRIVATE functions. */
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ klib_sources = files(
|
|||
'klib/kmemory.c',
|
||||
'klib/kprintf_stub.c',
|
||||
'klib/kpanic.c'
|
||||
# Add other klib source files here if created (e.g. katom.c)
|
||||
# TODO Add other klib source files here if created (e.g. katom.c)
|
||||
)
|
||||
|
||||
klib = static_library('klib',
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ void vm_suspend(struct proc *caller, const struct proc *target,
|
|||
*/
|
||||
KASSERT(!RTS_ISSET(caller, RTS_VMREQUEST));
|
||||
KASSERT(!RTS_ISSET(target, RTS_VMREQUEST));
|
||||
|
||||
|
||||
RTS_SET(caller, RTS_VMREQUEST);
|
||||
|
||||
caller->p_vmrequest.req_type = VMPTYPE_CHECK;
|
||||
|
|
@ -360,11 +360,13 @@ check_misc_flags:
|
|||
|
||||
KASSERT(p);
|
||||
KASSERT(proc_is_runnable(p));
|
||||
|
||||
while (p->p_misc_flags &
|
||||
(MF_KCALL_RESUME | MF_DELIVERMSG |
|
||||
MF_SC_DEFER | MF_SC_TRACE | MF_SC_ACTIVE)) {
|
||||
|
||||
KASSERT(proc_is_runnable(p));
|
||||
|
||||
if (p->p_misc_flags & MF_KCALL_RESUME) {
|
||||
kernel_call_resume(p);
|
||||
}
|
||||
|
|
@ -445,6 +447,7 @@ check_misc_flags:
|
|||
p = arch_finish_switch_to_user();
|
||||
KASSERT(p->p_cpu_time_left);
|
||||
|
||||
|
||||
context_stop(proc_addr(KERNEL));
|
||||
|
||||
/* If the process isn't the owner of FPU, enable the FPU exception */
|
||||
|
|
@ -463,6 +466,7 @@ check_misc_flags:
|
|||
#elif defined(__arm__)
|
||||
KASSERT(p->p_seg.p_ttbr != 0);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
if (p->p_misc_flags & MF_FLUSH_TLB) {
|
||||
if (tlb_must_refresh)
|
||||
|
|
@ -624,7 +628,9 @@ int do_ipc(reg_t r1, reg_t r2, reg_t r3)
|
|||
* input message. Postpone the entire system call.
|
||||
*/
|
||||
caller_ptr->p_misc_flags &= ~MF_SC_TRACE;
|
||||
KASSERT(!(caller_ptr->p_misc_flags & MF_SC_DEFER));
|
||||
|
||||
KASSERT(!(caller_ptr->p_misc_flags & MF_SC_DEFER));
|
||||
|
||||
caller_ptr->p_misc_flags |= MF_SC_DEFER;
|
||||
caller_ptr->p_defer.r1 = r1;
|
||||
caller_ptr->p_defer.r2 = r2;
|
||||
|
|
@ -642,6 +648,7 @@ int do_ipc(reg_t r1, reg_t r2, reg_t r3)
|
|||
|
||||
KASSERT (!(caller_ptr->p_misc_flags & MF_SC_ACTIVE));
|
||||
|
||||
|
||||
/* Set a flag to allow reliable tracing of leaving the system call. */
|
||||
caller_ptr->p_misc_flags |= MF_SC_ACTIVE;
|
||||
}
|
||||
|
|
@ -733,6 +740,7 @@ static int deadlock(
|
|||
xp = proc_addr(src_dst_slot); /* follow chain of processes */
|
||||
KASSERT(proc_ptr_ok(xp));
|
||||
KASSERT(!RTS_ISSET(xp, RTS_SLOT_FREE));
|
||||
|
||||
#if DEBUG_ENABLE_IPC_WARNINGS
|
||||
processes[group_size] = xp;
|
||||
#endif
|
||||
|
|
@ -958,6 +966,7 @@ int mini_send(
|
|||
|
||||
/* Process is now blocked. Put in on the destination's queue. */
|
||||
KASSERT(caller_ptr->p_q_link == NULL); /* NULL can be an issue if stddef.h is truly gone */
|
||||
|
||||
xpp = &dst_ptr->p_caller_q; /* find end of list */
|
||||
while (*xpp) xpp = &(*xpp)->p_q_link;
|
||||
*xpp = caller_ptr; /* add caller to end */
|
||||
|
|
@ -1033,6 +1042,7 @@ static int mini_receive(struct proc * caller_ptr,
|
|||
KASSERT(!(caller_ptr->p_misc_flags & MF_DELIVERMSG));
|
||||
KASSERT(src_e == ANY || sender_e == src_e);
|
||||
|
||||
|
||||
/* assemble message */
|
||||
BuildNotifyMessage(&caller_ptr->p_delivermsg, src_proc_nr, caller_ptr);
|
||||
caller_ptr->p_delivermsg.m_source = sender_e;
|
||||
|
|
@ -1070,6 +1080,7 @@ static int mini_receive(struct proc * caller_ptr,
|
|||
|
||||
/* Found acceptable message. Copy it and update status. */
|
||||
KASSERT(!(caller_ptr->p_misc_flags & MF_DELIVERMSG));
|
||||
|
||||
caller_ptr->p_delivermsg = sender->p_sendmsg;
|
||||
caller_ptr->p_delivermsg.m_source = sender->p_endpoint;
|
||||
caller_ptr->p_misc_flags |= MF_DELIVERMSG;
|
||||
|
|
@ -1384,6 +1395,7 @@ static int try_async(struct proc * caller_ptr)
|
|||
#endif
|
||||
|
||||
KASSERT(!(caller_ptr->p_misc_flags & MF_DELIVERMSG));
|
||||
|
||||
if ((r = try_one(ANY, src_ptr, caller_ptr)) == OK)
|
||||
return(r);
|
||||
}
|
||||
|
|
@ -1464,6 +1476,7 @@ static int try_one(endpoint_t receive_e, struct proc *src_ptr,
|
|||
|
||||
if (!CANRECEIVE(receive_e, src_e, dst_ptr,
|
||||
table_v + i*sizeof(asynmsg_t) + K_OFFSETOF(struct asynmsg,msg),
|
||||
|
||||
NULL)) { // MODIFIED (NULL)
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1641,7 +1654,9 @@ void enqueue(
|
|||
*/
|
||||
struct proc * p;
|
||||
p = get_cpulocal_var(proc_ptr);
|
||||
KASSERT(p);
|
||||
|
||||
KASSERT(p);
|
||||
|
||||
if((p->p_priority > rp->p_priority) &&
|
||||
(priv(p)->s_flags & PREEMPTIBLE))
|
||||
RTS_SET(p, RTS_PREEMPTED); /* calls dequeue() */
|
||||
|
|
@ -1692,7 +1707,6 @@ static void enqueue_head(struct proc *rp)
|
|||
|
||||
KASSERT(q >= 0);
|
||||
|
||||
|
||||
rdy_head = get_cpu_var(rp->p_cpu, run_q_head);
|
||||
rdy_tail = get_cpu_var(rp->p_cpu, run_q_tail);
|
||||
|
||||
|
|
@ -1715,6 +1729,7 @@ static void enqueue_head(struct proc *rp)
|
|||
|
||||
#if DEBUG_SANITYCHECKS
|
||||
KASSERT(runqueues_ok_local());
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1784,6 +1799,7 @@ void dequeue(struct proc *rp)
|
|||
|
||||
#if DEBUG_SANITYCHECKS
|
||||
KASSERT(runqueues_ok_local());
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1813,6 +1829,7 @@ static struct proc * pick_proc(void)
|
|||
continue;
|
||||
}
|
||||
KASSERT(proc_is_runnable(rp));
|
||||
|
||||
if (priv(rp)->s_flags & BILLABLE)
|
||||
get_cpulocal_var(bill_ptr) = rp; /* bill for system time */
|
||||
return rp;
|
||||
|
|
@ -1944,6 +1961,7 @@ void copr_not_available_handler(void)
|
|||
local_fpu_owner = get_cpulocal_var_ptr(fpu_owner);
|
||||
if (*local_fpu_owner != NULL) { // MODIFIED (NULL)
|
||||
KASSERT(*local_fpu_owner != p);
|
||||
|
||||
save_local_fpu(*local_fpu_owner, FALSE /*retain*/);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ static void smp_schedule_sync(struct proc * p, unsigned task)
|
|||
unsigned mycpu = cpuid;
|
||||
|
||||
KASSERT(cpu != mycpu);
|
||||
|
||||
/*
|
||||
* if some other cpu made a request to the same cpu, wait until it is
|
||||
* done before proceeding
|
||||
|
|
@ -144,6 +145,7 @@ void smp_schedule_stop_proc_save_ctx(struct proc * p)
|
|||
*/
|
||||
smp_schedule_sync(p, SCHED_IPI_STOP_PROC | SCHED_IPI_SAVE_CTX);
|
||||
KASSERT(RTS_ISSET(p, RTS_PROC_STOP));
|
||||
|
||||
}
|
||||
|
||||
void smp_schedule_migrate_proc(struct proc * p, unsigned dest_cpu)
|
||||
|
|
@ -154,7 +156,7 @@ void smp_schedule_migrate_proc(struct proc * p, unsigned dest_cpu)
|
|||
*/
|
||||
smp_schedule_sync(p, SCHED_IPI_STOP_PROC | SCHED_IPI_SAVE_CTX);
|
||||
KASSERT(RTS_ISSET(p, RTS_PROC_STOP));
|
||||
|
||||
|
||||
/* assign the new cpu and let the process run again */
|
||||
p->p_cpu = dest_cpu;
|
||||
RTS_UNSET(p, RTS_PROC_STOP);
|
||||
|
|
|
|||
|
|
@ -623,7 +623,6 @@ void kernel_call_resume(struct proc *caller)
|
|||
|
||||
KASSERT(!RTS_ISSET(caller, RTS_SLOT_FREE));
|
||||
KASSERT(!RTS_ISSET(caller, RTS_VMREQUEST));
|
||||
|
||||
KASSERT(caller->p_vmrequest.saved.reqmsg.m_source == caller->p_endpoint);
|
||||
|
||||
/*
|
||||
|
|
@ -840,6 +839,7 @@ int allow_ipc_filtered_msg(struct proc *rp, endpoint_t src_e,
|
|||
|
||||
/* If so, copy it in from the process. */
|
||||
if (get_mtype) {
|
||||
/* FIXME: offsetof may be undefined */
|
||||
r = data_copy(src_e,
|
||||
m_src_v + K_OFFSETOF(message, m_type), KERNEL,
|
||||
(vir_bytes)&m_buff.m_type, sizeof(m_buff.m_type));
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ int do_copy(struct proc * caller, message * m_ptr)
|
|||
if(m_ptr->m_lsys_krn_sys_copy.flags & CP_FLAG_TRY) {
|
||||
int r;
|
||||
KASSERT(caller->p_endpoint == VFS_PROC_NR);
|
||||
|
||||
r = virtual_copy(&vir_addr[_SRC_], &vir_addr[_DST_], bytes);
|
||||
if(r == EFAULT_SRC || r == EFAULT_DST) return r = EFAULT; // EFAULT* might be undefined
|
||||
return r;
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ int do_getmcontext(struct proc * caller, message * m_ptr)
|
|||
save_fpu(rp);
|
||||
mc.mc_flags = (rp->p_misc_flags & MF_FPU_INITIALIZED) ? _MC_FPU_SAVED : 0;
|
||||
KASSERT(sizeof(mc.__fpregs.__fp_reg_set) == FPU_XFP_SIZE);
|
||||
|
||||
kmemcpy(&(mc.__fpregs.__fp_reg_set), rp->p_seg.fpu_state, FPU_XFP_SIZE); // MODIFIED
|
||||
}
|
||||
#endif
|
||||
|
|
@ -101,6 +102,7 @@ int do_setmcontext(struct proc * caller, message * m_ptr)
|
|||
if (mc.mc_flags & _MC_FPU_SAVED) {
|
||||
rp->p_misc_flags |= MF_FPU_INITIALIZED;
|
||||
KASSERT(sizeof(mc.__fpregs.__fp_reg_set) == FPU_XFP_SIZE);
|
||||
|
||||
kmemcpy(rp->p_seg.fpu_state, &(mc.__fpregs.__fp_reg_set), FPU_XFP_SIZE); // MODIFIED
|
||||
} else
|
||||
rp->p_misc_flags &= ~MF_FPU_INITIALIZED;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ int do_runctl(struct proc * caller, message * m_ptr)
|
|||
break;
|
||||
case RC_RESUME:
|
||||
KASSERT(RTS_ISSET(rp, RTS_PROC_STOP));
|
||||
|
||||
RTS_UNSET(rp, RTS_PROC_STOP);
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -265,6 +265,7 @@ int verify_grant(
|
|||
/* If requested, store information regarding soft faults. */
|
||||
if (sfinfo != NULL && (sfinfo->try = !!(g.cp_flags & CPF_TRY))) { // MODIFIED (NULL)
|
||||
sfinfo->endpt = granter;
|
||||
/* FIXME: offsetof may be undefined */
|
||||
sfinfo->addr = priv(granter_proc)->s_grant_table +
|
||||
sizeof(g) * grant_idx + K_OFFSETOF(cp_grant_t, cp_faulted);
|
||||
sfinfo->value = grant;
|
||||
|
|
@ -414,6 +415,7 @@ int do_vsafecopy(struct proc * caller, message * m_ptr)
|
|||
/* Set vector copy parameters. */
|
||||
src.proc_nr_e = caller->p_endpoint;
|
||||
KASSERT(src.proc_nr_e != NONE);
|
||||
|
||||
src.offset = (vir_bytes) m_ptr->m_lsys_krn_vsafecopy.vec_addr;
|
||||
dst.proc_nr_e = KERNEL;
|
||||
dst.offset = (vir_bytes) vec;
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ int do_trace(struct proc * caller, message * m_ptr)
|
|||
return(EFAULT); // EFAULT might be undefined
|
||||
|
||||
if (i == K_OFFSETOF(struct proc, p_reg.psw))
|
||||
|
||||
/* only selected bits are changeable */
|
||||
SETPSW(rp, tr_data);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
#include <klib/include/kstring.h>
|
||||
#include <klib/include/kmemory.h>
|
||||
|
||||
|
||||
#if USE_UPDATE
|
||||
|
||||
#define DEBUG 0
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ int do_vmctl(struct proc * caller, message * m_ptr)
|
|||
switch(m_ptr->SVMCTL_PARAM) {
|
||||
case VMCTL_CLEAR_PAGEFAULT:
|
||||
KASSERT(RTS_ISSET(p,RTS_PAGEFAULT));
|
||||
LDER(RTS_ISSET(p,RTS_PAGEFAULT)); // MODIFIED
|
||||
RTS_UNSET(p, RTS_PAGEFAULT);
|
||||
return OK;
|
||||
case VMCTL_MEMREQ_GET:
|
||||
|
|
@ -144,6 +145,7 @@ int do_vmctl(struct proc * caller, message * m_ptr)
|
|||
return OK;
|
||||
case VMCTL_VMINHIBIT_CLEAR:
|
||||
KASSERT(RTS_ISSET(p, RTS_VMINHIBIT));
|
||||
|
||||
/*
|
||||
* the processes is certainly not runnable, no need to tell its
|
||||
* cpu
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ int do_vumap(struct proc *caller, message *m_ptr)
|
|||
/* Copy out the resulting vector of physical addresses. */
|
||||
KASSERT(pcount > 0);
|
||||
|
||||
|
||||
size = pcount * sizeof(pvec[0]);
|
||||
|
||||
r = data_copy_vmcheck(caller, KERNEL, (vir_bytes) pvec, endpt, paddr, size);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user