本文整理汇总了C++中pmap_bootstrap函数的典型用法代码示例。如果您正苦于以下问题:C++ pmap_bootstrap函数的具体用法?C++ pmap_bootstrap怎么用?C++ pmap_bootstrap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pmap_bootstrap函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: mips_init
static void
mips_init(void)
{
int i;
for (i = 0; i < 10; i++) {
phys_avail[i] = 0;
}
/* phys_avail regions are in bytes */
phys_avail[0] = MIPS_KSEG0_TO_PHYS((vm_offset_t)&end);
phys_avail[1] = ctob(realmem);
physmem = realmem;
init_param1();
init_param2(physmem);
mips_cpu_init();
pmap_bootstrap();
mips_proc0_init();
mutex_init();
#ifdef DDB
kdb_init();
#endif
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:25,代码来源:malta_machdep.c
示例2: mips_init
static void
mips_init(void)
{
int i;
printf("entry: mips_init()\n");
bootverbose = 1;
realmem = btoc(32 << 20);
for (i = 0; i < 10; i++) {
phys_avail[i] = 0;
}
/* phys_avail regions are in bytes */
dump_avail[0] = phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end);
dump_avail[1] = phys_avail[1] = ctob(realmem);
physmem = realmem;
init_param1();
init_param2(physmem);
mips_cpu_init();
pmap_bootstrap();
mips_proc0_init();
mutex_init();
kdb_init();
#ifdef KDB
if (boothowto & RB_KDB)
kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger");
#endif
}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:32,代码来源:rt305x_machdep.c
示例3: mips_init
static void
mips_init(void)
{
int i;
#ifdef FDT
struct mem_region mr[FDT_MEM_REGIONS];
uint64_t val;
int mr_cnt;
int j;
#endif
for (i = 0; i < 10; i++) {
phys_avail[i] = 0;
}
/* phys_avail regions are in bytes */
phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end);
phys_avail[1] = ctob(realmem);
dump_avail[0] = phys_avail[0];
dump_avail[1] = phys_avail[1];
physmem = realmem;
#ifdef FDT
if (fdt_get_mem_regions(mr, &mr_cnt, &val) == 0) {
physmem = btoc(val);
KASSERT((phys_avail[0] >= mr[0].mr_start) && \
(phys_avail[0] < (mr[0].mr_start + mr[0].mr_size)),
("First region is not within FDT memory range"));
/* Limit size of the first region */
phys_avail[1] = (mr[0].mr_start + MIN(mr[0].mr_size, ctob(realmem)));
dump_avail[1] = phys_avail[1];
/* Add the rest of regions */
for (i = 1, j = 2; i < mr_cnt; i++, j+=2) {
phys_avail[j] = mr[i].mr_start;
phys_avail[j+1] = (mr[i].mr_start + mr[i].mr_size);
dump_avail[j] = phys_avail[j];
dump_avail[j+1] = phys_avail[j+1];
}
}
#endif
init_param1();
init_param2(physmem);
mips_cpu_init();
pmap_bootstrap();
mips_proc0_init();
mutex_init();
kdb_init();
#ifdef KDB
if (boothowto & RB_KDB)
kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger");
#endif
}
开发者ID:RichardsonAlex,项目名称:cheribsd,代码行数:59,代码来源:beri_machdep.c
示例4: landisk_startup
__dead void
landisk_startup(int howto, char *_esym)
{
u_int32_t ramsize;
/* Start to determine heap area */
esym = _esym;
kernend = (vaddr_t)round_page((vaddr_t)esym);
boothowto = howto;
ramsize = getramsize();
/* Initialize CPU ops. */
sh_cpu_init(CPU_ARCH_SH4, CPU_PRODUCT_7751R);
/* Initialize early console */
consinit();
/* Load memory to UVM */
if (ramsize == 0 || ramsize > 512 * 1024 * 1024)
ramsize = IOM_RAM_SIZE;
physmem = atop(ramsize);
kernend = atop(round_page(SH3_P1SEG_TO_PHYS(kernend)));
uvm_page_physload(atop(IOM_RAM_BEGIN),
atop(IOM_RAM_BEGIN + ramsize), kernend,
atop(IOM_RAM_BEGIN + ramsize), 0);
cpu_init_kcore_hdr(); /* need to be done before pmap_bootstrap */
/* Initialize proc0 u-area */
sh_proc0_init();
/* Initialize pmap and start to address translation */
pmap_bootstrap();
#if defined(DDB)
db_machine_init();
ddb_init();
if (boothowto & RB_KDB) {
Debugger();
}
#endif
/* Jump to main */
__asm volatile(
"jmp @%0\n\t"
" mov %1, sp"
:: "r" (main), "r" (proc0.p_md.md_pcb->pcb_sf.sf_r7_bank));
/* NOTREACHED */
for (;;) ;
}
开发者ID:toddfries,项目名称:OpenBSD-sys-patches,代码行数:51,代码来源:machdep.c
示例5: dreamcast_startup
void
dreamcast_startup()
{
extern char edata[], end[];
paddr_t kernend;
/* Clear bss */
memset(edata, 0, end - edata);
/* Initialize CPU ops. */
sh_cpu_init(CPU_ARCH_SH4, CPU_PRODUCT_7750);
/* Console */
consinit();
/* Load memory to UVM */
physmem = atop(IOM_RAM_SIZE);
kernend = atop(round_page(SH3_P1SEG_TO_PHYS(end)));
uvm_page_physload(
kernend, atop(IOM_RAM_BEGIN + IOM_RAM_SIZE),
kernend, atop(IOM_RAM_BEGIN + IOM_RAM_SIZE),
VM_FREELIST_DEFAULT);
/* Initialize proc0 u-area */
sh_proc0_init();
/* Initialize pmap and start to address translation */
pmap_bootstrap();
/* Debugger. */
#ifdef DDB
ddb_init(0, NULL, NULL);
#endif
#if defined(KGDB) && (NSCIF > 0)
if (scif_kgdb_init() == 0) {
kgdb_debug_init = 1;
kgdb_connect(1);
}
#endif /* KGDB && NSCIF > 0 */
/* Jump to main */
__asm__ __volatile__(
"jmp @%0;"
"mov %1, sp"
:: "r"(main),"r"(proc0.p_md.md_pcb->pcb_sf.sf_r7_bank));
/* NOTREACHED */
while (1)
;
}
开发者ID:MarginC,项目名称:kame,代码行数:49,代码来源:machdep.c
示例6: _vm_init
/*
* This function is called from _bootstrap() to initialize
* pre-vm-sytem virtual memory. All this really does is to
* set virtual_avail to the first page following preloaded
* data (i.e. the kernel and its symbol table) and special
* things that may be needed very early (lwp0 upages).
* Once that is done, pmap_bootstrap() is called to do the
* usual preparations for our use of the MMU.
*/
static void
_vm_init(void)
{
vaddr_t nextva;
/*
* First preserve our symbol table, which might have been
* loaded after our BSS area by the boot loader. However,
* if DDB is not part of this kernel, ignore the symbols.
*/
esym = end + 4;
#if defined(DDB)
/* This will advance esym past the symbols. */
_save_symtab();
#endif
/*
* Steal some special-purpose, already mapped pages.
* Note: msgbuf is setup in machdep.c:cpu_startup()
*/
nextva = m68k_round_page(esym);
/*
* Setup the u-area pages (stack, etc.) for lwp0.
* This is done very early (here) to make sure the
* fault handler works in case we hit an early bug.
* (The fault handler may reference lwp0 stuff.)
*/
uvm_lwp_setuarea(&lwp0, nextva);
memset((void *)nextva, 0, USPACE);
nextva += USPACE;
/*
* Now that lwp0 exists, make it the "current" one.
*/
curlwp = &lwp0;
curpcb = lwp_getpcb(&lwp0);
/* This does most of the real work. */
pmap_bootstrap(nextva);
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:51,代码来源:locore2.c
示例7: hppa_init
//.........这里部分代码省略.........
valloc(msghdrs, struct msg, msginfo.msgtql);
valloc(msqids, struct msqid_ds, msginfo.msgmni);
#endif
#ifndef BUFCACHEPERCENT
#define BUFCACHEPERCENT 10
#endif /* BUFCACHEPERCENT */
if (bufpages == 0)
bufpages = totalphysmem / BUFCACHEPERCENT / CLSIZE;
if (nbuf == 0) {
nbuf = bufpages;
if (nbuf < 16)
nbuf = 16;
}
/* Restrict to at most 70% filled kvm */
if (nbuf * MAXBSIZE >
(VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) * 7 / 10)
nbuf = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
MAXBSIZE * 7 / 10;
/* More buffer pages than fits into the buffers is senseless. */
if (bufpages > nbuf * MAXBSIZE / CLBYTES)
bufpages = nbuf * MAXBSIZE / CLBYTES;
if (nswbuf == 0) {
nswbuf = (nbuf / 2) & ~1; /* force even */
if (nswbuf > 256)
nswbuf = 256; /* sanity */
}
valloc(swbuf, struct buf, nswbuf);
valloc(buf, struct buf, nbuf);
#undef valloc
bzero ((void *)vstart, (v - vstart));
vstart = v;
pmap_bootstrap(&vstart, &vend);
physmem = totalphysmem - btoc(vstart);
/* alloc msgbuf */
if (!(msgbufp = (void *)pmap_steal_memory(sizeof(struct msgbuf),
NULL, NULL)))
panic("cannot allocate msgbuf");
msgbufmapped = 1;
#ifdef DEBUG
printf("mem: %x+%x, %x\n", physmem, resvmem, totalphysmem);
#endif
/* Turn on the HW TLB assist */
if (usehpt) {
if ((pdcerr = pdc_call((iodcio_t)pdc, 0, PDC_TLB,
PDC_TLB_CONFIG, &pdc_hwtlb, hpt_table,
sizeof(struct hpt_entry) * hpt_hashsize,
PDC_TLB_WORD3)) < 0) {
printf("Warning: HW TLB init failed (%d), disabled\n",
pdcerr);
usehpt = 0;
} else
printf("HW TLB(%d entries at 0x%x) initialized (%d)\n",
hpt_hashsize, hpt_table, pdcerr);
}
/*
* Locate any coprocessors and enable them by setting up the CCR.
* SFU's are ignored (since we dont have any). Also, initialize
* the floating point registers here.
*/
if ((pdcerr = pdc_call((iodcio_t)pdc, 0, PDC_COPROC, PDC_COPROC_DFLT,
&pdc_coproc)) < 0)
printf("WARNING: PDC_COPROC call Ret'd %d\n", pdcerr);
else {
#ifdef DEBUG
printf("pdc_coproc: %x, %x\n", pdc_coproc.ccr_enable,
pdc_coproc.ccr_present);
#endif
}
copr_sfu_config = pdc_coproc.ccr_enable;
mtctl(copr_sfu_config & CCR_MASK, CR_CCR);
/*
fprinit(&fpcopr_version);
fpcopr_version = (fpcopr_version & 0x003ff800) >> 11;
mtctl(CR_CCR, 0);
*/
/*
* Clear the FAULT light (so we know when we get a real one)
* PDC_COPROC apparently turns it on (for whatever reason).
*/
pdcerr = PDC_OSTAT(PDC_OSTAT_RUN) | 0xCEC0;
(void) (*pdc)(PDC_CHASSIS, PDC_CHASSIS_DISP, pdcerr);
#ifdef DDB
ddb_init();
#endif
#ifdef DEBUG
printf("hppa_init: leaving\n");
#endif
kernelmapped++;
}
开发者ID:MarginC,项目名称:kame,代码行数:101,代码来源:machdep.c
示例8: initarm
//.........这里部分代码省略.........
xscale_setup_minidata(l1pagetable, afterkern,
minidataclean.pv_pa);
/* Map the vector page. */
pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa,
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
if (cpu_is_ixp43x())
arm_devmap_bootstrap(l1pagetable, ixp435_devmap);
else
arm_devmap_bootstrap(l1pagetable, ixp425_devmap);
/*
* Give the XScale global cache clean code an appropriately
* sized chunk of unmapped VA space starting at 0xff000000
* (our device mappings end before this address).
*/
xscale_cache_clean_addr = 0xff000000U;
cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT);
setttb(kernel_l1pt.pv_pa);
cpu_tlb_flushID();
cpu_domains(DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2));
/*
* Pages were allocated during the secondary bootstrap for the
* stacks for different CPU modes.
* We must now set the r13 registers in the different CPU modes to
* point to these stacks.
* Since the ARM stacks use STMFD etc. we must set r13 to the top end
* of the stack memory.
*/
set_stackptrs(0);
/*
* We must now clean the cache again....
* Cleaning may be done by reading new data to displace any
* dirty data in the cache. This will have happened in setttb()
* but since we are boot strapping the addresses used for the read
* may have just been remapped and thus the cache could be out
* of sync. A re-clean after the switch will cure this.
* After booting there are no gross relocations of the kernel thus
* this problem will not occur after initarm().
*/
cpu_idcache_wbinv_all();
cpu_setup();
/* ready to setup the console (XXX move earlier if possible) */
cninit();
/*
* Fetch the RAM size from the MCU registers. The
* expansion bus was mapped above so we can now read 'em.
*/
if (cpu_is_ixp43x())
memsize = ixp435_ddram_size();
else
memsize = ixp425_sdram_size();
undefined_init();
init_proc0(kernelstack.pv_va);
arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
pmap_curmaxkvaddr = afterkern + PAGE_SIZE;
vm_max_kernel_address = 0xe0000000;
pmap_bootstrap(pmap_curmaxkvaddr, &kernel_l1pt);
msgbufp = (void*)msgbufpv.pv_va;
msgbufinit(msgbufp, msgbufsize);
mutex_init();
/*
* Add the physical ram we have available.
*
* Exclude the kernel, and all the things we allocated which immediately
* follow the kernel, from the VM allocation pool but not from crash
* dumps. virtual_avail is a global variable which tracks the kva we've
* "allocated" while setting up pmaps.
*
* Prepare the list of physical memory available to the vm subsystem.
*/
arm_physmem_hardware_region(PHYSADDR, memsize);
arm_physmem_exclude_region(freemem_pt, KERNPHYSADDR -
freemem_pt, EXFLAG_NOALLOC);
arm_physmem_exclude_region(freemempos, KERNPHYSADDR - 0x100000 -
freemempos, EXFLAG_NOALLOC);
arm_physmem_exclude_region(abp->abp_physaddr,
virtual_avail - KERNVIRTADDR, EXFLAG_NOALLOC);
arm_physmem_init_kernel_globals();
init_param2(physmem);
kdb_init();
/* use static kernel environment if so configured */
if (envmode == 1)
kern_envp = static_env;
return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP -
sizeof(struct pcb)));
#undef next_page
#undef next_chunk2
}
开发者ID:rebost,项目名称:freebsd,代码行数:101,代码来源:avila_machdep.c
示例9: initarm
void
initarm(struct arm64_bootparams *abp)
{
struct efi_map_header *efihdr;
struct pcpu *pcpup;
vm_offset_t lastaddr;
caddr_t kmdp;
vm_paddr_t mem_len;
int i;
/* Set the module data location */
preload_metadata = (caddr_t)(uintptr_t)(abp->modulep);
/* Find the kernel address */
kmdp = preload_search_by_type("elf kernel");
if (kmdp == NULL)
kmdp = preload_search_by_type("elf64 kernel");
boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int);
kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
#ifdef FDT
try_load_dtb(kmdp);
#endif
/* Find the address to start allocating from */
lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t);
/* Load the physical memory ranges */
physmap_idx = 0;
efihdr = (struct efi_map_header *)preload_search_info(kmdp,
MODINFO_METADATA | MODINFOMD_EFI_MAP);
add_efi_map_entries(efihdr, physmap, &physmap_idx);
/* Print the memory map */
mem_len = 0;
for (i = 0; i < physmap_idx; i += 2) {
dump_avail[i] = physmap[i];
dump_avail[i + 1] = physmap[i + 1];
mem_len += physmap[i + 1] - physmap[i];
}
dump_avail[i] = 0;
dump_avail[i + 1] = 0;
/* Set the pcpu data, this is needed by pmap_bootstrap */
pcpup = &__pcpu[0];
pcpu_init(pcpup, 0, sizeof(struct pcpu));
/*
* Set the pcpu pointer with a backup in tpidr_el1 to be
* loaded when entering the kernel from userland.
*/
__asm __volatile(
"mov x18, %0 \n"
"msr tpidr_el1, %0" :: "r"(pcpup));
PCPU_SET(curthread, &thread0);
/* Do basic tuning, hz etc */
init_param1();
cache_setup();
/* Bootstrap enough of pmap to enter the kernel proper */
pmap_bootstrap(abp->kern_l1pt, KERNBASE - abp->kern_delta,
lastaddr - KERNBASE);
arm_devmap_bootstrap(0, NULL);
cninit();
init_proc0(abp->kern_stack);
msgbufinit(msgbufp, msgbufsize);
mutex_init();
init_param2(physmem);
dbg_monitor_init();
kdb_init();
early_boot = 0;
}
开发者ID:ralphost,项目名称:NextBSD,代码行数:81,代码来源:machdep.c
示例10: platform_start
void
platform_start(__register_t a0, __register_t a1,
__register_t a2 __unused, __register_t a3 __unused)
{
uint64_t platform_counter_freq;
vm_offset_t kernend;
int argc = a0;
char **argv = (char **)a1;
int i, mem;
/* clear the BSS and SBSS segments */
kernend = (vm_offset_t)&end;
memset(&edata, 0, kernend - (vm_offset_t)(&edata));
mips_postboot_fixup();
/* Initialize pcpu stuff */
mips_pcpu0_init();
/*
* Looking for mem=XXM argument
*/
mem = 0; /* Just something to start with */
for (i=0; i < argc; i++) {
if (strncmp(argv[i], "mem=", 4) == 0) {
mem = strtol(argv[i] + 4, NULL, 0);
break;
}
}
bootverbose = 1;
if (mem > 0)
realmem = btoc(mem << 20);
else
realmem = btoc(32 << 20);
for (i = 0; i < 10; i++) {
phys_avail[i] = 0;
}
/* phys_avail regions are in bytes */
phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end);
phys_avail[1] = ctob(realmem);
dump_avail[0] = phys_avail[0];
dump_avail[1] = phys_avail[1];
physmem = realmem;
/*
* ns8250 uart code uses DELAY so ticker should be inititalized
* before cninit. And tick_init_params refers to hz, so * init_param1
* should be called first.
*/
init_param1();
/* TODO: parse argc,argv */
platform_counter_freq = 330000000UL;
mips_timer_init_params(platform_counter_freq, 1);
cninit();
/* Panic here, after cninit */
if (mem == 0)
panic("No mem=XX parameter in arguments");
printf("cmd line: ");
for (i=0; i < argc; i++)
printf("%s ", argv[i]);
printf("\n");
init_param2(physmem);
mips_cpu_init();
pmap_bootstrap();
mips_proc0_init();
mutex_init();
kdb_init();
#ifdef KDB
if (boothowto & RB_KDB)
kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger");
#endif
}
开发者ID:coyizumi,项目名称:cs111,代码行数:80,代码来源:idt_machdep.c
示例11: initarm
//.........这里部分代码省略.........
#if NISADMA > 0
paddr_t istart, isize;
extern struct arm32_dma_range *footbridge_isa_dma_ranges;
extern int footbridge_isa_dma_nranges;
#endif
if (start < physical_freestart)
start = physical_freestart;
if (end > physical_freeend)
end = physical_freeend;
#if 0
printf("%d: %lx -> %lx\n", loop, start, end - 1);
#endif
#if NISADMA > 0
if (arm32_dma_range_intersect(footbridge_isa_dma_ranges,
footbridge_isa_dma_nranges,
start, end - start,
&istart, &isize)) {
/*
* Place the pages that intersect with the
* ISA DMA range onto the ISA DMA free list.
*/
#if 0
printf(" ISADMA 0x%lx -> 0x%lx\n", istart,
istart + isize - 1);
#endif
uvm_page_physload(atop(istart),
atop(istart + isize), atop(istart),
atop(istart + isize), VM_FREELIST_ISADMA);
/*
* Load the pieces that come before the
* intersection onto the default free list.
*/
if (start < istart) {
#if 0
printf(" BEFORE 0x%lx -> 0x%lx\n",
start, istart - 1);
#endif
uvm_page_physload(atop(start),
atop(istart), atop(start),
atop(istart), VM_FREELIST_DEFAULT);
}
/*
* Load the pieces that come after the
* intersection onto the default free list.
*/
if ((istart + isize) < end) {
#if 0
printf(" AFTER 0x%lx -> 0x%lx\n",
(istart + isize), end - 1);
#endif
uvm_page_physload(atop(istart + isize),
atop(end), atop(istart + isize),
atop(end), VM_FREELIST_DEFAULT);
}
} else {
uvm_page_physload(atop(start), atop(end),
atop(start), atop(end), VM_FREELIST_DEFAULT);
}
#else /* NISADMA > 0 */
uvm_page_physload(atop(start), atop(end),
atop(start), atop(end), VM_FREELIST_DEFAULT);
#endif /* NISADMA > 0 */
}
/* Boot strap pmap telling it where the kernel page table is */
printf("pmap ");
pmap_bootstrap(KERNEL_VM_BASE, KERNEL_VM_BASE + KERNEL_VM_SIZE);
/* Now that pmap is inited, we can set cpu_reset_address */
cpu_reset_address_paddr = vtophys((vaddr_t)netwinder_reset);
/* Setup the IRQ system */
printf("irq ");
footbridge_intr_init();
printf("done.\n");
/*
* Warn the user if the bootinfo was bogus. We already
* faked up some safe values.
*/
if (nwbootinfo.bi_pagesize == 0xdeadbeef)
printf("WARNING: NeTTrom boot info corrupt\n");
#ifdef DDB
db_machine_init();
if (boothowto & RB_KDB)
Debugger();
#endif
/* Turn the led green */
ISA_PUTBYTE(0x338, 0x06);
/* We return the new stack pointer address */
return(kernelstack.pv_va + USPACE_SVC_STACK_TOP);
}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:101,代码来源:netwinder_machdep.c
示例12: bootstrap
//.........这里部分代码省略.........
#if NKSYMS || defined(DDB) || defined(MODULAR)
struct btinfo_symtab *bi_sym;
#endif
struct btinfo_count *bi_count;
struct btinfo_kernend *bi_kend;
struct btinfo_tlb *bi_tlb;
struct btinfo_boothowto *bi_howto;
extern void *romtba;
extern void* get_romtba(void);
extern void OF_val2sym32(void *);
extern void OF_sym2val32(void *);
extern struct consdev consdev_prom;
/* Save OpenFrimware entry point */
romp = ofw;
romtba = get_romtba();
prom_init();
console_instance = promops.po_stdout;
console_node = OF_instance_to_package(promops.po_stdout);
/* Initialize the PROM console so printf will not panic */
cn_tab = &consdev_prom;
(*cn_tab->cn_init)(cn_tab);
DPRINTF(ACDB_BOOTARGS,
("sparc64_init(%p, %p, %p, %p, %p)\n", o0, bootargs, bootsize,
o3, ofw));
/* Extract bootinfo pointer */
if ((long)bootsize >= (4 * sizeof(uint64_t))) {
/* Loaded by 64-bit bootloader */
bi = (void*)(u_long)(((uint64_t*)bootargs)[3]);
bmagic = (long)(((uint64_t*)bootargs)[0]);
} else if ((long)bootsize >= (4 * sizeof(uint32_t))) {
/* Loaded by 32-bit bootloader */
bi = (void*)(u_long)(((uint32_t*)bootargs)[3]);
bmagic = (long)(((uint32_t*)bootargs)[0]);
} else {
printf("Bad bootinfo size.\n");
die_old_boot_loader:
printf("This kernel requires NetBSD boot loader version 1.9 "
"or newer\n");
panic("sparc64_init.");
}
DPRINTF(ACDB_BOOTARGS,
("sparc64_init: bmagic=%lx, bi=%p\n", bmagic, bi));
/* Read in the information provided by NetBSD boot loader */
if (SPARC_MACHINE_OPENFIRMWARE != bmagic) {
printf("No bootinfo information.\n");
goto die_old_boot_loader;
}
bootinfo = (void*)(u_long)((uint64_t*)bi)[1];
LOOKUP_BOOTINFO(bi_kend, BTINFO_KERNEND);
if (bi_kend->addr == (vaddr_t)0) {
panic("Kernel end address is not found in bootinfo.\n");
}
#if NKSYMS || defined(DDB) || defined(MODULAR)
LOOKUP_BOOTINFO(bi_sym, BTINFO_SYMTAB);
ksyms_addsyms_elf(bi_sym->nsym, (int *)(u_long)bi_sym->ssym,
(int *)(u_long)bi_sym->esym);
#ifdef DDB
#ifdef __arch64__
/* This can only be installed on an 64-bit system cause otherwise our stack is screwed */
OF_set_symbol_lookup(OF_sym2val, OF_val2sym);
#else
OF_set_symbol_lookup(OF_sym2val32, OF_val2sym32);
#endif
#endif
#endif
if (OF_getprop(findroot(), "compatible", buf, sizeof(buf)) > 0) {
if (strcmp(buf, "sun4us") == 0)
setcputyp(CPU_SUN4US);
else if (strcmp(buf, "sun4v") == 0)
setcputyp(CPU_SUN4V);
}
bi_howto = lookup_bootinfo(BTINFO_BOOTHOWTO);
if (bi_howto)
boothowto = bi_howto->boothowto;
LOOKUP_BOOTINFO(bi_count, BTINFO_DTLB_SLOTS);
kernel_dtlb_slots = bi_count->count;
kernel_itlb_slots = kernel_dtlb_slots-1;
bi_count = lookup_bootinfo(BTINFO_ITLB_SLOTS);
if (bi_count)
kernel_itlb_slots = bi_count->count;
LOOKUP_BOOTINFO(bi_tlb, BTINFO_DTLB);
kernel_tlbs = &bi_tlb->tlb[0];
get_ncpus();
pmap_bootstrap(KERNBASE, bi_kend->addr);
}
开发者ID:gvsurenderreddy,项目名称:frankenlibc,代码行数:101,代码来源:autoconf.c
示例13: initarm
//.........这里部分代码省略.........
/*
* Moved from cpu_startup() as data_abort_handler() references
* this during uvm init
*/
proc0paddr = (struct user *)kernelstack.pv_va;
proc0.p_addr = proc0paddr;
#ifdef VERBOSE_INIT_ARM
printf("bootstrap done.\n");
#endif
#ifdef HIGH_VECT
arm32_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
#else
arm32_vector_init(ARM_VECTORS_LOW, ARM_VEC_ALL);
#endif
/*
* Pages were allocated during the secondary bootstrap for the
* stacks for different CPU modes.
* We must now set the r13 registers in the different CPU modes to
* point to these stacks.
* Since the ARM stacks use STMFD etc. we must set r13 to the top end
* of the stack memory.
*/
#ifdef VERBOSE_INIT_ARM
printf("init subsystems: stacks ");
#endif
set_stackptr(PSR_IRQ32_MODE,
irqstack.pv_va + IRQ_STACK_SIZE * PAGE_SIZE);
set_stackptr(PSR_ABT32_MODE,
abtstack.pv_va + ABT_STACK_SIZE * PAGE_SIZE);
set_stackptr(PSR_UND32_MODE,
undstack.pv_va + UND_STACK_SIZE * PAGE_SIZE);
/*
* Well we should set a data abort handler.
* Once things get going this will change as we will need a proper
* handler.
* Until then we will use a handler that just panics but tells us
* why.
* Initialisation of the vectors will just panic on a data abort.
* This just fills in a slightly better one.
*/
#ifdef VERBOSE_INIT_ARM
printf("vectors ");
#endif
data_abort_handler_address = (u_int)data_abort_handler;
prefetch_abort_handler_address = (u_int)prefetch_abort_handler;
undefined_handler_address = (u_int)undefinedinstruction_bounce;
/* Initialise the undefined instruction handlers */
#ifdef VERBOSE_INIT_ARM
printf("undefined ");
#endif
undefined_init();
/* Load memory into UVM. */
#ifdef VERBOSE_INIT_ARM
printf("page ");
#endif
uvm_setpagesize(); /* initialize PAGE_SIZE-dependent variables */
uvm_page_physload(atop(physical_freestart), atop(physical_freeend),
atop(physical_freestart), atop(physical_freeend), 0);
/* Boot strap pmap telling it where the kernel page table is */
#ifdef VERBOSE_INIT_ARM
printf("pmap ");
#endif
pmap_bootstrap((pd_entry_t *)kernel_l1pt.pv_va, KERNEL_VM_BASE,
KERNEL_VM_BASE + KERNEL_VM_SIZE);
/* Update dump information */
cpu_kcore_hdr.pmap_kernel_l1 = (u_int32_t)pmap_kernel()->pm_l1;
cpu_kcore_hdr.pmap_kernel_l2 = (u_int32_t)&(pmap_kernel()->pm_l2);
/* Setup the IRQ system */
#ifdef VERBOSE_INIT_ARM
printf("irq ");
#endif
i80321intc_intr_init();
#ifdef VERBOSE_INIT_ARM
printf("done.\n");
#endif
#ifdef DDB
db_machine_init();
/* Firmware doesn't load symbols. */
ddb_init();
if (boothowto & RB_KDB)
Debugger();
#endif
/* We return the new stack pointer address */
return(kernelstack.pv_va + USPACE_SVC_STACK_TOP);
}
开发者ID:ajinkya93,项目名称:OpenBSD,代码行数:101,代码来源:armish_machdep.c
示例14: mach_init
//.........这里部分代码省略.........
/* Load symbol table if present */
if (bi_syms != NULL) {
ssym = (void *)(intptr_t)bi_syms->ssym;
esym = (void *)(intptr_t)bi_syms->esym;
kernend = (void *)mips_round_page(esym);
}
#endif
bi_howto = lookup_bootinfo(BTINFO_HOWTO);
if (bi_howto != NULL)
boothowto = bi_howto->bi_howto;
cobalt_id = read_board_id();
if (cobalt_id >= COBALT_MODELS || cobalt_model[cobalt_id] == NULL)
cpu_setmodel("Cobalt unknown model (board ID %u)",
cobalt_id);
else
cpu_setmodel("%s", cobalt_model[cobalt_id]);
switch (cobalt_id) {
case COBALT_ID_QUBE2700:
case COBALT_ID_RAQ:
cpuspeed = 150; /* MHz */
break;
case COBALT_ID_QUBE2:
case COBALT_ID_RAQ2:
cpuspeed = 250; /* MHz */
break;
default:
/* assume the fastest, so that delay(9) works */
cpuspeed = 250;
break;
}
curcpu()->ci_cpu_freq = cpuspeed * 1000 * 1000;
curcpu()->ci_cycles_per_hz = (curcpu()->ci_cpu_freq + hz / 2) / hz;
curcpu()->ci_divisor_delay =
((curcpu()->ci_cpu_freq + (1000000 / 2)) / 1000000);
/* all models have Rm5200, which is CPU_MIPS_DOUBLE_COUNT */
curcpu()->ci_cycles_per_hz /= 2;
curcpu()->ci_divisor_delay /= 2;
physmem = btoc(memsize - MIPS_KSEG0_START);
consinit();
KASSERT(&lwp0 == curlwp);
if (bi_msg != NULL)
printf("%s: magic=%#x bip=%p\n", bi_msg, bim, bip);
uvm_setpagesize();
/*
* The boot command is passed in the top 512 bytes,
* so don't clobber that.
*/
mem_clusters[0].start = 0;
mem_clusters[0].size = ctob(physmem) - 512;
mem_cluster_cnt = 1;
memcpy(bootstring, (char *)(memsize - 512), 512);
memset((char *)(memsize - 512), 0, 512);
bootstring[511] = '\0';
decode_bootstring();
#if NKSYMS || defined(DDB) || defined(MODULAR)
/* init symbols if present */
if ((bi_syms != NULL) && (esym != NULL))
ksyms_addsyms_elf(esym - ssym, ssym, esym);
#endif
KASSERT(&lwp0 == curlwp);
#ifdef DDB
if (boothowto & RB_KDB)
Debugger();
#endif
#ifdef KGDB
if (boothowto & RB_KDB)
kgdb_connect(0);
#endif
/*
* Load the rest of the available pages into the VM system.
*/
first = round_page(MIPS_KSEG0_TO_PHYS(kernend));
last = mem_clusters[0].start + mem_clusters[0].size;
uvm_page_physload(atop(first), atop(last), atop(first), atop(last),
VM_FREELIST_DEFAULT);
/*
* Initialize error message buffer (at end of core).
*/
mips_init_msgbuf();
pmap_bootstrap();
/*
* Allocate space for proc0's USPACE.
*/
mips_init_lwp0_uarea();
}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:101,代码来源:machdep.c
示例15: hp700_init
//.........这里部分代码省略.........
* linked the image past the end of the PDC/IODC area.
*/
if (text_start < 0x10800)
panic("kernel text mapped over PDC and IODC memory");
/*
* find ranges of physical memory that isn't allocated to the kernel
*/
avail_start = round_page(first_page);
first_avail = avail_start;
avail_end = trunc_page(mem_size);
/*
* bootstrap the rest of the virtual memory system
*/
#ifdef MAXMEMBYTES
if ((avail_end - avail_start) > MAXMEMBYTES) {
mem_size = trunc_page(MAXMEMBYTES);
avail_end = mem_size;
}
#endif
#ifdef HPT
/*
* If we want to use the HW TLB support, ensure that it exists.
*/
if (usehpt &&
!((*pdc)(PDC_TLB, PDC_TLB_INFO, &pdc_hwtlb) == 0 &&
(pdc_hwtlb.min_size || pdc_hwtlb.max_size)))
usehpt = 0;
#endif
pmap_bootstrap(&avail_start, &avail_end);
/*
* set limits on virtual memory and kernel equivalenced memory
*/
virtual_avail = avail_end;
virtual_end = trunc_page(VM_MAX_KERNEL_ADDRESS);
/*
* pmap_bootstrap allocated memory for data structures that must
* be equivalently mapped.
*/
equiv_end = (long) round_page((vm_offset_t) &end);
io_end = 0xF0000000; /* XXX */
/*
* Do block mapping. We are mapping from 0, up through the first
* power of 2 address above the end of the equiv region. This
* means some memory gets block mapped that should not be, but
* so be it (we make the text writable also :-)). We do this to
* conserve block entries since we hope to use them for other
* purposes (someday).
*/
addr = avail_start;
if (addr != 1 << log2(addr))
addr = 1 << log2(addr);
#ifdef BTLB
if(pdc_btlb.finfo.num_c)
printf("%d BTLB entries found. Block mapping up to 0x%x (0x%x)\n",
pdc_btlb.finfo.num_c, addr, avail_start);
/*
开发者ID:rohsaini,项目名称:mkunity,代码行数:67,代码来源:hp700_init.c
示例16: mips_init
//.........这里部分代码省略.........
/*
* Last chance to call the BIOS. Wiping the TLB means the BIOS' data
* areas are demapped on most systems.
*/
delay(20*1000); /* Let any UART FIFO drain... */
sys_config.cpu[0].tlbwired = UPAGES / 2;
tlb_set_wired(0);
tlb_flush(sys_config.cpu[0].tlbsize);
tlb_set_wired(sys_config.cpu[0].tlbwired);
/*
* Get a console, very early but after initial mapping setup.
*/
consinit();
printf("Initial setup done, switching console.\n");
/*
* Init message buffer.
*/
msgbufbase = (caddr_t)pmap_steal_memory(MSGBUFSIZE, NULL,NULL);
initmsgbuf(msgbufbase, MSGBUFSIZE);
/*
* Allocate U page(s) for proc[0], pm_tlbpid 1.
*/
proc0.p_addr = proc0paddr = curprocpaddr =
(struct user *)pmap_steal_memory(USPACE, NULL, NULL);
proc0.p_md.md_regs = (struct trap_frame *)&proc0paddr->u_pcb.pcb_regs;
tlb_set_pid(1);
/*
* Allocate system data structures.
*/
i = (vsize_t)allocsys(NULL);
sd = (caddr_t)pmap_steal_memory(i, NULL, NULL);
allocsys(sd);
/*
* Bootstrap VM system.
*/
pmap_bootstrap();
/*
* Copy down exception vector code.
*/
bcopy(exception, (char *)CACHE_ERR_EXC_VEC, e_exception - exception);
bcopy(exception, (char *)GEN_EXC_VEC, e_exception - exception);
/*
* Build proper TLB refill handler trampolines.
*/
switch (cputype) {
case MIPS_R5000:
/*
* R5000 processors need a specific chip bug workaround
* in their tlb handlers. Theoretically only revision 1
* of the processor need it, but there is evidence
* later versions also need it.
*
* This is also necessary on RM52x0; we test on the `rounded'
* cputype value instead of sys_config.cpu[0].type; this
* causes RM7k and RM9k to be included, just to be on the
* safe side.
*/
tlb_handler = (vaddr_t)&tlb_miss_err_r5k;
xtlb_handler = (vaddr_t)&xtlb_miss_err_r5k;
break;
default:
tlb_handler = (vaddr_t)&tlb_miss;
xtlb_handler = (vaddr_t)&xtlb_miss;
break;
}
build_trampoline(TLB_MISS_EXC_VEC, tlb_handler);
build_trampoline(XTLB_MISS_EXC_VEC, xtlb_handler);
/*
* Turn off bootstrap exception vectors.
*/
setsr(getsr() & ~SR_BOOT_EXC_VEC);
proc0.p_md.md_regs->sr = getsr();
/*
* Clear out the I and D caches.
*/
Mips_SyncCache();
#ifdef DDB
db_machine_init();
if (boothowto & RB_KDB)
Debugger();
#endif
/*
* Return new stack pointer.
*/
return ((caddr_t)proc0paddr + USPACE - 64);
}
开发者ID:genua,项目名称:anoubis_os,代码行数:101,代码来源:machdep.c
示例17: mach_init
//.........这里部分代码省略.........
physmem += btoc(((int) len));
mem_clusters[mem_cluster_cnt].start =
(long) start;
mem_clusters[mem_cluster_cnt].size =
(long) len;
mem_cluster_cnt++;
added = 1;
}
}
if (added)
printf("added to map\n");
else
printf("not added to map\n");
idx++;
}
} else {
/*
* Handle the case of not being called from the firmware.
*/
/* XXX hardwire to 32MB; should be kernel config option */
physmem = 32 * 1024 * 1024 / 4096;
mem_clusters[0].start = 0;
mem_clusters[0].size = ctob(physmem);
mem_cluster_cnt = 1;
}
for (i = 0; i < sizeof(bootinfo.boot_flags); i++) {
switch (bootinfo.boot_flags[i]) {
case '\0':
break;
case ' ':
continue;
case '-':
while (bootinfo.boot_flags[i] != ' ' &&
bootinfo.boot_flags[i] != '\0') {
switch (bootinfo.boot_flags[i]) {
case 'a':
boothowto |= RB_ASKNAME;
break;
case 'd':
boothowto |= RB_KDB;
break;
case 's':
boothowto |= RB_SINGLE;
break;
}
i++;
}
}
}
/*
* Load the rest of the available pages into the VM system.
* The first chunk is tricky because we have to avoid the
* kernel, but the rest are easy.
*/
first = round_page(MIPS_KSEG0_TO_PHYS(kernend));
last = mem_clusters[0].start + mem_clusters[0].size;
uvm_page_physload(atop(first), atop(last), atop(first), atop(last),
VM_FREELIST_DEFAULT);
for (i = 1; i < mem_cluster_cnt; i++) {
first = round_page(mem_clusters[i].start);
last = mem_clusters[i].start + mem_clusters[i].size;
uvm_page_physload(atop(first), atop(last), atop(first),
atop(last), VM_FREELIST_DEFAULT);
}
/*
* Initialize error message buffer (at end of core).
*/
mips_init_msgbuf();
/*
* Allocate space for proc0's USPACE
*/
p0 = (void *)pmap_steal_memory(USPACE, NULL, NULL);
lwp0.l_addr = proc0paddr = (struct user *)p0;
lwp0.l_md.md_regs = (struct frame *)((char *)p0 + USPACE) - 1;
proc0paddr->u_pcb.pcb_context[11] =
MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
pmap_bootstrap();
/*
* Initialize debuggers, and break into them, if appropriate.
*/
#if NKSYMS || defined(DDB) || defined(LKM)
ksyms_init(((uintptr_t)ksym_end - (uintptr_t)ksym_start),
ksym_start, ksym_end);
#endif
if (boothowto & RB_KDB) {
#if defined(DDB)
Debugger();
#endif
}
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:101,代码来源:machdep.c
示例18: initarm
//.........这里部分代码省略.........
/*
* Give the XScale global cache clean code an appropriately
* sized chunk of unmapped VA space starting at 0xff000000
* (our device mappings end before this address).
*/
xscale_cache_clean_addr = 0xff000000U;
cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT);
setttb(kernel_l1pt.pv_pa);
cpu_tlb_flushID();
cpu_domains(DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2));
/*
* Pages were allocated during the secondary bootstrap for the
* stacks for different CPU modes.
* We must now set the r13 registers in the different CPU modes to
* point to these stacks.
* Since the ARM stacks use STMFD etc. we must set r13 to the top end
* of the stack memory.
*/
set_stackptr(PSR_IRQ32_MODE, irqstack.pv_va + IRQ_STACK_SIZE*PAGE_SIZE);
set_stackptr(PSR_ABT32_MODE, abtstack.pv_va + ABT_STACK_SIZE*PAGE_SIZE);
set_stackptr(PSR_UND32_MODE, undstack.pv_va + UND_STACK_SIZE*PAGE_SIZE);
/*
* We must now clean the cache again....
* Cleaning may be done by reading new data to displace any
* dirty data in the cache. This will have happened in setttb()
* but since we are boot strapping the addresses used for the read
* may have just been remapped and thus the cache could be out
* of sync. A re-clean after the switch will cure this.
* After booting there are no gross relocations of the kernel thus
* this problem will not occur after initarm().
*/
cpu_idcache_wbinv_all();
/* ready to setup the console (XXX move earlier if possible) */
cninit();
/*
* Fetch the RAM size from the MCU registers. The
* expansion bus was mapped above so we can now read 'em.
*/
if (cpu_is_ixp43x())
memsize = ixp435_ddram_size();
else
memsize = ixp425_sdram_size();
physmem = memsize / PAGE_SIZE;
/* Set stack for exception handlers */
data_abort_handler_address = (u_int)data_abort_handler;
prefetch_abort_handler_address = (u_int)prefetch_abort_handler;
undefined_handler_address = (u_int)undefinedinstruction_bounce;
undefined_init();
proc_linkup0(&proc0, &thread0);
thread0.td_kstack = kernelstack.pv_va;
thread0.td_pcb = (struct pcb *)
(thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
thread0.td_pcb->pcb_flags = 0;
thread0.td_frame = &proc0_tf;
pcpup->pc_curpcb = thread0.td_pcb;
arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
pmap_curmaxkvaddr = afterkern + PAGE_SIZE;
dump_avail[0] = PHYSADDR;
dump_avail[1] = PHYSADDR + memsize;
dump_avail[2] = 0;
dump_avail[3] = 0;
pmap_bootstrap(pmap_curmaxkvaddr, 0xd0000000, &kernel_l1pt);
msgbufp = (void*)msgbufpv.pv_va;
msgbufinit(msgbufp, msgbufsize);
mutex_init();
i = 0;
#ifdef ARM_USE_SMALL_ALLOC
phys_avail[i++] = PHYSADDR;
phys_avail[i++] = PHYSADDR + PAGE_SIZE; /*
*XXX: Gross hack to get our
* pages in the vm_page_array.
*/
#endif
phys_avail[i++] = round_page(virtual_avail - KERNBASE + PHYSADDR);
phys_avail[i++] = trunc_page(PHYSADDR + memsize - 1);
phys_avail[i++] = 0;
phys_avail[i] = 0;
init_param2(physmem);
kdb_init();
/* use static kernel environment if so configured */
if (envmode == 1)
kern_envp = static_env;
return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP -
sizeof(struct pcb)));
#undef next_page
#undef next_chunk2
}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:101,代码来源:avila_machdep.c
示例19: mips_init
static void
mips_init(void)
{
struct mem_region mr[FDT_MEM_REGIONS];
uint64_t val;
int i, j, mr_cnt;
char *memsize;
printf("entry: mips_init()\n");
bootverbose = 1;
for (i = 0; i < 10; i++)
phys_avail[i] = 0;
dump_avail[0] = phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end);
/*
* The most low memory MT7621 can have. Currently MT7621 is the chip
* that supports the most memory, so that seems reasonable.
*/
realmem = btoc(448 * 1024 * 1024);
if (fdt_get_mem_regions(mr, &mr_cnt, &val) == 0) {
physmem = btoc(val);
printf("RAM size: %ldMB (from FDT)\n",
ctob(physmem) / (1024 * 1024));
KASSERT((phys_avail[0] >= mr[0].mr_start) && \
(phys_avail[0] < (mr[0].mr_start + mr[0].mr_size)),
("First region is not within FDT memory range"));
/* Limit size of the first region */
phys_avail[1] = (m
|
请发表评论