1 ###################################-*-asm*-
3 # Copyright (c) 2001 Xilinx, Inc. All rights reserved.
5 # Xilinx, Inc. CONFIDENTIAL
7 # XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
8 # COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
9 # ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
10 # STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
11 # IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
12 # FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
13 # XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
14 # THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
15 # ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
16 # FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
17 # AND FITNESS FOR A PARTICULAR PURPOSE.
22 # Used for initialization of small data
23 # anchors and stack for programs compiled using
24 # Xilinx Gnu Tools. This routine also intializes the
25 # exception and interrupt handlers
27 # $Id: crt0.s,v 1.1.4.2 2005/05/26 21:50:39 vasanth Exp $
29 #######################################
31 /* Vector map (Interrupts, Exceptions, Breakpoints) */
32 # # 0x00 # Jump to Start
34 # # 0x08 # Imm instr for soft exception address [Hi halfword]
35 # # 0x0c # Jump to sof Exception handler [Lo halfword]
36 # # 0x10 # Imm instr for interrupt address [Hi halfword]
37 # # 0x14 # Jump to interrupt handler [Lo halfword]
38 # # 0x18 # nop - Reserved for breakpoint vector
39 # # 0x1C # nop - Reserved for breakpoint vector
40 # # 0x20 # Imm instr for hw exception address [Hi halfword]
41 # # 0x24 # Jump instr to hw exception handler [Lo halfword]
45 /* Set the exception and interrupt address vectors */
46 /* to jump to the appropriate handlers */
53 nop # 0x08 # Reserve space for software exception vector
55 nop # 0x10 # Reserve space for interrupt vector
57 nop # 0x18 # Reserve space for breakpoint vector
59 nop # 0x18 # Reserve space for hw exception vector
63 /* Set the Small Data Anchors and the Stack pointer */
64 la r13, r0, _SDA_BASE_
65 la r2, r0, _SDA2_BASE_
66 la r1, r0, _stack-16 # 16 bytes (4 words are needed by
67 # crt for args and link reg )
69 /* Set the opcodes brai and imm for handlers */
70 la r6,r0,0xb8080000 # [opcode for brai ]
71 swi r6,r0,0x4 # [brai opcode for reset]
72 swi r6,r0,0xc # [brai opcode for exception]
73 swi r6,r0,0x14 # [brai opcode for interrupt]
74 swi r6,r0,0x24 # [brai opcode for hw exceptions]
76 la r6,r0,0xb0000000 # [opcode for imm ]
77 swi r6,r0,0x0 # [imm opcode for reset]
78 swi r6,r0,0x8 # [imm opcode for exception]
79 swi r6,r0,0x10 # [imm opocde for interrupt]
80 swi r6,r0,0x20 # [imm opocde for hw exceptions]
82 /* Set Reset vector */
86 shi r7,r0, 0x2 # [imm for reset]
87 shi r6,r0, 0x6 # [lower half for reset]
89 /* Set Software Exception Handler */
90 la r6,r0,_exception_handler
93 shi r7,r0, 0xa # [imm for exception]
94 shi r6,r0, 0xe # [lower half for exception ]
96 /* Set Interrupt Handler */
97 la r6,r0,_interrupt_handler
100 shi r7,r0, 0x12 # [imm for exception]
101 shi r6,r0, 0x16 # [lower half for intterupt ]
103 /* Set HW Exception Handler */
104 la r6,r0,_hw_exception_handler
107 shi r7,r0, 0x22 # [imm for exception]
108 shi r6,r0, 0x26 # [lower half for hw exception]
110 /* initialize bss sections */
114 /* Adjust the stack pointer */
117 /* Fall through to exit */
120 /* Use this exit function */
121 .globl exit # exit library call