clean:
cd system && $(MAKE) -$(MAKEFLAGS) $@
- rm -f *.a *.o *.bak kernel
+ rm -f *.a *.o *~ *.bak kernel
depend:
cd system && $(MAKE) -$(MAKEFLAGS) $@
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;
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);
* 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)
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 *
*=========================================================================*/
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;
_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));
#include "kernel.h"
#include "protect.h"
#include "proc.h"
+#include <stdlib.h>
FORWARD _PROTOTYPE( char *get_value, (_CONST char *params, _CONST char *key));
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
* 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
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);
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
aal cr $@ *.o
clean:
- rm -f $(SYSTEM) *.o *.bak
+ rm -f $(SYSTEM) *.o *~ *.bak
depend:
/usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend
*
* 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)
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)
*/
#include "../system.h"
+#include <string.h>
#include <signal.h>
#include <sys/sigcontext.h>
#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 */
#include "../system.h"
#include <signal.h>
+#include <string.h>
#include <sys/sigcontext.h>
#if USE_SIGSEND
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;