The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/pc/rebootcode.s

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #include "mem.h"
    2 
    3 /*
    4  * Turn off MMU, then memmory the new kernel to its correct location
    5  * in physical memory.  Then jumps the to start of the kernel.
    6  */
    7 
    8 TEXT    main(SB),$0
    9         MOVL    p1+0(FP), DI            /* destination */
   10         MOVL    DI, AX                  /* entry point */
   11         MOVL    p2+4(FP), SI            /* source */
   12         MOVL    n+8(FP), CX             /* byte count */
   13 
   14 /*
   15  * disable paging
   16  */
   17         MOVL    CR0, DX
   18         ANDL    $~0x80000000, DX                /* ~(PG) */
   19         MOVL    DX, CR0
   20         MOVL    $0, DX
   21         MOVL    DX, CR3
   22 
   23 /*
   24  * the source and destination may overlap.
   25  * determine whether to copy forward or backwards
   26  */
   27         CMPL    SI, DI
   28         JGT     _forward
   29         MOVL    SI, DX
   30         ADDL    CX, DX
   31         CMPL    DX, DI
   32         JGT     _back
   33 
   34 _forward:
   35         CLD
   36         REP;    MOVSB
   37         JMP     _startkernel
   38 
   39 _back:
   40         ADDL    CX, DI
   41         ADDL    CX, SI
   42         SUBL    $1, DI
   43         SUBL    $1, SI
   44         STD
   45         REP;    MOVSB
   46         JMP     _startkernel
   47 /*
   48  * JMP to kernel entry point.  Note the true kernel entry point is
   49  * the virtual address KZERO|AX, but this must wait until
   50  * the MMU is enabled by the kernel in l.s
   51  */
   52 _startkernel:
   53         ORL     AX, AX          /* NOP: avoid link bug */
   54         JMP*    AX

Cache object: 4747bb30fd8841515abe240803a7fea9


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.