Various ... reg.h changes, bug fixes, cpu_switch, ...

This commit is contained in:
phil 1994-05-20 06:44:26 +00:00
parent a69b1b6104
commit 42fb05a042
6 changed files with 58 additions and 64 deletions

View File

@ -35,7 +35,7 @@
*
* @(#)clock.c 7.2 (Berkeley) 5/12/91
*
* $Id: clock.c,v 1.5 1994/05/17 17:31:32 phil Exp $
* $Id: clock.c,v 1.6 1994/05/20 06:44:26 phil Exp $
*/
/*
@ -63,7 +63,6 @@ startrtclock()
WR_ADR (unsigned short, ICU_ADR + HCSV, timer);
WR_ADR (unsigned short, ICU_ADR + HCCV, timer);
printf ("startrtclock\n");
}
/* convert 2 digit BCD number */
@ -126,11 +125,9 @@ inittodr(base)
unsigned int sec;
int leap;
printf ("inittodr\n");
if (!have_rtc)
{
time.tv_sec = 0;
time.tv_sec = base;
return;
}
@ -139,11 +136,12 @@ printf ("inittodr\n");
rw_rtc ( buffer, 0); /* Read the rtc. */
/* Check to see if it was really the rtc by checking for bad date info. */
if (buffer[1] > 59 || buffer[2] > 59 || buffer[3] > 23 || buffer[5] > 31
|| buffer[6] > 12)
if (bcd(buffer[1]) > 59 || bcd(buffer[2]) > 59 || bcd(buffer[3]) > 23
|| bcd(buffer[5]) > 31 || bcd(buffer[6]) > 12)
{
printf ("inittodr: No clock found\n");
have_rtc = 0;
time.tv_sec = 0;
time.tv_sec = base;
return;
}
@ -157,6 +155,9 @@ printf ("inittodr\n");
sec -= 24*60*60; /* XXX why ??? Compensate for Jan 1, 1970??? */
if (sec < base)
printf ("WARNING: clock is earlier than last shutdown time.\n");
time.tv_sec = sec;
time.tv_usec = 0;
}
@ -175,7 +176,6 @@ resettodr()
*/
enablertclock()
{
printf ("enablertclock()\n");
/* Set the clock interrupt enable (CICTL) */
WR_ADR (unsigned char, ICU_ADR +CICTL, 0x30);
PL_zero |= SPL_CLK | SPL_SOFTCLK | SPL_NET | SPL_IMP;
@ -198,10 +198,8 @@ DELAY(n)
int
cpu_initclocks()
{
printf ("cpu_initclocks\n");
startrtclock();
enablertclock();
inittodr(0);
}
int

View File

@ -1,4 +1,3 @@
#define DEBUG
/*
* Copyright (c) 1993 Philip A. Nelson.
* All rights reserved.
@ -32,7 +31,7 @@
*
* icode.c
*
* $Id: icode.c,v 1.3 1994/05/17 17:31:35 phil Exp $
* $Id: icode.c,v 1.4 1994/05/20 06:44:28 phil Exp $
*/
/*
* This is the "user" code for process 1 that execs /sbin/init.

View File

@ -641,8 +641,8 @@ rem2:
/* Switch to another process from kernel code... */
ENTRY(swtch)
ints_off /* to make sure swtch runs to completion. */
ENTRY(cpu_switch)
ints_off /* to make sure cpu_switch runs to completion. */
enter [r0,r1,r2,r3,r4,r5,r6,r7],0
/* addqd 1, _cnt+V_SWTCH(pc) */
@ -728,7 +728,7 @@ Idle:
wait /* Wait for interrupt. */
br sw1
m_setrq: .asciz "Setrq problem!"
m_setrq: .asciz "Setrunqueue problem!"
m_remrq: .asciz "Remrq problem!"
/* As part of the fork operation, we need to prepare a user are for

View File

@ -88,8 +88,8 @@ void reboot_cpu();
/* the following is used externally (sysctl_hw) */
char machine[] = "ns32k"; /* cpu "architecture" */
char cpu_model[120] = "32532";
char machine[] = "pc532";
char cpu_model[] = "ns32532";
/*
* Declare these as initialized data so we can patch them.
@ -554,7 +554,7 @@ sendsig(catcher, sig, mask, code)
ps->ps_sigstk.ss_size - sizeof(struct sigframe));
ps->ps_sigstk.ss_flags |= SA_ONSTACK;
} else {
fp = (struct sigframe *)(regs[SP]
fp = (struct sigframe *)(regs[REG_SP]
- sizeof(struct sigframe));
}
@ -591,13 +591,13 @@ sendsig(catcher, sig, mask, code)
*/
fp->sf_sc.sc_onstack = oonstack;
fp->sf_sc.sc_mask = mask;
fp->sf_sc.sc_sp = regs[SP];
fp->sf_sc.sc_fp = regs[FP];
fp->sf_sc.sc_pc = regs[PC];
fp->sf_sc.sc_ps = regs[PSR];
fp->sf_sc.sc_sb = regs[SB];
regs[SP] = (int)fp;
regs[PC] = (int)(((char *)PS_STRINGS) - (esigcode - sigcode));
fp->sf_sc.sc_sp = regs[REG_SP];
fp->sf_sc.sc_fp = regs[REG_FP];
fp->sf_sc.sc_pc = regs[REG_PC];
fp->sf_sc.sc_ps = regs[REG_PSR];
fp->sf_sc.sc_sb = regs[REG_SB];
regs[REG_SP] = (int)fp;
regs[REG_PC] = (int)(((char *)PS_STRINGS) - (esigcode - sigcode));
}
/*
@ -623,7 +623,7 @@ sigreturn(p, uap, retval)
register struct sigcontext *scp;
register struct sigframe *fp;
register int *regs = p->p_md.md_regs;
fp = (struct sigframe *) regs[SP] ;
fp = (struct sigframe *) regs[REG_SP] ;
if (useracc((caddr_t)fp, sizeof (*fp), 0) == 0)
return(EINVAL);
@ -645,11 +645,11 @@ sigreturn(p, uap, retval)
p->p_sigacts->ps_sigstk.ss_flags &= ~SA_ONSTACK;
p->p_sigmask = scp->sc_mask &~
(sigmask(SIGKILL)|sigmask(SIGCONT)|sigmask(SIGSTOP));
regs[FP] = scp->sc_fp;
regs[SP] = scp->sc_sp;
regs[PC] = scp->sc_pc;
regs[PSR] = scp->sc_ps;
regs[SB] = scp->sc_sb;
regs[REG_FP] = scp->sc_fp;
regs[REG_SP] = scp->sc_sp;
regs[REG_PC] = scp->sc_pc;
regs[REG_PSR] = scp->sc_ps;
regs[REG_SB] = scp->sc_sb;
return(EJUSTRETURN);
}
@ -1035,7 +1035,7 @@ ptrace_set_pc (struct proc *p, unsigned int addr)
{
register int *regs = p->p_md.md_regs;
regs[PC] = addr;
regs[REG_PC] = addr;
return 0;
}
@ -1044,7 +1044,7 @@ ptrace_single_step (struct proc *p)
{
register int *regs = p->p_md.md_regs;
regs[PSR] |= PSL_T;
regs[REG_PSR] |= PSL_T;
return 0;
}

View File

@ -329,13 +329,13 @@ out:
* our priority without moving us from one queue to another
* (since the running process is not on a queue.)
* If that happened after we setrunqueue ourselves but
* before we swtch()'ed, we might not be on the queue
* before we switch()'ed, we might not be on the queue
* indicated by our priority.
*/
(void) splclock();
(void) splstatclock();
setrunqueue(p);
p->p_stats->p_ru.ru_nivcsw++;
swtch();
mi_switch();
(void) splnone();
while (i = CURSIG(p))
postsig(i);
@ -392,7 +392,7 @@ syscall(frame)
#ifdef notdef
sticks = p->p_stime;
#endif
code = frame.sf_reg[R0];
code = frame.sf_reg[REG_R0];
p->p_md.md_regs = (int *) & (frame.sf_reg);
params = (caddr_t)frame.sf_usp + sizeof (int) ;
@ -438,7 +438,7 @@ if (code == -1 && p->p_pid == 1) {
if ((i = callp->sy_narg * sizeof (int)) &&
(error = copyin(params, (caddr_t)args, (u_int)i))) {
frame.sf_reg[R0] = error;
frame.sf_reg[REG_R0] = error;
frame.sf_psr |= PSL_C;
#ifdef SYSCALL_DEBUG
scdebug_call(p, code, callp->sy_narg, args);
@ -463,11 +463,11 @@ if (code == -1 && p->p_pid == 1) {
frame.sf_pc = opc;
else if (error != EJUSTRETURN) {
if (error) {
frame.sf_reg[R0] = error;
frame.sf_reg[REG_R0] = error;
frame.sf_psr |= PSL_C;
} else {
frame.sf_reg[R0] = rval[0];
frame.sf_reg[R1] = rval[1];
frame.sf_reg[REG_R0] = rval[0];
frame.sf_reg[REG_R1] = rval[1];
frame.sf_psr &= ~PSL_C;
}
}
@ -488,13 +488,13 @@ done:
* our priority without moving us from one queue to another
* (since the running process is not on a queue.)
* If that happened after we setrunqeue ourselves but before
* we swtch()'ed, we might not be on the queue indicated by
* we switch()'ed, we might not be on the queue indicated by
* our priority.
*/
(void) splclock();
(void) splstatclock();
setrunqueue(p);
p->p_stats->p_ru.ru_nivcsw++;
swtch();
mi_switch();
(void) splnone();
while (i = CURSIG(p))
postsig(i);

View File

@ -37,25 +37,26 @@
*
* @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
*
* $Id: vm_machdep.c,v 1.2 1993/09/13 07:26:52 phil Exp $
* $Id: vm_machdep.c,v 1.3 1994/05/20 06:44:35 phil Exp $
*/
/*
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
*/
static char rcsid[] = "$Header: /cvsroot/src/sys/arch/pc532/pc532/Attic/vm_machdep.c,v 1.2 1993/09/13 07:26:52 phil Exp $";
static char rcsid[] = "$Header: /cvsroot/src/sys/arch/pc532/pc532/Attic/vm_machdep.c,v 1.3 1994/05/20 06:44:35 phil Exp $";
#include "param.h"
#include "systm.h"
#include "proc.h"
#include "malloc.h"
#include "buf.h"
#include "user.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/malloc.h>
#include <sys/buf.h>
#include <user.h>
#include "../include/cpu.h"
#include <vm/vm.h>
#include <vm/vm_kern.h>
#include <machine/cpu.h>
#include "vm/vm.h"
#include "vm/vm_kern.h"
/*
* Finish a fork operation, with process p2 nearly set up.
@ -139,8 +140,8 @@ cpu_exit(p)
kmem_free(kernel_map, (vm_offset_t)p->p_addr, ctob(UPAGES));
p->p_addr = (struct user *) &nullpcb;
splclock();
swtch();
splstatclock();
cpu_switch();
/* NOTREACHED */
}
#else
@ -149,14 +150,10 @@ cpu_exit(p)
register struct proc *p;
{
#if NNPX > 0
npxexit(p);
#endif
splclock();
swtch();
splstatclock();
cpu_switch();
/* Not reached. */
panic ("cpu_exit! swtch returned!");
while (1);
}
void