[6b45e470] | 1 | /* rtems.s |
---|
| 2 | * |
---|
| 3 | * This file contains the single entry point code for |
---|
| 4 | * the PowerPC implementation of RTEMS. |
---|
| 5 | * |
---|
[5c491aef] | 6 | * Author: Andrew Bray <andy@i-cubed.co.uk> |
---|
[6b45e470] | 7 | * |
---|
| 8 | * COPYRIGHT (c) 1995 by i-cubed ltd. |
---|
| 9 | * |
---|
| 10 | * To anyone who acknowledges that this file is provided "AS IS" |
---|
| 11 | * without any express or implied warranty: |
---|
| 12 | * permission to use, copy, modify, and distribute this file |
---|
| 13 | * for any purpose is hereby granted without fee, provided that |
---|
| 14 | * the above copyright notice and this notice appears in all |
---|
| 15 | * copies, and that the name of i-cubed limited not be used in |
---|
| 16 | * advertising or publicity pertaining to distribution of the |
---|
| 17 | * software without specific, written prior permission. |
---|
| 18 | * i-cubed limited makes no representations about the suitability |
---|
| 19 | * of this software for any purpose. |
---|
| 20 | * |
---|
| 21 | * Derived from c/src/exec/cpu/no_cpu/rtems.c: |
---|
| 22 | * |
---|
| 23 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
| 24 | * On-Line Applications Research Corporation (OAR). |
---|
| 25 | * All rights assigned to U.S. Government, 1994. |
---|
| 26 | * |
---|
| 27 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
| 28 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
| 29 | * notice must appear in all copies of this file and its derivatives. |
---|
| 30 | * |
---|
[eb5a7e07] | 31 | * $Id$ |
---|
[6b45e470] | 32 | */ |
---|
| 33 | |
---|
[985796a] | 34 | #include <asm.h> |
---|
[6b45e470] | 35 | |
---|
| 36 | BEGIN_CODE |
---|
| 37 | /* |
---|
| 38 | * RTEMS |
---|
| 39 | * |
---|
| 40 | * This routine jumps to the directive indicated in r11. |
---|
| 41 | * This routine is used when RTEMS is linked by itself and placed |
---|
| 42 | * in ROM. This routine is the first address in the ROM space for |
---|
| 43 | * RTEMS. The user "calls" this address with the directive arguments |
---|
| 44 | * in the normal place. |
---|
| 45 | * This routine then jumps indirectly to the correct directive |
---|
| 46 | * preserving the arguments. The directive should not realize |
---|
| 47 | * it has been "wrapped" in this way. The table "_Entry_points" |
---|
| 48 | * is used to look up the directive. |
---|
| 49 | */ |
---|
| 50 | |
---|
| 51 | ALIGN (4, 2) |
---|
| 52 | PUBLIC_PROC (RTEMS) |
---|
| 53 | PROC (RTEMS): |
---|
| 54 | #if (PPC_ABI == PPC_ABI_POWEROPEN) |
---|
| 55 | mflr r0 |
---|
| 56 | stw r0, 8(r1) |
---|
| 57 | stwu r1, -64(r1) |
---|
| 58 | |
---|
| 59 | /* Establish addressing */ |
---|
| 60 | bl base |
---|
| 61 | base: |
---|
| 62 | mflr r12 |
---|
| 63 | addi r12, r12, tabaddr - base |
---|
| 64 | |
---|
| 65 | lwz r12, Entry_points-abase(r12) |
---|
| 66 | slwi r11, r11, 2 |
---|
| 67 | lwzx r12, r12, r11 |
---|
| 68 | |
---|
| 69 | stw r2, 56(r1) |
---|
| 70 | lwz r0, 0(r12) |
---|
| 71 | mtlr r0 |
---|
| 72 | lwz r2, 4(r12) |
---|
| 73 | lwz r11, 8(r12) |
---|
| 74 | blrl |
---|
| 75 | lwz r2, 56(r1) |
---|
| 76 | addi r1, r1, 64 |
---|
| 77 | lwz r0, 8(r1) |
---|
| 78 | mtlr r0 |
---|
| 79 | #else |
---|
| 80 | mflr r0 |
---|
| 81 | stw r0, 4(r1) |
---|
| 82 | stwu r1, -16(r1) |
---|
| 83 | |
---|
| 84 | /* Establish addressing */ |
---|
| 85 | bl base |
---|
| 86 | base: |
---|
| 87 | mflr r12 |
---|
| 88 | addi r12, r12, tabaddr - base |
---|
| 89 | |
---|
| 90 | lwz r12, Entry_points-abase(r12) |
---|
| 91 | slwi r11, r11, 2 |
---|
| 92 | lwzx r11, r12, r11 |
---|
| 93 | |
---|
| 94 | stw r2, 8(r1) |
---|
| 95 | #if (PPC_ABI != PPC_ABI_GCC27) |
---|
| 96 | stw r13, 12(r1) |
---|
| 97 | #endif |
---|
| 98 | mtlr r11 |
---|
| 99 | lwz r11, irqinfo-abase(r12) |
---|
| 100 | lwz r2, 0(r11) |
---|
| 101 | #if (PPC_ABI != PPC_ABI_GCC27) |
---|
| 102 | lwz r13, 4(r11) |
---|
| 103 | #endif |
---|
| 104 | blrl |
---|
| 105 | lwz r2, 8(r1) |
---|
| 106 | #if (PPC_ABI != PPC_ABI_GCC27) |
---|
| 107 | lwz r13, 12(r1) |
---|
| 108 | #endif |
---|
| 109 | addi r1, r1, 16 |
---|
| 110 | lwz r0, 4(r1) |
---|
| 111 | mtlr r0 |
---|
| 112 | #endif |
---|
| 113 | blr |
---|
| 114 | |
---|
| 115 | |
---|
| 116 | /* Addressability stuff */ |
---|
| 117 | tabaddr: |
---|
| 118 | abase: |
---|
| 119 | EXTERN_VAR (_Entry_points) |
---|
| 120 | Entry_points: |
---|
| 121 | EXT_SYM_REF (_Entry_points) |
---|
| 122 | #if (PPC_ABI != PPC_ABI_POWEROPEN) |
---|
| 123 | EXTERN_VAR (_CPU_IRQ_info) |
---|
| 124 | irqinfo: |
---|
| 125 | EXT_SYM_REF (_CPU_IRQ_info) |
---|
| 126 | #endif |
---|
| 127 | |
---|
| 128 | #if (PPC_ABI == PPC_ABI_POWEROPEN) |
---|
| 129 | DESCRIPTOR (RTEMS) |
---|
| 130 | #endif |
---|
| 131 | |
---|
| 132 | |
---|