📄 init_cpuinfo.c
字号:
/* * $QNXLicenseC: * Copyright 2007, QNX Software Systems. * * Licensed under the Apache License, Version 2.0 (the "License"). You * may not reproduce, modify or distribute this software except in * compliance with the License. You may obtain a copy of the License * at: http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OF ANY KIND, either express or implied. * * This file may contain contributions from others, either as * contributors under the License or as licensors under other terms. * Please review this entire file for other proprietary rights or license * notices, as well as the QNX Development Suite License Guide at * http://licensing.qnx.com/license-guide/ for other information. * $ */#include "startup.h"//// Initialize cpuinfo structures in the system page.// This code is hardware independant and should not have to be changed// changed by end users.//#define NAME_NOT_SET ((uint16_t)~0)voidinit_one_cpuinfo(unsigned cpunum) { struct cpuinfo_entry *cpu; struct ppc_kerinfo_entry *ker; cpu = &lsp.cpuinfo.p[cpunum]; cpu->cpu = get_pvr(); cpu->speed = (cpu_freq != 0) ? (cpu_freq / 1000000) : ppc_cpuspeed(); cpu->name = NAME_NOT_SET; // Do this before CPU specific code so that it can be turned off // if needed. lsp.cpu.ppc_kerinfo.p->callout_ts_clear = PPC_MSR_DS; ppcv_config.cpuinfo(cpu); ker = lsp.cpu.ppc_kerinfo.p; ker->ppc_family = ppcv_config.family; ker->pretend_cpu = ppcv->pretend_cpu; // Reset CPU pointer in case syspage memory has shifted around cpu = &lsp.cpuinfo.p[cpunum]; if(shdr->flags1 & STARTUP_HDR_FLAGS1_VIRTUAL) { if(!(cpu->flags & CPU_FLAG_MMU)) { crash("Virtual memory not supported on this processor (0x%l).\n", cpu->cpu); } } else { cpu->flags &= ~CPU_FLAG_MMU; } if(cpu->name == NAME_NOT_SET) { // CPU specific code didn't bother setting the name, so do it here. cpu->name = add_string(ppcv->name); }}voidinit_cpuinfo() { unsigned num; unsigned i; struct cpuinfo_entry *cpu; num = lsp.syspage.p->num_cpu; cpu = set_syspage_section(&lsp.cpuinfo, sizeof(*lsp.cpuinfo.p) * num); for(i = 0; i < num; ++i) { cpu[i].ins_cache = system_icache_idx; cpu[i].data_cache = system_dcache_idx; } init_one_cpuinfo(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -