Make setsoft* use the real software interrupt register.

Integrate several fixes from the amiga port (and drop COMPAT_HPUX for now).
Add lots of debugging checks to pmap.c - still needs work.
This commit is contained in:
gwr 1994-06-28 22:05:41 +00:00
parent d22df96ea2
commit f3d0b50b88
10 changed files with 118 additions and 31 deletions

View File

@ -28,8 +28,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/sun3/autoconf.c,v 1.10 1994/06/14 02:31:09 gwr Exp $
* $Id: autoconf.c,v 1.11 1994/06/28 22:05:41 gwr Exp $
*/
/*
* Setup the system to run on the current machine.
*
@ -89,12 +90,14 @@ int nmi_intr(arg)
void configure()
{
int root_found;
extern int soft1intr();
isr_init();
root_found = config_rootfound("mainbus", NULL);
if (!root_found)
panic("configure: autoconfig failed, no device tree root found");
isr_add(7, nmi_intr, 0);
isr_add(1, soft1intr, 0);
isr_cleanup();
conf_init();
}

View File

@ -1 +1 @@
revision 1.18 intentionally removed
revision 1.19 intentionally removed

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: isr.c,v 1.8 1994/05/27 14:58:29 gwr Exp $
* $Id: isr.c,v 1.9 1994/06/28 22:05:49 gwr Exp $
*/
#include <sys/param.h>
@ -219,7 +219,8 @@ void intrhand(ipl)
}
/*
* XXX - This probably belongs in src/sys/net/netisr.c -gwr
* XXX - This really belongs in some common file, like
* src/sys/net/netisr.c -gwr
*/
netintr()
{
@ -235,6 +236,8 @@ netintr()
* XXX this is bogus: should just have a list of
* routines to call, a la timeouts. Mods to
* netisr are not atomic and must be protected (gah).
* Gordon says:
* How about an array of characters (1 per protocol)?
*/
#ifdef INET
if (n & (1 << NETISR_ARP))
@ -256,3 +259,37 @@ netintr()
}
#endif
}
/*
* Level 1 software interrupt.
* Possible reasons:
* Network software interrupt
* Soft clock interrupt
*/
int
soft1intr(fp)
void *fp;
{
isr_soft_clear(1);
if (sun3sir.sir_any) {
cnt.v_soft++;
if (sun3sir.sir_which[SIR_NET]) {
sun3sir.sir_which[SIR_NET] = 0;
netintr();
}
if (sun3sir.sir_which[SIR_CLOCK]) {
sun3sir.sir_which[SIR_CLOCK] = 0;
softclock();
}
if (sun3sir.sir_which[SIR_SPARE2]) {
sun3sir.sir_which[SIR_SPARE2] = 0;
/* spare2intr(); */
}
if (sun3sir.sir_which[SIR_SPARE3]) {
sun3sir.sir_which[SIR_SPARE3] = 0;
/* spare3intr(); */
}
}
return (1);
}

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: locore2.c,v 1.21 1994/05/06 07:47:12 gwr Exp $
* $Id: locore2.c,v 1.22 1994/06/28 22:06:02 gwr Exp $
*/
#include <sys/param.h>
@ -204,6 +204,7 @@ void u_area_bootstrap(u_va, u_pa)
set_pte(va, pte_proto|PA_PGNUM(pa));
}
/* This is called just before pmap_bootstrap() */
void sun3_vm_init()
{
unsigned int monitor_memory = 0;
@ -212,7 +213,6 @@ void sun3_vm_init()
unsigned char sme;
int valid;
pmeg_init();
va = (vm_offset_t) start;
@ -345,8 +345,9 @@ void sun3_vm_init()
virtual_avail = eva;
/*
* unmap kernel virtual space (only segments. if it squished ptes, bad
* things might happen.
* Unmap kernel virtual space (only segments. if it squished ptes,
* bad things might happen. Also, make sure to leave no valid
* segmap entries in the MMU unless pmeg_array records them.
*/
/* this only works because both are seg bounds*/
@ -356,6 +357,21 @@ void sun3_vm_init()
va = sun3_round_up_seg(va);
}
/*
* Record pmegs in use by DVMA segment.
* I would have preferred to just nuke these, but that
* made the kernel die before we even get to consinit.
* Instead, there is a hack in pmap_enter_kernel (sigh)
*/
va = DVMA_SPACE_START;
while (va < DVMA_SPACE_END) {
sme = get_segmap(va);
if (sme != SEGINV)
pmeg_steal(sme);
va = sun3_round_up_seg(va);
}
/* My sincere apologies for this crud -- glass*/
u_area_va = high_segment_alloc(UPAGES*2);
if (u_area_va != MONSHORTSEG) /* pg 3,4,5 */

View File

@ -38,7 +38,7 @@
* from: Utah Hdr: machdep.c 1.63 91/04/24
* from: @(#)machdep.c 7.16 (Berkeley) 6/3/91
* machdep.c,v 1.3 1993/07/07 07:20:03 cgd Exp
* $Id: machdep.c,v 1.32 1994/06/03 02:08:59 gwr Exp $
* $Id: machdep.c,v 1.33 1994/06/28 22:05:52 gwr Exp $
*/
#include <sys/param.h>
@ -144,6 +144,10 @@ void identifycpu()
printf("Model: %s\n", cpu_model);
}
/* The following two functions assume UPAGES == 3 */
#if UPAGES != 3
#error "UPAGES changed?"
#endif
void save_u_area(pcbp, va)
struct pcb *pcbp;
vm_offset_t va;
@ -170,6 +174,7 @@ void cpu_startup()
int base, residual;
vm_offset_t minaddr, maxaddr, uarea_pages;
/* XXX - Get boot parameters from PROM. */
/* msgbuf mapped earlier, should figure out why? */
printf(version);
@ -539,6 +544,8 @@ struct hpuxsigframe {
};
#endif
#define DEBUG XXX
#ifdef DEBUG
int sigdebug = 0;
int sigpid = 0;
@ -891,7 +898,7 @@ sigreturn(p, uap, retval)
* Grab context as an HP-UX style context and determine if it
* was one that we contructed in sendsig.
*/
if (p->p_emul == COMPAT_HPUX) {
if (p->p_emul == EMUL_HPUX) {
struct hpuxsigcontext *hscp = (struct hpuxsigcontext *)scp;
struct hpuxsigcontext htsigc;
@ -1062,7 +1069,7 @@ void boot(howto)
*/
if (panicstr == 0)
vnode_pager_umount(NULL);
sync((struct proc *)0, (void *)0, (int *)0);
sync(&proc0, (void *)0, (int *)0);
for (iter = 0; iter < 20; iter++) {
nbusy = 0;
@ -1101,8 +1108,8 @@ void boot(howto)
}
regdump(rp, sbytes)
int *rp; /* must not be register */
regdump(fp, sbytes)
struct frame *fp; /* must not be register */
int sbytes;
{
static int doingdump = 0;
@ -1115,8 +1122,8 @@ regdump(rp, sbytes)
s = splhigh();
doingdump = 1;
printf("pid = %d, pc = %s, ",
curproc ? curproc->p_pid : -1, hexstr(rp[PC], 8));
printf("ps = %s, ", hexstr(rp[PS], 4));
curproc ? curproc->p_pid : -1, hexstr(fp->f_pc, 8));
printf("ps = %s, ", hexstr(fp->f_sr, 4));
printf("sfc = %s, ", hexstr(getsfc(), 4));
printf("dfc = %s\n", hexstr(getdfc(), 4));
printf("Registers:\n ");
@ -1124,18 +1131,18 @@ regdump(rp, sbytes)
printf(" %d", i);
printf("\ndreg:");
for (i = 0; i < 8; i++)
printf(" %s", hexstr(rp[i], 8));
printf(" %s", hexstr(fp->f_regs[i], 8));
printf("\nareg:");
for (i = 0; i < 8; i++)
printf(" %s", hexstr(rp[i+8], 8));
printf(" %s", hexstr(fp->f_regs[i+8], 8));
if (sbytes > 0) {
if (rp[PS] & PSL_S) {
if (fp->f_sr & PSL_S) {
printf("\n\nKernel stack (%s):",
hexstr((int)(((int *)&rp)-1), 8));
dumpmem(((int *)&rp)-1, sbytes, 0);
hexstr((int)(((int *)&fp)-1), 8));
dumpmem(((int *)&fp)-1, sbytes, 0);
} else {
printf("\n\nUser stack (%s):", hexstr(rp[SP], 8));
dumpmem((int *)rp[SP], sbytes, 1);
printf("\n\nUser stack (%s):", hexstr(fp->f_regs[SP], 8));
dumpmem((int *)fp->f_regs[SP], sbytes, 1);
}
}
doingdump = 0;

View File

@ -40,7 +40,7 @@
*
* from: @(#)locore.s 7.11 (Berkeley) 5/9/91
* locore.s,v 1.2 1993/05/22 07:57:30 cgd Exp
* $Id: process.s,v 1.16 1994/06/01 15:37:03 gwr Exp $
* $Id: process.s,v 1.17 1994/06/28 22:05:55 gwr Exp $
*/
/*
@ -145,10 +145,13 @@ mdpflag:
* The mapping of the pcb at p->p_addr has already been deleted,
* and the memory for the pcb+stack has been freed.
* The ipl is high enough to prevent the memory from being reallocated.
* XXX - Should this use p->p_addr instead of _curpcb? -gwr
*/
ENTRY(switch_exit)
movl sp@(4),a0 | struct proc *p
movl #nullpcb,_curpcb | save state into garbage pcb
lea tmpstk,sp | goto a tmp stack
movl a0,sp@- | pass proc ptr down
jra _cpu_switch
/*
@ -180,8 +183,9 @@ Lbadsw:
.globl _load_u_area;
/*
* cpu_switch()
*
* Hacked for sun3
* XXX - Arg 1 is a proc pointer (curproc) but this doesn't use it.
* XXX - Sould we use p->p_addr instead of curpcb? -gwr
*/
ENTRY(cpu_switch)
movl _curpcb,a0 | current pcb

View File

@ -95,7 +95,7 @@ Lsigr1:
*/
.globl _sigcode, _esigcode, _sigcodetrap
.data
_sigcode:
_sigcode: /* Found at address: 0x0DFFffdc */
movl sp@(12),a0 | signal handler addr (4 bytes)
jsr a0@ | call signal handler (2 bytes)
addql #4,sp | pop signo (2 bytes)

View File

@ -103,7 +103,9 @@ Laststkadj:
#else
rte | and do real RTE
#endif
Lchksir:
#if 0 /* XXX - Now using isr_soft_request() */
tstb _ssir | SIR pending?
jeq Ldorte | no, all done
movl d0,sp@- | need a scratch register
@ -135,6 +137,8 @@ Lgotsir:
#endif
Lnosir:
movl sp@+,d0 | restore scratch register
#endif /* XXX */
Ldorte:
#ifdef STACKCHECK
movw #SPL6,sr | avoid trouble

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: sun3_startup.c,v 1.21 1994/05/06 07:47:12 gwr Exp $
* $Id: sun3_startup.c,v 1.22 1994/06/28 22:06:02 gwr Exp $
*/
#include <sys/param.h>
@ -204,6 +204,7 @@ void u_area_bootstrap(u_va, u_pa)
set_pte(va, pte_proto|PA_PGNUM(pa));
}
/* This is called just before pmap_bootstrap() */
void sun3_vm_init()
{
unsigned int monitor_memory = 0;
@ -212,7 +213,6 @@ void sun3_vm_init()
unsigned char sme;
int valid;
pmeg_init();
va = (vm_offset_t) start;
@ -345,8 +345,9 @@ void sun3_vm_init()
virtual_avail = eva;
/*
* unmap kernel virtual space (only segments. if it squished ptes, bad
* things might happen.
* Unmap kernel virtual space (only segments. if it squished ptes,
* bad things might happen. Also, make sure to leave no valid
* segmap entries in the MMU unless pmeg_array records them.
*/
/* this only works because both are seg bounds*/
@ -356,6 +357,21 @@ void sun3_vm_init()
va = sun3_round_up_seg(va);
}
/*
* Record pmegs in use by DVMA segment.
* I would have preferred to just nuke these, but that
* made the kernel die before we even get to consinit.
* Instead, there is a hack in pmap_enter_kernel (sigh)
*/
va = DVMA_SPACE_START;
while (va < DVMA_SPACE_END) {
sme = get_segmap(va);
if (sme != SEGINV)
pmeg_steal(sme);
va = sun3_round_up_seg(va);
}
/* My sincere apologies for this crud -- glass*/
u_area_va = high_segment_alloc(UPAGES*2);
if (u_area_va != MONSHORTSEG) /* pg 3,4,5 */

View File

@ -39,7 +39,7 @@
* from: Utah $Hdr: vm_machdep.c 1.21 91/04/06$
* from: @(#)vm_machdep.c 7.10 (Berkeley) 5/7/91
* vm_machdep.c,v 1.3 1993/07/07 07:09:32 cgd Exp
* $Id: vm_machdep.c,v 1.16 1994/05/27 14:58:44 gwr Exp $
* $Id: vm_machdep.c,v 1.17 1994/06/28 22:06:05 gwr Exp $
*/
#include <sys/param.h>
@ -127,7 +127,7 @@ cpu_exit(p)
(void) splimp();
kmem_free(kernel_map, (vm_offset_t)p->p_addr, ctob(UPAGES));
switch_exit();
switch_exit(p);
/* NOTREACHED */
}