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_cpu.h" 50 51 #include <sys/param.h> 52 #include <sys/systm.h> 53 #include <sys/bio.h> 54 #include <sys/buf.h> 55 #include <sys/kernel.h> 56 #include <sys/ktr.h> 57 #include <sys/lock.h> 58 #include <sys/malloc.h> 59 #include <sys/mbuf.h> 60 #include <sys/mutex.h> 61 #include <sys/pioctl.h> 62 #include <sys/priv.h> 63 #include <sys/proc.h> 64 #include <sys/procctl.h> 65 #include <sys/smp.h> 66 #include <sys/sysctl.h> 67 #include <sys/sysent.h> 68 #include <sys/unistd.h> 69 #include <sys/vnode.h> 70 #include <sys/vmmeter.h> 71 #include <sys/wait.h> 72 73 #include <machine/cpu.h> 74 #include <machine/md_var.h> 75 #include <machine/pcb.h> 76 #include <machine/smp.h> 77 #include <machine/specialreg.h> 78 #include <machine/tss.h> 79 80 #include <vm/vm.h> 81 #include <vm/vm_extern.h> 82 #include <vm/vm_kern.h> 83 #include <vm/vm_page.h> 84 #include <vm/vm_map.h> 85 #include <vm/vm_param.h> 86 87 _Static_assert(OFFSETOF_MONITORBUF == offsetof(struct pcpu, pc_monitorbuf), 88 "OFFSETOF_MONITORBUF does not correspond with offset of pc_monitorbuf."); 89 90 struct savefpu * 91 get_pcb_user_save_td(struct thread *td) 92 { 93 vm_offset_t p; 94 95 p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE - 96 roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN); 97 KASSERT((p % XSAVE_AREA_ALIGN) == 0, ("Unaligned pcb_user_save area")); 98 return ((struct savefpu *)p); 99 } 100 101 struct savefpu * 102 get_pcb_user_save_pcb(struct pcb *pcb) 103 { 104 vm_offset_t p; 105 106 p = (vm_offset_t)(pcb + 1); 107 return ((struct savefpu *)p); 108 } 109 110 struct pcb * 111 get_pcb_td(struct thread *td) 112 { 113 vm_offset_t p; 114 115 p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE - 116 roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN) - 117 sizeof(struct pcb); 118 return ((struct pcb *)p); 119 } 120 121 void * 122 alloc_fpusave(int flags) 123 { 124 void *res; 125 struct savefpu_ymm *sf; 126 127 res = malloc(cpu_max_ext_state_size, M_DEVBUF, flags); 128 if (use_xsave) { 129 sf = (struct savefpu_ymm *)res; 130 bzero(&sf->sv_xstate.sx_hd, sizeof(sf->sv_xstate.sx_hd)); 131 sf->sv_xstate.sx_hd.xstate_bv = xsave_mask; 132 } 133 return (res); 134 } 135 136 /* 137 * Finish a fork operation, with process p2 nearly set up. 138 * Copy and update the pcb, set up the stack so that the child 139 * ready to run and return to user mode. 140 */ 141 void 142 cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) 143 { 144 struct proc *p1; 145 struct pcb *pcb2; 146 struct mdproc *mdp1, *mdp2; 147 struct proc_ldt *pldt; 148 149 p1 = td1->td_proc; 150 if ((flags & RFPROC) == 0) { 151 if ((flags & RFMEM) == 0) { 152 /* unshare user LDT */ 153 mdp1 = &p1->p_md; 154 mtx_lock(&dt_lock); 155 if ((pldt = mdp1->md_ldt) != NULL && 156 pldt->ldt_refcnt > 1 && 157 user_ldt_alloc(p1, 1) == NULL) 158 panic("could not copy LDT"); 159 mtx_unlock(&dt_lock); 160 } 161 return; 162 } 163 164 /* Ensure that td1's pcb is up to date. */ 165 fpuexit(td1); 166 update_pcb_bases(td1->td_pcb); 167 168 /* Point the pcb to the top of the stack */ 169 pcb2 = get_pcb_td(td2); 170 td2->td_pcb = pcb2; 171 172 /* Copy td1's pcb */ 173 bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); 174 175 /* Properly initialize pcb_save */ 176 pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); 177 bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), 178 cpu_max_ext_state_size); 179 180 /* Point mdproc and then copy over td1's contents */ 181 mdp2 = &p2->p_md; 182 bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); 183 184 /* 185 * Create a new fresh stack for the new process. 186 * Copy the trap frame for the return to user mode as if from a 187 * syscall. This copies most of the user mode register values. 188 */ 189 td2->td_frame = (struct trapframe *)td2->td_pcb - 1; 190 bcopy(td1->td_frame, td2->td_frame, sizeof(struct trapframe)); 191 192 td2->td_frame->tf_rax = 0; /* Child returns zero */ 193 td2->td_frame->tf_rflags &= ~PSL_C; /* success */ 194 td2->td_frame->tf_rdx = 1; 195 196 /* 197 * If the parent process has the trap bit set (i.e. a debugger had 198 * single stepped the process to the system call), we need to clear 199 * the trap flag from the new frame unless the debugger had set PF_FORK 200 * on the parent. Otherwise, the child will receive a (likely 201 * unexpected) SIGTRAP when it executes the first instruction after 202 * returning to userland. 203 */ 204 if ((p1->p_pfsflags & PF_FORK) == 0) 205 td2->td_frame->tf_rflags &= ~PSL_T; 206 207 /* 208 * Set registers for trampoline to user mode. Leave space for the 209 * return address on stack. These are the kernel mode register values. 210 */ 211 pcb2->pcb_r12 = (register_t)fork_return; /* fork_trampoline argument */ 212 pcb2->pcb_rbp = 0; 213 pcb2->pcb_rsp = (register_t)td2->td_frame - sizeof(void *); 214 pcb2->pcb_rbx = (register_t)td2; /* fork_trampoline argument */ 215 pcb2->pcb_rip = (register_t)fork_trampoline; 216 /*- 217 * pcb2->pcb_dr*: cloned above. 218 * pcb2->pcb_savefpu: cloned above. 219 * pcb2->pcb_flags: cloned above. 220 * pcb2->pcb_onfault: cloned above (always NULL here?). 221 * pcb2->pcb_[fg]sbase: cloned above 222 */ 223 224 /* Setup to release spin count in fork_exit(). */ 225 td2->td_md.md_spinlock_count = 1; 226 td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; 227 pmap_thread_init_invl_gen(td2); 228 229 /* As an i386, do not copy io permission bitmap. */ 230 pcb2->pcb_tssp = NULL; 231 232 /* New segment registers. */ 233 set_pcb_flags_raw(pcb2, PCB_FULL_IRET); 234 235 /* Copy the LDT, if necessary. */ 236 mdp1 = &td1->td_proc->p_md; 237 mdp2 = &p2->p_md; 238 if (mdp1->md_ldt == NULL) { 239 mdp2->md_ldt = NULL; 240 return; 241 } 242 mtx_lock(&dt_lock); 243 if (mdp1->md_ldt != NULL) { 244 if (flags & RFMEM) { 245 mdp1->md_ldt->ldt_refcnt++; 246 mdp2->md_ldt = mdp1->md_ldt; 247 bcopy(&mdp1->md_ldt_sd, &mdp2->md_ldt_sd, sizeof(struct 248 system_segment_descriptor)); 249 } else { 250 mdp2->md_ldt = NULL; 251 mdp2->md_ldt = user_ldt_alloc(p2, 0); 252 if (mdp2->md_ldt == NULL) 253 panic("could not copy LDT"); 254 amd64_set_ldt_data(td2, 0, max_ldt_segment, 255 (struct user_segment_descriptor *) 256 mdp1->md_ldt->ldt_base); 257 } 258 } else 259 mdp2->md_ldt = NULL; 260 mtx_unlock(&dt_lock); 261 262 /* 263 * Now, cpu_switch() can schedule the new process. 264 * pcb_rsp is loaded pointing to the cpu_switch() stack frame 265 * containing the return address when exiting cpu_switch. 266 * This will normally be to fork_trampoline(), which will have 267 * %ebx loaded with the new proc's pointer. fork_trampoline() 268 * will set up a stack to call fork_return(p, frame); to complete 269 * the return to user-mode. 270 */ 271 } 272 273 /* 274 * Intercept the return address from a freshly forked process that has NOT 275 * been scheduled yet. 276 * 277 * This is needed to make kernel threads stay in kernel mode. 278 */ 279 void 280 cpu_fork_kthread_handler(struct thread *td, void (*func)(void *), void *arg) 281 { 282 /* 283 * Note that the trap frame follows the args, so the function 284 * is really called like this: func(arg, frame); 285 */ 286 td->td_pcb->pcb_r12 = (long) func; /* function */ 287 td->td_pcb->pcb_rbx = (long) arg; /* first arg */ 288 } 289 290 void 291 cpu_exit(struct thread *td) 292 { 293 294 /* 295 * If this process has a custom LDT, release it. 296 */ 297 if (td->td_proc->p_md.md_ldt != NULL) 298 user_ldt_free(td); 299 } 300 301 void 302 cpu_thread_exit(struct thread *td) 303 { 304 struct pcb *pcb; 305 306 critical_enter(); 307 if (td == PCPU_GET(fpcurthread)) 308 fpudrop(); 309 critical_exit(); 310 311 pcb = td->td_pcb; 312 313 /* Disable any hardware breakpoints. */ 314 if (pcb->pcb_flags & PCB_DBREGS) { 315 reset_dbregs(); 316 clear_pcb_flags(pcb, PCB_DBREGS); 317 } 318 } 319 320 void 321 cpu_thread_clean(struct thread *td) 322 { 323 struct pcb *pcb; 324 325 pcb = td->td_pcb; 326 327 /* 328 * Clean TSS/iomap 329 */ 330 if (pcb->pcb_tssp != NULL) { 331 pmap_pti_remove_kva((vm_offset_t)pcb->pcb_tssp, 332 (vm_offset_t)pcb->pcb_tssp + ctob(IOPAGES + 1)); 333 kmem_free((vm_offset_t)pcb->pcb_tssp, ctob(IOPAGES + 1)); 334 pcb->pcb_tssp = NULL; 335 } 336 } 337 338 void 339 cpu_thread_swapin(struct thread *td) 340 { 341 } 342 343 void 344 cpu_thread_swapout(struct thread *td) 345 { 346 } 347 348 void 349 cpu_thread_alloc(struct thread *td) 350 { 351 struct pcb *pcb; 352 struct xstate_hdr *xhdr; 353 354 td->td_pcb = pcb = get_pcb_td(td); 355 td->td_frame = (struct trapframe *)pcb - 1; 356 pcb->pcb_save = get_pcb_user_save_pcb(pcb); 357 if (use_xsave) { 358 xhdr = (struct xstate_hdr *)(pcb->pcb_save + 1); 359 bzero(xhdr, sizeof(*xhdr)); 360 xhdr->xstate_bv = xsave_mask; 361 } 362 } 363 364 void 365 cpu_thread_free(struct thread *td) 366 { 367 368 cpu_thread_clean(td); 369 } 370 371 bool 372 cpu_exec_vmspace_reuse(struct proc *p, vm_map_t map) 373 { 374 375 return (((curproc->p_md.md_flags & P_MD_KPTI) != 0) == 376 (vm_map_pmap(map)->pm_ucr3 != PMAP_NO_CR3)); 377 } 378 379 static void 380 cpu_procctl_kpti(struct proc *p, int com, int *val) 381 { 382 383 if (com == PROC_KPTI_CTL) { 384 if (pti && *val == PROC_KPTI_CTL_ENABLE_ON_EXEC) 385 p->p_md.md_flags |= P_MD_KPTI; 386 if (*val == PROC_KPTI_CTL_DISABLE_ON_EXEC) 387 p->p_md.md_flags &= ~P_MD_KPTI; 388 } else /* PROC_KPTI_STATUS */ { 389 *val = (p->p_md.md_flags & P_MD_KPTI) != 0 ? 390 PROC_KPTI_CTL_ENABLE_ON_EXEC: 391 PROC_KPTI_CTL_DISABLE_ON_EXEC; 392 if (vmspace_pmap(p->p_vmspace)->pm_ucr3 != PMAP_NO_CR3) 393 *val |= PROC_KPTI_STATUS_ACTIVE; 394 } 395 } 396 397 int 398 cpu_procctl(struct thread *td, int idtype, id_t id, int com, void *data) 399 { 400 struct proc *p; 401 int error, val; 402 403 switch (com) { 404 case PROC_KPTI_CTL: 405 case PROC_KPTI_STATUS: 406 if (idtype != P_PID) { 407 error = EINVAL; 408 break; 409 } 410 if (com == PROC_KPTI_CTL) { 411 /* sad but true and not a joke */ 412 error = priv_check(td, PRIV_IO); 413 if (error != 0) 414 break; 415 error = copyin(data, &val, sizeof(val)); 416 if (error != 0) 417 break; 418 if (val != PROC_KPTI_CTL_ENABLE_ON_EXEC && 419 val != PROC_KPTI_CTL_DISABLE_ON_EXEC) { 420 error = EINVAL; 421 break; 422 } 423 } 424 error = pget(id, PGET_CANSEE | PGET_NOTWEXIT | PGET_NOTID, &p); 425 if (error == 0) { 426 cpu_procctl_kpti(p, com, &val); 427 PROC_UNLOCK(p); 428 if (com == PROC_KPTI_STATUS) 429 error = copyout(&val, data, sizeof(val)); 430 } 431 break; 432 default: 433 error = EINVAL; 434 break; 435 } 436 return (error); 437 } 438 439 void 440 cpu_set_syscall_retval(struct thread *td, int error) 441 { 442 struct trapframe *frame; 443 444 frame = td->td_frame; 445 if (__predict_true(error == 0)) { 446 frame->tf_rax = td->td_retval[0]; 447 frame->tf_rdx = td->td_retval[1]; 448 frame->tf_rflags &= ~PSL_C; 449 return; 450 } 451 452 switch (error) { 453 case ERESTART: 454 /* 455 * Reconstruct pc, we know that 'syscall' is 2 bytes, 456 * lcall $X,y is 7 bytes, int 0x80 is 2 bytes. 457 * We saved this in tf_err. 458 * %r10 (which was holding the value of %rcx) is restored 459 * for the next iteration. 460 * %r10 restore is only required for freebsd/amd64 processes, 461 * but shall be innocent for any ia32 ABI. 462 * 463 * Require full context restore to get the arguments 464 * in the registers reloaded at return to usermode. 465 */ 466 frame->tf_rip -= frame->tf_err; 467 frame->tf_r10 = frame->tf_rcx; 468 set_pcb_flags(td->td_pcb, PCB_FULL_IRET); 469 break; 470 471 case EJUSTRETURN: 472 break; 473 474 default: 475 frame->tf_rax = SV_ABI_ERRNO(td->td_proc, error); 476 frame->tf_rflags |= PSL_C; 477 break; 478 } 479 } 480 481 /* 482 * Initialize machine state, mostly pcb and trap frame for a new 483 * thread, about to return to userspace. Put enough state in the new 484 * thread's PCB to get it to go back to the fork_return(), which 485 * finalizes the thread state and handles peculiarities of the first 486 * return to userspace for the new thread. 487 */ 488 void 489 cpu_copy_thread(struct thread *td, struct thread *td0) 490 { 491 struct pcb *pcb2; 492 493 /* Point the pcb to the top of the stack. */ 494 pcb2 = td->td_pcb; 495 496 /* 497 * Copy the upcall pcb. This loads kernel regs. 498 * Those not loaded individually below get their default 499 * values here. 500 */ 501 update_pcb_bases(td0->td_pcb); 502 bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); 503 clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | 504 PCB_KERNFPU); 505 pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); 506 bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, 507 cpu_max_ext_state_size); 508 set_pcb_flags_raw(pcb2, PCB_FULL_IRET); 509 510 /* 511 * Create a new fresh stack for the new thread. 512 */ 513 bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); 514 515 /* If the current thread has the trap bit set (i.e. a debugger had 516 * single stepped the process to the system call), we need to clear 517 * the trap flag from the new frame. Otherwise, the new thread will 518 * receive a (likely unexpected) SIGTRAP when it executes the first 519 * instruction after returning to userland. 520 */ 521 td->td_frame->tf_rflags &= ~PSL_T; 522 523 /* 524 * Set registers for trampoline to user mode. Leave space for the 525 * return address on stack. These are the kernel mode register values. 526 */ 527 pcb2->pcb_r12 = (register_t)fork_return; /* trampoline arg */ 528 pcb2->pcb_rbp = 0; 529 pcb2->pcb_rsp = (register_t)td->td_frame - sizeof(void *); /* trampoline arg */ 530 pcb2->pcb_rbx = (register_t)td; /* trampoline arg */ 531 pcb2->pcb_rip = (register_t)fork_trampoline; 532 /* 533 * If we didn't copy the pcb, we'd need to do the following registers: 534 * pcb2->pcb_dr*: cloned above. 535 * pcb2->pcb_savefpu: cloned above. 536 * pcb2->pcb_onfault: cloned above (always NULL here?). 537 * pcb2->pcb_[fg]sbase: cloned above 538 */ 539 540 /* Setup to release spin count in fork_exit(). */ 541 td->td_md.md_spinlock_count = 1; 542 td->td_md.md_saved_flags = PSL_KERNEL | PSL_I; 543 pmap_thread_init_invl_gen(td); 544 } 545 546 /* 547 * Set that machine state for performing an upcall that starts 548 * the entry function with the given argument. 549 */ 550 void 551 cpu_set_upcall(struct thread *td, void (*entry)(void *), void *arg, 552 stack_t *stack) 553 { 554 555 /* 556 * Do any extra cleaning that needs to be done. 557 * The thread may have optional components 558 * that are not present in a fresh thread. 559 * This may be a recycled thread so make it look 560 * as though it's newly allocated. 561 */ 562 cpu_thread_clean(td); 563 564 #ifdef COMPAT_FREEBSD32 565 if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) { 566 /* 567 * Set the trap frame to point at the beginning of the entry 568 * function. 569 */ 570 td->td_frame->tf_rbp = 0; 571 td->td_frame->tf_rsp = 572 (((uintptr_t)stack->ss_sp + stack->ss_size - 4) & ~0x0f) - 4; 573 td->td_frame->tf_rip = (uintptr_t)entry; 574 575 /* Return address sentinel value to stop stack unwinding. */ 576 suword32((void *)td->td_frame->tf_rsp, 0); 577 578 /* Pass the argument to the entry point. */ 579 suword32((void *)(td->td_frame->tf_rsp + sizeof(int32_t)), 580 (uint32_t)(uintptr_t)arg); 581 582 return; 583 } 584 #endif 585 586 /* 587 * Set the trap frame to point at the beginning of the uts 588 * function. 589 */ 590 td->td_frame->tf_rbp = 0; 591 td->td_frame->tf_rsp = 592 ((register_t)stack->ss_sp + stack->ss_size) & ~0x0f; 593 td->td_frame->tf_rsp -= 8; 594 td->td_frame->tf_rip = (register_t)entry; 595 td->td_frame->tf_ds = _udatasel; 596 td->td_frame->tf_es = _udatasel; 597 td->td_frame->tf_fs = _ufssel; 598 td->td_frame->tf_gs = _ugssel; 599 td->td_frame->tf_flags = TF_HASSEGS; 600 601 /* Return address sentinel value to stop stack unwinding. */ 602 suword((void *)td->td_frame->tf_rsp, 0); 603 604 /* Pass the argument to the entry point. */ 605 td->td_frame->tf_rdi = (register_t)arg; 606 } 607 608 int 609 cpu_set_user_tls(struct thread *td, void *tls_base) 610 { 611 struct pcb *pcb; 612 613 if ((u_int64_t)tls_base >= VM_MAXUSER_ADDRESS) 614 return (EINVAL); 615 616 pcb = td->td_pcb; 617 set_pcb_flags(pcb, PCB_FULL_IRET); 618 #ifdef COMPAT_FREEBSD32 619 if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) { 620 pcb->pcb_gsbase = (register_t)tls_base; 621 return (0); 622 } 623 #endif 624 pcb->pcb_fsbase = (register_t)tls_base; 625 return (0); 626 } 627 628 /* 629 * Software interrupt handler for queued VM system processing. 630 */ 631 void 632 swi_vm(void *dummy) 633 { 634 if (busdma_swi_pending != 0) 635 busdma_swi(); 636 } 637 638 /* 639 * Tell whether this address is in some physical memory region. 640 * Currently used by the kernel coredump code in order to avoid 641 * dumping the ``ISA memory hole'' which could cause indefinite hangs, 642 * or other unpredictable behaviour. 643 */ 644 645 int 646 is_physical_memory(vm_paddr_t addr) 647 { 648 649 #ifdef DEV_ISA 650 /* The ISA ``memory hole''. */ 651 if (addr >= 0xa0000 && addr < 0x100000) 652 return 0; 653 #endif 654 655 /* 656 * stuff other tests for known memory-mapped devices (PCI?) 657 * here 658 */ 659 660 return 1; 661 } 662