From: Jorrit Herder Date: Tue, 19 Jul 2005 15:01:47 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: v3.1.0~593 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/index.css?a=commitdiff_plain;h=1d7bdd4ab15278e73edc922625cacaaaa8b85acd;p=minix.git *** empty log message *** --- diff --git a/kernel/Makefile b/kernel/Makefile index 259e6a1b4..20ccab4bf 100755 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -31,7 +31,7 @@ kernel build install: $(HEAD) $(OBJS) clean: cd system && $(MAKE) -$(MAKEFLAGS) $@ - rm -f *.a *.o *.bak kernel + rm -f *.a *.o *~ *.bak kernel depend: cd system && $(MAKE) -$(MAKEFLAGS) $@ diff --git a/kernel/exception.c b/kernel/exception.c index 6e19ed645..59eb67553 100755 --- a/kernel/exception.c +++ b/kernel/exception.c @@ -52,6 +52,10 @@ unsigned vec_nr; return; } + /* If an exception occurs while running a process, the k_reenter variable + * will be zero. Exceptions in interrupt handlers or system traps will make + * k_reenter larger than zero. + */ if (k_reenter == 0 && ! iskernelp(saved_proc)) { cause_sig(proc_nr(saved_proc), ep->signum); return; @@ -62,7 +66,8 @@ unsigned vec_nr; kprintf("\nIntel-reserved exception %d\n", vec_nr); else kprintf("\n%s\n", karg(ep->msg)); - kprintf("process number %d, ", proc_nr(saved_proc)); + kprintf("process number %d ", proc_nr(saved_proc)); + kprintf("(%s), ", saved_proc->p_name); kprintf("pc = %d:", (unsigned) saved_proc->p_reg.cs); kprintf("0x%x\n", (unsigned) saved_proc->p_reg.pc); diff --git a/kernel/klibc.c b/kernel/klibc.c index 113ae5856..ab885b952 100644 --- a/kernel/klibc.c +++ b/kernel/klibc.c @@ -4,7 +4,6 @@ * can be slightly different. * March 2005, Jorrit N. Herder. * Entrypoints into this file: - * katoi: convert string to integer * kmemcpy: copy n bytes from pointer p1 to pointer p2 * kmemset: set n bytes to c starting at pointer p * kprintf: printf for the kernel (see working below) @@ -28,23 +27,6 @@ FORWARD _PROTOTYPE(void kputc, (int c)); -/*=========================================================================* - * katoi * - *=========================================================================*/ -PUBLIC int katoi(register const char *s) -{ - int value = 0; /* default value */ - int sign = 1; /* assume positive */ - - while(*s == ' ') s++; /* skip spaces */ - if (*s == '-') { sign = -1; s++; } /* detect sign */ - while(isdigit(*s)) /* get integer */ - value = value*10 + (*s++) -'0'; - - return(sign * value); /* return result */ -} - - /*=========================================================================* * kmemcpy * *=========================================================================*/ diff --git a/kernel/proc.c b/kernel/proc.c index 70cf8a7d0..ca235b4ec 100755 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -183,11 +183,8 @@ message *m_ptr; /* pointer to message in the caller's space */ break; case NOTIFY: result = mini_notify(caller_ptr, src_dst, m_ptr); -#if TEMP_CODE break; case ECHO: - kprintf("Echo message from process %s\n", proc_nr(caller_ptr)); -#endif CopyMess(caller_ptr->p_nr, caller_ptr, m_ptr, caller_ptr, m_ptr); result = OK; break; diff --git a/kernel/proto.h b/kernel/proto.h index cef1817e7..265ce8e70 100755 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -16,7 +16,6 @@ _PROTOTYPE( void set_timer, (struct timer *tp, clock_t t, tmr_func_t f) ); _PROTOTYPE( void reset_timer, (struct timer *tp) ); /* klibc.c */ -_PROTOTYPE( int katoi, (register const char *s)); _PROTOTYPE( void *kmemcpy, (void *s1, const void *s2, register size_t n)); _PROTOTYPE( void *kmemset, (void *s, register int c, register size_t n)); _PROTOTYPE( int kstrcmp, (register const char *s1, register const char *s2)); diff --git a/kernel/start.c b/kernel/start.c index bf82c6f92..ab7d83214 100755 --- a/kernel/start.c +++ b/kernel/start.c @@ -11,6 +11,7 @@ #include "kernel.h" #include "protect.h" #include "proc.h" +#include FORWARD _PROTOTYPE( char *get_value, (_CONST char *params, _CONST char *key)); @@ -64,7 +65,7 @@ U16_t parmoff, parmsize; /* boot parameters offset and length */ kinfo.kmem_size = (phys_bytes) &end; /* Processor? 86, 186, 286, 386, ... */ - machine.processor=katoi(get_value(params, "processor")); + machine.processor=atoi(get_value(params, "processor")); /* Decide if mode is protected for older machines. */ #if _WORD_SIZE == 2 diff --git a/kernel/system.c b/kernel/system.c index 1f965e382..bfe596895 100755 --- a/kernel/system.c +++ b/kernel/system.c @@ -13,6 +13,7 @@ * there are several other minor entry points: * send_sig: send signal directly to a system process * cause_sig: take action to cause a signal to occur via PM + * init_proc: initialize a process, during start up or fork * clear_proc: clean up a process in the process table, e.g. on exit * umap_local: map virtual address in LOCAL_SEG to physical * umap_remote: map virtual address in REMOTE_SEG to physical @@ -216,7 +217,7 @@ int proc_nr; /* slot of process to clean up */ rc = proc_addr(proc_nr); /* Turn off any alarm timers at the clock. */ - reset_timer(&rc->p_priv->s_alarm_timer); + reset_timer(&priv(rc)->s_alarm_timer); /* Make sure the exiting process is no longer scheduled. */ if (rc->p_rts_flags == 0) lock_unready(rc); @@ -248,11 +249,11 @@ int proc_nr; /* slot of process to clean up */ irq_hooks[i].proc_nr = NONE; } +#if TEMP_CODE /* Check if there are pending notifications. Release the buffers. */ while (rc->p_ntf_q != NULL) { i = (int) (rc->p_ntf_q - ¬ify_buffer[0]); free_bit(i, notify_bitmap, NR_NOTIFY_BUFS); -#if TEMP_CODE rc->p_ntf_q = rc->p_ntf_q->n_next; } #endif diff --git a/kernel/system/Makefile b/kernel/system/Makefile index a9d3d72c9..ac5d04984 100644 --- a/kernel/system/Makefile +++ b/kernel/system/Makefile @@ -48,7 +48,7 @@ $(SYSTEM): $(OBJECTS) aal cr $@ *.o clean: - rm -f $(SYSTEM) *.o *.bak + rm -f $(SYSTEM) *.o *~ *.bak depend: /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend diff --git a/kernel/system/do_exec.c b/kernel/system/do_exec.c index c8db74a28..b7ba512e0 100644 --- a/kernel/system/do_exec.c +++ b/kernel/system/do_exec.c @@ -3,9 +3,6 @@ * * The parameters for this system call are: * m1_i1: PR_PROC_NR (process that did exec call) -#if DEAD_CODE - * m1_i3: PR_TRACING (flag to indicate tracing is on/ off) -#endif * m1_p1: PR_STACK_PTR (new stack pointer) * m1_p2: PR_NAME_PTR (pointer to program name) * m1_p3: PR_IP_PTR (new instruction pointer) @@ -28,9 +25,6 @@ register message *m_ptr; /* pointer to request message */ char *np; rp = proc_addr(m_ptr->PR_PROC_NR); -#if DEAD_CODE - if (m_ptr->PR_TRACING) cause_sig(m_ptr->PR_PROC_NR, SIGTRAP); -#endif sp = (reg_t) m_ptr->PR_STACK_PTR; rp->p_reg.sp = sp; /* set the stack pointer */ #if (CHIP == M68000) diff --git a/kernel/system/do_sigreturn.c b/kernel/system/do_sigreturn.c index e3d131ed9..052b450df 100644 --- a/kernel/system/do_sigreturn.c +++ b/kernel/system/do_sigreturn.c @@ -8,6 +8,7 @@ */ #include "../system.h" +#include #include #include @@ -61,7 +62,7 @@ message *m_ptr; /* pointer to request message */ #endif /* Restore the registers. */ - kmemcpy(&rp->p_reg, (char *)&sc.sc_regs, sizeof(struct sigregs)); + memcpy(&rp->p_reg, (char *)&sc.sc_regs, sizeof(struct sigregs)); return(OK); } #endif /* USE_SIGRETURN */ diff --git a/kernel/system/do_sigsend.c b/kernel/system/do_sigsend.c index 0656a4cac..f298b948d 100644 --- a/kernel/system/do_sigsend.c +++ b/kernel/system/do_sigsend.c @@ -10,6 +10,7 @@ #include "../system.h" #include +#include #include #if USE_SIGSEND @@ -40,7 +41,7 @@ message *m_ptr; /* pointer to request message */ scp = (struct sigcontext *) smsg.sm_stkptr - 1; /* Copy the registers to the sigcontext structure. */ - kmemcpy(&sc.sc_regs, &rp->p_reg, sizeof(struct sigregs)); + memcpy(&sc.sc_regs, &rp->p_reg, sizeof(struct sigregs)); /* Finish the sigcontext initialization. */ sc.sc_flags = SC_SIGCONTEXT;