Remove building with NOCRYPTO option
[minix3.git] / lib / libkvm / kvm_or1k.c
blob3306eb71097f5e0f100aab5d05e6fe76eaafd5d7
1 /* $NetBSD: kvm_or1k.c,v 1.1 2014/09/03 19:34:26 matt Exp $ */
3 /*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
33 * OR1K machine dependent routines for kvm.
36 #include <sys/param.h>
37 #include <sys/exec.h>
38 #include <sys/types.h>
40 #include <uvm/uvm_extern.h>
42 #include <db.h>
43 #include <limits.h>
44 #include <kvm.h>
45 #include <stdlib.h>
46 #include <unistd.h>
48 #include "kvm_private.h"
50 #include <sys/kcore.h>
51 #include <machine/kcore.h>
52 #include <machine/vmparam.h>
54 __RCSID("$NetBSD: kvm_or1k.c,v 1.1 2014/09/03 19:34:26 matt Exp $");
56 void
57 _kvm_freevtop(kvm_t *kd)
59 if (kd->vmst != 0)
60 free(kd->vmst);
63 /*ARGSUSED*/
64 int
65 _kvm_initvtop(kvm_t *kd)
68 return 0;
72 * Translate a KVA to a PA
74 int
75 _kvm_kvatop(kvm_t *kd, vaddr_t va, paddr_t *pa)
77 // cpu_kcore_hdr_t *cpu_kh;
79 if (ISALIVE(kd)) {
80 _kvm_err(kd, 0, "vatop called in live kernel!");
81 return 0;
84 /* No hit -- no translation */
85 *pa = (u_long)~0UL;
86 return 0;
89 off_t
90 _kvm_pa2off(kvm_t *kd, paddr_t pa)
92 cpu_kcore_hdr_t *cpu_kh;
93 phys_ram_seg_t *ram;
94 off_t off;
95 void *e;
97 cpu_kh = kd->cpu_data;
98 e = (char *) kd->cpu_data + kd->cpu_dsize;
99 ram = (void *)((char *)(void *)cpu_kh + ALIGN(sizeof *cpu_kh));
100 off = kd->dump_off;
101 do {
102 if (pa >= ram->start && (pa - ram->start) < ram->size) {
103 return off + (pa - ram->start);
105 ram++;
106 off += ram->size;
107 } while ((void *) ram < e && ram->size);
109 _kvm_err(kd, 0, "pa2off failed for pa %#" PRIxPADDR "\n", pa);
110 return (off_t) -1;
114 * Machine-dependent initialization for ALL open kvm descriptors,
115 * not just those for a kernel crash dump. Some architectures
116 * have to deal with these NOT being constants! (i.e. m68k)
119 _kvm_mdopen(kvm_t *kd)
121 kd->usrstack = USRSTACK;
122 kd->min_uva = VM_MIN_ADDRESS;
123 kd->max_uva = VM_MAXUSER_ADDRESS;
125 return (0);