[BACK]Return to locore.S CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / arch / i386 / i386

Annotation of src/sys/arch/i386/i386/locore.S, Revision 1.118

1.118   ! maxv        1: /*     $NetBSD: locore.S,v 1.117 2016/05/13 14:03:00 maxv Exp $        */
1.53      yamt        2:
                      3: /*
                      4:  * Copyright-o-rama!
                      5:  */
                      6:
                      7: /*
1.62      bouyer      8:  * Copyright (c) 2006 Manuel Bouyer.
                      9:  *
                     10:  * Redistribution and use in source and binary forms, with or without
                     11:  * modification, are permitted provided that the following conditions
                     12:  * are met:
                     13:  * 1. Redistributions of source code must retain the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer.
                     15:  * 2. Redistributions in binary form must reproduce the above copyright
                     16:  *    notice, this list of conditions and the following disclaimer in the
                     17:  *    documentation and/or other materials provided with the distribution.
                     18:  *
                     19:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
                     20:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
                     21:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
                     22:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
                     23:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
                     24:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
                     25:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
                     26:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
                     27:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
                     28:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
                     29:  *
                     30:  */
                     31:
                     32: /*
1.53      yamt       33:  * Copyright (c) 2001 Wasabi Systems, Inc.
                     34:  * All rights reserved.
                     35:  *
                     36:  * Written by Frank van der Linden for Wasabi Systems, Inc.
                     37:  *
                     38:  * Redistribution and use in source and binary forms, with or without
                     39:  * modification, are permitted provided that the following conditions
                     40:  * are met:
                     41:  * 1. Redistributions of source code must retain the above copyright
                     42:  *    notice, this list of conditions and the following disclaimer.
                     43:  * 2. Redistributions in binary form must reproduce the above copyright
                     44:  *    notice, this list of conditions and the following disclaimer in the
                     45:  *    documentation and/or other materials provided with the distribution.
                     46:  * 3. All advertising materials mentioning features or use of this software
                     47:  *    must display the following acknowledgement:
                     48:  *      This product includes software developed for the NetBSD Project by
                     49:  *      Wasabi Systems, Inc.
                     50:  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
                     51:  *    or promote products derived from this software without specific prior
                     52:  *    written permission.
                     53:  *
                     54:  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
                     55:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     56:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     57:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
                     58:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     59:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     60:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     61:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     62:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     63:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     64:  * POSSIBILITY OF SUCH DAMAGE.
                     65:  */
                     66:
1.1       fvdl       67: /*-
1.84      ad         68:  * Copyright (c) 1998, 2000, 2004, 2006, 2007, 2009 The NetBSD Foundation, Inc.
1.1       fvdl       69:  * All rights reserved.
                     70:  *
                     71:  * This code is derived from software contributed to The NetBSD Foundation
1.84      ad         72:  * by Charles M. Hannum, and by Andrew Doran.
1.1       fvdl       73:  *
                     74:  * Redistribution and use in source and binary forms, with or without
                     75:  * modification, are permitted provided that the following conditions
                     76:  * are met:
                     77:  * 1. Redistributions of source code must retain the above copyright
                     78:  *    notice, this list of conditions and the following disclaimer.
                     79:  * 2. Redistributions in binary form must reproduce the above copyright
                     80:  *    notice, this list of conditions and the following disclaimer in the
                     81:  *    documentation and/or other materials provided with the distribution.
                     82:  *
                     83:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     84:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     85:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     86:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
                     87:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     88:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     89:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     90:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     91:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     92:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     93:  * POSSIBILITY OF SUCH DAMAGE.
                     94:  */
                     95:
                     96: /*-
                     97:  * Copyright (c) 1990 The Regents of the University of California.
                     98:  * All rights reserved.
                     99:  *
                    100:  * This code is derived from software contributed to Berkeley by
                    101:  * William Jolitz.
                    102:  *
                    103:  * Redistribution and use in source and binary forms, with or without
                    104:  * modification, are permitted provided that the following conditions
                    105:  * are met:
                    106:  * 1. Redistributions of source code must retain the above copyright
                    107:  *    notice, this list of conditions and the following disclaimer.
                    108:  * 2. Redistributions in binary form must reproduce the above copyright
                    109:  *    notice, this list of conditions and the following disclaimer in the
                    110:  *    documentation and/or other materials provided with the distribution.
1.12      agc       111:  * 3. Neither the name of the University nor the names of its contributors
1.1       fvdl      112:  *    may be used to endorse or promote products derived from this software
                    113:  *    without specific prior written permission.
                    114:  *
                    115:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                    116:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                    117:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                    118:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                    119:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                    120:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                    121:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                    122:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                    123:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                    124:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                    125:  * SUCH DAMAGE.
                    126:  *
                    127:  *     @(#)locore.s    7.3 (Berkeley) 5/13/91
                    128:  */
                    129:
1.59      lukem     130: #include <machine/asm.h>
1.118   ! maxv      131: __KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.117 2016/05/13 14:03:00 maxv Exp $");
1.59      lukem     132:
1.18      christos  133: #include "opt_compat_oldboot.h"
1.114     uebayasi  134: #include "opt_copy_symtab.h"
1.1       fvdl      135: #include "opt_ddb.h"
1.83      apb       136: #include "opt_modular.h"
1.78      joerg     137: #include "opt_multiboot.h"
1.1       fvdl      138: #include "opt_realmem.h"
1.18      christos  139: #include "opt_vm86.h"
1.62      bouyer    140: #include "opt_xen.h"
1.1       fvdl      141:
                    142: #include "assym.h"
                    143: #include "lapic.h"
                    144: #include "ioapic.h"
1.8       fvdl      145: #include "ksyms.h"
1.1       fvdl      146:
                    147: #include <sys/errno.h>
                    148: #include <sys/syscall.h>
                    149:
                    150: #include <machine/cputypes.h>
                    151: #include <machine/segments.h>
                    152: #include <machine/specialreg.h>
                    153: #include <machine/trap.h>
                    154: #include <machine/i82489reg.h>
1.48      yamt      155: #include <machine/frameasm.h>
                    156: #include <machine/i82489reg.h>
1.62      bouyer    157: #ifndef XEN
                    158: #include <machine/multiboot.h>
                    159: #endif
1.1       fvdl      160:
                    161: /* Get definitions for IOM_BEGIN, IOM_END, and IOM_SIZE */
                    162: #include <dev/isa/isareg.h>
                    163:
1.104     uebayasi  164: #ifndef XEN
                    165: #define        _RELOC(x)       ((x) - KERNBASE)
                    166: #else
                    167: #define        _RELOC(x)       ((x))
                    168: #endif /* XEN */
                    169: #define        RELOC(x)        _RELOC(_C_LABEL(x))
                    170:
1.115     maxv      171: #ifndef PAE
                    172: #define        PROC0_PDIR_OFF  0
                    173: #else
                    174: #define PROC0_L3_OFF   0
                    175: #define PROC0_PDIR_OFF 1 * PAGE_SIZE
                    176: #endif
                    177:
                    178: #define        PROC0_STK_OFF   (PROC0_PDIR_OFF + PDP_SIZE * PAGE_SIZE)
                    179: #define        PROC0_PTP1_OFF  (PROC0_STK_OFF + UPAGES * PAGE_SIZE)
                    180:
                    181: /*
                    182:  * fillkpt - Fill in a kernel page table
                    183:  *     eax = pte (page frame | control | status)
                    184:  *     ebx = page table address
                    185:  *     ecx = number of pages to map
                    186:  *
                    187:  * For PAE, each entry is 8 bytes long: we must set the 4 upper bytes to 0.
                    188:  * This is done by the first instruction of fillkpt. In the non-PAE case, this
                    189:  * instruction just clears the page table entry.
                    190:  */
                    191:
                    192: #define fillkpt        \
                    193: 1:     movl    $0,(PDE_SIZE-4)(%ebx)   ;       /* upper 32 bits: 0 */  \
                    194:        movl    %eax,(%ebx)             ;       /* store phys addr */   \
                    195:        addl    $PDE_SIZE,%ebx          ;       /* next PTE/PDE */      \
                    196:        addl    $PAGE_SIZE,%eax         ;       /* next phys page */    \
                    197:        loop    1b                      ;
                    198:
1.118   ! maxv      199: /*
        !           200:  * killkpt - Destroy a kernel page table
        !           201:  *     ebx = page table address
        !           202:  *     ecx = number of pages to destroy
        !           203:  */
        !           204: #define killkpt \
        !           205: 1:     movl    $0,(PDE_SIZE-4)(%ebx)   ;       /* upper bits (for PAE) */ \
        !           206:        movl    $0,(%ebx)               ; \
        !           207:        addl    $PDE_SIZE,%ebx          ; \
        !           208:        loop    1b                      ;
        !           209:
1.115     maxv      210:
1.62      bouyer    211: #ifdef XEN
                    212: /*
                    213:  * Xen guest identifier and loader selection
                    214:  */
                    215: .section __xen_guest
                    216:        .ascii  "GUEST_OS=netbsd,GUEST_VER=3.0,XEN_VER=xen-3.0"
1.106     uebayasi  217:        .ascii  ",VIRT_BASE=0xc0000000" /* KERNBASE */
                    218:        .ascii  ",ELF_PADDR_OFFSET=0xc0000000" /* KERNBASE */
                    219:        .ascii  ",VIRT_ENTRY=0xc0100000" /* KERNTEXTOFF */
                    220:        .ascii  ",HYPERCALL_PAGE=0x00000101"
1.62      bouyer    221:                /* (???+HYPERCALL_PAGE_OFFSET)/PAGE_SIZE) */
1.66      bouyer    222: #ifdef PAE
1.106     uebayasi  223:        .ascii  ",PAE=yes[extended-cr3]"
1.66      bouyer    224: #endif
1.62      bouyer    225:        .ascii  ",LOADER=generic"
1.114     uebayasi  226: #if (NKSYMS || defined(DDB) || defined(MODULAR)) && !defined(makeoptions_COPY_SYMTAB)
1.62      bouyer    227:        .ascii  ",BSD_SYMTAB=yes"
                    228: #endif
                    229:        .byte   0
1.106     uebayasi  230: #endif /* XEN */
1.62      bouyer    231:
1.1       fvdl      232: /*
                    233:  * Initialization
                    234:  */
                    235:        .data
                    236:
1.100     chs       237:        .globl  _C_LABEL(cputype)
1.73      ad        238:        .globl  _C_LABEL(cpuid_level)
1.38      jmmv      239:        .globl  _C_LABEL(esym)
1.71      ad        240:        .globl  _C_LABEL(eblob)
1.38      jmmv      241:        .globl  _C_LABEL(atdevbase)
1.104     uebayasi  242:        .globl  _C_LABEL(lwp0uarea)
                    243:        .globl  _C_LABEL(PDPpaddr)
1.1       fvdl      244:        .globl  _C_LABEL(gdt)
                    245:        .globl  _C_LABEL(idt)
1.30      junyoung  246:        .globl  _C_LABEL(lapic_tpr)
                    247:
1.1       fvdl      248: #if NLAPIC > 0
                    249: #ifdef __ELF__
1.7       thorpej   250:        .align  PAGE_SIZE
1.1       fvdl      251: #else
                    252:        .align  12
                    253: #endif
                    254:        .globl _C_LABEL(local_apic), _C_LABEL(lapic_id)
1.104     uebayasi  255:        .type   _C_LABEL(local_apic), @object
                    256: LABEL(local_apic)
1.1       fvdl      257:        .space  LAPIC_ID
1.104     uebayasi  258: END(local_apic)
                    259:        .type   _C_LABEL(lapic_id), @object
                    260: LABEL(lapic_id)
1.1       fvdl      261:        .long   0x00000000
1.106     uebayasi  262:        .space  LAPIC_TPRI-(LAPIC_ID+4)
1.104     uebayasi  263: END(lapic_id)
                    264:        .type   _C_LABEL(lapic_tpr), @object
                    265: LABEL(lapic_tpr)
1.106     uebayasi  266:        .space  LAPIC_PPRI-LAPIC_TPRI
1.104     uebayasi  267: END(lapic_tpr)
                    268:        .type   _C_LABEL(lapic_ppr), @object
1.30      junyoung  269: _C_LABEL(lapic_ppr):
1.1       fvdl      270:        .space  LAPIC_ISR-LAPIC_PPRI
1.104     uebayasi  271: END(lapic_ppr)
                    272:        .type   _C_LABEL(lapic_isr), @object
1.1       fvdl      273: _C_LABEL(lapic_isr):
1.7       thorpej   274:        .space  PAGE_SIZE-LAPIC_ISR
1.104     uebayasi  275: END(lapic_isr)
1.1       fvdl      276: #else
1.104     uebayasi  277:        .type   _C_LABEL(lapic_tpr), @object
                    278: LABEL(lapic_tpr)
1.1       fvdl      279:        .long 0
1.104     uebayasi  280: END(lapic_tpr)
1.1       fvdl      281: #endif
1.104     uebayasi  282:        .type   _C_LABEL(cputype), @object
1.115     maxv      283: LABEL(cputype)         .long   0       /* are we 80486, Pentium, or.. */
1.104     uebayasi  284: END(cputype)
                    285:        .type   _C_LABEL(cpuid_level), @object
                    286: LABEL(cpuid_level)     .long   0
                    287: END(cpuid_level)
                    288:        .type   _C_LABEL(atdevbase), @object
1.115     maxv      289: LABEL(atdevbase)       .long   0       /* location of start of iomem in virt */
1.104     uebayasi  290: END(atdevbase)
                    291:        .type   _C_LABEL(lwp0uarea), @object
                    292: LABEL(lwp0uarea)       .long   0
                    293: END(lwp0uarea)
                    294:        .type   _C_LABEL(PDPpaddr), @object
1.115     maxv      295: LABEL(PDPpaddr)                .long   0       /* paddr of PDP, for libkvm */
1.104     uebayasi  296: END(PDPpaddr)
                    297:        .type   _C_LABEL(tablesize), @object
1.53      yamt      298: _C_LABEL(tablesize):   .long   0
1.104     uebayasi  299: END(tablesize)
1.115     maxv      300:
                    301:        /* Space for the temporary stack */
1.104     uebayasi  302:        .size   tmpstk, tmpstk - .
1.115     maxv      303:        .space  512
1.1       fvdl      304: tmpstk:
1.96      cherry    305: #ifdef XEN
1.115     maxv      306:        .align          PAGE_SIZE, 0x0  /* Align on page boundary */
1.104     uebayasi  307: LABEL(tmpgdt)
1.115     maxv      308:        .space          PAGE_SIZE       /* Xen expects a page */
1.104     uebayasi  309: END(tmpgdt)
1.96      cherry    310: #endif /* XEN */
1.1       fvdl      311:
                    312:        .text
                    313:        .globl  _C_LABEL(kernel_text)
                    314:        .set    _C_LABEL(kernel_text),KERNTEXTOFF
                    315:
1.104     uebayasi  316: ENTRY(start)
1.62      bouyer    317: #ifndef XEN
1.115     maxv      318:
                    319:        /* Warm boot */
                    320:        movw    $0x1234,0x472
                    321:
1.37      jmmv      322: #if defined(MULTIBOOT)
                    323:        jmp     1f
                    324:
                    325:        .align  4
                    326:        .globl  Multiboot_Header
                    327: _C_LABEL(Multiboot_Header):
1.44      jmmv      328: #define MULTIBOOT_HEADER_FLAGS (MULTIBOOT_HEADER_WANT_MEMORY)
1.37      jmmv      329:        .long   MULTIBOOT_HEADER_MAGIC
                    330:        .long   MULTIBOOT_HEADER_FLAGS
                    331:        .long   -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
                    332:
                    333: 1:
                    334:        /* Check if we are being executed by a Multiboot-compliant boot
                    335:         * loader. */
                    336:        cmpl    $MULTIBOOT_INFO_MAGIC,%eax
                    337:        jne     1f
                    338:
1.43      mrg       339:        /*
                    340:         * Indeed, a multiboot-compliant boot loader executed us.  We copy
1.37      jmmv      341:         * the received Multiboot information structure into kernel's data
                    342:         * space to process it later -- after we are relocated.  It will
1.43      mrg       343:         * be safer to run complex C code than doing it at this point.
                    344:         */
1.115     maxv      345:        pushl   %ebx            /* Address of Multiboot information */
1.37      jmmv      346:        call    _C_LABEL(multiboot_pre_reloc)
                    347:        addl    $4,%esp
1.38      jmmv      348:        jmp     2f
1.37      jmmv      349: #endif
                    350:
                    351: 1:
1.1       fvdl      352:        /*
1.38      jmmv      353:         * At this point, we know that a NetBSD-specific boot loader
1.117     maxv      354:         * booted this kernel.
                    355:         *
                    356:         * Load parameters from the stack (32 bits):
                    357:         *     boothowto, [bootdev], bootinfo, esym, biosextmem, biosbasemem
                    358:         * We are not interested in 'bootdev'.
1.1       fvdl      359:         */
1.117     maxv      360:
1.115     maxv      361:        addl    $4,%esp         /* Discard return address to boot loader */
1.38      jmmv      362:        call    _C_LABEL(native_loader)
                    363:        addl    $24,%esp
1.1       fvdl      364:
                    365: 2:
                    366:        /* First, reset the PSL. */
                    367:        pushl   $PSL_MBO
                    368:        popfl
                    369:
                    370:        /* Clear segment registers; always null in proc0. */
                    371:        xorl    %eax,%eax
                    372:        movw    %ax,%fs
                    373:        movw    %ax,%gs
                    374:        decl    %eax
1.73      ad        375:        movl    %eax,RELOC(cpuid_level)
1.1       fvdl      376:
                    377:        /* Find out our CPU type. */
                    378:
                    379: try386:        /* Try to toggle alignment check flag; does not exist on 386. */
                    380:        pushfl
                    381:        popl    %eax
                    382:        movl    %eax,%ecx
                    383:        orl     $PSL_AC,%eax
                    384:        pushl   %eax
                    385:        popfl
                    386:        pushfl
                    387:        popl    %eax
                    388:        xorl    %ecx,%eax
                    389:        andl    $PSL_AC,%eax
                    390:        pushl   %ecx
                    391:        popfl
                    392:
                    393:        testl   %eax,%eax
                    394:        jnz     try486
                    395:
                    396:        /*
                    397:         * Try the test of a NexGen CPU -- ZF will not change on a DIV
                    398:         * instruction on a NexGen, it will on an i386.  Documented in
                    399:         * Nx586 Processor Recognition Application Note, NexGen, Inc.
                    400:         */
                    401:        movl    $0x5555,%eax
                    402:        xorl    %edx,%edx
                    403:        movl    $2,%ecx
                    404:        divl    %ecx
                    405:        jnz     is386
                    406:
                    407: isnx586:
                    408:        /*
                    409:         * Don't try cpuid, as Nx586s reportedly don't support the
                    410:         * PSL_ID bit.
                    411:         */
1.100     chs       412:        movl    $CPU_NX586,RELOC(cputype)
1.1       fvdl      413:        jmp     2f
                    414:
                    415: is386:
1.100     chs       416:        movl    $CPU_386,RELOC(cputype)
1.1       fvdl      417:        jmp     2f
                    418:
                    419: try486:        /* Try to toggle identification flag; does not exist on early 486s. */
                    420:        pushfl
                    421:        popl    %eax
                    422:        movl    %eax,%ecx
                    423:        xorl    $PSL_ID,%eax
                    424:        pushl   %eax
                    425:        popfl
                    426:        pushfl
                    427:        popl    %eax
                    428:        xorl    %ecx,%eax
                    429:        andl    $PSL_ID,%eax
                    430:        pushl   %ecx
                    431:        popfl
                    432:
                    433:        testl   %eax,%eax
                    434:        jnz     try586
1.100     chs       435: is486: movl    $CPU_486,RELOC(cputype)
1.1       fvdl      436:        /*
                    437:         * Check Cyrix CPU
                    438:         * Cyrix CPUs do not change the undefined flags following
                    439:         * execution of the divide instruction which divides 5 by 2.
                    440:         *
                    441:         * Note: CPUID is enabled on M2, so it passes another way.
                    442:         */
                    443:        pushfl
                    444:        movl    $0x5555, %eax
                    445:        xorl    %edx, %edx
                    446:        movl    $2, %ecx
                    447:        clc
                    448:        divl    %ecx
                    449:        jnc     trycyrix486
                    450:        popfl
                    451:        jmp 2f
                    452: trycyrix486:
1.115     maxv      453:        movl    $CPU_6x86,RELOC(cputype)        /* set CPU type */
1.1       fvdl      454:        /*
                    455:         * Check for Cyrix 486 CPU by seeing if the flags change during a
                    456:         * divide. This is documented in the Cx486SLC/e SMM Programmer's
                    457:         * Guide.
                    458:         */
                    459:        xorl    %edx,%edx
1.115     maxv      460:        cmpl    %edx,%edx               /* set flags to known state */
1.1       fvdl      461:        pushfl
1.115     maxv      462:        popl    %ecx                    /* store flags in ecx */
1.1       fvdl      463:        movl    $-1,%eax
                    464:        movl    $4,%ebx
1.115     maxv      465:        divl    %ebx                    /* do a long division */
1.1       fvdl      466:        pushfl
                    467:        popl    %eax
1.115     maxv      468:        xorl    %ecx,%eax               /* are the flags different? */
                    469:        testl   $0x8d5,%eax             /* only check C|PF|AF|Z|N|V */
                    470:        jne     2f                      /* yes; must be Cyrix 6x86 CPU */
                    471:        movl    $CPU_486DLC,RELOC(cputype)      /* set CPU type */
1.1       fvdl      472:
                    473: #ifndef CYRIX_CACHE_WORKS
                    474:        /* Disable caching of the ISA hole only. */
                    475:        invd
1.115     maxv      476:        movb    $CCR0,%al       /* Configuration Register index (CCR0) */
1.1       fvdl      477:        outb    %al,$0x22
                    478:        inb     $0x23,%al
                    479:        orb     $(CCR0_NC1|CCR0_BARB),%al
                    480:        movb    %al,%ah
                    481:        movb    $CCR0,%al
                    482:        outb    %al,$0x22
                    483:        movb    %ah,%al
                    484:        outb    %al,$0x23
                    485:        invd
                    486: #else /* CYRIX_CACHE_WORKS */
                    487:        /* Set cache parameters */
1.115     maxv      488:        invd                    /* Start with guaranteed clean cache */
                    489:        movb    $CCR0,%al       /* Configuration Register index (CCR0) */
1.1       fvdl      490:        outb    %al,$0x22
                    491:        inb     $0x23,%al
                    492:        andb    $~CCR0_NC0,%al
                    493: #ifndef CYRIX_CACHE_REALLY_WORKS
                    494:        orb     $(CCR0_NC1|CCR0_BARB),%al
                    495: #else
                    496:        orb     $CCR0_NC1,%al
                    497: #endif
                    498:        movb    %al,%ah
                    499:        movb    $CCR0,%al
                    500:        outb    %al,$0x22
                    501:        movb    %ah,%al
                    502:        outb    %al,$0x23
                    503:        /* clear non-cacheable region 1 */
                    504:        movb    $(NCR1+2),%al
                    505:        outb    %al,$0x22
                    506:        movb    $NCR_SIZE_0K,%al
                    507:        outb    %al,$0x23
                    508:        /* clear non-cacheable region 2 */
                    509:        movb    $(NCR2+2),%al
                    510:        outb    %al,$0x22
                    511:        movb    $NCR_SIZE_0K,%al
                    512:        outb    %al,$0x23
                    513:        /* clear non-cacheable region 3 */
                    514:        movb    $(NCR3+2),%al
                    515:        outb    %al,$0x22
                    516:        movb    $NCR_SIZE_0K,%al
                    517:        outb    %al,$0x23
                    518:        /* clear non-cacheable region 4 */
                    519:        movb    $(NCR4+2),%al
                    520:        outb    %al,$0x22
                    521:        movb    $NCR_SIZE_0K,%al
                    522:        outb    %al,$0x23
                    523:        /* enable caching in CR0 */
                    524:        movl    %cr0,%eax
                    525:        andl    $~(CR0_CD|CR0_NW),%eax
                    526:        movl    %eax,%cr0
                    527:        invd
                    528: #endif /* CYRIX_CACHE_WORKS */
                    529:
                    530:        jmp     2f
                    531:
                    532: try586:        /* Use the `cpuid' instruction. */
                    533:        xorl    %eax,%eax
                    534:        cpuid
1.73      ad        535:        movl    %eax,RELOC(cpuid_level)
1.1       fvdl      536:
                    537: 2:
                    538:        /*
                    539:         * Finished with old stack; load new %esp now instead of later so we
                    540:         * can trace this code without having to worry about the trace trap
                    541:         * clobbering the memory test or the zeroing of the bss+bootstrap page
                    542:         * tables.
                    543:         *
                    544:         * The boot program should check:
                    545:         *      text+data <= &stack_variable - more_space_for_stack
                    546:         *      text+data+bss+pad+space_for_page_tables <= end_of_memory
1.115     maxv      547:         *
                    548:         * XXX: the gdt is in the carcass of the boot program so clearing
1.1       fvdl      549:         * the rest of memory is still not possible.
                    550:         */
1.115     maxv      551:        movl    $_RELOC(tmpstk),%esp
1.1       fvdl      552:
                    553: /*
1.117     maxv      554:  * There are two different layouts possible, depending on whether PAE is
                    555:  * enabled or not.
1.1       fvdl      556:  *
1.117     maxv      557:  * If PAE is not enabled, there are two levels of pages: PD -> PT. They will
                    558:  * be referred to as: L2 -> L1. L2 is 1 page long. The BOOTSTRAP TABLES have
                    559:  * the following layout:
                    560:  *     +-----+------------+----+
                    561:  *     | L2 -> PROC0 STK -> L1 |
                    562:  *     +-----+------------+----+
                    563:  *
                    564:  * If PAE is enabled, there are three levels of pages: PDP -> PD -> PT. They
                    565:  * will be referred to as: L3 -> L2 -> L1. L3 is 1 page long, L2 is 4 page
                    566:  * long. The BOOTSTRAP TABLES have the following layout:
                    567:  *     +-----+-----+------------+----+
                    568:  *     | L3 -> L2 -> PROC0 STK -> L1 |
                    569:  *     +-----+-----+------------+----+
                    570:  *
                    571:  * Virtual address space of the kernel in both cases:
                    572:  * +------+--------+------+-----+--------+---------------------+-----------
                    573:  * | TEXT | RODATA | DATA | BSS | [SYMS] | [PRELOADED MODULES] | BOOTSTRAP
                    574:  * +------+--------+------+-----+--------+---------------------+-----------
                    575:  *                             (1)      (2)                   (3)
                    576:  *
                    577:  * -------+------------+
                    578:  * TABLES | ISA IO MEM |
                    579:  * -------+------------+
                    580:  *       (4)
1.93      jym       581:  *
1.117     maxv      582:  * PROC0 STK is obviously not linked as a page level. It just happens to be
                    583:  * caught between L2 and L1.
1.1       fvdl      584:  */
                    585:
1.117     maxv      586:        /* Find end of kernel image; brings us on (1). */
1.1       fvdl      587:        movl    $RELOC(end),%edi
1.71      ad        588:
1.114     uebayasi  589: #if (NKSYMS || defined(DDB) || defined(MODULAR)) && !defined(makeoptions_COPY_SYMTAB)
1.117     maxv      590:        /* Save the symbols (if loaded); brinds us on (2). */
1.1       fvdl      591:        movl    RELOC(esym),%eax
                    592:        testl   %eax,%eax
                    593:        jz      1f
1.35      yamt      594:        subl    $KERNBASE,%eax
1.1       fvdl      595:        movl    %eax,%edi
                    596: 1:
                    597: #endif
                    598:
1.117     maxv      599:        /* Skip over any modules/blobs; brings us on (3). */
1.71      ad        600:        movl    RELOC(eblob),%eax
                    601:        testl   %eax,%eax
                    602:        jz      1f
                    603:        subl    $KERNBASE,%eax
                    604:        movl    %eax,%edi
                    605: 1:
1.117     maxv      606:
                    607:        /* We are on (3). Align up for BOOTSTRAP TABLES. */
1.71      ad        608:        movl    %edi,%esi
1.115     maxv      609:        addl    $PGOFSET,%esi
1.1       fvdl      610:        andl    $~PGOFSET,%esi
                    611:
1.53      yamt      612:        /* nkptp[1] = (esi + ~L2_FRAME) >> L2_SHIFT + 1; */
                    613:        movl    %esi,%eax
                    614:        addl    $~L2_FRAME,%eax
                    615:        shrl    $L2_SHIFT,%eax
1.117     maxv      616:        incl    %eax            /* one more PTP for VAs stolen by bootstrap */
1.53      yamt      617: 1:     movl    %eax,RELOC(nkptp)+1*4
                    618:
1.93      jym       619:        /* tablesize = (PDP_SIZE + UPAGES + nkptp) << PGSHIFT; */
                    620:        addl    $(PDP_SIZE+UPAGES),%eax
                    621: #ifdef PAE
1.117     maxv      622:        incl    %eax            /* one more page for L3 */
1.93      jym       623:        shll    $PGSHIFT+1,%eax /* PTP tables are twice larger with PAE */
                    624: #else
1.53      yamt      625:        shll    $PGSHIFT,%eax
1.93      jym       626: #endif
1.53      yamt      627:        movl    %eax,RELOC(tablesize)
                    628:
1.117     maxv      629:        /* Ensure that nkptp covers BOOTSTRAP TABLES. */
1.53      yamt      630:        addl    %esi,%eax
                    631:        addl    $~L2_FRAME,%eax
                    632:        shrl    $L2_SHIFT,%eax
                    633:        incl    %eax
                    634:        cmpl    %eax,RELOC(nkptp)+1*4
                    635:        jnz     1b
                    636:
1.117     maxv      637:        /* Now, zero out the BOOTSTRAP TABLES (before filling them in). */
1.105     uebayasi  638:        movl    %esi,%edi
1.1       fvdl      639:        xorl    %eax,%eax
                    640:        cld
1.105     uebayasi  641:        movl    RELOC(tablesize),%ecx
                    642:        shrl    $2,%ecx
1.1       fvdl      643:        rep
1.117     maxv      644:        stosl                           /* copy eax -> edi */
1.1       fvdl      645:
                    646: /*
1.117     maxv      647:  * Build the page tables and levels. We go from L1 to L2/L3, and link the levels
                    648:  * together. Note: RELOC computes &addr - KERNBASE in 32 bits; the value can't
                    649:  * be > 4G, or we can't deal with it anyway, since we are in 32bit mode.
1.1       fvdl      650:  */
1.105     uebayasi  651:        /*
1.117     maxv      652:         * Build L1.
1.105     uebayasi  653:         */
1.117     maxv      654:        leal    (PROC0_PTP1_OFF)(%esi),%ebx
                    655:
                    656:        /* Compute &__rodata_start - KERNBASE. */
1.116     maxv      657:        movl    $RELOC(__rodata_start),%edx
1.1       fvdl      658:        andl    $~PGOFSET,%edx
1.30      junyoung  659:
1.117     maxv      660:        /* Skip the first MB. */
1.118   ! maxv      661:        movl    $(KERNTEXTOFF - KERNBASE),%eax
1.1       fvdl      662:        movl    %eax,%ecx
1.117     maxv      663:        shrl    $(PGSHIFT-2),%ecx       /* ((n >> PGSHIFT) << 2) for # PDEs */
1.93      jym       664: #ifdef PAE
1.117     maxv      665:        shll    $1,%ecx                 /* PDEs are twice larger with PAE */
1.93      jym       666: #endif
1.105     uebayasi  667:        addl    %ecx,%ebx
1.1       fvdl      668:
                    669:        /* Map the kernel text read-only. */
                    670:        movl    %edx,%ecx
                    671:        subl    %eax,%ecx
                    672:        shrl    $PGSHIFT,%ecx
                    673:        orl     $(PG_V|PG_KR),%eax
                    674:        fillkpt
                    675:
                    676:        /* Map the data, BSS, and bootstrap tables read-write. */
                    677:        leal    (PG_V|PG_KW)(%edx),%eax
1.53      yamt      678:        movl    RELOC(tablesize),%ecx
1.115     maxv      679:        addl    %esi,%ecx                       /* end of tables */
                    680:        subl    %edx,%ecx                       /* subtract end of text */
1.1       fvdl      681:        shrl    $PGSHIFT,%ecx
                    682:        fillkpt
                    683:
1.53      yamt      684:        /* Map ISA I/O mem (later atdevbase) */
1.115     maxv      685:        movl    $(IOM_BEGIN|PG_V|PG_KW/*|PG_N*/),%eax
                    686:        movl    $(IOM_SIZE>>PGSHIFT),%ecx
1.1       fvdl      687:        fillkpt
                    688:
1.117     maxv      689:        /*
                    690:         * Build L2 for identity mapping. Linked to L1.
                    691:         */
1.105     uebayasi  692:        leal    (PROC0_PDIR_OFF)(%esi),%ebx
                    693:        leal    (PROC0_PTP1_OFF)(%esi),%eax
1.117     maxv      694:        orl     $(PG_V|PG_KW),%eax
1.105     uebayasi  695:        movl    RELOC(nkptp)+1*4,%ecx
1.1       fvdl      696:        fillkpt
                    697:
1.117     maxv      698:        /* Set up L2 entries for actual kernel mapping */
                    699:        leal    (PROC0_PDIR_OFF + L2_SLOT_KERNBASE * PDE_SIZE)(%esi),%ebx
1.105     uebayasi  700:        leal    (PROC0_PTP1_OFF)(%esi),%eax
1.117     maxv      701:        orl     $(PG_V|PG_KW),%eax
1.105     uebayasi  702:        movl    RELOC(nkptp)+1*4,%ecx
1.1       fvdl      703:        fillkpt
                    704:
                    705:        /* Install a PDE recursively mapping page directory as a page table! */
1.117     maxv      706:        leal    (PROC0_PDIR_OFF + PDIR_SLOT_PTE * PDE_SIZE)(%esi),%ebx
1.105     uebayasi  707:        leal    (PROC0_PDIR_OFF)(%esi),%eax
                    708:        orl     $(PG_V|PG_KW),%eax
1.93      jym       709:        movl    $PDP_SIZE,%ecx
                    710:        fillkpt
                    711:
                    712: #ifdef PAE
1.117     maxv      713:        /*
                    714:         * Build L3. Linked to L2.
                    715:         */
1.93      jym       716:        leal    (PROC0_L3_OFF)(%esi),%ebx
                    717:        leal    (PROC0_PDIR_OFF)(%esi),%eax
                    718:        orl     $(PG_V),%eax
                    719:        movl    $PDP_SIZE,%ecx
                    720:        fillkpt
                    721:
                    722:        /* Enable PAE mode */
                    723:        movl    %cr4,%eax
                    724:        orl     $CR4_PAE,%eax
                    725:        movl    %eax,%cr4
                    726: #endif
1.1       fvdl      727:
1.117     maxv      728:        /* Save physical address of L2. */
1.93      jym       729:        leal    (PROC0_PDIR_OFF)(%esi),%eax
                    730:        movl    %eax,RELOC(PDPpaddr)
1.1       fvdl      731:
1.93      jym       732:        /*
                    733:         * Startup checklist:
1.117     maxv      734:         * 1. Load %cr3 with pointer to L2 (or L3 for PAE).
1.93      jym       735:         */
1.117     maxv      736:        movl    %esi,%eax
                    737:        movl    %eax,%cr3
1.93      jym       738:
1.105     uebayasi  739:        /*
                    740:         * 2. Enable paging and the rest of it.
                    741:         */
1.115     maxv      742:        movl    %cr0,%eax
1.111     dsl       743:        orl     $(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_MP|CR0_WP|CR0_AM),%eax
1.115     maxv      744:        movl    %eax,%cr0
1.1       fvdl      745:
1.115     maxv      746:        pushl   $begin                  /* jump to high mem */
1.1       fvdl      747:        ret
                    748:
                    749: begin:
1.105     uebayasi  750:        /*
1.117     maxv      751:         * We have arrived. There's no need anymore for the identity mapping in
                    752:         * low memory, remove it.
1.105     uebayasi  753:         */
                    754:        movl    _C_LABEL(nkptp)+1*4,%ecx
1.115     maxv      755:        leal    (PROC0_PDIR_OFF)(%esi),%ebx     /* old, phys address of PDIR */
                    756:        addl    $(KERNBASE), %ebx               /* new, virt address of PDIR */
1.118   ! maxv      757:        killkpt
1.1       fvdl      758:
                    759:        /* Relocate atdevbase. */
1.53      yamt      760:        movl    $KERNBASE,%edx
                    761:        addl    _C_LABEL(tablesize),%edx
1.1       fvdl      762:        addl    %esi,%edx
                    763:        movl    %edx,_C_LABEL(atdevbase)
                    764:
                    765:        /* Set up bootstrap stack. */
1.105     uebayasi  766:        leal    (PROC0_STK_OFF+KERNBASE)(%esi),%eax
1.91      rmind     767:        movl    %eax,_C_LABEL(lwp0uarea)
1.112     dsl       768:        leal    (USPACE-FRAMESIZE)(%eax),%esp
1.115     maxv      769:        movl    %esi,PCB_CR3(%eax)      /* pcb->pcb_cr3 */
                    770:        xorl    %ebp,%ebp               /* mark end of frames */
1.1       fvdl      771:
1.37      jmmv      772: #if defined(MULTIBOOT)
                    773:        /* It is now safe to parse the Multiboot information structure
                    774:         * we saved before from C code.  Note that we cannot delay its
                    775:         * parsing any more because initgdt (called below) needs to make
                    776:         * use of this information. */
                    777:        call    _C_LABEL(multiboot_post_reloc)
                    778: #endif
                    779:
1.115     maxv      780:        subl    $NGDT*8, %esp           /* space for temporary gdt */
1.1       fvdl      781:        pushl   %esp
                    782:        call    _C_LABEL(initgdt)
                    783:        addl    $4,%esp
1.30      junyoung  784:
1.105     uebayasi  785:        movl    _C_LABEL(tablesize),%eax
1.115     maxv      786:        addl    %esi,%eax               /* skip past stack and page tables */
1.1       fvdl      787:
1.93      jym       788: #ifdef PAE
1.115     maxv      789:        pushl   $0      /* init386() expects a 64 bits paddr_t with PAE */
1.93      jym       790: #endif
1.1       fvdl      791:        pushl   %eax
1.115     maxv      792:        call    _C_LABEL(init386)       /* wire 386 chip for unix operation */
                    793:        addl    $PDE_SIZE,%esp          /* pop paddr_t */
                    794:        addl    $NGDT*8,%esp            /* pop temporary gdt */
1.1       fvdl      795:
                    796: #ifdef SAFARI_FIFO_HACK
                    797:        movb    $5,%al
                    798:        movw    $0x37b,%dx
                    799:        outb    %al,%dx
                    800:        movw    $0x37f,%dx
                    801:        inb     %dx,%al
                    802:        movb    %al,%cl
                    803:
                    804:        orb     $1,%cl
                    805:
                    806:        movb    $5,%al
                    807:        movw    $0x37b,%dx
                    808:        outb    %al,%dx
                    809:        movw    $0x37f,%dx
                    810:        movb    %cl,%al
                    811:        outb    %al,%dx
                    812: #endif /* SAFARI_FIFO_HACK */
                    813:
                    814:        call    _C_LABEL(main)
1.62      bouyer    815: #else /* XEN */
                    816:        /* First, reset the PSL. */
                    817:        pushl   $PSL_MBO
                    818:        popfl
                    819:
                    820:        cld
1.115     maxv      821:        movl    %esp, %ebx              /* save start of available space */
                    822:        movl    $_RELOC(tmpstk),%esp    /* bootstrap stack end location */
1.62      bouyer    823:
1.106     uebayasi  824:        /* Clear BSS. */
1.62      bouyer    825:        xorl    %eax,%eax
                    826:        movl    $RELOC(__bss_start),%edi
                    827:        movl    $RELOC(_end),%ecx
                    828:        subl    %edi,%ecx
                    829:        rep stosb
                    830:
                    831:        /* Copy the necessary stuff from start_info structure. */
1.105     uebayasi  832:        /* We need to copy shared_info early, so that sti/cli work */
1.62      bouyer    833:        movl    $RELOC(start_info_union),%edi
                    834:        movl    $128,%ecx
                    835:        rep movsl
                    836:
                    837:        /* Clear segment registers; always null in proc0. */
                    838:        xorl    %eax,%eax
                    839:        movw    %ax,%fs
                    840:        movw    %ax,%gs
                    841:        decl    %eax
1.73      ad        842:        movl    %eax,RELOC(cpuid_level)
1.62      bouyer    843:
                    844:        xorl    %eax,%eax
                    845:        cpuid
1.73      ad        846:        movl    %eax,RELOC(cpuid_level)
1.62      bouyer    847:
1.96      cherry    848:        /*
                    849:         * Use a temp page. We'll re- add it to uvm(9) once we're
                    850:         * done using it.
                    851:         */
                    852:        movl    $RELOC(tmpgdt), %eax
1.115     maxv      853:        pushl   %eax            /* start of temporary gdt */
1.96      cherry    854:        call    _C_LABEL(initgdt)
                    855:        addl    $4,%esp
                    856:
1.62      bouyer    857:        call    xen_pmap_bootstrap
1.92      jym       858:
1.62      bouyer    859:        /*
                    860:         * First avail returned by xen_pmap_bootstrap in %eax
                    861:         */
                    862:        movl    %eax, %esi;
1.91      rmind     863:        movl    %esi, _C_LABEL(lwp0uarea)
1.62      bouyer    864:
                    865:        /* Set up bootstrap stack. */
1.112     dsl       866:        leal    (USPACE-FRAMESIZE)(%eax),%esp
1.115     maxv      867:        xorl    %ebp,%ebp               /* mark end of frames */
1.62      bouyer    868:
                    869:        addl    $USPACE, %esi
1.115     maxv      870:        subl    $KERNBASE, %esi         /* init386 wants a physical address */
1.92      jym       871:
                    872: #ifdef PAE
1.115     maxv      873:        pushl   $0      /* init386() expects a 64 bits paddr_t with PAE */
1.92      jym       874: #endif
1.62      bouyer    875:        pushl   %esi
1.115     maxv      876:        call    _C_LABEL(init386)       /* wire 386 chip for unix operation */
                    877:        addl    $PDE_SIZE,%esp          /* pop paddr_t */
1.62      bouyer    878:        call    _C_LABEL(main)
1.106     uebayasi  879: #endif /* XEN */
1.104     uebayasi  880: END(start)
1.62      bouyer    881:
1.101     jym       882: #if defined(XEN)
1.62      bouyer    883: /* space for the hypercall call page */
                    884: #define HYPERCALL_PAGE_OFFSET 0x1000
                    885: .org HYPERCALL_PAGE_OFFSET
                    886: ENTRY(hypercall_page)
                    887: .skip 0x1000
1.104     uebayasi  888: END(hypercall_page)
1.62      bouyer    889:
                    890: /*
                    891:  * void lgdt_finish(void);
                    892:  * Finish load a new GDT pointer (do any necessary cleanup).
                    893:  * XXX It's somewhat questionable whether reloading all the segment registers
                    894:  * is necessary, since the actual descriptor data is not changed except by
                    895:  * process creation and exit, both of which clean up via task switches.  OTOH,
                    896:  * this only happens at run time when the GDT is resized.
                    897:  */
                    898: /* LINTSTUB: Func: void lgdt_finish(void) */
                    899: NENTRY(lgdt_finish)
                    900:        movl    $GSEL(GDATA_SEL, SEL_KPL),%eax
                    901:        movw    %ax,%ds
                    902:        movw    %ax,%es
                    903:        movw    %ax,%gs
                    904:        movw    %ax,%ss
                    905:        movl    $GSEL(GCPU_SEL, SEL_KPL),%eax
                    906:        movw    %ax,%fs
                    907:        /* Reload code selector by doing intersegment return. */
                    908:        popl    %eax
                    909:        pushl   $GSEL(GCODE_SEL, SEL_KPL)
                    910:        pushl   %eax
                    911:        lret
1.72      yamt      912: END(lgdt_finish)
1.62      bouyer    913:
                    914: #endif /* XEN */
1.1       fvdl      915:
                    916: /*
1.48      yamt      917:  * void lwp_trampoline(void);
                    918:  *
1.1       fvdl      919:  * This is a trampoline function pushed onto the stack of a newly created
                    920:  * process in order to do some additional setup.  The trampoline is entered by
1.109     christos  921:  * cpu_switchto()ing to the process, so we abuse the callee-saved
                    922:  * registers used by cpu_switchto() to store the information about the
                    923:  * stub to call.
1.1       fvdl      924:  * NOTE: This function does not have a normal calling sequence!
                    925:  */
1.48      yamt      926: NENTRY(lwp_trampoline)
1.68      ad        927:        movl    %ebp,%edi       /* for .Lsyscall_checkast */
1.48      yamt      928:        xorl    %ebp,%ebp
1.68      ad        929:        pushl   %edi
1.48      yamt      930:        pushl   %eax
                    931:        call    _C_LABEL(lwp_startup)
                    932:        addl    $8,%esp
1.1       fvdl      933:        pushl   %ebx
                    934:        call    *%esi
                    935:        addl    $4,%esp
1.68      ad        936:        jmp     .Lsyscall_checkast
1.1       fvdl      937:        /* NOTREACHED */
1.72      yamt      938: END(lwp_trampoline)
1.1       fvdl      939:
                    940: /*
1.48      yamt      941:  * sigcode()
                    942:  *
                    943:  * Signal trampoline; copied to top of user stack.  Used only for
                    944:  * compatibility with old releases of NetBSD.
1.1       fvdl      945:  */
                    946: NENTRY(sigcode)
                    947:        /*
                    948:         * Handler has returned here as if we called it.  The sigcontext
                    949:         * is on the stack after the 3 args "we" pushed.
                    950:         */
1.115     maxv      951:        leal    12(%esp),%eax           /* get pointer to sigcontext */
                    952:        movl    %eax,4(%esp)            /* put it in the argument slot */
                    953:                                        /* fake return address already there */
1.17      christos  954:        movl    $SYS_compat_16___sigreturn14,%eax
1.115     maxv      955:        int     $0x80                   /* enter kernel with args on stack */
1.1       fvdl      956:        movl    $SYS_exit,%eax
1.115     maxv      957:        int     $0x80                   /* exit if sigreturn fails */
1.1       fvdl      958:        .globl  _C_LABEL(esigcode)
                    959: _C_LABEL(esigcode):
1.72      yamt      960: END(sigcode)
1.1       fvdl      961:
                    962: /*
1.48      yamt      963:  * int setjmp(label_t *)
                    964:  *
                    965:  * Used primarily by DDB.
1.1       fvdl      966:  */
                    967: ENTRY(setjmp)
                    968:        movl    4(%esp),%eax
1.115     maxv      969:        movl    %ebx,(%eax)             /* save ebx */
                    970:        movl    %esp,4(%eax)            /* save esp */
                    971:        movl    %ebp,8(%eax)            /* save ebp */
                    972:        movl    %esi,12(%eax)           /* save esi */
                    973:        movl    %edi,16(%eax)           /* save edi */
                    974:        movl    (%esp),%edx             /* get rta */
                    975:        movl    %edx,20(%eax)           /* save eip */
                    976:        xorl    %eax,%eax               /* return 0 */
1.1       fvdl      977:        ret
1.72      yamt      978: END(setjmp)
1.1       fvdl      979:
1.48      yamt      980: /*
                    981:  * int longjmp(label_t *)
                    982:  *
                    983:  * Used primarily by DDB.
                    984:  */
1.1       fvdl      985: ENTRY(longjmp)
                    986:        movl    4(%esp),%eax
1.115     maxv      987:        movl    (%eax),%ebx             /* restore ebx */
                    988:        movl    4(%eax),%esp            /* restore esp */
                    989:        movl    8(%eax),%ebp            /* restore ebp */
                    990:        movl    12(%eax),%esi           /* restore esi */
                    991:        movl    16(%eax),%edi           /* restore edi */
                    992:        movl    20(%eax),%edx           /* get rta */
                    993:        movl    %edx,(%esp)             /* put in return frame */
                    994:        movl    $1,%eax                 /* return 1 */
1.1       fvdl      995:        ret
1.72      yamt      996: END(longjmp)
1.1       fvdl      997:
1.65      skrll     998: /*
                    999:  * void dumpsys(void)
                   1000:  *
                   1001:  * Mimic cpu_switchto() for postmortem debugging.
                   1002:  */
1.64      skrll    1003: ENTRY(dumpsys)
1.115     maxv     1004:        pushl   %ebx                    /* set up fake switchframe */
                   1005:        pushl   %esi                    /* and save context */
                   1006:        pushl   %edi
1.65      skrll    1007:        movl    %esp,_C_LABEL(dumppcb)+PCB_ESP
                   1008:        movl    %ebp,_C_LABEL(dumppcb)+PCB_EBP
1.115     maxv     1009:        call    _C_LABEL(dodumpsys)     /* dump! */
                   1010:        addl    $(3*4), %esp            /* unwind switchframe */
1.64      skrll    1011:        ret
1.72      yamt     1012: END(dumpsys)
1.64      skrll    1013:
1.1       fvdl     1014: /*
1.106     uebayasi 1015:  * struct lwp *cpu_switchto(struct lwp *oldlwp, struct lwp *newlwp,
1.58      ad       1016:  *                         bool returning)
1.30      junyoung 1017:  *
1.48      yamt     1018:  *     1. if (oldlwp != NULL), save its context.
                   1019:  *     2. then, restore context of newlwp.
                   1020:  *
                   1021:  * Note that the stack frame layout is known to "struct switchframe" in
                   1022:  * <machine/frame.h> and to the code in cpu_lwp_fork() which initializes
1.5       thorpej  1023:  * it for a new lwp.
1.1       fvdl     1024:  */
1.48      yamt     1025: ENTRY(cpu_switchto)
1.1       fvdl     1026:        pushl   %ebx
                   1027:        pushl   %esi
                   1028:        pushl   %edi
                   1029:
1.70      ad       1030: #if defined(DIAGNOSTIC) && !defined(XEN)
                   1031:        cmpl    $IPL_SCHED,CPUVAR(ILEVEL)
                   1032:        jbe     0f
1.74      christos 1033:        pushl   CPUVAR(ILEVEL)
1.70      ad       1034:        pushl   $.Lstr
                   1035:        call    _C_LABEL(panic)
1.74      christos 1036:        addl    $8,%esp
                   1037: .Lstr: .string "cpu_switchto: switching above IPL_SCHED (%d)\0"
1.70      ad       1038: 0:
                   1039: #endif
                   1040:
1.115     maxv     1041:        movl    16(%esp),%esi           /* oldlwp */
                   1042:        movl    20(%esp),%edi           /* newlwp */
                   1043:        movl    24(%esp),%edx           /* returning */
1.48      yamt     1044:        testl   %esi,%esi
                   1045:        jz      1f
1.1       fvdl     1046:
1.48      yamt     1047:        /* Save old context. */
1.91      rmind    1048:        movl    L_PCB(%esi),%eax
1.48      yamt     1049:        movl    %esp,PCB_ESP(%eax)
                   1050:        movl    %ebp,PCB_EBP(%eax)
                   1051:
                   1052:        /* Switch to newlwp's stack. */
1.91      rmind    1053: 1:     movl    L_PCB(%edi),%ebx
1.48      yamt     1054:        movl    PCB_EBP(%ebx),%ebp
                   1055:        movl    PCB_ESP(%ebx),%esp
1.1       fvdl     1056:
1.61      ad       1057:        /*
                   1058:         * Set curlwp.  This must be globally visible in order to permit
                   1059:         * non-interlocked mutex release.
                   1060:         */
                   1061:        movl    %edi,%ecx
                   1062:        xchgl   %ecx,CPUVAR(CURLWP)
1.58      ad       1063:
                   1064:        /* Skip the rest if returning to a pinned LWP. */
                   1065:        testl   %edx,%edx
                   1066:        jnz     4f
                   1067:
1.62      bouyer   1068: #ifdef XEN
                   1069:        pushl   %edi
                   1070:        call    _C_LABEL(i386_switch_context)
                   1071:        addl    $4,%esp
1.97      bouyer   1072: #else /* !XEN */
1.60      yamt     1073:        /* Switch ring0 esp */
                   1074:        movl    PCB_ESP0(%ebx),%eax
                   1075:        movl    %eax,CPUVAR(ESP0)
1.97      bouyer   1076: #endif /* !XEN */
1.1       fvdl     1077:
                   1078:        /* Don't bother with the rest if switching to a system process. */
1.48      yamt     1079:        testl   $LW_SYSTEM,L_FLAG(%edi)
                   1080:        jnz     4f
1.1       fvdl     1081:
1.97      bouyer   1082: #ifndef XEN
1.54      ad       1083:        /* Restore thread-private %fs/%gs descriptors. */
1.60      yamt     1084:        movl    CPUVAR(GDT),%ecx
1.55      ad       1085:        movl    PCB_FSD(%ebx), %eax
                   1086:        movl    PCB_FSD+4(%ebx), %edx
1.54      ad       1087:        movl    %eax, (GUFS_SEL*8)(%ecx)
                   1088:        movl    %edx, (GUFS_SEL*8+4)(%ecx)
1.55      ad       1089:        movl    PCB_GSD(%ebx), %eax
                   1090:        movl    PCB_GSD+4(%ebx), %edx
1.54      ad       1091:        movl    %eax, (GUGS_SEL*8)(%ecx)
                   1092:        movl    %edx, (GUGS_SEL*8+4)(%ecx)
1.97      bouyer   1093: #endif /* !XEN */
1.54      ad       1094:
1.60      yamt     1095:        /* Switch I/O bitmap */
                   1096:        movl    PCB_IOMAP(%ebx),%eax
                   1097:        orl     %eax,%eax
1.95      joerg    1098:        jnz     .Lcopy_iobitmap
1.60      yamt     1099:        movl    $(IOMAP_INVALOFF << 16),CPUVAR(IOBASE)
                   1100: .Liobitmap_done:
                   1101:
1.56      ad       1102:        /* Is this process using RAS (restartable atomic sequences)? */
                   1103:        movl    L_PROC(%edi),%eax
                   1104:        cmpl    $0,P_RASLIST(%eax)
                   1105:        jne     5f
                   1106:
1.48      yamt     1107:        /*
1.90      rmind    1108:         * Restore cr0 (including FPU state).  Raise the IPL to IPL_HIGH.
1.48      yamt     1109:         * FPU IPIs can alter the LWP's saved cr0.  Dropping the priority
                   1110:         * is deferred until mi_switch(), when cpu_switchto() returns.
                   1111:         */
1.62      bouyer   1112: 2:
1.97      bouyer   1113: #ifdef XEN
                   1114:        pushl   %edi
                   1115:        call    _C_LABEL(i386_tls_switch)
                   1116:        addl    $4,%esp
                   1117: #else /* !XEN */
1.108     christos 1118:        movl    $IPL_HIGH,CPUVAR(ILEVEL)
                   1119:        movl    PCB_CR0(%ebx),%ecx              /* has CR0_TS clear */
1.48      yamt     1120:        movl    %cr0,%edx
1.1       fvdl     1121:
1.108     christos 1122:        /*
                   1123:         * If our floating point registers are on a different CPU,
                   1124:         * set CR0_TS so we'll trap rather than reuse bogus state.
                   1125:         */
                   1126:        cmpl    CPUVAR(FPCURLWP),%edi
                   1127:        je      3f
                   1128:        orl     $CR0_TS,%ecx
                   1129:
1.48      yamt     1130:        /* Reloading CR0 is very expensive - avoid if possible. */
1.108     christos 1131: 3:     cmpl    %edx,%ecx
1.48      yamt     1132:        je      4f
1.1       fvdl     1133:        movl    %ecx,%cr0
1.97      bouyer   1134: #endif /* !XEN */
1.1       fvdl     1135:
1.48      yamt     1136:        /* Return to the new LWP, returning 'oldlwp' in %eax. */
                   1137: 4:     movl    %esi,%eax
1.1       fvdl     1138:        popl    %edi
                   1139:        popl    %esi
                   1140:        popl    %ebx
                   1141:        ret
1.20      dsl      1142:
1.48      yamt     1143:        /* Check for restartable atomic sequences (RAS). */
                   1144: 5:     movl    L_MD_REGS(%edi),%ecx
                   1145:        pushl   TF_EIP(%ecx)
1.20      dsl      1146:        pushl   %eax
                   1147:        call    _C_LABEL(ras_lookup)
                   1148:        addl    $8,%esp
                   1149:        cmpl    $-1,%eax
1.48      yamt     1150:        je      2b
1.49      ad       1151:        movl    L_MD_REGS(%edi),%ecx
                   1152:        movl    %eax,TF_EIP(%ecx)
1.48      yamt     1153:        jmp     2b
1.1       fvdl     1154:
1.60      yamt     1155: .Lcopy_iobitmap:
                   1156:        /* Copy I/O bitmap. */
1.86      ad       1157:        incl    _C_LABEL(pmap_iobmp_evcnt)+EV_COUNT
1.60      yamt     1158:        movl    $(IOMAPSIZE/4),%ecx
                   1159:        pushl   %esi
                   1160:        pushl   %edi
                   1161:        movl    %eax,%esi               /* pcb_iomap */
                   1162:        movl    CPUVAR(SELF),%edi
                   1163:        leal    CPU_INFO_IOMAP(%edi),%edi
                   1164:        rep
                   1165:        movsl
                   1166:        popl    %edi
                   1167:        popl    %esi
                   1168:        movl    $((CPU_INFO_IOMAP - CPU_INFO_TSS) << 16),CPUVAR(IOBASE)
                   1169:        jmp     .Liobitmap_done
1.72      yamt     1170: END(cpu_switchto)
1.60      yamt     1171:
1.1       fvdl     1172: /*
                   1173:  * void savectx(struct pcb *pcb);
1.48      yamt     1174:  *
1.1       fvdl     1175:  * Update pcb, saving current processor state.
                   1176:  */
                   1177: ENTRY(savectx)
1.115     maxv     1178:        movl    4(%esp),%edx            /* edx = pcb */
1.1       fvdl     1179:        movl    %esp,PCB_ESP(%edx)
                   1180:        movl    %ebp,PCB_EBP(%edx)
                   1181:        ret
1.72      yamt     1182: END(savectx)
1.1       fvdl     1183:
                   1184: /*
1.48      yamt     1185:  * osyscall()
                   1186:  *
1.1       fvdl     1187:  * Old call gate entry for syscall
                   1188:  */
                   1189: IDTVEC(osyscall)
1.87      ad       1190: #ifndef XEN
                   1191:        /* XXX we are in trouble! interrupts be off here. */
1.115     maxv     1192:        cli                     /* must be first instruction */
1.87      ad       1193: #endif
1.115     maxv     1194:        pushfl                  /* set eflags in trap frame */
1.1       fvdl     1195:        popl    8(%esp)
1.115     maxv     1196:        orl     $PSL_I,8(%esp)  /* re-enable ints on return to user */
                   1197:        pushl   $7              /* size of instruction for restart */
1.1       fvdl     1198:        jmp     syscall1
1.72      yamt     1199: IDTVEC_END(osyscall)
1.1       fvdl     1200:
                   1201: /*
1.48      yamt     1202:  * syscall()
                   1203:  *
1.1       fvdl     1204:  * Trap gate entry for syscall
                   1205:  */
                   1206: IDTVEC(syscall)
1.115     maxv     1207:        pushl   $2              /* size of instruction for restart */
1.1       fvdl     1208: syscall1:
1.115     maxv     1209:        pushl   $T_ASTFLT       /* trap # for doing ASTs */
1.1       fvdl     1210:        INTRENTRY
1.85      ad       1211:        STI(%eax)
1.1       fvdl     1212: #ifdef DIAGNOSTIC
                   1213:        movl    CPUVAR(ILEVEL),%ebx
                   1214:        testl   %ebx,%ebx
                   1215:        jz      1f
                   1216:        pushl   $5f
1.84      ad       1217:        call    _C_LABEL(panic)
1.1       fvdl     1218:        addl    $4,%esp
                   1219: #ifdef DDB
                   1220:        int     $3
                   1221: #endif
1.30      junyoung 1222: 1:
1.1       fvdl     1223: #endif /* DIAGNOSTIC */
1.115     maxv     1224:        addl    $1,CPUVAR(NSYSCALL)     /* count it atomically */
                   1225:        adcl    $0,CPUVAR(NSYSCALL)+4   /* count it atomically */
1.68      ad       1226:        movl    CPUVAR(CURLWP),%edi
                   1227:        movl    L_PROC(%edi),%edx
1.115     maxv     1228:        movl    %esp,L_MD_REGS(%edi)    /* save pointer to frame */
1.15      fvdl     1229:        pushl   %esp
1.115     maxv     1230:        call    *P_MD_SYSCALL(%edx)     /* get pointer to syscall() function */
1.15      fvdl     1231:        addl    $4,%esp
1.27      yamt     1232: .Lsyscall_checkast:
1.24      yamt     1233:        /* Check for ASTs on exit to user mode. */
1.62      bouyer   1234:        CLI(%eax)
1.68      ad       1235:        movl    L_MD_ASTPENDING(%edi), %eax
                   1236:        orl     CPUVAR(WANT_PMAPLOAD), %eax
1.24      yamt     1237:        jnz     9f
1.62      bouyer   1238: #ifdef XEN
                   1239:        STIC(%eax)
                   1240:        jz      14f
                   1241:        call    _C_LABEL(stipending)
                   1242:        testl   %eax,%eax
                   1243:        jz      14f
                   1244:        /* process pending interrupts */
                   1245:        CLI(%eax)
                   1246:        movl    CPUVAR(ILEVEL), %ebx
1.115     maxv     1247:        movl    $.Lsyscall_resume, %esi /* address to resume loop at */
1.62      bouyer   1248: .Lsyscall_resume:
1.115     maxv     1249:        movl    %ebx,%eax               /* get cpl */
1.62      bouyer   1250:        movl    CPUVAR(IUNMASK)(,%eax,4),%eax
1.115     maxv     1251:        andl    CPUVAR(IPENDING),%eax   /* any non-masked bits left? */
1.62      bouyer   1252:        jz      17f
                   1253:        bsrl    %eax,%eax
                   1254:        btrl    %eax,CPUVAR(IPENDING)
                   1255:        movl    CPUVAR(ISOURCES)(,%eax,4),%eax
                   1256:        jmp     *IS_RESUME(%eax)
1.115     maxv     1257: 17:    movl    %ebx, CPUVAR(ILEVEL)    /* restore cpl  */
1.62      bouyer   1258:        jmp     .Lsyscall_checkast
                   1259: 14:
                   1260: #endif /* XEN */
1.1       fvdl     1261: #ifndef DIAGNOSTIC
1.24      yamt     1262:        INTRFASTEXIT
1.1       fvdl     1263: #else /* DIAGNOSTIC */
1.24      yamt     1264:        cmpl    $IPL_NONE,CPUVAR(ILEVEL)
1.1       fvdl     1265:        jne     3f
                   1266:        INTRFASTEXIT
1.62      bouyer   1267: 3:     STI(%eax)
1.1       fvdl     1268:        pushl   $4f
1.84      ad       1269:        call    _C_LABEL(panic)
1.1       fvdl     1270:        addl    $4,%esp
1.58      ad       1271:        pushl   $IPL_NONE
                   1272:        call    _C_LABEL(spllower)
                   1273:        addl    $4,%esp
1.53      yamt     1274:        jmp     .Lsyscall_checkast
1.84      ad       1275: 4:     .asciz  "SPL NOT LOWERED ON SYSCALL EXIT\n"
                   1276: 5:     .asciz  "SPL NOT ZERO ON SYSCALL ENTRY\n"
1.1       fvdl     1277: #endif /* DIAGNOSTIC */
1.68      ad       1278: 9:
                   1279:        cmpl    $0, CPUVAR(WANT_PMAPLOAD)
                   1280:        jz      10f
                   1281:        STI(%eax)
1.24      yamt     1282:        call    _C_LABEL(pmap_load)
1.27      yamt     1283:        jmp     .Lsyscall_checkast      /* re-check ASTs */
1.68      ad       1284: 10:
                   1285:        /* Always returning to user mode here. */
                   1286:        movl    $0, L_MD_ASTPENDING(%edi)
                   1287:        STI(%eax)
                   1288:        /* Pushed T_ASTFLT into tf_trapno on entry. */
                   1289:        pushl   %esp
                   1290:        call    _C_LABEL(trap)
                   1291:        addl    $4,%esp
                   1292:        jmp     .Lsyscall_checkast      /* re-check ASTs */
1.72      yamt     1293: IDTVEC_END(syscall)
1.1       fvdl     1294:
1.81      ad       1295: IDTVEC(svr4_fasttrap)
1.115     maxv     1296:        pushl   $2              /* size of instruction for restart */
                   1297:        pushl   $T_ASTFLT       /* trap # for doing ASTs */
1.81      ad       1298:        INTRENTRY
1.85      ad       1299:        STI(%eax)
1.81      ad       1300:        pushl   $RW_READER
                   1301:        pushl   $_C_LABEL(svr4_fasttrap_lock)
                   1302:        call    _C_LABEL(rw_enter)
                   1303:        addl    $8,%esp
                   1304:        call    *_C_LABEL(svr4_fasttrap_vec)
                   1305:        pushl   $_C_LABEL(svr4_fasttrap_lock)
                   1306:        call    _C_LABEL(rw_exit)
                   1307:        addl    $4,%esp
                   1308: 2:     /* Check for ASTs on exit to user mode. */
                   1309:        cli
1.115     maxv     1310:        CHECK_ASTPENDING(%eax)
1.81      ad       1311:        je      1f
                   1312:        /* Always returning to user mode here. */
                   1313:        CLEAR_ASTPENDING(%eax)
                   1314:        sti
                   1315:        /* Pushed T_ASTFLT into tf_trapno on entry. */
                   1316:        pushl   %esp
                   1317:        call    _C_LABEL(trap)
                   1318:        addl    $4,%esp
                   1319:        jmp     2b
                   1320: 1:     CHECK_DEFERRED_SWITCH
                   1321:        jnz     9f
                   1322:        INTRFASTEXIT
                   1323: 9:     sti
                   1324:        call    _C_LABEL(pmap_load)
                   1325:        cli
                   1326:        jmp     2b
                   1327:
1.48      yamt     1328: /*
                   1329:  * int npx586bug1(int a, int b)
1.110     dsl      1330:  * Used when checking for the FDIV bug on first generations pentiums.
                   1331:  * Anything 120MHz or above is fine.
1.48      yamt     1332:  */
1.1       fvdl     1333: NENTRY(npx586bug1)
1.115     maxv     1334:        fildl   4(%esp)         /* x */
                   1335:        fildl   8(%esp)         /* y */
1.1       fvdl     1336:        fld     %st(1)
1.115     maxv     1337:        fdiv    %st(1),%st      /* x/y */
                   1338:        fmulp   %st,%st(1)      /* (x/y)*y */
                   1339:        fsubrp  %st,%st(1)      /* x-(x/y)*y */
1.1       fvdl     1340:        pushl   $0
                   1341:        fistpl  (%esp)
                   1342:        popl    %eax
                   1343:        ret
1.72      yamt     1344: END(npx586bug1)
1.50      ad       1345:
                   1346: /*
1.76      ad       1347:  * void sse2_idlezero_page(void *pg)
1.50      ad       1348:  *
1.76      ad       1349:  * Zero a page without polluting the cache.  Preemption must be
                   1350:  * disabled by the caller. Abort if a preemption is pending.
1.50      ad       1351:  */
1.76      ad       1352: ENTRY(sse2_idlezero_page)
1.50      ad       1353:        pushl   %ebp
                   1354:        movl    %esp,%ebp
                   1355:        movl    8(%esp), %edx
1.76      ad       1356:        movl    $(PAGE_SIZE/32), %ecx
1.50      ad       1357:        xorl    %eax, %eax
                   1358:        .align  16
                   1359: 1:
1.82      ad       1360:        testl   $RESCHED_KPREEMPT, CPUVAR(RESCHED)
1.76      ad       1361:        jnz     2f
1.50      ad       1362:        movnti  %eax, 0(%edx)
                   1363:        movnti  %eax, 4(%edx)
                   1364:        movnti  %eax, 8(%edx)
                   1365:        movnti  %eax, 12(%edx)
                   1366:        movnti  %eax, 16(%edx)
                   1367:        movnti  %eax, 20(%edx)
                   1368:        movnti  %eax, 24(%edx)
                   1369:        movnti  %eax, 28(%edx)
1.76      ad       1370:        addl    $32, %edx
1.75      ad       1371:        decl    %ecx
1.50      ad       1372:        jnz     1b
                   1373:        sfence
1.76      ad       1374:        incl    %eax
1.50      ad       1375:        pop     %ebp
                   1376:        ret
1.76      ad       1377: 2:
1.50      ad       1378:        sfence
                   1379:        popl    %ebp
                   1380:        ret
1.76      ad       1381: END(sse2_idlezero_page)

CVSweb <webmaster@jp.NetBSD.org>