Various changes, including new ptrace support and modified exec support.

Some clean-up of code is done.
This commit is contained in:
phil 1993-09-13 07:26:47 +00:00
parent 5e277797c4
commit 3b4c805248
4 changed files with 99 additions and 28 deletions

View File

@ -30,7 +30,7 @@
*
* locore.s
*
* $Id: locore.s,v 1.1.1.1 1993/09/09 23:53:47 phil Exp $
* $Id: locore.s,v 1.2 1993/09/13 07:26:47 phil Exp $
*/
/*
@ -290,15 +290,17 @@ ENTRY (_get_fp)
ENTRY(bpt_to_monitor)
/* Switch to monitor's stack. */
ints_off
bicpsrw PSR_S /* make sure we are using sp0. */
sprd psr, tos /* Push the current psl. */
ints_off
save [r1,r2,r3]
save [r1,r2,r3,r4]
sprd sp, r1 /* save kernel's sp */
sprd fp, r2 /* save kernel's fp */
sprd intbase, r3 /* Save current intbase. */
smr ptb0, r4 /* Save current ptd! */
/* Change to low addresses */
lmr ptb0, _IdlePTD(pc) /* Load the idle ptd */
addr low(pc), r0
andd ~KERNBASE, r0
movd r0, tos
@ -318,8 +320,14 @@ low:
lprd fp, r2 /* restore kernel's fp */
lprd sp, r1 /* restore kernel's sp */
lmr mcr, r0
restore [r1,r2,r3]
addr highagain(pc), r0
ord KERNBASE, r0
jump 0(r0)
highagain:
lmr ptb0, r4 /* Get the last ptd! */
restore [r1,r2,r3,r4]
lprd psr, tos /* restore psl */
ints_on
ret 0

View File

@ -35,14 +35,14 @@
*
* @(#)machdep.c 7.4 (Berkeley) 6/3/91
*
* $Id: machdep.c,v 1.1.1.1 1993/09/09 23:53:47 phil Exp $
* $Id: machdep.c,v 1.2 1993/09/13 07:26:49 phil Exp $
*/
/*
* Modified for the pc532 by Phil Nelson. 2/3/93
*/
static char rcsid[] = "$Header: /cvsroot/src/sys/arch/pc532/pc532/Attic/machdep.c,v 1.1.1.1 1993/09/09 23:53:47 phil Exp $";
static char rcsid[] = "$Header: /cvsroot/src/sys/arch/pc532/pc532/Attic/machdep.c,v 1.2 1993/09/13 07:26:49 phil Exp $";
#include "param.h"
#include "systm.h"
@ -70,6 +70,7 @@ static char rcsid[] = "$Header: /cvsroot/src/sys/arch/pc532/pc532/Attic/machdep.
vm_map_t buffer_map;
#include "machine/psl.h"
#include "machine/reg.h"
#include "machine/cpu.h"
#include "icu.h"
@ -77,6 +78,9 @@ vm_map_t buffer_map;
extern vm_offset_t avail_end;
extern struct user *proc0paddr;
/* A local function... */
void reboot_cpu();
/*
* Declare these as initialized data so we can patch them.
*/
@ -199,7 +203,7 @@ _low_level_init ()
/* Load the ptb0 register and start mapping. */
_mapped = 1;
_mapped = 1;
_load_ptb0 (p0);
asm(" lmr mcr, 3"); /* Start the machine mapping, 1 vm space. */
@ -604,6 +608,7 @@ boot(arghowto)
for(;;);
}
howto = arghowto;
printf ("boot: howto=0x%x\n", howto);
#if 0
if ((howto&RB_NOSYNC) == 0 && waittime < 0 && bfreelist[0].b_forw) {
register struct buf *bp;
@ -641,23 +646,34 @@ boot(arghowto)
#endif /* if 0 */
splhigh();
devtype = major(rootdev);
#if 0
if (howto&RB_HALT) {
pg("\nThe operating system has halted. Please press any key to reboot.\n\n");
} else {
if (howto & RB_DUMP) {
savectx(&dumppcb, 0);
dumppcb.pcb_ptd = _get_ptb0();
dumpsys();
/*NOTREACHED*/
}
printf ("\nThe operating system has halted.\n\n");
cpu_reset();
for(;;) ;
/*NOTREACHED*/
}
#ifdef lint
dummy = 0; dummy = dummy;
printf("howto %d, devtype %d\n", arghowto, devtype);
if (howto & RB_DUMP) {
#if 1
/* dump the stack! */
{ int *fp = (int *)_get_fp();
int i=0;
while ((u_int)fp < (u_int)UPT_MIN_ADDRESS-40) {
printf ("0x%x (@0x%x), ", fp[1], fp);
fp = (int *)fp[0];
if (++i == 3) { printf ("\n"); i=0; }
}
}
#else
savectx(&dumppcb, 0);
dumppcb.pcb_ptd = _get_ptb0();
dumpsys();
/*NOTREACHED*/
#endif
#endif /* if 0 */
cpu_reset();
}
reboot_cpu();
for(;;) ;
/*NOTREACHED*/
}
@ -711,7 +727,7 @@ physstrat(bp, strat, prio)
* Strange exec values! (Do we want to support a minix a.out header?)
*/
int
cpu_exec_makecmds()
cpu_exec_aout_makecmds()
{
return ENOEXEC;
};
@ -938,6 +954,43 @@ dumpsys()
}
#endif
/* ptrace support is next. */
int
ptrace_set_pc (struct proc *p, unsigned int addr)
{
register int *regs = p->p_regs;
regs[PC] = addr;
return 0;
}
int
ptrace_single_step (struct proc *p)
{
register int *regs = p->p_regs;
regs[PSR] |= PSL_T;
return 0;
}
int
ptrace_getregs (struct proc *p, unsigned int *addr)
{
register int *regs;
regs = p->p_regs;
return copyout (regs, addr, NIPCREG*sizeof(int));
}
int
ptrace_setregs (struct proc *p, unsigned int *addr)
{
register int *regs = p->p_regs;
return copyin (addr, regs, NIPCREG*sizeof(int));
}
/* Final little things that need to be here to get it to link or
are not available on the system. */
@ -962,3 +1015,11 @@ void bad_intr (struct intrframe frame)
splx(x);
}
/* Stub function for reboot_cpu. */
void reboot_cpu()
{
printf ("Should be rebooting! Hit reset!\n");
while (1);
}

View File

@ -36,7 +36,7 @@
*
* @(#)pmap.c 7.7 (Berkeley) 5/12/91
*
* $Id: pmap.c,v 1.1.1.1 1993/09/09 23:53:49 phil Exp $
* $Id: pmap.c,v 1.2 1993/09/13 07:26:50 phil Exp $
*/
/*
@ -315,7 +315,6 @@ pmap_bootstrap(firstaddr, loadaddr)
struct pte *pte;
#endif
extern vm_offset_t maxmem, physmem;
extern int IdlePTD;
ns532pagesperpage = PAGE_SIZE / NS532_PAGE_SIZE;

View File

@ -37,13 +37,13 @@
*
* @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
*
* $Id: vm_machdep.c,v 1.1.1.1 1993/09/09 23:53:50 phil Exp $
* $Id: vm_machdep.c,v 1.2 1993/09/13 07:26:52 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.1.1.1 1993/09/09 23:53:50 phil Exp $";
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 $";
#include "param.h"
#include "systm.h"
@ -154,6 +154,9 @@ cpu_exit(p)
#endif
splclock();
swtch();
/* Not reached. */
panic ("cpu_exit! swtch returned!");
while (1);
}
void
@ -384,11 +387,11 @@ vunmapbuf(bp)
}
/*
* Force reset the processor by invalidating the entire address space!
* (Force reset the processor by invalidating the entire address space!)
* Well, lets just hang!
*/
cpu_reset()
{
splhigh();
printf ("\n\nMachine halted. Push reset.\n\n");
while (1);
}