kvm_sh3.c revision 1.6
11.6Sagc/* $NetBSD: kvm_sh3.c,v 1.6 2003/08/07 16:44:39 agc 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.6Sagc * 3. Neither the name of the University nor the names of its contributors 201.1Smsaitoh * may be used to endorse or promote products derived from this software 211.1Smsaitoh * without specific prior written permission. 221.1Smsaitoh * 231.1Smsaitoh * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 241.1Smsaitoh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 251.1Smsaitoh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 261.1Smsaitoh * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 271.1Smsaitoh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 281.1Smsaitoh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 291.1Smsaitoh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 301.1Smsaitoh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 311.1Smsaitoh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 321.1Smsaitoh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 331.1Smsaitoh * SUCH DAMAGE. 341.1Smsaitoh */ 351.1Smsaitoh 361.1Smsaitoh#include <sys/cdefs.h> 371.1Smsaitoh#if defined(LIBC_SCCS) && !defined(lint) 381.1Smsaitoh#if 0 391.1Smsaitohstatic char sccsid[] = "@(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93"; 401.1Smsaitoh#else 411.6Sagc__RCSID("$NetBSD: kvm_sh3.c,v 1.6 2003/08/07 16:44:39 agc Exp $"); 421.1Smsaitoh#endif 431.1Smsaitoh#endif /* LIBC_SCCS and not lint */ 441.1Smsaitoh 451.1Smsaitoh/* 461.5Sscw * SH3 machine dependent routines for kvm. 471.1Smsaitoh */ 481.1Smsaitoh 491.1Smsaitoh#include <sys/param.h> 501.1Smsaitoh#include <sys/user.h> 511.1Smsaitoh#include <sys/proc.h> 521.1Smsaitoh#include <sys/stat.h> 531.1Smsaitoh#include <sys/kcore.h> 541.1Smsaitoh#include <stdlib.h> 551.1Smsaitoh#include <unistd.h> 561.1Smsaitoh#include <nlist.h> 571.1Smsaitoh#include <kvm.h> 581.1Smsaitoh 591.3Smrg#include <uvm/uvm_extern.h> 601.1Smsaitoh 611.1Smsaitoh#include <limits.h> 621.1Smsaitoh#include <db.h> 631.1Smsaitoh 641.1Smsaitoh#include "kvm_private.h" 651.1Smsaitoh 661.1Smsaitoh#include <machine/pte.h> 671.4Smatt#include <machine/vmparam.h> 681.1Smsaitoh 691.1Smsaitoh#ifndef btop 701.1Smsaitoh#define btop(x) (((unsigned)(x)) >> PGSHIFT) /* XXX */ 711.1Smsaitoh#define ptob(x) ((caddr_t)((x) << PGSHIFT)) /* XXX */ 721.1Smsaitoh#endif 731.1Smsaitoh 741.1Smsaitohvoid 751.1Smsaitoh_kvm_freevtop(kd) 761.1Smsaitoh kvm_t *kd; 771.1Smsaitoh{ 781.1Smsaitoh 791.1Smsaitoh /* Not actually used for anything right now, but safe. */ 801.1Smsaitoh if (kd->vmst != 0) 811.1Smsaitoh free(kd->vmst); 821.1Smsaitoh} 831.1Smsaitoh 841.1Smsaitoh/*ARGSUSED*/ 851.1Smsaitohint 861.1Smsaitoh_kvm_initvtop(kd) 871.1Smsaitoh kvm_t *kd; 881.1Smsaitoh{ 891.1Smsaitoh 901.1Smsaitoh return (0); 911.1Smsaitoh} 921.1Smsaitoh 931.1Smsaitoh/* 941.1Smsaitoh * Translate a kernel virtual address to a physical address. 951.1Smsaitoh */ 961.1Smsaitohint 971.1Smsaitoh_kvm_kvatop(kd, va, pa) 981.1Smsaitoh kvm_t *kd; 991.1Smsaitoh u_long va; 1001.1Smsaitoh u_long *pa; 1011.1Smsaitoh{ 1021.1Smsaitoh _kvm_err(kd, 0, "vatop not yet implemented!"); 1031.1Smsaitoh return 0; 1041.1Smsaitoh} 1051.1Smsaitoh 1061.1Smsaitoh/* 1071.1Smsaitoh * Translate a physical address to a file-offset in the crash dump. 1081.1Smsaitoh */ 1091.1Smsaitohoff_t 1101.1Smsaitoh_kvm_pa2off(kd, pa) 1111.1Smsaitoh kvm_t *kd; 1121.1Smsaitoh u_long pa; 1131.1Smsaitoh{ 1141.1Smsaitoh _kvm_err(kd, 0, "pa2off not yet implemented!"); 1151.1Smsaitoh return 0; 1161.1Smsaitoh} 1171.1Smsaitoh 1181.1Smsaitoh/* 1191.1Smsaitoh * Machine-dependent initialization for ALL open kvm descriptors, 1201.1Smsaitoh * not just those for a kernel crash dump. Some architectures 1211.1Smsaitoh * have to deal with these NOT being constants! (i.e. m68k) 1221.1Smsaitoh */ 1231.1Smsaitohint 1241.1Smsaitoh_kvm_mdopen(kd) 1251.1Smsaitoh kvm_t *kd; 1261.1Smsaitoh{ 1271.1Smsaitoh 1281.1Smsaitoh kd->usrstack = USRSTACK; 1291.1Smsaitoh kd->min_uva = VM_MIN_ADDRESS; 1301.1Smsaitoh kd->max_uva = VM_MAXUSER_ADDRESS; 1311.1Smsaitoh 1321.1Smsaitoh return (0); 1331.1Smsaitoh} 134