1164426Ssam/* $NetBSD: hpc_machdep.c,v 1.70 2003/09/16 08:18:22 agc Exp $ */ 2164426Ssam 3164426Ssam/*- 4164426Ssam * Copyright (c) 1994-1998 Mark Brinicombe. 5164426Ssam * Copyright (c) 1994 Brini. 6164426Ssam * All rights reserved. 7164426Ssam * 8164426Ssam * This code is derived from software written for Brini by Mark Brinicombe 9164426Ssam * 10164426Ssam * Redistribution and use in source and binary forms, with or without 11164426Ssam * modification, are permitted provided that the following conditions 12164426Ssam * are met: 13164426Ssam * 1. Redistributions of source code must retain the above copyright 14164426Ssam * notice, this list of conditions and the following disclaimer. 15164426Ssam * 2. Redistributions in binary form must reproduce the above copyright 16164426Ssam * notice, this list of conditions and the following disclaimer in the 17164426Ssam * documentation and/or other materials provided with the distribution. 18164426Ssam * 3. All advertising materials mentioning features or use of this software 19164426Ssam * must display the following acknowledgement: 20164426Ssam * This product includes software developed by Brini. 21164426Ssam * 4. The name of the company nor the name of the author may be used to 22164426Ssam * endorse or promote products derived from this software without specific 23164426Ssam * prior written permission. 24164426Ssam * 25164426Ssam * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED 26164426Ssam * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 27164426Ssam * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28164426Ssam * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 29164426Ssam * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 30164426Ssam * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 31164426Ssam * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32164426Ssam * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33164426Ssam * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34164426Ssam * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35164426Ssam * SUCH DAMAGE. 36164426Ssam * 37164426Ssam * RiscBSD kernel project 38164426Ssam * 39164426Ssam * machdep.c 40164426Ssam * 41299069Spfg * Machine dependent functions for kernel setup 42164426Ssam * 43236987Simp * This file needs a lot of work. 44164426Ssam * 45164426Ssam * Created : 17/09/94 46164426Ssam */ 47164426Ssam 48164426Ssam#include <sys/cdefs.h> 49164426Ssam__FBSDID("$FreeBSD$"); 50164426Ssam 51285627Szbb#include "opt_kstack_pages.h" 52285627Szbb 53164426Ssam#define _ARM32_BUS_DMA_PRIVATE 54164426Ssam#include <sys/param.h> 55164426Ssam#include <sys/systm.h> 56164426Ssam#include <sys/sysproto.h> 57164426Ssam#include <sys/signalvar.h> 58164426Ssam#include <sys/imgact.h> 59164426Ssam#include <sys/kernel.h> 60164426Ssam#include <sys/ktr.h> 61164426Ssam#include <sys/linker.h> 62164426Ssam#include <sys/lock.h> 63164426Ssam#include <sys/malloc.h> 64164426Ssam#include <sys/mutex.h> 65164426Ssam#include <sys/pcpu.h> 66164426Ssam#include <sys/proc.h> 67164426Ssam#include <sys/ptrace.h> 68164426Ssam#include <sys/cons.h> 69164426Ssam#include <sys/bio.h> 70164426Ssam#include <sys/bus.h> 71164426Ssam#include <sys/buf.h> 72164426Ssam#include <sys/exec.h> 73164426Ssam#include <sys/kdb.h> 74164426Ssam#include <sys/msgbuf.h> 75298627Sbr#include <sys/devmap.h> 76261643Sian#include <machine/physmem.h> 77164426Ssam#include <machine/reg.h> 78164426Ssam#include <machine/cpu.h> 79164426Ssam 80164426Ssam#include <vm/vm.h> 81164426Ssam#include <vm/pmap.h> 82164426Ssam#include <vm/vm_object.h> 83164426Ssam#include <vm/vm_page.h> 84164426Ssam#include <vm/vm_map.h> 85164426Ssam#include <machine/vmparam.h> 86164426Ssam#include <machine/pcb.h> 87164426Ssam#include <machine/undefined.h> 88164426Ssam#include <machine/machdep.h> 89164426Ssam#include <machine/metadata.h> 90164426Ssam#include <machine/armreg.h> 91164426Ssam#include <machine/bus.h> 92164426Ssam#include <sys/reboot.h> 93164426Ssam 94164426Ssam#include <arm/xscale/ixp425/ixp425reg.h> 95164426Ssam#include <arm/xscale/ixp425/ixp425var.h> 96164426Ssam 97164426Ssam#define KERNEL_PT_SYS 0 /* Page table for mapping proc0 zero page */ 98164426Ssam#define KERNEL_PT_IO 1 99164426Ssam#define KERNEL_PT_IO_NUM 3 100164426Ssam#define KERNEL_PT_BEFOREKERN KERNEL_PT_IO + KERNEL_PT_IO_NUM 101164426Ssam#define KERNEL_PT_AFKERNEL KERNEL_PT_BEFOREKERN + 1 /* L2 table for mapping after kernel */ 102164426Ssam#define KERNEL_PT_AFKERNEL_NUM 9 103164426Ssam 104164426Ssam/* this should be evenly divisable by PAGE_SIZE / L2_TABLE_SIZE_REAL (or 4) */ 105164426Ssam#define NUM_KERNEL_PTS (KERNEL_PT_AFKERNEL + KERNEL_PT_AFKERNEL_NUM) 106164426Ssam 107164426Ssamstruct pv_addr kernel_pt_table[NUM_KERNEL_PTS]; 108164426Ssam 109164426Ssam/* Physical and virtual addresses for some global pages */ 110164426Ssam 111164426Ssamstruct pv_addr systempage; 112164426Ssamstruct pv_addr msgbufpv; 113164426Ssamstruct pv_addr irqstack; 114164426Ssamstruct pv_addr undstack; 115164426Ssamstruct pv_addr abtstack; 116164426Ssamstruct pv_addr kernelstack; 117164426Ssamstruct pv_addr minidataclean; 118164426Ssam 119164426Ssam/* Static device mappings. */ 120298627Sbrstatic const struct devmap_entry ixp425_devmap[] = { 121164426Ssam /* Physical/Virtual address for I/O space */ 122295694Sskra { IXP425_IO_VBASE, IXP425_IO_HWBASE, IXP425_IO_SIZE, }, 123164426Ssam 124164426Ssam /* Expansion Bus */ 125295694Sskra { IXP425_EXP_VBASE, IXP425_EXP_HWBASE, IXP425_EXP_SIZE, }, 126164426Ssam 127188088Ssam /* CFI Flash on the Expansion Bus */ 128188088Ssam { IXP425_EXP_BUS_CS0_VBASE, IXP425_EXP_BUS_CS0_HWBASE, 129295694Sskra IXP425_EXP_BUS_CS0_SIZE, }, 130188088Ssam 131164426Ssam /* IXP425 PCI Configuration */ 132295694Sskra { IXP425_PCI_VBASE, IXP425_PCI_HWBASE, IXP425_PCI_SIZE, }, 133164426Ssam 134164426Ssam /* SDRAM Controller */ 135295694Sskra { IXP425_MCU_VBASE, IXP425_MCU_HWBASE, IXP425_MCU_SIZE, }, 136164426Ssam 137164426Ssam /* PCI Memory Space */ 138295694Sskra { IXP425_PCI_MEM_VBASE, IXP425_PCI_MEM_HWBASE, IXP425_PCI_MEM_SIZE, }, 139186352Ssam 140186352Ssam /* Q-Mgr Memory Space */ 141295694Sskra { IXP425_QMGR_VBASE, IXP425_QMGR_HWBASE, IXP425_QMGR_SIZE, }, 142186352Ssam 143186352Ssam { 0 }, 144186352Ssam}; 145186352Ssam 146186352Ssam/* Static device mappings. */ 147298627Sbrstatic const struct devmap_entry ixp435_devmap[] = { 148186352Ssam /* Physical/Virtual address for I/O space */ 149295694Sskra { IXP425_IO_VBASE, IXP425_IO_HWBASE, IXP425_IO_SIZE, }, 150186352Ssam 151295694Sskra { IXP425_EXP_VBASE, IXP425_EXP_HWBASE, IXP425_EXP_SIZE, }, 152186352Ssam 153186352Ssam /* IXP425 PCI Configuration */ 154295694Sskra { IXP425_PCI_VBASE, IXP425_PCI_HWBASE, IXP425_PCI_SIZE, }, 155186352Ssam 156186352Ssam /* DDRII Controller NB: mapped same place as IXP425 */ 157295694Sskra { IXP425_MCU_VBASE, IXP435_MCU_HWBASE, IXP425_MCU_SIZE, }, 158186352Ssam 159186352Ssam /* PCI Memory Space */ 160295694Sskra { IXP425_PCI_MEM_VBASE, IXP425_PCI_MEM_HWBASE, IXP425_PCI_MEM_SIZE, }, 161186352Ssam 162164426Ssam /* Q-Mgr Memory Space */ 163295694Sskra { IXP425_QMGR_VBASE, IXP425_QMGR_HWBASE, IXP425_QMGR_SIZE, }, 164164426Ssam 165194654Ssam /* CFI Flash on the Expansion Bus */ 166194654Ssam { IXP425_EXP_BUS_CS0_VBASE, IXP425_EXP_BUS_CS0_HWBASE, 167295694Sskra IXP425_EXP_BUS_CS0_SIZE, }, 168194654Ssam 169186352Ssam /* USB1 Memory Space */ 170295694Sskra { IXP435_USB1_VBASE, IXP435_USB1_HWBASE, IXP435_USB1_SIZE, }, 171186352Ssam /* USB2 Memory Space */ 172295694Sskra { IXP435_USB2_VBASE, IXP435_USB2_HWBASE, IXP435_USB2_SIZE, }, 173186352Ssam 174194654Ssam /* GPS Memory Space */ 175295694Sskra { CAMBRIA_GPS_VBASE, CAMBRIA_GPS_HWBASE, CAMBRIA_GPS_SIZE, }, 176194654Ssam 177194654Ssam /* RS485 Memory Space */ 178295694Sskra { CAMBRIA_RS485_VBASE, CAMBRIA_RS485_HWBASE, CAMBRIA_RS485_SIZE, }, 179194654Ssam 180186352Ssam { 0 } 181164426Ssam}; 182164426Ssam 183164426Ssamextern vm_offset_t xscale_cache_clean_addr; 184164426Ssam 185164426Ssamvoid * 186236524Simpinitarm(struct arm_boot_params *abp) 187164426Ssam{ 188186352Ssam#define next_chunk2(a,b) (((a) + (b)) &~ ((b)-1)) 189186352Ssam#define next_page(a) next_chunk2(a,PAGE_SIZE) 190164426Ssam struct pv_addr kernel_l1pt; 191194784Sjeff struct pv_addr dpcpu; 192177886Sraj int loop, i; 193164426Ssam u_int l1pagetable; 194164426Ssam vm_offset_t freemempos; 195164426Ssam vm_offset_t freemem_pt; 196164426Ssam vm_offset_t afterkern; 197164426Ssam vm_offset_t freemem_after; 198164426Ssam vm_offset_t lastaddr; 199164426Ssam uint32_t memsize; 200164426Ssam 201261646Sian /* kernel text starts where we were loaded at boot */ 202261646Sian#define KERNEL_TEXT_OFF (abp->abp_physaddr - PHYSADDR) 203261646Sian#define KERNEL_TEXT_BASE (KERNBASE + KERNEL_TEXT_OFF) 204261646Sian#define KERNEL_TEXT_PHYS (PHYSADDR + KERNEL_TEXT_OFF) 205261646Sian 206237040Simp lastaddr = parse_boot_param(abp); 207261649Sian arm_physmem_kernaddr = abp->abp_physaddr; 208186352Ssam set_cpufuncs(); /* NB: sets cputype */ 209164426Ssam pcpu_init(pcpup, 0, sizeof(struct pcpu)); 210164426Ssam PCPU_SET(curthread, &thread0); 211164426Ssam 212293045Sian init_static_kenv(NULL, 0); 213293045Sian 214218666Scognet /* Do basic tuning, hz etc */ 215218666Scognet init_param1(); 216218666Scognet 217186352Ssam /* 218186352Ssam * We allocate memory downwards from where we were loaded 219186352Ssam * by RedBoot; first the L1 page table, then NUM_KERNEL_PTS 220186352Ssam * entries in the L2 page table. Past that we re-align the 221186352Ssam * allocation boundary so later data structures (stacks, etc) 222186352Ssam * can be mapped with different attributes (write-back vs 223186352Ssam * write-through). Note this leaves a gap for expansion 224186352Ssam * (or might be repurposed). 225186352Ssam */ 226261646Sian freemempos = abp->abp_physaddr; 227164426Ssam 228186352Ssam /* macros to simplify initial memory allocation */ 229186352Ssam#define alloc_pages(var, np) do { \ 230186352Ssam freemempos -= (np * PAGE_SIZE); \ 231186352Ssam (var) = freemempos; \ 232186352Ssam /* NB: this works because locore maps PA=VA */ \ 233186352Ssam memset((char *)(var), 0, ((np) * PAGE_SIZE)); \ 234186352Ssam} while (0) 235186352Ssam#define valloc_pages(var, np) do { \ 236186352Ssam alloc_pages((var).pv_pa, (np)); \ 237261646Sian (var).pv_va = (var).pv_pa + (KERNVIRTADDR - abp->abp_physaddr); \ 238186352Ssam} while (0) 239164426Ssam 240186352Ssam /* force L1 page table alignment */ 241164426Ssam while (((freemempos - L1_TABLE_SIZE) & (L1_TABLE_SIZE - 1)) != 0) 242164426Ssam freemempos -= PAGE_SIZE; 243186352Ssam /* allocate contiguous L1 page table */ 244164426Ssam valloc_pages(kernel_l1pt, L1_TABLE_SIZE / PAGE_SIZE); 245186352Ssam /* now allocate L2 page tables; they are linked to L1 below */ 246164426Ssam for (loop = 0; loop < NUM_KERNEL_PTS; ++loop) { 247164426Ssam if (!(loop % (PAGE_SIZE / L2_TABLE_SIZE_REAL))) { 248164426Ssam valloc_pages(kernel_pt_table[loop], 249164426Ssam L2_TABLE_SIZE / PAGE_SIZE); 250164426Ssam } else { 251164426Ssam kernel_pt_table[loop].pv_pa = freemempos + 252164426Ssam (loop % (PAGE_SIZE / L2_TABLE_SIZE_REAL)) * 253164426Ssam L2_TABLE_SIZE_REAL; 254236987Simp kernel_pt_table[loop].pv_va = 255186352Ssam kernel_pt_table[loop].pv_pa + 256261646Sian (KERNVIRTADDR - abp->abp_physaddr); 257164426Ssam } 258164426Ssam } 259186352Ssam freemem_pt = freemempos; /* base of allocated pt's */ 260186352Ssam 261164426Ssam /* 262186352Ssam * Re-align allocation boundary so we can map the area 263186352Ssam * write-back instead of write-through for the stacks and 264186352Ssam * related structures allocated below. 265186352Ssam */ 266186352Ssam freemempos = PHYSADDR + 0x100000; 267186352Ssam /* 268164426Ssam * Allocate a page for the system page mapped to V0x00000000 269164426Ssam * This page will just contain the system vectors and can be 270164426Ssam * shared by all processes. 271164426Ssam */ 272164426Ssam valloc_pages(systempage, 1); 273164426Ssam 274194784Sjeff /* Allocate dynamic per-cpu area. */ 275194784Sjeff valloc_pages(dpcpu, DPCPU_SIZE / PAGE_SIZE); 276194784Sjeff dpcpu_init((void *)dpcpu.pv_va, 0); 277194784Sjeff 278164426Ssam /* Allocate stacks for all modes */ 279164426Ssam valloc_pages(irqstack, IRQ_STACK_SIZE); 280164426Ssam valloc_pages(abtstack, ABT_STACK_SIZE); 281164426Ssam valloc_pages(undstack, UND_STACK_SIZE); 282286584Skib valloc_pages(kernelstack, kstack_pages); 283164426Ssam alloc_pages(minidataclean.pv_pa, 1); 284217688Spluknet valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE); 285164426Ssam 286164426Ssam /* 287186352Ssam * Now construct the L1 page table. First map the L2 288186352Ssam * page tables into the L1 so we can replace L1 mappings 289186352Ssam * later on if necessary 290164426Ssam */ 291164426Ssam l1pagetable = kernel_l1pt.pv_va; 292164426Ssam 293164426Ssam /* Map the L2 pages tables in the L1 page table */ 294298433Spfg pmap_link_l2pt(l1pagetable, rounddown2(ARM_VECTORS_HIGH, 0x00100000), 295164426Ssam &kernel_pt_table[KERNEL_PT_SYS]); 296164426Ssam pmap_link_l2pt(l1pagetable, IXP425_IO_VBASE, 297186352Ssam &kernel_pt_table[KERNEL_PT_IO]); 298164426Ssam pmap_link_l2pt(l1pagetable, IXP425_MCU_VBASE, 299186352Ssam &kernel_pt_table[KERNEL_PT_IO + 1]); 300164426Ssam pmap_link_l2pt(l1pagetable, IXP425_PCI_MEM_VBASE, 301186352Ssam &kernel_pt_table[KERNEL_PT_IO + 2]); 302164426Ssam pmap_link_l2pt(l1pagetable, KERNBASE, 303164426Ssam &kernel_pt_table[KERNEL_PT_BEFOREKERN]); 304186352Ssam pmap_map_chunk(l1pagetable, KERNBASE, PHYSADDR, 0x100000, 305164426Ssam VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); 306186352Ssam pmap_map_chunk(l1pagetable, KERNBASE + 0x100000, PHYSADDR + 0x100000, 307164426Ssam 0x100000, VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE); 308186352Ssam pmap_map_chunk(l1pagetable, KERNEL_TEXT_BASE, KERNEL_TEXT_PHYS, 309186352Ssam next_chunk2(((uint32_t)lastaddr) - KERNEL_TEXT_BASE, L1_S_SIZE), 310164426Ssam VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); 311186352Ssam freemem_after = next_page((int)lastaddr); 312186352Ssam afterkern = round_page(next_chunk2((vm_offset_t)lastaddr, L1_S_SIZE)); 313164426Ssam for (i = 0; i < KERNEL_PT_AFKERNEL_NUM; i++) { 314164426Ssam pmap_link_l2pt(l1pagetable, afterkern + i * 0x00100000, 315164426Ssam &kernel_pt_table[KERNEL_PT_AFKERNEL + i]); 316164426Ssam } 317236987Simp pmap_map_entry(l1pagetable, afterkern, minidataclean.pv_pa, 318164426Ssam VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); 319164426Ssam 320164426Ssam 321164426Ssam /* Map the Mini-Data cache clean area. */ 322164426Ssam xscale_setup_minidata(l1pagetable, afterkern, 323164426Ssam minidataclean.pv_pa); 324164426Ssam 325164426Ssam /* Map the vector page. */ 326164426Ssam pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa, 327164426Ssam VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); 328186352Ssam if (cpu_is_ixp43x()) 329298627Sbr devmap_bootstrap(l1pagetable, ixp435_devmap); 330186352Ssam else 331298627Sbr devmap_bootstrap(l1pagetable, ixp425_devmap); 332164426Ssam /* 333164426Ssam * Give the XScale global cache clean code an appropriately 334164426Ssam * sized chunk of unmapped VA space starting at 0xff000000 335164426Ssam * (our device mappings end before this address). 336164426Ssam */ 337164426Ssam xscale_cache_clean_addr = 0xff000000U; 338164426Ssam 339164426Ssam cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT); 340295213Smmel cpu_setttb(kernel_l1pt.pv_pa); 341164426Ssam cpu_tlb_flushID(); 342164426Ssam cpu_domains(DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)); 343186352Ssam 344164426Ssam /* 345164426Ssam * Pages were allocated during the secondary bootstrap for the 346164426Ssam * stacks for different CPU modes. 347164426Ssam * We must now set the r13 registers in the different CPU modes to 348164426Ssam * point to these stacks. 349164426Ssam * Since the ARM stacks use STMFD etc. we must set r13 to the top end 350164426Ssam * of the stack memory. 351164426Ssam */ 352240802Sandrew set_stackptrs(0); 353164426Ssam 354164426Ssam /* 355164426Ssam * We must now clean the cache again.... 356164426Ssam * Cleaning may be done by reading new data to displace any 357295213Smmel * dirty data in the cache. This will have happened in cpu_setttb() 358164426Ssam * but since we are boot strapping the addresses used for the read 359164426Ssam * may have just been remapped and thus the cache could be out 360164426Ssam * of sync. A re-clean after the switch will cure this. 361185513Sstas * After booting there are no gross relocations of the kernel thus 362164426Ssam * this problem will not occur after initarm(). 363164426Ssam */ 364164426Ssam cpu_idcache_wbinv_all(); 365280823Sandrew cpu_setup(); 366258412Sian 367186352Ssam /* ready to setup the console (XXX move earlier if possible) */ 368186352Ssam cninit(); 369164426Ssam /* 370186352Ssam * Fetch the RAM size from the MCU registers. The 371186352Ssam * expansion bus was mapped above so we can now read 'em. 372164426Ssam */ 373186352Ssam if (cpu_is_ixp43x()) 374186352Ssam memsize = ixp435_ddram_size(); 375186352Ssam else 376186352Ssam memsize = ixp425_sdram_size(); 377164426Ssam 378164426Ssam undefined_init(); 379186352Ssam 380236828Sandrew init_proc0(kernelstack.pv_va); 381164426Ssam 382164426Ssam arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); 383164426Ssam 384164426Ssam pmap_curmaxkvaddr = afterkern + PAGE_SIZE; 385256712Scognet vm_max_kernel_address = 0xe0000000; 386247046Salc pmap_bootstrap(pmap_curmaxkvaddr, &kernel_l1pt); 387164426Ssam msgbufp = (void*)msgbufpv.pv_va; 388217688Spluknet msgbufinit(msgbufp, msgbufsize); 389164426Ssam mutex_init(); 390186352Ssam 391261643Sian /* 392261643Sian * Add the physical ram we have available. 393261643Sian * 394261643Sian * Exclude the kernel, and all the things we allocated which immediately 395261643Sian * follow the kernel, from the VM allocation pool but not from crash 396261643Sian * dumps. virtual_avail is a global variable which tracks the kva we've 397261643Sian * "allocated" while setting up pmaps. 398261643Sian * 399261643Sian * Prepare the list of physical memory available to the vm subsystem. 400261643Sian */ 401261643Sian arm_physmem_hardware_region(PHYSADDR, memsize); 402292525Sian arm_physmem_exclude_region(freemem_pt, abp->abp_physaddr - 403266850Scognet freemem_pt, EXFLAG_NOALLOC); 404292525Sian arm_physmem_exclude_region(freemempos, abp->abp_physaddr - 0x100000 - 405266850Scognet freemempos, EXFLAG_NOALLOC); 406261643Sian arm_physmem_exclude_region(abp->abp_physaddr, 407261643Sian virtual_avail - KERNVIRTADDR, EXFLAG_NOALLOC); 408261643Sian arm_physmem_init_kernel_globals(); 409186352Ssam 410164426Ssam init_param2(physmem); 411164426Ssam kdb_init(); 412183557Sbms 413164426Ssam return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP - 414164426Ssam sizeof(struct pcb))); 415186352Ssam#undef next_page 416186352Ssam#undef next_chunk2 417164426Ssam} 418