]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/i386/i386/vm_machdep.c
Centralize __pcpu definitions.
[FreeBSD/FreeBSD.git] / sys / i386 / i386 / vm_machdep.c
1 /*-
2  * SPDX-License-Identifier: BSD-4-Clause
3  *
4  * Copyright (c) 1982, 1986 The Regents of the University of California.
5  * Copyright (c) 1989, 1990 William Jolitz
6  * Copyright (c) 1994 John Dyson
7  * All rights reserved.
8  *
9  * This code is derived from software contributed to Berkeley by
10  * the Systems Programming Group of the University of Utah Computer
11  * Science Department, and William Jolitz.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  * 1. Redistributions of source code must retain the above copyright
17  *    notice, this list of conditions and the following disclaimer.
18  * 2. Redistributions in binary form must reproduce the above copyright
19  *    notice, this list of conditions and the following disclaimer in the
20  *    documentation and/or other materials provided with the distribution.
21  * 3. All advertising materials mentioning features or use of this software
22  *    must display the following acknowledgement:
23  *      This product includes software developed by the University of
24  *      California, Berkeley and its contributors.
25  * 4. Neither the name of the University nor the names of its contributors
26  *    may be used to endorse or promote products derived from this software
27  *    without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39  * SUCH DAMAGE.
40  *
41  *      from: @(#)vm_machdep.c  7.3 (Berkeley) 5/13/91
42  *      Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
43  */
44
45 #include <sys/cdefs.h>
46 __FBSDID("$FreeBSD$");
47
48 #include "opt_isa.h"
49 #include "opt_npx.h"
50 #include "opt_reset.h"
51 #include "opt_cpu.h"
52
53 #include <sys/param.h>
54 #include <sys/systm.h>
55 #include <sys/bio.h>
56 #include <sys/buf.h>
57 #include <sys/kernel.h>
58 #include <sys/ktr.h>
59 #include <sys/lock.h>
60 #include <sys/malloc.h>
61 #include <sys/mbuf.h>
62 #include <sys/mutex.h>
63 #include <sys/pioctl.h>
64 #include <sys/proc.h>
65 #include <sys/sysent.h>
66 #include <sys/sf_buf.h>
67 #include <sys/smp.h>
68 #include <sys/sched.h>
69 #include <sys/sysctl.h>
70 #include <sys/unistd.h>
71 #include <sys/vnode.h>
72 #include <sys/vmmeter.h>
73
74 #include <machine/cpu.h>
75 #include <machine/cputypes.h>
76 #include <machine/md_var.h>
77 #include <machine/pcb.h>
78 #include <machine/pcb_ext.h>
79 #include <machine/smp.h>
80 #include <machine/vm86.h>
81
82 #include <vm/vm.h>
83 #include <vm/vm_extern.h>
84 #include <vm/vm_kern.h>
85 #include <vm/vm_page.h>
86 #include <vm/vm_map.h>
87 #include <vm/vm_param.h>
88
89 #ifndef NSFBUFS
90 #define NSFBUFS         (512 + maxusers * 16)
91 #endif
92
93 _Static_assert(__OFFSETOF_MONITORBUF == offsetof(struct pcpu, pc_monitorbuf),
94     "__OFFSETOF_MONITORBUF does not correspond with offset of pc_monitorbuf.");
95
96 union savefpu *
97 get_pcb_user_save_td(struct thread *td)
98 {
99         vm_offset_t p;
100
101         p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
102             roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN);
103         KASSERT((p % XSAVE_AREA_ALIGN) == 0, ("Unaligned pcb_user_save area"));
104         return ((union savefpu *)p);
105 }
106
107 union savefpu *
108 get_pcb_user_save_pcb(struct pcb *pcb)
109 {
110         vm_offset_t p;
111
112         p = (vm_offset_t)(pcb + 1);
113         return ((union savefpu *)p);
114 }
115
116 struct pcb *
117 get_pcb_td(struct thread *td)
118 {
119         vm_offset_t p;
120
121         p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
122             roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN) -
123             sizeof(struct pcb);
124         return ((struct pcb *)p);
125 }
126
127 void *
128 alloc_fpusave(int flags)
129 {
130         void *res;
131         struct savefpu_ymm *sf;
132
133         res = malloc(cpu_max_ext_state_size, M_DEVBUF, flags);
134         if (use_xsave) {
135                 sf = (struct savefpu_ymm *)res;
136                 bzero(&sf->sv_xstate.sx_hd, sizeof(sf->sv_xstate.sx_hd));
137                 sf->sv_xstate.sx_hd.xstate_bv = xsave_mask;
138         }
139         return (res);
140 }
141 /*
142  * Finish a fork operation, with process p2 nearly set up.
143  * Copy and update the pcb, set up the stack so that the child
144  * ready to run and return to user mode.
145  */
146 void
147 cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
148 {
149         struct proc *p1;
150         struct pcb *pcb2;
151         struct mdproc *mdp2;
152
153         p1 = td1->td_proc;
154         if ((flags & RFPROC) == 0) {
155                 if ((flags & RFMEM) == 0) {
156                         /* unshare user LDT */
157                         struct mdproc *mdp1 = &p1->p_md;
158                         struct proc_ldt *pldt, *pldt1;
159
160                         mtx_lock_spin(&dt_lock);
161                         if ((pldt1 = mdp1->md_ldt) != NULL &&
162                             pldt1->ldt_refcnt > 1) {
163                                 pldt = user_ldt_alloc(mdp1, pldt1->ldt_len);
164                                 if (pldt == NULL)
165                                         panic("could not copy LDT");
166                                 mdp1->md_ldt = pldt;
167                                 set_user_ldt(mdp1);
168                                 user_ldt_deref(pldt1);
169                         } else
170                                 mtx_unlock_spin(&dt_lock);
171                 }
172                 return;
173         }
174
175         /* Ensure that td1's pcb is up to date. */
176         if (td1 == curthread)
177                 td1->td_pcb->pcb_gs = rgs();
178         critical_enter();
179         if (PCPU_GET(fpcurthread) == td1)
180                 npxsave(td1->td_pcb->pcb_save);
181         critical_exit();
182
183         /* Point the pcb to the top of the stack */
184         pcb2 = get_pcb_td(td2);
185         td2->td_pcb = pcb2;
186
187         /* Copy td1's pcb */
188         bcopy(td1->td_pcb, pcb2, sizeof(*pcb2));
189
190         /* Properly initialize pcb_save */
191         pcb2->pcb_save = get_pcb_user_save_pcb(pcb2);
192         bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2),
193             cpu_max_ext_state_size);
194
195         /* Point mdproc and then copy over td1's contents */
196         mdp2 = &p2->p_md;
197         bcopy(&p1->p_md, mdp2, sizeof(*mdp2));
198
199         /*
200          * Create a new fresh stack for the new process.
201          * Copy the trap frame for the return to user mode as if from a
202          * syscall.  This copies most of the user mode register values.
203          * The -VM86_STACK_SPACE (-16) is so we can expand the trapframe
204          * if we go to vm86.
205          */
206         td2->td_frame = (struct trapframe *)((caddr_t)td2->td_pcb -
207             VM86_STACK_SPACE) - 1;
208         bcopy(td1->td_frame, td2->td_frame, sizeof(struct trapframe));
209
210         td2->td_frame->tf_eax = 0;              /* Child returns zero */
211         td2->td_frame->tf_eflags &= ~PSL_C;     /* success */
212         td2->td_frame->tf_edx = 1;
213
214         /*
215          * If the parent process has the trap bit set (i.e. a debugger had
216          * single stepped the process to the system call), we need to clear
217          * the trap flag from the new frame unless the debugger had set PF_FORK
218          * on the parent.  Otherwise, the child will receive a (likely
219          * unexpected) SIGTRAP when it executes the first instruction after
220          * returning  to userland.
221          */
222         if ((p1->p_pfsflags & PF_FORK) == 0)
223                 td2->td_frame->tf_eflags &= ~PSL_T;
224
225         /*
226          * Set registers for trampoline to user mode.  Leave space for the
227          * return address on stack.  These are the kernel mode register values.
228          */
229         pcb2->pcb_cr3 = pmap_get_cr3(vmspace_pmap(p2->p_vmspace));
230         pcb2->pcb_edi = 0;
231         pcb2->pcb_esi = (int)fork_return;       /* fork_trampoline argument */
232         pcb2->pcb_ebp = 0;
233         pcb2->pcb_esp = (int)td2->td_frame - sizeof(void *);
234         pcb2->pcb_ebx = (int)td2;               /* fork_trampoline argument */
235         pcb2->pcb_eip = (int)fork_trampoline + setidt_disp;
236         /*-
237          * pcb2->pcb_dr*:       cloned above.
238          * pcb2->pcb_savefpu:   cloned above.
239          * pcb2->pcb_flags:     cloned above.
240          * pcb2->pcb_onfault:   cloned above (always NULL here?).
241          * pcb2->pcb_gs:        cloned above.
242          * pcb2->pcb_ext:       cleared below.
243          */
244
245         /*
246          * XXX don't copy the i/o pages.  this should probably be fixed.
247          */
248         pcb2->pcb_ext = 0;
249
250         /* Copy the LDT, if necessary. */
251         mtx_lock_spin(&dt_lock);
252         if (mdp2->md_ldt != NULL) {
253                 if (flags & RFMEM) {
254                         mdp2->md_ldt->ldt_refcnt++;
255                 } else {
256                         mdp2->md_ldt = user_ldt_alloc(mdp2,
257                             mdp2->md_ldt->ldt_len);
258                         if (mdp2->md_ldt == NULL)
259                                 panic("could not copy LDT");
260                 }
261         }
262         mtx_unlock_spin(&dt_lock);
263
264         /* Setup to release spin count in fork_exit(). */
265         td2->td_md.md_spinlock_count = 1;
266         td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I;
267
268         /*
269          * Now, cpu_switch() can schedule the new process.
270          * pcb_esp is loaded pointing to the cpu_switch() stack frame
271          * containing the return address when exiting cpu_switch.
272          * This will normally be to fork_trampoline(), which will have
273          * %ebx loaded with the new proc's pointer.  fork_trampoline()
274          * will set up a stack to call fork_return(p, frame); to complete
275          * the return to user-mode.
276          */
277 }
278
279 /*
280  * Intercept the return address from a freshly forked process that has NOT
281  * been scheduled yet.
282  *
283  * This is needed to make kernel threads stay in kernel mode.
284  */
285 void
286 cpu_fork_kthread_handler(struct thread *td, void (*func)(void *), void *arg)
287 {
288         /*
289          * Note that the trap frame follows the args, so the function
290          * is really called like this:  func(arg, frame);
291          */
292         td->td_pcb->pcb_esi = (int) func;       /* function */
293         td->td_pcb->pcb_ebx = (int) arg;        /* first arg */
294 }
295
296 void
297 cpu_exit(struct thread *td)
298 {
299
300         /*
301          * If this process has a custom LDT, release it.  Reset pc->pcb_gs
302          * and %gs before we free it in case they refer to an LDT entry.
303          */
304         mtx_lock_spin(&dt_lock);
305         if (td->td_proc->p_md.md_ldt) {
306                 td->td_pcb->pcb_gs = _udatasel;
307                 load_gs(_udatasel);
308                 user_ldt_free(td);
309         } else
310                 mtx_unlock_spin(&dt_lock);
311 }
312
313 void
314 cpu_thread_exit(struct thread *td)
315 {
316
317         critical_enter();
318         if (td == PCPU_GET(fpcurthread))
319                 npxdrop();
320         critical_exit();
321
322         /* Disable any hardware breakpoints. */
323         if (td->td_pcb->pcb_flags & PCB_DBREGS) {
324                 reset_dbregs();
325                 td->td_pcb->pcb_flags &= ~PCB_DBREGS;
326         }
327 }
328
329 void
330 cpu_thread_clean(struct thread *td)
331 {
332         struct pcb *pcb;
333
334         pcb = td->td_pcb; 
335         if (pcb->pcb_ext != NULL) {
336                 /* if (pcb->pcb_ext->ext_refcount-- == 1) ?? */
337                 /*
338                  * XXX do we need to move the TSS off the allocated pages
339                  * before freeing them?  (not done here)
340                  */
341                 pmap_trm_free(pcb->pcb_ext, ctob(IOPAGES + 1));
342                 pcb->pcb_ext = NULL;
343         }
344 }
345
346 void
347 cpu_thread_swapin(struct thread *td)
348 {
349 }
350
351 void
352 cpu_thread_swapout(struct thread *td)
353 {
354 }
355
356 void
357 cpu_thread_alloc(struct thread *td)
358 {
359         struct pcb *pcb;
360         struct xstate_hdr *xhdr;
361
362         td->td_pcb = pcb = get_pcb_td(td);
363         td->td_frame = (struct trapframe *)((caddr_t)pcb -
364             VM86_STACK_SPACE) - 1;
365         pcb->pcb_ext = NULL; 
366         pcb->pcb_save = get_pcb_user_save_pcb(pcb);
367         if (use_xsave) {
368                 xhdr = (struct xstate_hdr *)(pcb->pcb_save + 1);
369                 bzero(xhdr, sizeof(*xhdr));
370                 xhdr->xstate_bv = xsave_mask;
371         }
372 }
373
374 void
375 cpu_thread_free(struct thread *td)
376 {
377
378         cpu_thread_clean(td);
379 }
380
381 bool
382 cpu_exec_vmspace_reuse(struct proc *p __unused, vm_map_t map __unused)
383 {
384
385         return (true);
386 }
387
388 int
389 cpu_procctl(struct thread *td __unused, int idtype __unused, id_t id __unused,
390     int com __unused, void *data __unused)
391 {
392
393         return (EINVAL);
394 }
395
396 void
397 cpu_set_syscall_retval(struct thread *td, int error)
398 {
399
400         switch (error) {
401         case 0:
402                 td->td_frame->tf_eax = td->td_retval[0];
403                 td->td_frame->tf_edx = td->td_retval[1];
404                 td->td_frame->tf_eflags &= ~PSL_C;
405                 break;
406
407         case ERESTART:
408                 /*
409                  * Reconstruct pc, assuming lcall $X,y is 7 bytes, int
410                  * 0x80 is 2 bytes. We saved this in tf_err.
411                  */
412                 td->td_frame->tf_eip -= td->td_frame->tf_err;
413                 break;
414
415         case EJUSTRETURN:
416                 break;
417
418         default:
419                 td->td_frame->tf_eax = SV_ABI_ERRNO(td->td_proc, error);
420                 td->td_frame->tf_eflags |= PSL_C;
421                 break;
422         }
423 }
424
425 /*
426  * Initialize machine state, mostly pcb and trap frame for a new
427  * thread, about to return to userspace.  Put enough state in the new
428  * thread's PCB to get it to go back to the fork_return(), which
429  * finalizes the thread state and handles peculiarities of the first
430  * return to userspace for the new thread.
431  */
432 void
433 cpu_copy_thread(struct thread *td, struct thread *td0)
434 {
435         struct pcb *pcb2;
436
437         /* Point the pcb to the top of the stack. */
438         pcb2 = td->td_pcb;
439
440         /*
441          * Copy the upcall pcb.  This loads kernel regs.
442          * Those not loaded individually below get their default
443          * values here.
444          */
445         bcopy(td0->td_pcb, pcb2, sizeof(*pcb2));
446         pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE |
447             PCB_KERNNPX);
448         pcb2->pcb_save = get_pcb_user_save_pcb(pcb2);
449         bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save,
450             cpu_max_ext_state_size);
451
452         /*
453          * Create a new fresh stack for the new thread.
454          */
455         bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe));
456
457         /* If the current thread has the trap bit set (i.e. a debugger had
458          * single stepped the process to the system call), we need to clear
459          * the trap flag from the new frame. Otherwise, the new thread will
460          * receive a (likely unexpected) SIGTRAP when it executes the first
461          * instruction after returning to userland.
462          */
463         td->td_frame->tf_eflags &= ~PSL_T;
464
465         /*
466          * Set registers for trampoline to user mode.  Leave space for the
467          * return address on stack.  These are the kernel mode register values.
468          */
469         pcb2->pcb_edi = 0;
470         pcb2->pcb_esi = (int)fork_return;                   /* trampoline arg */
471         pcb2->pcb_ebp = 0;
472         pcb2->pcb_esp = (int)td->td_frame - sizeof(void *); /* trampoline arg */
473         pcb2->pcb_ebx = (int)td;                            /* trampoline arg */
474         pcb2->pcb_eip = (int)fork_trampoline + setidt_disp;
475         pcb2->pcb_gs = rgs();
476         /*
477          * If we didn't copy the pcb, we'd need to do the following registers:
478          * pcb2->pcb_cr3:       cloned above.
479          * pcb2->pcb_dr*:       cloned above.
480          * pcb2->pcb_savefpu:   cloned above.
481          * pcb2->pcb_flags:     cloned above.
482          * pcb2->pcb_onfault:   cloned above (always NULL here?).
483          * pcb2->pcb_gs:        cloned above.
484          * pcb2->pcb_ext:       cleared below.
485          */
486         pcb2->pcb_ext = NULL;
487
488         /* Setup to release spin count in fork_exit(). */
489         td->td_md.md_spinlock_count = 1;
490         td->td_md.md_saved_flags = PSL_KERNEL | PSL_I;
491 }
492
493 /*
494  * Set that machine state for performing an upcall that starts
495  * the entry function with the given argument.
496  */
497 void
498 cpu_set_upcall(struct thread *td, void (*entry)(void *), void *arg,
499     stack_t *stack)
500 {
501
502         /* 
503          * Do any extra cleaning that needs to be done.
504          * The thread may have optional components
505          * that are not present in a fresh thread.
506          * This may be a recycled thread so make it look
507          * as though it's newly allocated.
508          */
509         cpu_thread_clean(td);
510
511         /*
512          * Set the trap frame to point at the beginning of the entry
513          * function.
514          */
515         td->td_frame->tf_ebp = 0; 
516         td->td_frame->tf_esp =
517             (((int)stack->ss_sp + stack->ss_size - 4) & ~0x0f) - 4;
518         td->td_frame->tf_eip = (int)entry;
519
520         /* Return address sentinel value to stop stack unwinding. */
521         suword((void *)td->td_frame->tf_esp, 0);
522
523         /* Pass the argument to the entry point. */
524         suword((void *)(td->td_frame->tf_esp + sizeof(void *)),
525             (int)arg);
526 }
527
528 int
529 cpu_set_user_tls(struct thread *td, void *tls_base)
530 {
531         struct segment_descriptor sd;
532         uint32_t base;
533
534         /*
535          * Construct a descriptor and store it in the pcb for
536          * the next context switch.  Also store it in the gdt
537          * so that the load of tf_fs into %fs will activate it
538          * at return to userland.
539          */
540         base = (uint32_t)tls_base;
541         sd.sd_lobase = base & 0xffffff;
542         sd.sd_hibase = (base >> 24) & 0xff;
543         sd.sd_lolimit = 0xffff; /* 4GB limit, wraps around */
544         sd.sd_hilimit = 0xf;
545         sd.sd_type  = SDT_MEMRWA;
546         sd.sd_dpl   = SEL_UPL;
547         sd.sd_p     = 1;
548         sd.sd_xx    = 0;
549         sd.sd_def32 = 1;
550         sd.sd_gran  = 1;
551         critical_enter();
552         /* set %gs */
553         td->td_pcb->pcb_gsd = sd;
554         if (td == curthread) {
555                 PCPU_GET(fsgs_gdt)[1] = sd;
556                 load_gs(GSEL(GUGS_SEL, SEL_UPL));
557         }
558         critical_exit();
559         return (0);
560 }
561
562 /*
563  * Convert kernel VA to physical address
564  */
565 vm_paddr_t
566 kvtop(void *addr)
567 {
568         vm_paddr_t pa;
569
570         pa = pmap_kextract((vm_offset_t)addr);
571         if (pa == 0)
572                 panic("kvtop: zero page frame");
573         return (pa);
574 }
575
576 /*
577  * Get an sf_buf from the freelist.  May block if none are available.
578  */
579 void
580 sf_buf_map(struct sf_buf *sf, int flags)
581 {
582
583         pmap_sf_buf_map(sf);
584 #ifdef SMP
585         sf_buf_shootdown(sf, flags);
586 #endif
587 }
588
589 #ifdef SMP
590 void
591 sf_buf_shootdown(struct sf_buf *sf, int flags)
592 {
593         cpuset_t other_cpus;
594         u_int cpuid;
595
596         sched_pin();
597         cpuid = PCPU_GET(cpuid);
598         if (!CPU_ISSET(cpuid, &sf->cpumask)) {
599                 CPU_SET(cpuid, &sf->cpumask);
600                 invlpg(sf->kva);
601         }
602         if ((flags & SFB_CPUPRIVATE) == 0) {
603                 other_cpus = all_cpus;
604                 CPU_CLR(cpuid, &other_cpus);
605                 CPU_NAND(&other_cpus, &sf->cpumask);
606                 if (!CPU_EMPTY(&other_cpus)) {
607                         CPU_OR(&sf->cpumask, &other_cpus);
608                         smp_masked_invlpg(other_cpus, sf->kva, kernel_pmap);
609                 }
610         }
611         sched_unpin();
612 }
613 #endif
614
615 /*
616  * MD part of sf_buf_free().
617  */
618 int
619 sf_buf_unmap(struct sf_buf *sf)
620 {
621
622         return (0);
623 }
624
625 static void
626 sf_buf_invalidate(struct sf_buf *sf)
627 {
628         vm_page_t m = sf->m;
629
630         /*
631          * Use pmap_qenter to update the pte for
632          * existing mapping, in particular, the PAT
633          * settings are recalculated.
634          */
635         pmap_qenter(sf->kva, &m, 1);
636         pmap_invalidate_cache_range(sf->kva, sf->kva + PAGE_SIZE);
637 }
638
639 /*
640  * Invalidate the cache lines that may belong to the page, if
641  * (possibly old) mapping of the page by sf buffer exists.  Returns
642  * TRUE when mapping was found and cache invalidated.
643  */
644 boolean_t
645 sf_buf_invalidate_cache(vm_page_t m)
646 {
647
648         return (sf_buf_process_page(m, sf_buf_invalidate));
649 }
650
651 /*
652  * Software interrupt handler for queued VM system processing.
653  */   
654 void  
655 swi_vm(void *dummy) 
656 {     
657         if (busdma_swi_pending != 0)
658                 busdma_swi();
659 }
660
661 /*
662  * Tell whether this address is in some physical memory region.
663  * Currently used by the kernel coredump code in order to avoid
664  * dumping the ``ISA memory hole'' which could cause indefinite hangs,
665  * or other unpredictable behaviour.
666  */
667
668 int
669 is_physical_memory(vm_paddr_t addr)
670 {
671
672 #ifdef DEV_ISA
673         /* The ISA ``memory hole''. */
674         if (addr >= 0xa0000 && addr < 0x100000)
675                 return 0;
676 #endif
677
678         /*
679          * stuff other tests for known memory-mapped devices (PCI?)
680          * here
681          */
682
683         return 1;
684 }