kvm_sh3.c revision 1.5
11.5Sscw/*	$NetBSD: kvm_sh3.c,v 1.5 2002/07/10 09:17:02 scw Exp $	*/
21.1Smsaitoh
31.1Smsaitoh/*-
41.1Smsaitoh * Copyright (c) 1989, 1992, 1993
51.1Smsaitoh *	The Regents of the University of California.  All rights reserved.
61.1Smsaitoh *
71.1Smsaitoh * This code is derived from software developed by the Computer Systems
81.1Smsaitoh * Engineering group at Lawrence Berkeley Laboratory under DARPA contract
91.1Smsaitoh * BG 91-66 and contributed to Berkeley.
101.1Smsaitoh *
111.1Smsaitoh * Redistribution and use in source and binary forms, with or without
121.1Smsaitoh * modification, are permitted provided that the following conditions
131.1Smsaitoh * are met:
141.1Smsaitoh * 1. Redistributions of source code must retain the above copyright
151.1Smsaitoh *    notice, this list of conditions and the following disclaimer.
161.1Smsaitoh * 2. Redistributions in binary form must reproduce the above copyright
171.1Smsaitoh *    notice, this list of conditions and the following disclaimer in the
181.1Smsaitoh *    documentation and/or other materials provided with the distribution.
191.1Smsaitoh * 3. All advertising materials mentioning features or use of this software
201.1Smsaitoh *    must display the following acknowledgement:
211.1Smsaitoh *	This product includes software developed by the University of
221.1Smsaitoh *	California, Berkeley and its contributors.
231.1Smsaitoh * 4. Neither the name of the University nor the names of its contributors
241.1Smsaitoh *    may be used to endorse or promote products derived from this software
251.1Smsaitoh *    without specific prior written permission.
261.1Smsaitoh *
271.1Smsaitoh * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
281.1Smsaitoh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
291.1Smsaitoh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
301.1Smsaitoh * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
311.1Smsaitoh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
321.1Smsaitoh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
331.1Smsaitoh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
341.1Smsaitoh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
351.1Smsaitoh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
361.1Smsaitoh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
371.1Smsaitoh * SUCH DAMAGE.
381.1Smsaitoh */
391.1Smsaitoh
401.1Smsaitoh#include <sys/cdefs.h>
411.1Smsaitoh#if defined(LIBC_SCCS) && !defined(lint)
421.1Smsaitoh#if 0
431.1Smsaitohstatic char sccsid[] = "@(#)kvm_hp300.c	8.1 (Berkeley) 6/4/93";
441.1Smsaitoh#else
451.5Sscw__RCSID("$NetBSD: kvm_sh3.c,v 1.5 2002/07/10 09:17:02 scw Exp $");
461.1Smsaitoh#endif
471.1Smsaitoh#endif /* LIBC_SCCS and not lint */
481.1Smsaitoh
491.1Smsaitoh/*
501.5Sscw * SH3 machine dependent routines for kvm.
511.1Smsaitoh */
521.1Smsaitoh
531.1Smsaitoh#include <sys/param.h>
541.1Smsaitoh#include <sys/user.h>
551.1Smsaitoh#include <sys/proc.h>
561.1Smsaitoh#include <sys/stat.h>
571.1Smsaitoh#include <sys/kcore.h>
581.1Smsaitoh#include <stdlib.h>
591.1Smsaitoh#include <unistd.h>
601.1Smsaitoh#include <nlist.h>
611.1Smsaitoh#include <kvm.h>
621.1Smsaitoh
631.3Smrg#include <uvm/uvm_extern.h>
641.1Smsaitoh
651.1Smsaitoh#include <limits.h>
661.1Smsaitoh#include <db.h>
671.1Smsaitoh
681.1Smsaitoh#include "kvm_private.h"
691.1Smsaitoh
701.1Smsaitoh#include <machine/pte.h>
711.4Smatt#include <machine/vmparam.h>
721.1Smsaitoh
731.1Smsaitoh#ifndef btop
741.1Smsaitoh#define	btop(x)		(((unsigned)(x)) >> PGSHIFT)	/* XXX */
751.1Smsaitoh#define	ptob(x)		((caddr_t)((x) << PGSHIFT))	/* XXX */
761.1Smsaitoh#endif
771.1Smsaitoh
781.1Smsaitohvoid
791.1Smsaitoh_kvm_freevtop(kd)
801.1Smsaitoh	kvm_t *kd;
811.1Smsaitoh{
821.1Smsaitoh
831.1Smsaitoh	/* Not actually used for anything right now, but safe. */
841.1Smsaitoh	if (kd->vmst != 0)
851.1Smsaitoh		free(kd->vmst);
861.1Smsaitoh}
871.1Smsaitoh
881.1Smsaitoh/*ARGSUSED*/
891.1Smsaitohint
901.1Smsaitoh_kvm_initvtop(kd)
911.1Smsaitoh	kvm_t *kd;
921.1Smsaitoh{
931.1Smsaitoh
941.1Smsaitoh	return (0);
951.1Smsaitoh}
961.1Smsaitoh
971.1Smsaitoh/*
981.1Smsaitoh * Translate a kernel virtual address to a physical address.
991.1Smsaitoh */
1001.1Smsaitohint
1011.1Smsaitoh_kvm_kvatop(kd, va, pa)
1021.1Smsaitoh	kvm_t *kd;
1031.1Smsaitoh	u_long va;
1041.1Smsaitoh	u_long *pa;
1051.1Smsaitoh{
1061.1Smsaitoh	_kvm_err(kd, 0, "vatop not yet implemented!");
1071.1Smsaitoh	return 0;
1081.1Smsaitoh}
1091.1Smsaitoh
1101.1Smsaitoh/*
1111.1Smsaitoh * Translate a physical address to a file-offset in the crash dump.
1121.1Smsaitoh */
1131.1Smsaitohoff_t
1141.1Smsaitoh_kvm_pa2off(kd, pa)
1151.1Smsaitoh	kvm_t *kd;
1161.1Smsaitoh	u_long pa;
1171.1Smsaitoh{
1181.1Smsaitoh	_kvm_err(kd, 0, "pa2off not yet implemented!");
1191.1Smsaitoh	return 0;
1201.1Smsaitoh}
1211.1Smsaitoh
1221.1Smsaitoh/*
1231.1Smsaitoh * Machine-dependent initialization for ALL open kvm descriptors,
1241.1Smsaitoh * not just those for a kernel crash dump.  Some architectures
1251.1Smsaitoh * have to deal with these NOT being constants!  (i.e. m68k)
1261.1Smsaitoh */
1271.1Smsaitohint
1281.1Smsaitoh_kvm_mdopen(kd)
1291.1Smsaitoh	kvm_t	*kd;
1301.1Smsaitoh{
1311.1Smsaitoh
1321.1Smsaitoh	kd->usrstack = USRSTACK;
1331.1Smsaitoh	kd->min_uva = VM_MIN_ADDRESS;
1341.1Smsaitoh	kd->max_uva = VM_MAXUSER_ADDRESS;
1351.1Smsaitoh
1361.1Smsaitoh	return (0);
1371.1Smsaitoh}
138