kvm_sh3.c revision 1.3
11.3Smrg/* $NetBSD: kvm_sh3.c,v 1.3 2000/06/29 06:34:26 mrg 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.3Smrg__RCSID("$NetBSD: kvm_sh3.c,v 1.3 2000/06/29 06:34:26 mrg Exp $"); 461.1Smsaitoh#endif 471.1Smsaitoh#endif /* LIBC_SCCS and not lint */ 481.1Smsaitoh 491.1Smsaitoh/* 501.1Smsaitoh * i386 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.1Smsaitoh 721.1Smsaitoh#ifndef btop 731.1Smsaitoh#define btop(x) (((unsigned)(x)) >> PGSHIFT) /* XXX */ 741.1Smsaitoh#define ptob(x) ((caddr_t)((x) << PGSHIFT)) /* XXX */ 751.1Smsaitoh#endif 761.1Smsaitoh 771.1Smsaitohvoid 781.1Smsaitoh_kvm_freevtop(kd) 791.1Smsaitoh kvm_t *kd; 801.1Smsaitoh{ 811.1Smsaitoh 821.1Smsaitoh /* Not actually used for anything right now, but safe. */ 831.1Smsaitoh if (kd->vmst != 0) 841.1Smsaitoh free(kd->vmst); 851.1Smsaitoh} 861.1Smsaitoh 871.1Smsaitoh/*ARGSUSED*/ 881.1Smsaitohint 891.1Smsaitoh_kvm_initvtop(kd) 901.1Smsaitoh kvm_t *kd; 911.1Smsaitoh{ 921.1Smsaitoh 931.1Smsaitoh return (0); 941.1Smsaitoh} 951.1Smsaitoh 961.1Smsaitoh/* 971.1Smsaitoh * Translate a kernel virtual address to a physical address. 981.1Smsaitoh */ 991.1Smsaitohint 1001.1Smsaitoh_kvm_kvatop(kd, va, pa) 1011.1Smsaitoh kvm_t *kd; 1021.1Smsaitoh u_long va; 1031.1Smsaitoh u_long *pa; 1041.1Smsaitoh{ 1051.1Smsaitoh _kvm_err(kd, 0, "vatop not yet implemented!"); 1061.1Smsaitoh return 0; 1071.1Smsaitoh} 1081.1Smsaitoh 1091.1Smsaitoh/* 1101.1Smsaitoh * Translate a physical address to a file-offset in the crash dump. 1111.1Smsaitoh */ 1121.1Smsaitohoff_t 1131.1Smsaitoh_kvm_pa2off(kd, pa) 1141.1Smsaitoh kvm_t *kd; 1151.1Smsaitoh u_long pa; 1161.1Smsaitoh{ 1171.1Smsaitoh _kvm_err(kd, 0, "pa2off not yet implemented!"); 1181.1Smsaitoh return 0; 1191.1Smsaitoh} 1201.1Smsaitoh 1211.1Smsaitoh/* 1221.1Smsaitoh * Machine-dependent initialization for ALL open kvm descriptors, 1231.1Smsaitoh * not just those for a kernel crash dump. Some architectures 1241.1Smsaitoh * have to deal with these NOT being constants! (i.e. m68k) 1251.1Smsaitoh */ 1261.1Smsaitohint 1271.1Smsaitoh_kvm_mdopen(kd) 1281.1Smsaitoh kvm_t *kd; 1291.1Smsaitoh{ 1301.1Smsaitoh 1311.1Smsaitoh kd->usrstack = USRSTACK; 1321.1Smsaitoh kd->min_uva = VM_MIN_ADDRESS; 1331.1Smsaitoh kd->max_uva = VM_MAXUSER_ADDRESS; 1341.1Smsaitoh 1351.1Smsaitoh return (0); 1361.1Smsaitoh} 137