| version 1.586, 2006/11/16 01:32:38 |
version 1.586.2.6, 2009/10/18 15:20:42 |
| Line 132 __KERNEL_RCSID(0, "$NetBSD$"); |
|
| Line 132 __KERNEL_RCSID(0, "$NetBSD$"); |
|
| |
|
| #include <sys/sysctl.h> |
#include <sys/sysctl.h> |
| |
|
| |
#include <x86/cpu_msr.h> |
| |
|
| #include <machine/cpu.h> |
#include <machine/cpu.h> |
| #include <machine/cpufunc.h> |
#include <machine/cpufunc.h> |
| #include <machine/cpuvar.h> |
#include <machine/cpuvar.h> |
| Line 183 __KERNEL_RCSID(0, "$NetBSD$"); |
|
| Line 185 __KERNEL_RCSID(0, "$NetBSD$"); |
|
| #include "npx.h" |
#include "npx.h" |
| #include "ksyms.h" |
#include "ksyms.h" |
| |
|
| |
#include "cardbus.h" |
| |
#if NCARDBUS > 0 |
| |
/* For rbus_min_start hint. */ |
| |
#include <machine/bus.h> |
| |
#include <dev/cardbus/rbus.h> |
| |
#include <machine/rbus_machdep.h> |
| |
#endif |
| |
|
| #include "mca.h" |
#include "mca.h" |
| #if NMCA > 0 |
#if NMCA > 0 |
| #include <machine/mca_machdep.h> /* for mca_busprobe() */ |
#include <machine/mca_machdep.h> /* for mca_busprobe() */ |
| Line 240 int i386_has_sse2; |
|
| Line 250 int i386_has_sse2; |
|
| int tmx86_has_longrun; |
int tmx86_has_longrun; |
| |
|
| vaddr_t msgbuf_vaddr; |
vaddr_t msgbuf_vaddr; |
| paddr_t msgbuf_paddr; |
struct { |
| |
paddr_t paddr; |
| |
psize_t sz; |
| |
} msgbuf_p_seg[VM_PHYSSEG_MAX]; |
| |
unsigned int msgbuf_p_cnt = 0; |
| |
|
| vaddr_t idt_vaddr; |
vaddr_t idt_vaddr; |
| paddr_t idt_paddr; |
paddr_t idt_paddr; |
| Line 396 native_loader(int bl_boothowto, int bl_b |
|
| Line 410 native_loader(int bl_boothowto, int bl_b |
|
| void |
void |
| cpu_startup() |
cpu_startup() |
| { |
{ |
| int x; |
int x, y; |
| vaddr_t minaddr, maxaddr; |
vaddr_t minaddr, maxaddr; |
| |
psize_t sz; |
| char pbuf[9]; |
char pbuf[9]; |
| |
|
| /* |
/* |
| * Initialize error message buffer (et end of core). |
* Initialize error message buffer (et end of core). |
| */ |
*/ |
| msgbuf_vaddr = uvm_km_alloc(kernel_map, x86_round_page(MSGBUFSIZE), 0, |
if (msgbuf_p_cnt == 0) |
| UVM_KMF_VAONLY); |
panic("msgbuf paddr map has not been set up"); |
| |
for (x = 0, sz = 0; x < msgbuf_p_cnt; sz += msgbuf_p_seg[x++].sz) |
| |
continue; |
| |
msgbuf_vaddr = uvm_km_alloc(kernel_map, sz, 0, UVM_KMF_VAONLY); |
| if (msgbuf_vaddr == 0) |
if (msgbuf_vaddr == 0) |
| panic("failed to valloc msgbuf_vaddr"); |
panic("failed to valloc msgbuf_vaddr"); |
| |
|
| /* msgbuf_paddr was init'd in pmap */ |
/* msgbuf_paddr was init'd in pmap */ |
| for (x = 0; x < btoc(MSGBUFSIZE); x++) |
for (y = 0, sz = 0; y < msgbuf_p_cnt; y++) { |
| pmap_kenter_pa((vaddr_t)msgbuf_vaddr + x * PAGE_SIZE, |
for (x = 0; x < btoc(msgbuf_p_seg[y].sz); x++, sz += PAGE_SIZE) |
| msgbuf_paddr + x * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE); |
pmap_kenter_pa((vaddr_t)msgbuf_vaddr + sz, |
| |
msgbuf_p_seg[y].paddr + x * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE); |
| |
} |
| pmap_update(pmap_kernel()); |
pmap_update(pmap_kernel()); |
| |
|
| initmsgbuf((caddr_t)msgbuf_vaddr, round_page(MSGBUFSIZE)); |
initmsgbuf((caddr_t)msgbuf_vaddr, sz); |
| |
|
| printf("%s%s", copyright, version); |
printf("%s%s", copyright, version); |
| |
|
|
|
| format_bytes(pbuf, sizeof(pbuf), ptoa(physmem)); |
format_bytes(pbuf, sizeof(pbuf), ptoa(physmem)); |
| printf("total memory = %s\n", pbuf); |
printf("total memory = %s\n", pbuf); |
| |
|
| |
#if NCARDBUS > 0 |
| |
/* Tell RBUS how much RAM we have, so it can use heuristics. */ |
| |
rbus_min_start_hint(ptoa(physmem)); |
| |
#endif |
| |
|
| minaddr = 0; |
minaddr = 0; |
| |
|
| /* |
/* |
|
|
| |
|
| /* Safe for i/o port / memory space allocation to use malloc now. */ |
/* Safe for i/o port / memory space allocation to use malloc now. */ |
| x86_bus_space_mallocok(); |
x86_bus_space_mallocok(); |
| |
|
| |
x86_init(); |
| } |
} |
| |
|
| /* |
/* |
| Line 783 sendsig_siginfo(const ksiginfo_t *ksi, c |
|
| Line 810 sendsig_siginfo(const ksiginfo_t *ksi, c |
|
| |
|
| buildcontext(l, sel, catcher, fp); |
buildcontext(l, sel, catcher, fp); |
| |
|
| |
#if NNPX > 0 |
| |
/* make sure we get a clean FPU */ |
| |
npxsave_lwp(l, 0); |
| |
l->l_md.md_flags &= ~MDL_USEDFPU; |
| |
#endif |
| |
|
| /* Remember that we're now on the signal stack. */ |
/* Remember that we're now on the signal stack. */ |
| if (onstack) |
if (onstack) |
| p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; |
p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; |
| Line 1589 init386(paddr_t first_avail) |
|
| Line 1622 init386(paddr_t first_avail) |
|
| } |
} |
| |
|
| /* |
/* |
| |
* If the segment is smaller than a page, skip it. |
| |
*/ |
| |
if (bim->entry[x].size < NBPG) { |
| |
continue; |
| |
} |
| |
|
| |
/* |
| * Sanity check the entry. |
* Sanity check the entry. |
| * XXX Need to handle uint64_t in extent code |
* XXX Need to handle uint64_t in extent code |
| * XXX and 64-bit physical addresses in i386 |
* XXX and 64-bit physical addresses in i386 |
| Line 1813 init386(paddr_t first_avail) |
|
| Line 1853 init386(paddr_t first_avail) |
|
| psize_t sz = round_page(MSGBUFSIZE); |
psize_t sz = round_page(MSGBUFSIZE); |
| psize_t reqsz = sz; |
psize_t reqsz = sz; |
| |
|
| |
search_again: |
| for (x = 0; x < vm_nphysseg; x++) { |
for (x = 0; x < vm_nphysseg; x++) { |
| vps = &vm_physmem[x]; |
vps = &vm_physmem[x]; |
| if (ptoa(vps->avail_end) == avail_end) |
if (ptoa(vps->avail_end) == avail_end) |
| Line 1827 init386(paddr_t first_avail) |
|
| Line 1868 init386(paddr_t first_avail) |
|
| |
|
| vps->avail_end -= atop(sz); |
vps->avail_end -= atop(sz); |
| vps->end -= atop(sz); |
vps->end -= atop(sz); |
| msgbuf_paddr = ptoa(vps->avail_end); |
msgbuf_p_seg[msgbuf_p_cnt].sz = sz; |
| |
msgbuf_p_seg[msgbuf_p_cnt++].paddr = ptoa(vps->avail_end); |
| |
|
| /* Remove the last segment if it now has no pages. */ |
/* Remove the last segment if it now has no pages. */ |
| if (vps->start == vps->end) { |
if (vps->start == vps->end) { |
| Line 1841 init386(paddr_t first_avail) |
|
| Line 1883 init386(paddr_t first_avail) |
|
| avail_end = vm_physmem[x].avail_end; |
avail_end = vm_physmem[x].avail_end; |
| avail_end = ptoa(avail_end); |
avail_end = ptoa(avail_end); |
| |
|
| |
if (sz != reqsz) { |
| |
reqsz -= sz; |
| |
if (msgbuf_p_cnt != VM_PHYSSEG_MAX) { |
| |
/* if still segments available, get memory from next one ... */ |
| |
sz = reqsz; |
| |
goto search_again; |
| |
} |
| /* Warn if the message buffer had to be shrunk. */ |
/* Warn if the message buffer had to be shrunk. */ |
| if (sz != reqsz) |
|
| printf("WARNING: %ld bytes not available for msgbuf " |
printf("WARNING: %ld bytes not available for msgbuf " |
| "in last cluster (%ld used)\n", reqsz, sz); |
"in last cluster (%ld used)\n", (long)MSGBUFSIZE, MSGBUFSIZE - reqsz); |
| |
} |
| } |
} |
| |
|
| /* |
/* |