From de1b5e007699f9f4b9e395caa1ef07a14a06c915 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Mon, 8 Jun 2009 06:08:11 +0000 Subject: [PATCH] cleanup, sanity checking --- kernel/arch/i386/memory.c | 4 +++- kernel/arch/i386/mpx386.s | 1 + kernel/clock.c | 9 +++++++++ servers/pm/misc.c | 3 --- tools/release.sh | 7 ++++--- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/kernel/arch/i386/memory.c b/kernel/arch/i386/memory.c index 14f90d5fd..37b88447d 100644 --- a/kernel/arch/i386/memory.c +++ b/kernel/arch/i386/memory.c @@ -142,7 +142,6 @@ int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr, NOREC_ENTER(linlincopy); vmassert(vm_running); - vmassert(!catch_pagefaults); vmassert(nfreepdes >= 3); vmassert(ptproc); @@ -219,8 +218,11 @@ PRIVATE void vm_set_cr3(struct proc *newptproc) if(!intr_disabled()) { lock; u = 1; } vm_cr3= newptproc->p_seg.p_cr3; if(vm_cr3) { + vmassert(intr_disabled()); level0(set_cr3); + vmassert(intr_disabled()); ptproc = newptproc; + vmassert(intr_disabled()); } if(u) { unlock; } } diff --git a/kernel/arch/i386/mpx386.s b/kernel/arch/i386/mpx386.s index 36b2a0bf8..3c2248c48 100755 --- a/kernel/arch/i386/mpx386.s +++ b/kernel/arch/i386/mpx386.s @@ -403,6 +403,7 @@ _restart: ! Restart the current process or the next process if it is set. + cli call _schedcheck ! ask C function who we're running mov esp, (_proc_ptr) ! will assume P_STACKBASE == 0 lldt P_LDT_SEL(esp) ! enable process' segment descriptors diff --git a/kernel/clock.c b/kernel/clock.c index a1a65cd98..12d70ef01 100755 --- a/kernel/clock.c +++ b/kernel/clock.c @@ -99,6 +99,7 @@ message *m_ptr; /* pointer to request message */ /* Despite its name, this routine is not called on every clock tick. It * is called on those clock ticks when a lot of work needs to be done. */ + vmassert(!vm_running || (read_cr3() == ptproc->p_seg.p_cr3)); /* A process used up a full quantum. The interrupt handler stored this * process in 'prev_ptr'. First make sure that the process is not on the @@ -120,12 +121,17 @@ message *m_ptr; /* pointer to request message */ } } + vmassert(!vm_running || (read_cr3() == ptproc->p_seg.p_cr3)); /* Check if a clock timer expired and run its watchdog function. */ if (next_timeout <= realtime) { + vmassert(!vm_running || (read_cr3() == ptproc->p_seg.p_cr3)); tmrs_exptimers(&clock_timers, realtime, NULL); + vmassert(!vm_running || (read_cr3() == ptproc->p_seg.p_cr3)); next_timeout = (clock_timers == NULL) ? TMR_NEVER : clock_timers->tmr_exp_time; + vmassert(!vm_running || (read_cr3() == ptproc->p_seg.p_cr3)); } + vmassert(!vm_running || (read_cr3() == ptproc->p_seg.p_cr3)); return; } @@ -188,6 +194,8 @@ irq_hook_t *hook; if(minix_panicing) return; + vmassert(!vm_running || (read_cr3() == ptproc->p_seg.p_cr3)); + /* Get number of ticks and update realtime. */ ticks = lost_ticks + 1; lost_ticks = 0; @@ -223,6 +231,7 @@ irq_hook_t *hook; if (do_serial_debug) do_ser_debug(); + vmassert(!vm_running || (read_cr3() == ptproc->p_seg.p_cr3)); return(1); /* reenable interrupts */ } diff --git a/servers/pm/misc.c b/servers/pm/misc.c index 551cac882..76e4c81eb 100644 --- a/servers/pm/misc.c +++ b/servers/pm/misc.c @@ -346,12 +346,9 @@ PUBLIC int do_getprocnr() if (((rmp->mp_flags & (IN_USE | ZOMBIE)) == IN_USE) && strncmp(rmp->mp_name, search_key, key_len)==0) { mp->mp_reply.endpt = rmp->mp_endpoint; - printf("PM: name %s result: %d\n", search_key, - rmp->mp_endpoint); return(OK); } } - printf("PM: name %s result: ESRCH\n", search_key); return(ESRCH); } else { /* return own/parent process number */ #if 0 diff --git a/tools/release.sh b/tools/release.sh index 897452148..47ef972dc 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -3,6 +3,7 @@ set -e XBIN=usr/xbin +BRANCHNAME=src.beng-working.r4327 SRC=src # size of /tmp during build @@ -136,7 +137,7 @@ do done if [ ! "$USRMB" ] -then USRMB=550 +then USRMB=120 fi echo $USRMB MB @@ -232,10 +233,10 @@ chmod -R u+w $RELEASEDIR/usr/lib if [ "$COPY" -ne 1 ] then echo " * Doing new svn export" - REPO=https://gforge.cs.vu.nl/svn/minix/trunk/$SRC + REPO=https://gforge.cs.vu.nl/svn/minix/branches/$BRANCHNAME REVISION="`svn info $USERNAME $SVNREV $REPO | grep '^Revision: ' | awk '{ print $2 }'`" echo "Doing export of revision $REVISION from $REPO." - ( cd $RELEASEDIR/usr && svn $USERNAME export -r$REVISION $REPO ) + ( cd $RELEASEDIR/usr && svn $USERNAME export -r$REVISION $REPO && mv $BRANCHNAME $SRC ) REVTAG=r$REVISION echo " -- 2.44.0