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/powerpc/aim/locore32.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 /* $FreeBSD$ */
    2 
    3 /*-
    4  * Copyright (C) 2010-2016 Nathan Whitehorn
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  *
   16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   19  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
   22  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   23  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
   24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
   25  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   26  */
   27 
   28 #include "assym.inc"
   29 
   30 #include <sys/syscall.h>
   31 
   32 #include <machine/trap.h>
   33 #include <machine/param.h>
   34 #include <machine/spr.h>
   35 #include <machine/asm.h>
   36 #include <machine/vmparam.h>
   37 #include "opt_platform.h"
   38 
   39 /* Locate the per-CPU data structure */
   40 #define GET_CPUINFO(r)  \
   41         mfsprg0  r
   42 
   43 /*
   44  * Compiled KERNBASE location and the kernel load address
   45  */
   46         .globl  kernbase
   47         .set    kernbase, KERNBASE
   48 
   49 /*
   50  * Globals
   51  */
   52         .data
   53         .align 3
   54 GLOBAL(__startkernel)
   55         .long   begin
   56 GLOBAL(__endkernel)
   57         .long   end
   58         .align  4
   59 #define TMPSTKSZ        8192            /* 8K temporary stack */
   60 GLOBAL(tmpstk)
   61         .space  TMPSTKSZ
   62 
   63 #ifdef KDB
   64 #define TRAPSTKSZ       4096            /* 4k trap stack */
   65 GLOBAL(trapstk)
   66         .space        TRAPSTKSZ
   67 #endif
   68 
   69         .text
   70         .globl  btext
   71 btext:
   72 
   73 /*
   74  * Main kernel entry point.
   75  */
   76         .text
   77         .globl  __start
   78 __start:
   79         /* Figure out where we are */
   80         bl      1f
   81         .long   _DYNAMIC-.
   82         .long   _GLOBAL_OFFSET_TABLE_-.
   83         .long   tmpstk-.
   84 1:      mflr    %r30
   85 
   86         /* Set up temporary stack pointer */
   87         lwz     %r1,8(%r30)
   88         add     %r1,%r1,%r30
   89         addi    %r1,%r1,(8+TMPSTKSZ-40)
   90 
   91         /* Relocate self */
   92         stw     %r3,16(%r1)
   93         stw     %r4,20(%r1)
   94         stw     %r5,24(%r1)
   95         stw     %r6,28(%r1)
   96         stw     %r7,32(%r1)
   97 
   98         lwz     %r3,0(%r30) /* _DYNAMIC in %r3 */
   99         add     %r3,%r3,%r30
  100         lwz     %r4,4(%r30) /* GOT pointer */
  101         add     %r4,%r4,%r30
  102         lwz     %r4,4(%r4)  /* got[0] is _DYNAMIC link addr */
  103         subf    %r4,%r4,%r3 /* subtract to calculate relocbase */
  104         bl      elf_reloc_self
  105         
  106         lwz     %r3,16(%r1)
  107         lwz     %r4,20(%r1)
  108         lwz     %r5,24(%r1)
  109         lwz     %r6,28(%r1)
  110         lwz     %r7,32(%r1)
  111 
  112         /* MD setup */
  113         bl      powerpc_init
  114 
  115         /* Set stack pointer to new value and branch to mi_startup */
  116         mr      %r1, %r3
  117         li      %r3, 0
  118         stw     %r3, 0(%r1)
  119         bl      mi_startup
  120 
  121         /* mi_startup() does not return */
  122         b       .
  123 
  124 #include <powerpc/aim/trap_subr32.S>

Cache object: 9bcc336168d822cd18685e672bd90a91


[ 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.