Do kernel core header initialization a little differently.

This commit is contained in:
gwr 1997-10-05 20:53:41 +00:00
parent c669b1bdeb
commit d07537bd72
4 changed files with 47 additions and 28 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.h,v 1.10 1997/05/29 21:17:38 gwr Exp $ */
/* $NetBSD: machdep.h,v 1.11 1997/10/05 20:53:41 gwr Exp $ */
/*
* Copyright (c) 1994 Gordon W. Ross
@ -77,6 +77,7 @@ struct fpframe;
struct pcb;
struct proc;
struct reg;
struct sun3_kcore_hdr;
struct trapframe;
struct uio;
@ -141,7 +142,7 @@ void netintr __P((void));
void proc_trampoline __P((void));
void pmap_bootstrap __P((void));
void pmap_get_ksegmap __P((u_char *));
void pmap_kcore_hdr __P((struct sun3_kcore_hdr *));
void pmap_get_pagemap __P((int *pt, int off));
void savectx __P((struct pcb *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.102 1997/10/04 19:39:22 gwr Exp $ */
/* $NetBSD: machdep.c,v 1.103 1997/10/05 20:53:51 gwr Exp $ */
/*
* Copyright (c) 1994, 1995 Gordon W. Ross
@ -148,6 +148,7 @@ static void initcpu __P((void));
void
consinit()
{
/* Note: cninit() done earlier. (See _startup.c) */
#ifdef KGDB
/* XXX - Ask on console for kgdb_dev? */
@ -428,7 +429,7 @@ setregs(p, pack, stack)
/*
* Info for CTL_HW
*/
char machine[] = MACHINE; /* from <machine/param.h> */
char machine[16] = MACHINE; /* from <machine/param.h> */
char cpu_model[120];
/*
@ -529,6 +530,9 @@ cpu_reboot(howto, user_boot_string)
if (cold)
goto haltsys;
/* Un-blank the screen if appropriate. */
cnpollc(1);
if ((howto & RB_NOSYNC) == 0) {
reboot_sync();
/*
@ -698,21 +702,24 @@ dumpsys()
vaddr = (char*)dumppage;
bzero(vaddr, NBPG);
/* kcore header */
/* Set pointers to all three parts. */
kseg_p = (kcore_seg_t *)vaddr;
CORE_SETMAGIC(*kseg_p, KCORE_MAGIC, MID_MACHINE, CORE_CPU);
kseg_p->c_size = (ctob(DUMP_EXTRA) - sizeof(kcore_seg_t));
/* MMU state and dispatch info */
chdr_p = (cpu_kcore_hdr_t *) (kseg_p + 1);
sh = &chdr_p->un._sun3;
strcpy(chdr_p->name, machine);
/* Fill in kcore_seg_t part. */
CORE_SETMAGIC(*kseg_p, KCORE_MAGIC, MID_MACHINE, CORE_CPU);
kseg_p->c_size = (ctob(DUMP_EXTRA) - sizeof(*kseg_p));
/* Fill in cpu_kcore_hdr_t part. */
bcopy(machine, chdr_p->name, sizeof(chdr_p->name));
chdr_p->page_size = NBPG;
chdr_p->kernbase = KERNBASE;
sh->segshift = SEGSHIFT;
sh->pg_frame = PG_FRAME;
sh->pg_valid = PG_VALID;
pmap_get_ksegmap(sh->ksegmap);
/* Fill in the sun3_kcore_hdr part (MMU state). */
pmap_kcore_hdr(sh);
/* Write out the dump header. */
error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG);
if (error)
goto fail;

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.h,v 1.10 1997/05/29 21:17:38 gwr Exp $ */
/* $NetBSD: machdep.h,v 1.11 1997/10/05 20:53:41 gwr Exp $ */
/*
* Copyright (c) 1994 Gordon W. Ross
@ -77,6 +77,7 @@ struct fpframe;
struct pcb;
struct proc;
struct reg;
struct sun3_kcore_hdr;
struct trapframe;
struct uio;
@ -141,7 +142,7 @@ void netintr __P((void));
void proc_trampoline __P((void));
void pmap_bootstrap __P((void));
void pmap_get_ksegmap __P((u_char *));
void pmap_kcore_hdr __P((struct sun3_kcore_hdr *));
void pmap_get_pagemap __P((int *pt, int off));
void savectx __P((struct pcb *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.73 1997/07/29 06:41:35 fair Exp $ */
/* $NetBSD: pmap.c,v 1.74 1997/10/05 20:53:56 gwr Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -76,20 +76,21 @@
#include <sys/malloc.h>
#include <sys/user.h>
#include <sys/queue.h>
#include <sys/kcore.h>
#include <vm/vm.h>
#include <vm/vm_kern.h>
#include <vm/vm_page.h>
#include <machine/pte.h>
#include <machine/control.h>
#include <machine/cpu.h>
#include <machine/mon.h>
#include <machine/vmparam.h>
#include <machine/control.h>
#include <machine/dvma.h>
#include <machine/pmap.h>
#include <machine/kcore.h>
#include <machine/machdep.h>
#include <machine/mon.h>
#include <machine/pmap.h>
#include <machine/pte.h>
#include <machine/vmparam.h>
extern void copypage __P((const void*, void*));
extern void zeropage __P((void*));
@ -3310,20 +3311,29 @@ pmap_prefer(fo, va)
}
/*
* Copy the kernel segmap into the passed buffer (256 bytes).
* Fill in the sun3x-specific part of the kernel core header
* for dumpsys(). (See machdep.c for the rest.)
*/
void
pmap_get_ksegmap(cp)
u_char *cp;
pmap_kcore_hdr(sh)
struct sun3_kcore_hdr *sh;
{
vm_offset_t va;
u_char *cp, *ep;
sh->segshift = SEGSHIFT;
sh->pg_frame = PG_FRAME;
sh->pg_valid = PG_VALID;
/* Copy the kernel segmap (256 bytes). */
va = KERNBASE;
cp = sh->ksegmap;
ep = cp + sizeof(sh->ksegmap);
do {
*cp = get_segmap(va);
cp++;
va += NBSG;
} while (va < 0x10000000);
cp++;
} while (cp < ep);
}
/*