machdep.c revision 177110
1176771Sraj/*- 2176771Sraj * Copyright (C) 2006 Semihalf, Marian Balakowicz <m8@semihalf.com> 3176771Sraj * All rights reserved. 4176771Sraj * 5176771Sraj * Redistribution and use in source and binary forms, with or without 6176771Sraj * modification, are permitted provided that the following conditions 7176771Sraj * are met: 8176771Sraj * 1. Redistributions of source code must retain the above copyright 9176771Sraj * notice, this list of conditions and the following disclaimer. 10176771Sraj * 2. Redistributions in binary form must reproduce the above copyright 11176771Sraj * notice, this list of conditions and the following disclaimer in the 12176771Sraj * documentation and/or other materials provided with the distribution. 13176771Sraj * 3. The name of the author may not be used to endorse or promote products 14176771Sraj * derived from this software without specific prior written permission. 15176771Sraj * 16176771Sraj * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17176771Sraj * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18176771Sraj * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 19176771Sraj * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20176771Sraj * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21176771Sraj * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22176771Sraj * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23176771Sraj * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24176771Sraj * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25176771Sraj * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26176771Sraj */ 27176771Sraj/*- 28176771Sraj * Copyright (C) 2001 Benno Rice 29176771Sraj * All rights reserved. 30176771Sraj * 31176771Sraj * Redistribution and use in source and binary forms, with or without 32176771Sraj * modification, are permitted provided that the following conditions 33176771Sraj * are met: 34176771Sraj * 1. Redistributions of source code must retain the above copyright 35176771Sraj * notice, this list of conditions and the following disclaimer. 36176771Sraj * 2. Redistributions in binary form must reproduce the above copyright 37176771Sraj * notice, this list of conditions and the following disclaimer in the 38176771Sraj * documentation and/or other materials provided with the distribution. 39176771Sraj * 40176771Sraj * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR 41176771Sraj * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 42176771Sraj * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 43176771Sraj * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 44176771Sraj * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 45176771Sraj * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 46176771Sraj * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 47176771Sraj * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 48176771Sraj * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 49176771Sraj * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 50176771Sraj * $NetBSD: machdep.c,v 1.74.2.1 2000/11/01 16:13:48 tv Exp $ 51176771Sraj */ 52176771Sraj/*- 53176771Sraj * Copyright (C) 1995, 1996 Wolfgang Solfrank. 54176771Sraj * Copyright (C) 1995, 1996 TooLs GmbH. 55176771Sraj * All rights reserved. 56176771Sraj * 57176771Sraj * Redistribution and use in source and binary forms, with or without 58176771Sraj * modification, are permitted provided that the following conditions 59176771Sraj * are met: 60176771Sraj * 1. Redistributions of source code must retain the above copyright 61176771Sraj * notice, this list of conditions and the following disclaimer. 62176771Sraj * 2. Redistributions in binary form must reproduce the above copyright 63176771Sraj * notice, this list of conditions and the following disclaimer in the 64176771Sraj * documentation and/or other materials provided with the distribution. 65176771Sraj * 3. All advertising materials mentioning features or use of this software 66176771Sraj * must display the following acknowledgement: 67176771Sraj * This product includes software developed by TooLs GmbH. 68176771Sraj * 4. The name of TooLs GmbH may not be used to endorse or promote products 69176771Sraj * derived from this software without specific prior written permission. 70176771Sraj * 71176771Sraj * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 72176771Sraj * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 73176771Sraj * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 74176771Sraj * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 75176771Sraj * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 76176771Sraj * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 77176771Sraj * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 78176771Sraj * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 79176771Sraj * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 80176771Sraj * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 81176771Sraj */ 82176771Sraj 83176771Sraj#include <sys/cdefs.h> 84176771Sraj__FBSDID("$FreeBSD: head/sys/powerpc/booke/machdep.c 177110 2008-03-12 16:32:08Z raj $"); 85176771Sraj 86176771Sraj#include "opt_compat.h" 87176771Sraj#include "opt_kstack_pages.h" 88176771Sraj 89176771Sraj#include <sys/cdefs.h> 90176771Sraj#include <sys/types.h> 91176771Sraj 92176771Sraj#include <sys/param.h> 93176771Sraj#include <sys/proc.h> 94176771Sraj#include <sys/systm.h> 95176771Sraj#include <sys/time.h> 96176771Sraj#include <sys/bio.h> 97176771Sraj#include <sys/buf.h> 98176771Sraj#include <sys/bus.h> 99176771Sraj#include <sys/cons.h> 100176771Sraj#include <sys/cpu.h> 101176771Sraj#include <sys/kdb.h> 102176771Sraj#include <sys/kernel.h> 103176771Sraj#include <sys/lock.h> 104176771Sraj#include <sys/mutex.h> 105176771Sraj#include <sys/sysctl.h> 106176771Sraj#include <sys/exec.h> 107176771Sraj#include <sys/ktr.h> 108176771Sraj#include <sys/sysproto.h> 109176771Sraj#include <sys/signalvar.h> 110176771Sraj#include <sys/sysent.h> 111176771Sraj#include <sys/imgact.h> 112176771Sraj#include <sys/msgbuf.h> 113176771Sraj#include <sys/ptrace.h> 114176771Sraj 115176771Sraj#include <vm/vm.h> 116176771Sraj#include <vm/pmap.h> 117176771Sraj#include <vm/vm_page.h> 118176771Sraj#include <vm/vm_object.h> 119176771Sraj#include <vm/vm_pager.h> 120176771Sraj 121176771Sraj#include <machine/cpu.h> 122176771Sraj#include <machine/kdb.h> 123176771Sraj#include <machine/reg.h> 124176771Sraj#include <machine/vmparam.h> 125176771Sraj#include <machine/spr.h> 126176771Sraj#include <machine/hid.h> 127176771Sraj#include <machine/psl.h> 128176771Sraj#include <machine/trap.h> 129176771Sraj#include <machine/md_var.h> 130176771Sraj#include <machine/mmuvar.h> 131176771Sraj#include <machine/pmap.h> 132176771Sraj#include <machine/sigframe.h> 133176771Sraj#include <machine/metadata.h> 134176771Sraj#include <machine/bootinfo.h> 135176771Sraj#include <machine/powerpc.h> 136176771Sraj 137176771Sraj#include <sys/linker.h> 138176771Sraj#include <sys/reboot.h> 139176771Sraj 140176771Sraj#ifdef DEBUG 141176771Sraj#define debugf(fmt, args...) printf(fmt, ##args) 142176771Sraj#else 143176771Sraj#define debugf(fmt, args...) 144176771Sraj#endif 145176771Sraj 146176771Srajextern unsigned char kernel_text[]; 147176771Srajextern unsigned char _etext[]; 148176771Srajextern unsigned char _edata[]; 149176771Srajextern unsigned char __bss_start[]; 150176771Srajextern unsigned char __sbss_start[]; 151176771Srajextern unsigned char __sbss_end[]; 152176771Srajextern unsigned char _end[]; 153176771Sraj 154176771Srajextern struct mem_region availmem_regions[]; 155176771Srajextern int availmem_regions_sz; 156176771Sraj 157176771Srajextern void *trapcode, *trapsize; 158176771Sraj 159176771Srajextern unsigned char kstack0_space[]; 160176771Sraj 161176928Smarcelextern void dcache_enable(void); 162176928Smarcelextern void dcache_inval(void); 163176928Smarcelextern void icache_enable(void); 164176928Smarcelextern void icache_inval(void); 165176928Smarcel 166176771Srajstruct kva_md_info kmi; 167176771Srajstruct pcpu __pcpu[MAXCPU]; 168176771Srajstruct trapframe frame0; 169176771Srajint cold = 1; 170176771Srajlong realmem = 0; 171176771Srajlong Maxmem = 0; 172176771Sraj 173176771Srajstruct bootinfo *bootinfo; 174176771Sraj 175176771Srajchar machine[] = "powerpc"; 176176771SrajSYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0, ""); 177176771Sraj 178176771Srajstatic int cacheline_size = CACHELINESIZE; 179176771SrajSYSCTL_INT(_machdep, CPU_CACHELINE, cacheline_size, 180176771Sraj CTLFLAG_RD, &cacheline_size, 0, ""); 181176771Sraj 182176771Srajstatic void cpu_e500_startup(void *); 183176771SrajSYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_e500_startup, NULL) 184176771Sraj 185176771Srajvoid print_kernel_section_addr(void); 186176771Srajvoid dump_bootinfo(void); 187176771Srajvoid dump_kenv(void); 188176771Srajvoid e500_init(u_int32_t, u_int32_t, void *); 189176771Srajvoid setPQL2(int *const size, int *const ways); 190176771Sraj 191176771Srajvoid 192176771SrajsetPQL2(int *const size, int *const ways) 193176771Sraj{ 194176771Sraj 195176771Sraj return; 196176771Sraj} 197176771Sraj 198176771Srajstatic void 199176771Srajcpu_e500_startup(void *dummy) 200176771Sraj{ 201176771Sraj 202176771Sraj /* Initialise the decrementer-based clock. */ 203176771Sraj decr_init(); 204176771Sraj 205176771Sraj /* Good {morning,afternoon,evening,night}. */ 206176771Sraj cpu_setup(PCPU_GET(cpuid)); 207176771Sraj 208176771Sraj printf("real memory = %ld (%ld MB)\n", ptoa(physmem), 209176771Sraj ptoa(physmem) / 1048576); 210176771Sraj realmem = physmem; 211176771Sraj 212176771Sraj /* Display any holes after the first chunk of extended memory. */ 213176771Sraj if (bootverbose) { 214176771Sraj int indx; 215176771Sraj 216176771Sraj printf("Physical memory chunk(s):\n"); 217176771Sraj for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) { 218176771Sraj int size1 = phys_avail[indx + 1] - phys_avail[indx]; 219176771Sraj 220176771Sraj printf("0x%08x - 0x%08x, %d bytes (%d pages)\n", 221176771Sraj phys_avail[indx], phys_avail[indx + 1] - 1, size1, 222176771Sraj size1 / PAGE_SIZE); 223176771Sraj } 224176771Sraj } 225176771Sraj 226176771Sraj vm_ksubmap_init(&kmi); 227176771Sraj 228176771Sraj printf("avail memory = %ld (%ld MB)\n", ptoa(cnt.v_free_count), 229176771Sraj ptoa(cnt.v_free_count) / 1048576); 230176771Sraj 231176771Sraj /* Set up buffers, so they can be used to read disk labels. */ 232176771Sraj bufinit(); 233176771Sraj vm_pager_bufferinit(); 234176771Sraj} 235176771Sraj 236176771Srajstatic char * 237176771Srajkenv_next(char *cp) 238176771Sraj{ 239176771Sraj 240176771Sraj if (cp != NULL) { 241176771Sraj while (*cp != 0) 242176771Sraj cp++; 243176771Sraj cp++; 244176771Sraj if (*cp == 0) 245176771Sraj cp = NULL; 246176771Sraj } 247176771Sraj return (cp); 248176771Sraj} 249176771Sraj 250176771Srajvoid 251176771Srajdump_kenv(void) 252176771Sraj{ 253176771Sraj int len; 254176771Sraj char *cp; 255176771Sraj 256176771Sraj debugf("loader passed (static) kenv:\n"); 257176771Sraj if (kern_envp == NULL) { 258176771Sraj debugf(" no env, null ptr\n"); 259176771Sraj return; 260176771Sraj } 261176771Sraj debugf(" kern_envp = 0x%08x\n", (u_int32_t)kern_envp); 262176771Sraj 263176771Sraj len = 0; 264176771Sraj for (cp = kern_envp; cp != NULL; cp = kenv_next(cp)) 265176771Sraj debugf(" %x %s\n", (u_int32_t)cp, cp); 266176771Sraj} 267176771Sraj 268176771Srajvoid 269176771Srajdump_bootinfo(void) 270176771Sraj{ 271176771Sraj struct bi_mem_region *mr; 272176771Sraj struct bi_eth_addr *eth; 273176771Sraj int i, j; 274176771Sraj 275176771Sraj debugf("bootinfo:\n"); 276176771Sraj if (bootinfo == NULL) { 277176771Sraj debugf(" no bootinfo, null ptr\n"); 278176771Sraj return; 279176771Sraj } 280176771Sraj 281176771Sraj debugf(" version = 0x%08x\n", bootinfo->bi_version); 282176771Sraj debugf(" ccsrbar = 0x%08x\n", bootinfo->bi_bar_base); 283176771Sraj debugf(" cpu_clk = 0x%08x\n", bootinfo->bi_cpu_clk); 284176771Sraj debugf(" bus_clk = 0x%08x\n", bootinfo->bi_bus_clk); 285176771Sraj 286176771Sraj debugf(" mem regions:\n"); 287176771Sraj mr = (struct bi_mem_region *)bootinfo->bi_data; 288176771Sraj for (i = 0; i < bootinfo->bi_mem_reg_no; i++, mr++) 289176771Sraj debugf(" #%d, base = 0x%08x, size = 0x%08x\n", i, 290176771Sraj mr->mem_base, mr->mem_size); 291176771Sraj 292176771Sraj debugf(" eth addresses:\n"); 293176771Sraj eth = (struct bi_eth_addr *)mr; 294176771Sraj for (i = 0; i < bootinfo->bi_eth_addr_no; i++, eth++) { 295176771Sraj debugf(" #%d, addr = ", i); 296176771Sraj for (j = 0; j < 6; j++) 297176771Sraj debugf("%02x ", eth->mac_addr[j]); 298176771Sraj debugf("\n"); 299176771Sraj } 300176771Sraj} 301176771Sraj 302176771Srajvoid 303176771Srajprint_kernel_section_addr(void) 304176771Sraj{ 305176771Sraj 306176771Sraj debugf("kernel image addresses:\n"); 307176771Sraj debugf(" kernel_text = 0x%08x\n", (u_int32_t)kernel_text); 308176771Sraj debugf(" _etext (sdata) = 0x%08x\n", (u_int32_t)_etext); 309176771Sraj debugf(" _edata = 0x%08x\n", (u_int32_t)_edata); 310176771Sraj debugf(" __sbss_start = 0x%08x\n", (u_int32_t)__sbss_start); 311176771Sraj debugf(" __sbss_end = 0x%08x\n", (u_int32_t)__sbss_end); 312176771Sraj debugf(" __sbss_start = 0x%08x\n", (u_int32_t)__bss_start); 313176771Sraj debugf(" _end = 0x%08x\n", (u_int32_t)_end); 314176771Sraj} 315176771Sraj 316177110Srajstruct bi_mem_region * 317177110Srajbootinfo_mr(void) 318177110Sraj{ 319177110Sraj 320177110Sraj return((struct bi_mem_region *)bootinfo->bi_data); 321177110Sraj} 322177110Sraj 323177110Srajstruct bi_eth_addr * 324177110Srajbootinfo_eth(void) 325177110Sraj{ 326177110Sraj struct bi_mem_region *mr; 327177110Sraj struct bi_eth_addr *eth; 328177110Sraj int i; 329177110Sraj 330177110Sraj /* Advance to the eth section */ 331177110Sraj mr = bootinfo_mr(); 332177110Sraj for (i = 0; i < bootinfo->bi_mem_reg_no; i++, mr++) 333177110Sraj ; 334177110Sraj 335177110Sraj eth = (struct bi_eth_addr *)mr; 336177110Sraj return (eth); 337177110Sraj} 338177110Sraj 339176771Srajvoid 340176771Sraje500_init(u_int32_t startkernel, u_int32_t endkernel, void *mdp) 341176771Sraj{ 342176771Sraj struct pcpu *pc; 343176771Sraj void *kmdp; 344176771Sraj vm_offset_t end; 345176771Sraj struct bi_mem_region *mr; 346176928Smarcel uint32_t csr; 347176771Sraj int i; 348176771Sraj 349176771Sraj kmdp = NULL; 350176771Sraj 351176771Sraj end = endkernel; 352176771Sraj 353176771Sraj /* 354176771Sraj * Parse metadata and fetch parameters. This must be done as the first 355176771Sraj * step as we need bootinfo data to at least init the console 356176771Sraj */ 357176771Sraj if (mdp != NULL) { 358176771Sraj preload_metadata = mdp; 359176771Sraj kmdp = preload_search_by_type("elf kernel"); 360176771Sraj if (kmdp != NULL) { 361176771Sraj bootinfo = (struct bootinfo *)preload_search_info(kmdp, 362176771Sraj MODINFO_METADATA|MODINFOMD_BOOTINFO); 363176771Sraj 364176771Sraj boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); 365176771Sraj kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); 366176771Sraj end = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t); 367176771Sraj } 368176771Sraj } else { 369176771Sraj /* 370176771Sraj * We should scream but how? - without CCSR bar (in bootinfo) 371176771Sraj * cannot even output anything... 372176771Sraj */ 373176771Sraj 374176771Sraj /* 375176771Sraj * FIXME add return value and handle in the locore so we can 376176771Sraj * return to the loader maybe? (this seems not very easy to 377176771Sraj * restore everything as the TLB have all been reprogrammed 378176771Sraj * in the locore etc...) 379176771Sraj */ 380176771Sraj while(1); 381176771Sraj } 382176771Sraj 383176771Sraj /* Initialize memory regions table */ 384177110Sraj mr = bootinfo_mr(); 385176771Sraj for (i = 0; i < bootinfo->bi_mem_reg_no; i++, mr++) { 386176771Sraj if (i == MEM_REGIONS) 387176771Sraj break; 388176771Sraj availmem_regions[i].mr_start = mr->mem_base; 389176771Sraj availmem_regions[i].mr_size = mr->mem_size; 390176771Sraj } 391176771Sraj availmem_regions_sz = i; 392176771Sraj 393176771Sraj /* Initialize TLB1 handling */ 394176771Sraj tlb1_init(bootinfo->bi_bar_base); 395176771Sraj 396176771Sraj /* 397176771Sraj * Time Base and Decrementer are updated every 8 CCB bus clocks. 398176771Sraj * HID0[SEL_TBCLK] = 0 399176771Sraj */ 400176771Sraj decr_config(bootinfo->bi_bus_clk/8); 401176771Sraj 402176771Sraj /* Init params/tunables that can be overridden by the loader. */ 403176771Sraj init_param1(); 404176771Sraj 405176771Sraj /* Start initializing proc0 and thread0. */ 406176771Sraj proc_linkup(&proc0, &thread0); 407176771Sraj thread0.td_frame = &frame0; 408176771Sraj 409176771Sraj /* Set up per-cpu data and store the pointer in SPR general 0. */ 410176771Sraj pc = &__pcpu[0]; 411176771Sraj pcpu_init(pc, 0, sizeof(struct pcpu)); 412176771Sraj pc->pc_curthread = &thread0; 413176771Sraj pc->pc_cpuid = 0; 414176771Sraj __asm __volatile("mtsprg 0, %0" :: "r"(pc)); 415176771Sraj 416176771Sraj /* Initialize system mutexes. */ 417176771Sraj mutex_init(); 418176771Sraj 419176771Sraj /* Initialize the console before printing anything. */ 420176771Sraj cninit(); 421176771Sraj 422176771Sraj /* Print out some debug info... */ 423176771Sraj debugf("e500_init: console initialized\n"); 424176771Sraj debugf(" arg1 startkernel = 0x%08x\n", startkernel); 425176771Sraj debugf(" arg2 endkernel = 0x%08x\n", endkernel); 426176771Sraj debugf(" arg3 midp = 0x%08x\n", (u_int32_t)mdp); 427176771Sraj debugf(" end = 0x%08x\n", (u_int32_t)end); 428176771Sraj debugf(" boothowto = 0x%08x\n", boothowto); 429176771Sraj debugf(" kernel ccsrbar = 0x%08x\n", CCSRBAR_VA); 430176771Sraj debugf(" MSR = 0x%08x\n", mfmsr()); 431176771Sraj dump_bootinfo(); 432176771Sraj print_kernel_section_addr(); 433176771Sraj dump_kenv(); 434176771Sraj //tlb1_print_entries(); 435176771Sraj //tlb1_print_tlbentries(); 436176771Sraj 437176771Sraj kdb_init(); 438176771Sraj 439176771Sraj#ifdef KDB 440176771Sraj if (boothowto & RB_KDB) 441176771Sraj kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger"); 442176771Sraj#endif 443176771Sraj kobj_machdep_init(); 444176771Sraj 445176771Sraj /* Initialise virtual memory. */ 446176771Sraj pmap_mmu_install(MMU_TYPE_BOOKE, 0); 447176771Sraj pmap_bootstrap(startkernel, end); 448176771Sraj debugf("MSR = 0x%08x\n", mfmsr()); 449176771Sraj //tlb1_print_entries(); 450176771Sraj //tlb1_print_tlbentries(); 451176771Sraj 452176771Sraj /* Initialize params/tunables that are derived from memsize. */ 453176771Sraj init_param2(physmem); 454176771Sraj 455176771Sraj /* Finish setting up thread0. */ 456176771Sraj thread0.td_kstack = (vm_offset_t)kstack0_space; 457176771Sraj thread0.td_pcb = (struct pcb *) 458176771Sraj (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; 459176771Sraj bzero((void *)thread0.td_pcb, sizeof(struct pcb)); 460176771Sraj pc->pc_curpcb = thread0.td_pcb; 461176771Sraj 462176771Sraj /* Initialise the message buffer. */ 463176771Sraj msgbufinit(msgbufp, MSGBUF_SIZE); 464176771Sraj 465176771Sraj /* Enable Machine Check interrupt. */ 466176771Sraj mtmsr(mfmsr() | PSL_ME); 467176771Sraj isync(); 468176771Sraj 469176928Smarcel /* Enable D-cache if applicable */ 470176928Smarcel csr = mfspr(SPR_L1CSR0); 471176928Smarcel if ((csr & L1CSR0_DCE) == 0) { 472176928Smarcel dcache_inval(); 473176928Smarcel dcache_enable(); 474176928Smarcel } 475176928Smarcel csr = mfspr(SPR_L1CSR0); 476176928Smarcel if ((boothowto & RB_VERBOSE) != 0 || (csr & L1CSR0_DCE) == 0) 477176928Smarcel printf("L1 D-cache %sabled\n", 478176928Smarcel (csr & L1CSR0_DCE) ? "en" : "dis"); 479176928Smarcel 480176928Smarcel /* Enable L1 I-cache if applicable. */ 481176928Smarcel csr = mfspr(SPR_L1CSR1); 482176928Smarcel if ((csr & L1CSR1_ICE) == 0) { 483176928Smarcel icache_inval(); 484176928Smarcel icache_enable(); 485176928Smarcel } 486176928Smarcel csr = mfspr(SPR_L1CSR1); 487176928Smarcel if ((boothowto & RB_VERBOSE) != 0 || (csr & L1CSR1_ICE) == 0) 488176928Smarcel printf("L1 I-cache %sabled\n", 489176928Smarcel (csr & L1CSR1_ICE) ? "en" : "dis"); 490176928Smarcel 491176771Sraj debugf("e500_init: e\n"); 492176771Sraj} 493176771Sraj 494176771Sraj/* Initialise a struct pcpu. */ 495176771Srajvoid 496176771Srajcpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t sz) 497176771Sraj{ 498176771Sraj 499176771Sraj} 500176771Sraj 501176771Sraj/* Set set up registers on exec. */ 502176771Srajvoid 503176771Srajexec_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings) 504176771Sraj{ 505176771Sraj struct trapframe *tf; 506176771Sraj struct ps_strings arginfo; 507176771Sraj 508176771Sraj tf = trapframe(td); 509176771Sraj bzero(tf, sizeof *tf); 510176771Sraj tf->fixreg[1] = -roundup(-stack + 8, 16); 511176771Sraj 512176771Sraj /* 513176771Sraj * XXX Machine-independent code has already copied arguments and 514176771Sraj * XXX environment to userland. Get them back here. 515176771Sraj */ 516176771Sraj (void)copyin((char *)PS_STRINGS, &arginfo, sizeof(arginfo)); 517176771Sraj 518176771Sraj /* 519176771Sraj * Set up arguments for _start(): 520176771Sraj * _start(argc, argv, envp, obj, cleanup, ps_strings); 521176771Sraj * 522176771Sraj * Notes: 523176771Sraj * - obj and cleanup are the auxilliary and termination 524176771Sraj * vectors. They are fixed up by ld.elf_so. 525176771Sraj * - ps_strings is a NetBSD extention, and will be 526176771Sraj * ignored by executables which are strictly 527176771Sraj * compliant with the SVR4 ABI. 528176771Sraj * 529176771Sraj * XXX We have to set both regs and retval here due to different 530176771Sraj * XXX calling convention in trap.c and init_main.c. 531176771Sraj */ 532176771Sraj /* 533176771Sraj * XXX PG: these get overwritten in the syscall return code. 534176771Sraj * execve() should return EJUSTRETURN, like it does on NetBSD. 535176771Sraj * Emulate by setting the syscall return value cells. The 536176771Sraj * registers still have to be set for init's fork trampoline. 537176771Sraj */ 538176771Sraj td->td_retval[0] = arginfo.ps_nargvstr; 539176771Sraj td->td_retval[1] = (register_t)arginfo.ps_argvstr; 540176771Sraj tf->fixreg[3] = arginfo.ps_nargvstr; 541176771Sraj tf->fixreg[4] = (register_t)arginfo.ps_argvstr; 542176771Sraj tf->fixreg[5] = (register_t)arginfo.ps_envstr; 543176771Sraj tf->fixreg[6] = 0; /* auxillary vector */ 544176771Sraj tf->fixreg[7] = 0; /* termination vector */ 545176771Sraj tf->fixreg[8] = (register_t)PS_STRINGS; /* NetBSD extension */ 546176771Sraj 547176771Sraj tf->srr0 = entry; 548176771Sraj tf->srr1 = PSL_USERSET; 549176771Sraj td->td_pcb->pcb_flags = 0; 550176771Sraj} 551176771Sraj 552176771Srajint 553176771Srajfill_regs(struct thread *td, struct reg *regs) 554176771Sraj{ 555176771Sraj struct trapframe *tf; 556176771Sraj 557176771Sraj tf = td->td_frame; 558176771Sraj memcpy(regs, tf, sizeof(struct reg)); 559176771Sraj 560176771Sraj return (0); 561176771Sraj} 562176771Sraj 563176771Srajint 564176771Srajfill_fpregs(struct thread *td, struct fpreg *fpregs) 565176771Sraj{ 566176771Sraj 567176771Sraj return (0); 568176771Sraj} 569176771Sraj 570176771Sraj/* Get current clock frequency for the given cpu id. */ 571176771Srajint 572176771Srajcpu_est_clockrate(int cpu_id, uint64_t *rate) 573176771Sraj{ 574176771Sraj 575176771Sraj return (ENXIO); 576176771Sraj} 577176771Sraj 578176771Sraj/* 579176771Sraj * Construct a PCB from a trapframe. This is called from kdb_trap() where 580176771Sraj * we want to start a backtrace from the function that caused us to enter 581176771Sraj * the debugger. We have the context in the trapframe, but base the trace 582176771Sraj * on the PCB. The PCB doesn't have to be perfect, as long as it contains 583176771Sraj * enough for a backtrace. 584176771Sraj */ 585176771Srajvoid 586176771Srajmakectx(struct trapframe *tf, struct pcb *pcb) 587176771Sraj{ 588176771Sraj 589176771Sraj pcb->pcb_lr = tf->srr0; 590176771Sraj pcb->pcb_sp = tf->fixreg[1]; 591176771Sraj} 592176771Sraj 593176771Sraj/* 594176771Sraj * get_mcontext/sendsig helper routine that doesn't touch the 595176771Sraj * proc lock. 596176771Sraj */ 597176771Srajstatic int 598176771Srajgrab_mcontext(struct thread *td, mcontext_t *mcp, int flags) 599176771Sraj{ 600176771Sraj struct pcb *pcb; 601176771Sraj 602176771Sraj pcb = td->td_pcb; 603176771Sraj memset(mcp, 0, sizeof(mcontext_t)); 604176771Sraj 605176771Sraj mcp->mc_vers = _MC_VERSION; 606176771Sraj mcp->mc_flags = 0; 607176771Sraj memcpy(&mcp->mc_frame, td->td_frame, sizeof(struct trapframe)); 608176771Sraj if (flags & GET_MC_CLEAR_RET) { 609176771Sraj mcp->mc_gpr[3] = 0; 610176771Sraj mcp->mc_gpr[4] = 0; 611176771Sraj } 612176771Sraj 613176771Sraj /* XXX Altivec context ? */ 614176771Sraj 615176771Sraj mcp->mc_len = sizeof(*mcp); 616176771Sraj return (0); 617176771Sraj} 618176771Sraj 619176771Srajint 620176771Srajget_mcontext(struct thread *td, mcontext_t *mcp, int flags) 621176771Sraj{ 622176771Sraj int error; 623176771Sraj 624176771Sraj error = grab_mcontext(td, mcp, flags); 625176771Sraj if (error == 0) { 626176771Sraj PROC_LOCK(curthread->td_proc); 627176771Sraj mcp->mc_onstack = sigonstack(td->td_frame->fixreg[1]); 628176771Sraj PROC_UNLOCK(curthread->td_proc); 629176771Sraj } 630176771Sraj 631176771Sraj return (error); 632176771Sraj} 633176771Sraj 634176771Srajint 635176771Srajset_mcontext(struct thread *td, const mcontext_t *mcp) 636176771Sraj{ 637176771Sraj struct pcb *pcb; 638176771Sraj struct trapframe *tf; 639176771Sraj 640176771Sraj pcb = td->td_pcb; 641176771Sraj tf = td->td_frame; 642176771Sraj 643176771Sraj if (mcp->mc_vers != _MC_VERSION || mcp->mc_len != sizeof(*mcp)) 644176771Sraj return (EINVAL); 645176771Sraj 646176771Sraj memcpy(tf, mcp->mc_frame, sizeof(mcp->mc_frame)); 647176771Sraj 648176771Sraj /* XXX Altivec context? */ 649176771Sraj 650176771Sraj return (0); 651176771Sraj} 652176771Sraj 653176771Srajint 654176771Srajsigreturn(struct thread *td, struct sigreturn_args *uap) 655176771Sraj{ 656176771Sraj struct proc *p; 657176771Sraj ucontext_t uc; 658176771Sraj int error; 659176771Sraj 660176771Sraj CTR2(KTR_SIG, "sigreturn: td=%p ucp=%p", td, uap->sigcntxp); 661176771Sraj 662176771Sraj if (copyin(uap->sigcntxp, &uc, sizeof(uc)) != 0) { 663176771Sraj CTR1(KTR_SIG, "sigreturn: efault td=%p", td); 664176771Sraj return (EFAULT); 665176771Sraj } 666176771Sraj 667176771Sraj error = set_mcontext(td, &uc.uc_mcontext); 668176771Sraj if (error != 0) 669176771Sraj return (error); 670176771Sraj 671176771Sraj p = td->td_proc; 672176771Sraj PROC_LOCK(p); 673176771Sraj td->td_sigmask = uc.uc_sigmask; 674176771Sraj SIG_CANTMASK(td->td_sigmask); 675176771Sraj signotify(td); 676176771Sraj PROC_UNLOCK(p); 677176771Sraj 678176771Sraj CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x", 679176771Sraj td, uc.uc_mcontext.mc_srr0, uc.uc_mcontext.mc_gpr[1]); 680176771Sraj 681176771Sraj return (EJUSTRETURN); 682176771Sraj} 683176771Sraj 684176771Sraj#ifdef COMPAT_FREEBSD4 685176771Srajint 686176771Srajfreebsd4_sigreturn(struct thread *td, struct freebsd4_sigreturn_args *uap) 687176771Sraj{ 688176771Sraj 689176771Sraj return sigreturn(td, (struct sigreturn_args *)uap); 690176771Sraj} 691176771Sraj#endif 692176771Sraj 693176771Sraj/* 694176771Sraj * cpu_idle 695176771Sraj * 696176771Sraj * Set Wait state enable. 697176771Sraj */ 698176771Srajvoid 699176771Srajcpu_idle (void) 700176771Sraj{ 701176771Sraj register_t msr; 702176771Sraj 703176771Sraj msr = mfmsr(); 704176771Sraj#ifdef INVARIANTS 705176771Sraj if ((msr & PSL_EE) != PSL_EE) { 706176771Sraj struct thread *td = curthread; 707176771Sraj printf("td msr %x\n", td->td_md.md_saved_msr); 708176771Sraj panic("ints disabled in idleproc!"); 709176771Sraj } 710176771Sraj#endif 711176771Sraj#if 0 712176771Sraj /* 713176771Sraj * Freescale E500 core RM section 6.4.1 714176771Sraj */ 715176771Sraj msr = msr | PSL_WE; 716176771Sraj 717176771Sraj __asm__(" msync;" 718176771Sraj " mtmsr %0;" 719176771Sraj " isync;" 720176771Sraj "loop: b loop" : 721176771Sraj /* no output */ : 722176771Sraj "r" (msr)); 723176771Sraj#endif 724176771Sraj} 725176771Sraj 726176771Srajvoid 727176771Srajspinlock_enter(void) 728176771Sraj{ 729176771Sraj struct thread *td; 730176771Sraj 731176771Sraj td = curthread; 732176771Sraj if (td->td_md.md_spinlock_count == 0) 733176771Sraj td->td_md.md_saved_msr = intr_disable(); 734176771Sraj td->td_md.md_spinlock_count++; 735176771Sraj critical_enter(); 736176771Sraj} 737176771Sraj 738176771Srajvoid 739176771Srajspinlock_exit(void) 740176771Sraj{ 741176771Sraj struct thread *td; 742176771Sraj 743176771Sraj td = curthread; 744176771Sraj critical_exit(); 745176771Sraj td->td_md.md_spinlock_count--; 746176771Sraj if (td->td_md.md_spinlock_count == 0) 747176771Sraj intr_restore(td->td_md.md_saved_msr); 748176771Sraj} 749176771Sraj 750176771Sraj/* Shutdown the CPU as much as possible. */ 751176771Srajvoid 752176771Srajcpu_halt(void) 753176771Sraj{ 754176771Sraj 755176771Sraj mtmsr(mfmsr() & ~(PSL_CE | PSL_EE | PSL_ME | PSL_DE)); 756176771Sraj while (1); 757176771Sraj} 758176771Sraj 759176771Srajint 760176771Srajset_regs(struct thread *td, struct reg *regs) 761176771Sraj{ 762176771Sraj struct trapframe *tf; 763176771Sraj 764176771Sraj tf = td->td_frame; 765176771Sraj memcpy(tf, regs, sizeof(struct reg)); 766176771Sraj return (0); 767176771Sraj} 768176771Sraj 769176771Srajint 770176771Srajfill_dbregs(struct thread *td, struct dbreg *dbregs) 771176771Sraj{ 772176771Sraj 773176771Sraj /* No debug registers on PowerPC */ 774176771Sraj return (ENOSYS); 775176771Sraj} 776176771Sraj 777176771Srajint 778176771Srajset_dbregs(struct thread *td, struct dbreg *dbregs) 779176771Sraj{ 780176771Sraj 781176771Sraj /* No debug registers on PowerPC */ 782176771Sraj return (ENOSYS); 783176771Sraj} 784176771Sraj 785176771Srajint 786176771Srajset_fpregs(struct thread *td, struct fpreg *fpregs) 787176771Sraj{ 788176771Sraj 789176771Sraj return (0); 790176771Sraj} 791176771Sraj 792176771Srajint 793176771Srajptrace_set_pc(struct thread *td, unsigned long addr) 794176771Sraj{ 795176771Sraj struct trapframe *tf; 796176771Sraj 797176771Sraj tf = td->td_frame; 798176771Sraj tf->srr0 = (register_t)addr; 799176771Sraj 800176771Sraj return (0); 801176771Sraj} 802176771Sraj 803176771Srajint 804176771Srajptrace_single_step(struct thread *td) 805176771Sraj{ 806176771Sraj struct trapframe *tf; 807176771Sraj u_int reg; 808176771Sraj 809176771Sraj reg = mfspr(SPR_DBCR0); 810176771Sraj reg |= DBCR0_IC | DBCR0_IDM; 811176771Sraj mtspr(SPR_DBCR0, reg); 812176771Sraj 813176771Sraj tf = td->td_frame; 814176771Sraj tf->srr1 |= PSL_DE; 815176771Sraj return (0); 816176771Sraj} 817176771Sraj 818176771Srajint 819176771Srajptrace_clear_single_step(struct thread *td) 820176771Sraj{ 821176771Sraj struct trapframe *tf; 822176771Sraj 823176771Sraj tf = td->td_frame; 824176771Sraj tf->srr1 &= ~PSL_DE; 825176771Sraj return (0); 826176771Sraj} 827176771Sraj 828176771Srajvoid 829176771Srajkdb_cpu_clear_singlestep(void) 830176771Sraj{ 831176771Sraj register_t r; 832176771Sraj 833176771Sraj r = mfspr(SPR_DBCR0); 834176771Sraj mtspr(SPR_DBCR0, r & ~DBCR0_IC); 835176771Sraj kdb_frame->srr1 &= ~PSL_DE; 836176771Sraj} 837176771Sraj 838176771Srajvoid 839176771Srajkdb_cpu_set_singlestep(void) 840176771Sraj{ 841176771Sraj register_t r; 842176771Sraj 843176771Sraj r = mfspr(SPR_DBCR0); 844176771Sraj mtspr(SPR_DBCR0, r | DBCR0_IC | DBCR0_IDM); 845176771Sraj kdb_frame->srr1 |= PSL_DE; 846176771Sraj} 847176771Sraj 848176771Srajvoid 849176771Srajsendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) 850176771Sraj{ 851176771Sraj struct trapframe *tf; 852176771Sraj struct sigframe *sfp; 853176771Sraj struct sigacts *psp; 854176771Sraj struct sigframe sf; 855176771Sraj struct thread *td; 856176771Sraj struct proc *p; 857176771Sraj int oonstack, rndfsize; 858176771Sraj int sig, code; 859176771Sraj 860176771Sraj td = curthread; 861176771Sraj p = td->td_proc; 862176771Sraj PROC_LOCK_ASSERT(p, MA_OWNED); 863176771Sraj sig = ksi->ksi_signo; 864176771Sraj code = ksi->ksi_code; 865176771Sraj psp = p->p_sigacts; 866176771Sraj mtx_assert(&psp->ps_mtx, MA_OWNED); 867176771Sraj tf = td->td_frame; 868176771Sraj oonstack = sigonstack(tf->fixreg[1]); 869176771Sraj 870176771Sraj rndfsize = ((sizeof(sf) + 15) / 16) * 16; 871176771Sraj 872176771Sraj CTR4(KTR_SIG, "sendsig: td=%p (%s) catcher=%p sig=%d", td, p->p_comm, 873176771Sraj catcher, sig); 874176771Sraj 875176771Sraj /* 876176771Sraj * Save user context 877176771Sraj */ 878176771Sraj memset(&sf, 0, sizeof(sf)); 879176771Sraj grab_mcontext(td, &sf.sf_uc.uc_mcontext, 0); 880176771Sraj sf.sf_uc.uc_sigmask = *mask; 881176771Sraj sf.sf_uc.uc_stack = td->td_sigstk; 882176771Sraj sf.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) 883176771Sraj ? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE; 884176771Sraj 885176771Sraj sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0; 886176771Sraj 887176771Sraj /* 888176771Sraj * Allocate and validate space for the signal handler context. 889176771Sraj */ 890176771Sraj if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && 891176771Sraj SIGISMEMBER(psp->ps_sigonstack, sig)) { 892176771Sraj sfp = (struct sigframe *)((caddr_t)td->td_sigstk.ss_sp + 893176771Sraj td->td_sigstk.ss_size - rndfsize); 894176771Sraj } else { 895176771Sraj sfp = (struct sigframe *)(tf->fixreg[1] - rndfsize); 896176771Sraj } 897176771Sraj 898176771Sraj /* 899176771Sraj * Translate the signal if appropriate (Linux emu ?) 900176771Sraj */ 901176771Sraj if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize) 902176771Sraj sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)]; 903176771Sraj 904176771Sraj /* 905176771Sraj * Save the floating-point state, if necessary, then copy it. 906176771Sraj */ 907176771Sraj /* XXX */ 908176771Sraj 909176771Sraj /* 910176771Sraj * Set up the registers to return to sigcode. 911176771Sraj * 912176771Sraj * r1/sp - sigframe ptr 913176771Sraj * lr - sig function, dispatched to by blrl in trampoline 914176771Sraj * r3 - sig number 915176771Sraj * r4 - SIGINFO ? &siginfo : exception code 916176771Sraj * r5 - user context 917176771Sraj * srr0 - trampoline function addr 918176771Sraj */ 919176771Sraj tf->lr = (register_t)catcher; 920176771Sraj tf->fixreg[1] = (register_t)sfp; 921176771Sraj tf->fixreg[FIRSTARG] = sig; 922176771Sraj tf->fixreg[FIRSTARG+2] = (register_t)&sfp->sf_uc; 923176771Sraj if (SIGISMEMBER(psp->ps_siginfo, sig)) { 924176771Sraj /* 925176771Sraj * Signal handler installed with SA_SIGINFO. 926176771Sraj */ 927176771Sraj tf->fixreg[FIRSTARG+1] = (register_t)&sfp->sf_si; 928176771Sraj 929176771Sraj /* 930176771Sraj * Fill siginfo structure. 931176771Sraj */ 932176771Sraj sf.sf_si = ksi->ksi_info; 933176771Sraj sf.sf_si.si_signo = sig; 934176771Sraj sf.sf_si.si_addr = (void *) ((tf->exc == EXC_DSI) ? 935176771Sraj tf->cpu.booke.dear : tf->srr0); 936176771Sraj } else { 937176771Sraj /* Old FreeBSD-style arguments. */ 938176771Sraj tf->fixreg[FIRSTARG+1] = code; 939176771Sraj tf->fixreg[FIRSTARG+3] = (tf->exc == EXC_DSI) ? 940176771Sraj tf->cpu.booke.dear : tf->srr0; 941176771Sraj } 942176771Sraj mtx_unlock(&psp->ps_mtx); 943176771Sraj PROC_UNLOCK(p); 944176771Sraj 945176771Sraj tf->srr0 = (register_t)(PS_STRINGS - *(p->p_sysent->sv_szsigcode)); 946176771Sraj 947176771Sraj /* 948176771Sraj * copy the frame out to userland. 949176771Sraj */ 950176771Sraj if (copyout((caddr_t)&sf, (caddr_t)sfp, sizeof(sf)) != 0) { 951176771Sraj /* 952176771Sraj * Process has trashed its stack. Kill it. 953176771Sraj */ 954176771Sraj CTR2(KTR_SIG, "sendsig: sigexit td=%p sfp=%p", td, sfp); 955176771Sraj PROC_LOCK(p); 956176771Sraj sigexit(td, SIGILL); 957176771Sraj } 958176771Sraj 959176771Sraj CTR3(KTR_SIG, "sendsig: return td=%p pc=%#x sp=%#x", td, 960176771Sraj tf->srr0, tf->fixreg[1]); 961176771Sraj 962176771Sraj PROC_LOCK(p); 963176771Sraj mtx_lock(&psp->ps_mtx); 964176771Sraj} 965176771Sraj 966176771Srajvoid 967176771Srajbzero(void *buf, size_t len) 968176771Sraj{ 969176771Sraj caddr_t p; 970176771Sraj 971176771Sraj p = buf; 972176771Sraj 973176771Sraj while (((vm_offset_t) p & (sizeof(u_long) - 1)) && len) { 974176771Sraj *p++ = 0; 975176771Sraj len--; 976176771Sraj } 977176771Sraj 978176771Sraj while (len >= sizeof(u_long) * 8) { 979176771Sraj *(u_long*) p = 0; 980176771Sraj *((u_long*) p + 1) = 0; 981176771Sraj *((u_long*) p + 2) = 0; 982176771Sraj *((u_long*) p + 3) = 0; 983176771Sraj len -= sizeof(u_long) * 8; 984176771Sraj *((u_long*) p + 4) = 0; 985176771Sraj *((u_long*) p + 5) = 0; 986176771Sraj *((u_long*) p + 6) = 0; 987176771Sraj *((u_long*) p + 7) = 0; 988176771Sraj p += sizeof(u_long) * 8; 989176771Sraj } 990176771Sraj 991176771Sraj while (len >= sizeof(u_long)) { 992176771Sraj *(u_long*) p = 0; 993176771Sraj len -= sizeof(u_long); 994176771Sraj p += sizeof(u_long); 995176771Sraj } 996176771Sraj 997176771Sraj while (len) { 998176771Sraj *p++ = 0; 999176771Sraj len--; 1000176771Sraj } 1001176771Sraj} 1002176771Sraj 1003176771Sraj/* 1004176771Sraj * XXX what is the better/proper place for this routine? 1005176771Sraj */ 1006176771Srajint 1007176771Srajmem_valid(vm_offset_t addr, int len) 1008176771Sraj{ 1009176771Sraj 1010176771Sraj return (1); 1011176771Sraj} 1012