kvm_sh3.c revision 1.7
11.7Sjym/* $NetBSD: kvm_sh3.c,v 1.7 2010/09/19 02:07:00 jym 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.7Sjym__RCSID("$NetBSD: kvm_sh3.c,v 1.7 2010/09/19 02:07:00 jym 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.7Sjym_kvm_freevtop(kvm_t *kd) 761.1Smsaitoh{ 771.1Smsaitoh 781.1Smsaitoh /* Not actually used for anything right now, but safe. */ 791.1Smsaitoh if (kd->vmst != 0) 801.1Smsaitoh free(kd->vmst); 811.1Smsaitoh} 821.1Smsaitoh 831.1Smsaitoh/*ARGSUSED*/ 841.1Smsaitohint 851.7Sjym_kvm_initvtop(kvm_t *kd) 861.1Smsaitoh{ 871.1Smsaitoh 881.1Smsaitoh return (0); 891.1Smsaitoh} 901.1Smsaitoh 911.1Smsaitoh/* 921.1Smsaitoh * Translate a kernel virtual address to a physical address. 931.1Smsaitoh */ 941.1Smsaitohint 951.7Sjym_kvm_kvatop(kvm_t *kd, u_long va, u_long *pa) 961.1Smsaitoh{ 971.1Smsaitoh _kvm_err(kd, 0, "vatop not yet implemented!"); 981.1Smsaitoh return 0; 991.1Smsaitoh} 1001.1Smsaitoh 1011.1Smsaitoh/* 1021.1Smsaitoh * Translate a physical address to a file-offset in the crash dump. 1031.1Smsaitoh */ 1041.1Smsaitohoff_t 1051.7Sjym_kvm_pa2off(kvm_t *kd, u_long pa) 1061.1Smsaitoh{ 1071.1Smsaitoh _kvm_err(kd, 0, "pa2off not yet implemented!"); 1081.1Smsaitoh return 0; 1091.1Smsaitoh} 1101.1Smsaitoh 1111.1Smsaitoh/* 1121.1Smsaitoh * Machine-dependent initialization for ALL open kvm descriptors, 1131.1Smsaitoh * not just those for a kernel crash dump. Some architectures 1141.1Smsaitoh * have to deal with these NOT being constants! (i.e. m68k) 1151.1Smsaitoh */ 1161.1Smsaitohint 1171.7Sjym_kvm_mdopen(kvm_t *kd) 1181.1Smsaitoh{ 1191.1Smsaitoh 1201.1Smsaitoh kd->usrstack = USRSTACK; 1211.1Smsaitoh kd->min_uva = VM_MIN_ADDRESS; 1221.1Smsaitoh kd->max_uva = VM_MAXUSER_ADDRESS; 1231.1Smsaitoh 1241.1Smsaitoh return (0); 1251.1Smsaitoh} 126