vm_machdep.c revision 222813
1/*-
2 * Copyright (c) 1982, 1986 The Regents of the University of California.
3 * Copyright (c) 1989, 1990 William Jolitz
4 * Copyright (c) 1994 John Dyson
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * the Systems Programming Group of the University of Utah Computer
9 * Science Department, and William Jolitz.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 *    notice, this list of conditions and the following disclaimer in the
18 *    documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 *    must display the following acknowledgement:
21 *	This product includes software developed by the University of
22 *	California, Berkeley and its contributors.
23 * 4. Neither the name of the University nor the names of its contributors
24 *    may be used to endorse or promote products derived from this software
25 *    without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 *	from: @(#)vm_machdep.c	7.3 (Berkeley) 5/13/91
40 *	Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
41 */
42
43#include <sys/cdefs.h>
44__FBSDID("$FreeBSD: head/sys/amd64/amd64/vm_machdep.c 222813 2011-06-07 08:46:13Z attilio $");
45
46#include "opt_isa.h"
47#include "opt_cpu.h"
48#include "opt_compat.h"
49
50#include <sys/param.h>
51#include <sys/systm.h>
52#include <sys/bio.h>
53#include <sys/buf.h>
54#include <sys/kernel.h>
55#include <sys/ktr.h>
56#include <sys/lock.h>
57#include <sys/malloc.h>
58#include <sys/mbuf.h>
59#include <sys/mutex.h>
60#include <sys/pioctl.h>
61#include <sys/proc.h>
62#include <sys/sched.h>
63#include <sys/sf_buf.h>
64#include <sys/smp.h>
65#include <sys/sysctl.h>
66#include <sys/sysent.h>
67#include <sys/unistd.h>
68#include <sys/vnode.h>
69#include <sys/vmmeter.h>
70
71#include <machine/cpu.h>
72#include <machine/md_var.h>
73#include <machine/pcb.h>
74#include <machine/smp.h>
75#include <machine/specialreg.h>
76#include <machine/tss.h>
77
78#include <vm/vm.h>
79#include <vm/vm_extern.h>
80#include <vm/vm_kern.h>
81#include <vm/vm_page.h>
82#include <vm/vm_map.h>
83#include <vm/vm_param.h>
84
85#include <x86/isa/isa.h>
86
87static void	cpu_reset_real(void);
88#ifdef SMP
89static void	cpu_reset_proxy(void);
90static u_int	cpu_reset_proxyid;
91static volatile u_int	cpu_reset_proxy_active;
92#endif
93
94/*
95 * Finish a fork operation, with process p2 nearly set up.
96 * Copy and update the pcb, set up the stack so that the child
97 * ready to run and return to user mode.
98 */
99void
100cpu_fork(td1, p2, td2, flags)
101	register struct thread *td1;
102	register struct proc *p2;
103	struct thread *td2;
104	int flags;
105{
106	register struct proc *p1;
107	struct pcb *pcb2;
108	struct mdproc *mdp1, *mdp2;
109	struct proc_ldt *pldt;
110	pmap_t pmap2;
111
112	p1 = td1->td_proc;
113	if ((flags & RFPROC) == 0) {
114		if ((flags & RFMEM) == 0) {
115			/* unshare user LDT */
116			mdp1 = &p1->p_md;
117			mtx_lock(&dt_lock);
118			if ((pldt = mdp1->md_ldt) != NULL &&
119			    pldt->ldt_refcnt > 1 &&
120			    user_ldt_alloc(p1, 1) == NULL)
121				panic("could not copy LDT");
122			mtx_unlock(&dt_lock);
123		}
124		return;
125	}
126
127	/* Ensure that td1's pcb is up to date. */
128	fpuexit(td1);
129
130	/* Point the pcb to the top of the stack */
131	pcb2 = (struct pcb *)(td2->td_kstack +
132	    td2->td_kstack_pages * PAGE_SIZE) - 1;
133	td2->td_pcb = pcb2;
134
135	/* Copy td1's pcb */
136	bcopy(td1->td_pcb, pcb2, sizeof(*pcb2));
137
138	/* Properly initialize pcb_save */
139	pcb2->pcb_save = &pcb2->pcb_user_save;
140
141	/* Point mdproc and then copy over td1's contents */
142	mdp2 = &p2->p_md;
143	bcopy(&p1->p_md, mdp2, sizeof(*mdp2));
144
145	/*
146	 * Create a new fresh stack for the new process.
147	 * Copy the trap frame for the return to user mode as if from a
148	 * syscall.  This copies most of the user mode register values.
149	 */
150	td2->td_frame = (struct trapframe *)td2->td_pcb - 1;
151	bcopy(td1->td_frame, td2->td_frame, sizeof(struct trapframe));
152
153	td2->td_frame->tf_rax = 0;		/* Child returns zero */
154	td2->td_frame->tf_rflags &= ~PSL_C;	/* success */
155	td2->td_frame->tf_rdx = 1;
156
157	/*
158	 * If the parent process has the trap bit set (i.e. a debugger had
159	 * single stepped the process to the system call), we need to clear
160	 * the trap flag from the new frame unless the debugger had set PF_FORK
161	 * on the parent.  Otherwise, the child will receive a (likely
162	 * unexpected) SIGTRAP when it executes the first instruction after
163	 * returning  to userland.
164	 */
165	if ((p1->p_pfsflags & PF_FORK) == 0)
166		td2->td_frame->tf_rflags &= ~PSL_T;
167
168	/*
169	 * Set registers for trampoline to user mode.  Leave space for the
170	 * return address on stack.  These are the kernel mode register values.
171	 */
172	pmap2 = vmspace_pmap(p2->p_vmspace);
173	pcb2->pcb_cr3 = DMAP_TO_PHYS((vm_offset_t)pmap2->pm_pml4);
174	pcb2->pcb_r12 = (register_t)fork_return;	/* fork_trampoline argument */
175	pcb2->pcb_rbp = 0;
176	pcb2->pcb_rsp = (register_t)td2->td_frame - sizeof(void *);
177	pcb2->pcb_rbx = (register_t)td2;		/* fork_trampoline argument */
178	pcb2->pcb_rip = (register_t)fork_trampoline;
179	/*-
180	 * pcb2->pcb_dr*:	cloned above.
181	 * pcb2->pcb_savefpu:	cloned above.
182	 * pcb2->pcb_flags:	cloned above.
183	 * pcb2->pcb_onfault:	cloned above (always NULL here?).
184	 * pcb2->pcb_[fg]sbase:	cloned above
185	 */
186
187	/* Setup to release spin count in fork_exit(). */
188	td2->td_md.md_spinlock_count = 1;
189	td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I;
190
191	/* As an i386, do not copy io permission bitmap. */
192	pcb2->pcb_tssp = NULL;
193
194	/* New segment registers. */
195	set_pcb_flags(pcb2, PCB_FULL_IRET);
196
197	/* Copy the LDT, if necessary. */
198	mdp1 = &td1->td_proc->p_md;
199	mdp2 = &p2->p_md;
200	mtx_lock(&dt_lock);
201	if (mdp1->md_ldt != NULL) {
202		if (flags & RFMEM) {
203			mdp1->md_ldt->ldt_refcnt++;
204			mdp2->md_ldt = mdp1->md_ldt;
205			bcopy(&mdp1->md_ldt_sd, &mdp2->md_ldt_sd, sizeof(struct
206			    system_segment_descriptor));
207		} else {
208			mdp2->md_ldt = NULL;
209			mdp2->md_ldt = user_ldt_alloc(p2, 0);
210			if (mdp2->md_ldt == NULL)
211				panic("could not copy LDT");
212			amd64_set_ldt_data(td2, 0, max_ldt_segment,
213			    (struct user_segment_descriptor *)
214			    mdp1->md_ldt->ldt_base);
215		}
216	} else
217		mdp2->md_ldt = NULL;
218	mtx_unlock(&dt_lock);
219
220	/*
221	 * Now, cpu_switch() can schedule the new process.
222	 * pcb_rsp is loaded pointing to the cpu_switch() stack frame
223	 * containing the return address when exiting cpu_switch.
224	 * This will normally be to fork_trampoline(), which will have
225	 * %ebx loaded with the new proc's pointer.  fork_trampoline()
226	 * will set up a stack to call fork_return(p, frame); to complete
227	 * the return to user-mode.
228	 */
229}
230
231/*
232 * Intercept the return address from a freshly forked process that has NOT
233 * been scheduled yet.
234 *
235 * This is needed to make kernel threads stay in kernel mode.
236 */
237void
238cpu_set_fork_handler(td, func, arg)
239	struct thread *td;
240	void (*func)(void *);
241	void *arg;
242{
243	/*
244	 * Note that the trap frame follows the args, so the function
245	 * is really called like this:  func(arg, frame);
246	 */
247	td->td_pcb->pcb_r12 = (long) func;	/* function */
248	td->td_pcb->pcb_rbx = (long) arg;	/* first arg */
249}
250
251void
252cpu_exit(struct thread *td)
253{
254
255	/*
256	 * If this process has a custom LDT, release it.
257	 */
258	mtx_lock(&dt_lock);
259	if (td->td_proc->p_md.md_ldt != 0)
260		user_ldt_free(td);
261	else
262		mtx_unlock(&dt_lock);
263}
264
265void
266cpu_thread_exit(struct thread *td)
267{
268	struct pcb *pcb;
269
270	critical_enter();
271	if (td == PCPU_GET(fpcurthread))
272		fpudrop();
273	critical_exit();
274
275	pcb = td->td_pcb;
276
277	/* Disable any hardware breakpoints. */
278	if (pcb->pcb_flags & PCB_DBREGS) {
279		reset_dbregs();
280		clear_pcb_flags(pcb, PCB_DBREGS);
281	}
282}
283
284void
285cpu_thread_clean(struct thread *td)
286{
287	struct pcb *pcb;
288
289	pcb = td->td_pcb;
290
291	/*
292	 * Clean TSS/iomap
293	 */
294	if (pcb->pcb_tssp != NULL) {
295		kmem_free(kernel_map, (vm_offset_t)pcb->pcb_tssp,
296		    ctob(IOPAGES + 1));
297		pcb->pcb_tssp = NULL;
298	}
299}
300
301void
302cpu_thread_swapin(struct thread *td)
303{
304}
305
306void
307cpu_thread_swapout(struct thread *td)
308{
309}
310
311void
312cpu_thread_alloc(struct thread *td)
313{
314
315	td->td_pcb = (struct pcb *)(td->td_kstack +
316	    td->td_kstack_pages * PAGE_SIZE) - 1;
317	td->td_frame = (struct trapframe *)td->td_pcb - 1;
318	td->td_pcb->pcb_save = &td->td_pcb->pcb_user_save;
319}
320
321void
322cpu_thread_free(struct thread *td)
323{
324
325	cpu_thread_clean(td);
326}
327
328void
329cpu_set_syscall_retval(struct thread *td, int error)
330{
331
332	switch (error) {
333	case 0:
334		td->td_frame->tf_rax = td->td_retval[0];
335		td->td_frame->tf_rdx = td->td_retval[1];
336		td->td_frame->tf_rflags &= ~PSL_C;
337		break;
338
339	case ERESTART:
340		/*
341		 * Reconstruct pc, we know that 'syscall' is 2 bytes,
342		 * lcall $X,y is 7 bytes, int 0x80 is 2 bytes.
343		 * We saved this in tf_err.
344		 * %r10 (which was holding the value of %rcx) is restored
345		 * for the next iteration.
346		 * %r10 restore is only required for freebsd/amd64 processes,
347		 * but shall be innocent for any ia32 ABI.
348		 */
349		td->td_frame->tf_rip -= td->td_frame->tf_err;
350		td->td_frame->tf_r10 = td->td_frame->tf_rcx;
351		break;
352
353	case EJUSTRETURN:
354		break;
355
356	default:
357		if (td->td_proc->p_sysent->sv_errsize) {
358			if (error >= td->td_proc->p_sysent->sv_errsize)
359				error = -1;	/* XXX */
360			else
361				error = td->td_proc->p_sysent->sv_errtbl[error];
362		}
363		td->td_frame->tf_rax = error;
364		td->td_frame->tf_rflags |= PSL_C;
365		break;
366	}
367}
368
369/*
370 * Initialize machine state (pcb and trap frame) for a new thread about to
371 * upcall. Put enough state in the new thread's PCB to get it to go back
372 * userret(), where we can intercept it again to set the return (upcall)
373 * Address and stack, along with those from upcals that are from other sources
374 * such as those generated in thread_userret() itself.
375 */
376void
377cpu_set_upcall(struct thread *td, struct thread *td0)
378{
379	struct pcb *pcb2;
380
381	/* Point the pcb to the top of the stack. */
382	pcb2 = td->td_pcb;
383
384	/*
385	 * Copy the upcall pcb.  This loads kernel regs.
386	 * Those not loaded individually below get their default
387	 * values here.
388	 */
389	bcopy(td0->td_pcb, pcb2, sizeof(*pcb2));
390	clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE);
391	pcb2->pcb_save = &pcb2->pcb_user_save;
392	set_pcb_flags(pcb2, PCB_FULL_IRET);
393
394	/*
395	 * Create a new fresh stack for the new thread.
396	 */
397	bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe));
398
399	/* If the current thread has the trap bit set (i.e. a debugger had
400	 * single stepped the process to the system call), we need to clear
401	 * the trap flag from the new frame. Otherwise, the new thread will
402	 * receive a (likely unexpected) SIGTRAP when it executes the first
403	 * instruction after returning to userland.
404	 */
405	td->td_frame->tf_rflags &= ~PSL_T;
406
407	/*
408	 * Set registers for trampoline to user mode.  Leave space for the
409	 * return address on stack.  These are the kernel mode register values.
410	 */
411	pcb2->pcb_r12 = (register_t)fork_return;	    /* trampoline arg */
412	pcb2->pcb_rbp = 0;
413	pcb2->pcb_rsp = (register_t)td->td_frame - sizeof(void *);	/* trampoline arg */
414	pcb2->pcb_rbx = (register_t)td;			    /* trampoline arg */
415	pcb2->pcb_rip = (register_t)fork_trampoline;
416	/*
417	 * If we didn't copy the pcb, we'd need to do the following registers:
418	 * pcb2->pcb_cr3:	cloned above.
419	 * pcb2->pcb_dr*:	cloned above.
420	 * pcb2->pcb_savefpu:	cloned above.
421	 * pcb2->pcb_onfault:	cloned above (always NULL here?).
422	 * pcb2->pcb_[fg]sbase: cloned above
423	 */
424
425	/* Setup to release spin count in fork_exit(). */
426	td->td_md.md_spinlock_count = 1;
427	td->td_md.md_saved_flags = PSL_KERNEL | PSL_I;
428}
429
430/*
431 * Set that machine state for performing an upcall that has to
432 * be done in thread_userret() so that those upcalls generated
433 * in thread_userret() itself can be done as well.
434 */
435void
436cpu_set_upcall_kse(struct thread *td, void (*entry)(void *), void *arg,
437	stack_t *stack)
438{
439
440	/*
441	 * Do any extra cleaning that needs to be done.
442	 * The thread may have optional components
443	 * that are not present in a fresh thread.
444	 * This may be a recycled thread so make it look
445	 * as though it's newly allocated.
446	 */
447	cpu_thread_clean(td);
448
449#ifdef COMPAT_FREEBSD32
450	if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) {
451		/*
452	 	 * Set the trap frame to point at the beginning of the uts
453		 * function.
454		 */
455		td->td_frame->tf_rbp = 0;
456		td->td_frame->tf_rsp =
457		   (((uintptr_t)stack->ss_sp + stack->ss_size - 4) & ~0x0f) - 4;
458		td->td_frame->tf_rip = (uintptr_t)entry;
459
460		/*
461		 * Pass the address of the mailbox for this kse to the uts
462		 * function as a parameter on the stack.
463		 */
464		suword32((void *)(td->td_frame->tf_rsp + sizeof(int32_t)),
465		    (uint32_t)(uintptr_t)arg);
466
467		return;
468	}
469#endif
470
471	/*
472	 * Set the trap frame to point at the beginning of the uts
473	 * function.
474	 */
475	td->td_frame->tf_rbp = 0;
476	td->td_frame->tf_rsp =
477	    ((register_t)stack->ss_sp + stack->ss_size) & ~0x0f;
478	td->td_frame->tf_rsp -= 8;
479	td->td_frame->tf_rip = (register_t)entry;
480	td->td_frame->tf_ds = _udatasel;
481	td->td_frame->tf_es = _udatasel;
482	td->td_frame->tf_fs = _ufssel;
483	td->td_frame->tf_gs = _ugssel;
484	td->td_frame->tf_flags = TF_HASSEGS;
485
486	/*
487	 * Pass the address of the mailbox for this kse to the uts
488	 * function as a parameter on the stack.
489	 */
490	td->td_frame->tf_rdi = (register_t)arg;
491}
492
493int
494cpu_set_user_tls(struct thread *td, void *tls_base)
495{
496	struct pcb *pcb;
497
498	if ((u_int64_t)tls_base >= VM_MAXUSER_ADDRESS)
499		return (EINVAL);
500
501	pcb = td->td_pcb;
502#ifdef COMPAT_FREEBSD32
503	if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) {
504		pcb->pcb_gsbase = (register_t)tls_base;
505		return (0);
506	}
507#endif
508	pcb->pcb_fsbase = (register_t)tls_base;
509	set_pcb_flags(pcb, PCB_FULL_IRET);
510	return (0);
511}
512
513#ifdef SMP
514static void
515cpu_reset_proxy()
516{
517	cpuset_t tcrp;
518
519	cpu_reset_proxy_active = 1;
520	while (cpu_reset_proxy_active == 1)
521		;	/* Wait for other cpu to see that we've started */
522	CPU_SETOF(cpu_reset_proxyid, &tcrp);
523	stop_cpus(tcrp);
524	printf("cpu_reset_proxy: Stopped CPU %d\n", cpu_reset_proxyid);
525	DELAY(1000000);
526	cpu_reset_real();
527}
528#endif
529
530void
531cpu_reset()
532{
533#ifdef SMP
534	cpuset_t map;
535	u_int cnt;
536
537	if (smp_active) {
538		sched_pin();
539		map = PCPU_GET(other_cpus);
540		CPU_NAND(&map, &stopped_cpus);
541		if (!CPU_EMPTY(&map)) {
542			printf("cpu_reset: Stopping other CPUs\n");
543			stop_cpus(map);
544		}
545
546		if (PCPU_GET(cpuid) != 0) {
547			cpu_reset_proxyid = PCPU_GET(cpuid);
548			sched_unpin();
549			cpustop_restartfunc = cpu_reset_proxy;
550			cpu_reset_proxy_active = 0;
551			printf("cpu_reset: Restarting BSP\n");
552
553			/* Restart CPU #0. */
554			CPU_SETOF(0, &started_cpus);
555			wmb();
556
557			cnt = 0;
558			while (cpu_reset_proxy_active == 0 && cnt < 10000000)
559				cnt++;	/* Wait for BSP to announce restart */
560			if (cpu_reset_proxy_active == 0)
561				printf("cpu_reset: Failed to restart BSP\n");
562			enable_intr();
563			cpu_reset_proxy_active = 2;
564
565			while (1);
566			/* NOTREACHED */
567		} else
568			sched_unpin();
569
570		DELAY(1000000);
571	}
572#endif
573	cpu_reset_real();
574	/* NOTREACHED */
575}
576
577static void
578cpu_reset_real()
579{
580	struct region_descriptor null_idt;
581	int b;
582
583	disable_intr();
584
585	/*
586	 * Attempt to do a CPU reset via the keyboard controller,
587	 * do not turn off GateA20, as any machine that fails
588	 * to do the reset here would then end up in no man's land.
589	 */
590	outb(IO_KBD + 4, 0xFE);
591	DELAY(500000);	/* wait 0.5 sec to see if that did it */
592
593	/*
594	 * Attempt to force a reset via the Reset Control register at
595	 * I/O port 0xcf9.  Bit 2 forces a system reset when it
596	 * transitions from 0 to 1.  Bit 1 selects the type of reset
597	 * to attempt: 0 selects a "soft" reset, and 1 selects a
598	 * "hard" reset.  We try a "hard" reset.  The first write sets
599	 * bit 1 to select a "hard" reset and clears bit 2.  The
600	 * second write forces a 0 -> 1 transition in bit 2 to trigger
601	 * a reset.
602	 */
603	outb(0xcf9, 0x2);
604	outb(0xcf9, 0x6);
605	DELAY(500000);  /* wait 0.5 sec to see if that did it */
606
607	/*
608	 * Attempt to force a reset via the Fast A20 and Init register
609	 * at I/O port 0x92.  Bit 1 serves as an alternate A20 gate.
610	 * Bit 0 asserts INIT# when set to 1.  We are careful to only
611	 * preserve bit 1 while setting bit 0.  We also must clear bit
612	 * 0 before setting it if it isn't already clear.
613	 */
614	b = inb(0x92);
615	if (b != 0xff) {
616		if ((b & 0x1) != 0)
617			outb(0x92, b & 0xfe);
618		outb(0x92, b | 0x1);
619		DELAY(500000);  /* wait 0.5 sec to see if that did it */
620	}
621
622	printf("No known reset method worked, attempting CPU shutdown\n");
623	DELAY(1000000);	/* wait 1 sec for printf to complete */
624
625	/* Wipe the IDT. */
626	null_idt.rd_limit = 0;
627	null_idt.rd_base = 0;
628	lidt(&null_idt);
629
630	/* "good night, sweet prince .... <THUNK!>" */
631	breakpoint();
632
633	/* NOTREACHED */
634	while(1);
635}
636
637/*
638 * Allocate an sf_buf for the given vm_page.  On this machine, however, there
639 * is no sf_buf object.  Instead, an opaque pointer to the given vm_page is
640 * returned.
641 */
642struct sf_buf *
643sf_buf_alloc(struct vm_page *m, int pri)
644{
645
646	return ((struct sf_buf *)m);
647}
648
649/*
650 * Free the sf_buf.  In fact, do nothing because there are no resources
651 * associated with the sf_buf.
652 */
653void
654sf_buf_free(struct sf_buf *sf)
655{
656}
657
658/*
659 * Software interrupt handler for queued VM system processing.
660 */
661void
662swi_vm(void *dummy)
663{
664	if (busdma_swi_pending != 0)
665		busdma_swi();
666}
667
668/*
669 * Tell whether this address is in some physical memory region.
670 * Currently used by the kernel coredump code in order to avoid
671 * dumping the ``ISA memory hole'' which could cause indefinite hangs,
672 * or other unpredictable behaviour.
673 */
674
675int
676is_physical_memory(vm_paddr_t addr)
677{
678
679#ifdef DEV_ISA
680	/* The ISA ``memory hole''. */
681	if (addr >= 0xa0000 && addr < 0x100000)
682		return 0;
683#endif
684
685	/*
686	 * stuff other tests for known memory-mapped devices (PCI?)
687	 * here
688	 */
689
690	return 1;
691}
692