OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [arm/] [arch/] [current/] [src/] [vectors.S] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
// #========================================================================
2
// #
3
// #    vectors.S
4
// #
5
// #    ARM exception vectors
6
// #
7
// #========================================================================
8
// ####ECOSGPLCOPYRIGHTBEGIN####
9
// -------------------------------------------
10
// This file is part of eCos, the Embedded Configurable Operating System.
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under
14
// the terms of the GNU General Public License as published by the Free
15
// Software Foundation; either version 2 or (at your option) any later
16
// version.
17
//
18
// eCos is distributed in the hope that it will be useful, but WITHOUT
19
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
21
// for more details.
22
//
23
// You should have received a copy of the GNU General Public License
24
// along with eCos; if not, write to the Free Software Foundation, Inc.,
25
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
26
//
27
// As a special exception, if other files instantiate templates or use
28
// macros or inline functions from this file, or you compile this file
29
// and link it with other works to produce a work based on this file,
30
// this file does not by itself cause the resulting work to be covered by
31
// the GNU General Public License. However the source code for this file
32
// must still be made available in accordance with section (3) of the GNU
33
// General Public License v2.
34
//
35
// This exception does not invalidate any other reasons why a work based
36
// on this file might be covered by the GNU General Public License.
37
// -------------------------------------------
38
// ####ECOSGPLCOPYRIGHTEND####
39
// #========================================================================
40
// ######DESCRIPTIONBEGIN####
41
// #
42
// # Author(s):     nickg, gthomas
43
// # Contributors:  nickg, gthomas
44
// # Date:          1999-02-20
45
// # Purpose:       ARM exception vectors
46
// # Description:   This file defines the code placed into the exception
47
// #                vectors. It also contains the first level default VSRs
48
// #                that save and restore state for both exceptions and
49
// #                interrupts.
50
// #
51
// #####DESCRIPTIONEND####
52
// #
53
// #========================================================================
54
 
55
#include 
56
#include 
57
#ifdef CYGPKG_KERNEL  // no CDL yet
58
#include 
59
#else
60
# undef CYGFUN_HAL_COMMON_KERNEL_SUPPORT
61
# undef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
62
#endif
63
#include 
64
 
65
#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
66
// The CDL should enforce this
67
#undef  CYGHWR_HAL_ARM_DUMP_EXCEPTIONS
68
#endif
69
 
70
#include "arm.inc"
71
 
72
#ifdef __thumb__
73
// Switch to thumb mode
74
#define THUMB_MODE(_r_, _l_)                     \
75
        ldr     _r_,=_l_ ## f+1                 ;\
76
        bx      _r_                             ;\
77
        .pool                                   ;\
78
        .code   16                              ;\
79
        .thumb_func                             ;\
80
 _l_:
81
 
82
// Call thumb function from ARM mode, return to ARM
83
// mode afterwards
84
#define THUMB_CALL(_r_, _l_, _f_)                \
85
        ldr     _r_,=_f_+1                      ;\
86
        mov     lr,pc                           ;\
87
        bx      _r_                             ;\
88
        .pool                                   ;\
89
        .code   16                              ;\
90
        .thumb_func                             ;\
91
        ldr     _r_,=_l_  ## f                  ;\
92
        bx      _r_                             ;\
93
        .pool                                   ;\
94
        .code   32                              ;\
95
 _l_:
96
 
97
// Switch to ARM mode
98
#define ARM_MODE(_r_, _l_)                       \
99
        ldr     _r_,=_l_ ## f                   ;\
100
        bx      _r_                             ;\
101
        .pool                                   ;\
102
        .code   32                              ;\
103
 _l_:
104
 
105
// Function definition, start executing body in ARM mode
106
#define FUNC_START_ARM(_name_, _r_)              \
107
        .code   16                              ;\
108
        .thumb_func                             ;\
109
        .globl _name_                           ;\
110
        .type _name_, function                  ;\
111
_name_:                                         ;\
112
        ldr     _r_,=_name_ ## _ARM             ;\
113
        bx      _r_                             ;\
114
        .code   32                              ;\
115
_name_ ## _ARM:
116
 
117
#else
118
 
119
// Switch to thumb mode
120
#define THUMB_MODE(_r_, _l_)
121
 
122
// Call ARM function
123
#define THUMB_CALL(_r_, _l_, _f_) \
124
        bl      _f_
125
 
126
// Switch to ARM mode
127
#define ARM_MODE(_r_, _l_)
128
 
129
// Function definition, start executing body in ARM mode
130
#define FUNC_START_ARM(_name_, _r_) \
131
        .globl _name_; \
132
        .type _name_, function ;\
133
_name_:
134
 
135
#endif
136
 
137
 
138
 
139
#define PTR(name)               \
140
.##name: .word  name
141
 
142
// CYGHWR_HAL_ROM_VADDR is used when compiling for a different location
143
// from the base of ROM.  hal_platform_setup.h might define it.  For
144
// example, if flash is from 0x50000000 upwards (as on SA11x0), and we are
145
// to execute at 0x50040000, then we want the reset vector to point to
146
// 0x0004pqrs - the unmapped ROM address of the code - rather than
147
// 0x0000pqrs, which is the offset into our flash block.
148
//
149
// But usually it's not defined, so the behaviour is the obvious.
150
 
151
#ifndef UNMAPPED
152
#ifdef CYGHWR_HAL_ARM_HAS_MMU
153
# ifndef CYGHWR_HAL_ROM_VADDR
154
#  define CYGHWR_HAL_ROM_VADDR __exception_handlers
155
# endif
156
# define UNMAPPED(x) ((x)-CYGHWR_HAL_ROM_VADDR)
157
#else
158
# define UNMAPPED(x) (x)
159
#endif
160
#endif
161
 
162
#define UNMAPPED_PTR(name)              \
163
.##name: .word  UNMAPPED(name)
164
 
165
//        .file   "vectors.S"
166
 
167
 
168
// CYGHWR_LED_MACRO can be defined in hal_platform_setup.h. It's free to
169
// use r0+r1. Argument is in "\x" - cannot use macro arguments since the
170
// macro may contain #-chars and use of arguments cause these to be
171
// interpreted as CPP stringify operators.
172
// See example in PID hal_platform_setup.h.
173
#ifndef CYGHWR_LED_MACRO
174
#define CYGHWR_LED_MACRO
175
#endif
176
 
177
.macro LED x
178
    CYGHWR_LED_MACRO
179
.endm
180
 
181
 
182
//==========================================================================
183
// Hardware exception vectors.
184
//   This entire section will be copied to the vector table base (by default at
185
//   location 0x0000) at startup time.
186
//
187
 
188
#ifndef CYGHWR_HAL_VECTOR_TABLE_BASE
189
# define CYGHWR_HAL_VECTOR_TABLE_BASE     0x0
190
#endif  /* ifdef CYGHWR_HAL_VECTOR_TABLE_BASE */
191
 
192
        .code   32
193
        .section ".vectors","ax"
194
 
195
// This macro allows platforms to add their own code at the very start of
196
// the image.  This may be required in some circumstances where eCos ROM
197
// based code does not run immediately upon reset and/or when some sort of
198
// special header is required at the start of the image.
199
#ifdef PLATFORM_PREAMBLE
200
        PLATFORM_PREAMBLE
201
#endif
202
 
203
        .global __exception_handlers
204
__exception_handlers:
205
#ifdef CYGSEM_HAL_ROM_RESET_USES_JUMP
206
// Assumption:  ROM code has these vectors at the hardware reset address.
207
// A simple jump removes any address-space dependencies [i.e. safer]
208
        b       reset_vector                    // 0x00
209
#else
210
        ldr     pc,.reset_vector                // 0x00
211
#endif
212
        ldr     pc,.undefined_instruction       // 0x04
213
        ldr     pc,.software_interrupt          // 0x08 start && software int
214
        ldr     pc,.abort_prefetch              // 0x0C
215
        ldr     pc,.abort_data                  // 0x10
216
#ifdef CYGNUM_HAL_ARM_VECTOR_0x14
217
        .word   CYGNUM_HAL_ARM_VECTOR_0x14
218
#else
219
        .word   0                               // unused
220
#endif
221
        ldr     pc,.IRQ                         // 0x18
222
        ldr     pc,.FIQ                         // 0x1C
223
 
224
// The layout of these pointers should match the vector table above since
225
// they are copied in pairs.
226
        .global vectors
227
vectors:
228
UNMAPPED_PTR(reset_vector)                      // 0x20
229
PTR(undefined_instruction)                      // 0x24
230
PTR(software_interrupt)                         // 0x28
231
PTR(abort_prefetch)                             // 0x2C
232
PTR(abort_data)                                 // 0x30
233
        .word   0                               // 0x34
234
PTR(IRQ)                                        // 0x38
235
PTR(FIQ)                                        // 0x3c
236
#ifdef CYGSEM_HAL_ARM_PID_ANGEL_BOOT
237
PTR(start) // This is copied to 0x28 for bootup // 0x40
238
#endif
239
           // location 0x40 is used for storing DRAM size if known
240
           // for some platforms.
241
 
242
//
243
// "Vectors" - fixed location data items
244
//    This section contains any data which might be shared between
245
// an eCos application and any other environment, e.g. the debug
246
// ROM.
247
//
248
        .section ".fixed_vectors"
249
        // Interrupt/exception VSR pointers
250
        .globl  hal_vsr_table
251
hal_vsr_table:
252
        .rept   8
253
        .long   0
254
        .endr
255
 
256
        .globl  hal_dram_size
257
hal_dram_size:
258
        .long   0
259
        // what, if anything, hal_dram_type means is up to the platform
260
        .globl  hal_dram_type
261
hal_dram_type:
262
        .long   0
263
 
264
        .balign 16
265
#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT
266
        // Vectors used to communicate between eCos and ROM environments
267
        .globl  hal_virtual_vector_table
268
hal_virtual_vector_table:
269
        .rept   CYGNUM_CALL_IF_TABLE_SIZE
270
        .long   0
271
        .endr
272
#endif
273
 
274
#ifdef CYGHWR_HAL_ARM_ICE_THREAD_SUPPORT
275
        .balign 16      // Should be at 0x50
276
ice_thread_vector:
277
        .long   0       // Must be 'MICE'
278
        .long   0       // Pointer to thread support vector
279
        .long   0       // eCos executing flag
280
        .long   0       // Must be 'GDB '
281
#endif // CYGHWR_HAL_ARM_ICE_THREAD_SUPPORT
282
        .balign 32
283
 
284
// Other vectors - this may include "fixed" locations
285
#ifdef PLATFORM_VECTORS
286
        PLATFORM_VECTORS
287
#endif
288
 
289
        .text
290
// Startup code which will get the machine into supervisor mode
291
        .global reset_vector
292
        .type   reset_vector,function
293
reset_vector:
294
        PLATFORM_SETUP1         // Early stage platform initialization
295
                                // which can set DRAM size at 0x40
296
                                // see 
297
 
298
        // Come here to reset board
299
warm_reset:
300
 
301
#if defined(CYG_HAL_STARTUP_RAM) && \
302
    !defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS)
303
        mrs     r7,cpsr                 // move back to IRQ mode
304
        and     r7,r7,#CPSR_MODE_BITS
305
        cmp     r7,#CPSR_SUPERVISOR_MODE
306
        beq     start
307
#endif
308
 
309
        // We cannot access any LED registers until after PLATFORM_SETUP1
310
        LED 7
311
 
312
        mov     r0,#0           // move vectors
313
        ldr     r1,=__exception_handlers
314
#ifndef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
315
        // Wait with this if stubs are included (see further down).
316
        ldr     r2,[r1,#0x04]   // undefined instruction
317
        str     r2,[r0,#0x04]
318
        ldr     r2,[r1,#0x24]
319
        str     r2,[r0,#0x24]
320
#endif
321
        ldr     r2,[r1,#0x08]   // software interrupt
322
        str     r2,[r0,#0x08]
323
 
324
#ifdef CYGHWR_HAL_ARM_ICE_THREAD_SUPPORT
325
        ldr     r2,=ice_thread_vector
326
        sub     r2,r2,r1        // compute fixed (low memory) address
327
        ldr     r3,=0x4D494345  // 'MICE'
328
        str     r3,[r2],#4
329
        ldr     r3,=hal_arm_ice_thread_handler
330
        str     r3,[r2],#4
331
        mov     r3,#1
332
        str     r3,[r2],#4
333
        ldr     r3,=0x47444220  // 'GDB '
334
        str     r3,[r2],#4
335
#endif // CYGHWR_HAL_ARM_ICE_THREAD_SUPPORT
336
 
337
#if defined(CYGSEM_HAL_ARM_PID_ANGEL_BOOT)
338
// Ugly hack to get into supervisor mode
339
        ldr     r2,[r1,#0x40]
340
        str     r2,[r0,#0x28]
341
 
342
        LED 6
343
 
344
        swi                     // switch to supervisor mode
345
#endif
346
 
347
// =========================================================================
348
// Real startup code. We jump here from the reset vector to set up the world.
349
        .globl  start
350
        .type   start,function
351
start:
352
 
353
        LED 5
354
 
355
#if defined(CYG_HAL_STARTUP_RAM) && \
356
    !defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS)
357
// If we get restarted, hang here to avoid corrupting memory
358
        ldr     r0,.init_flag
359
        ldr     r1,[r0]
360
1:      cmp     r1,#0
361
        bne     1b
362
        ldr     r1,init_done
363
        str     r1,[r0]
364
#endif
365
 
366
        // Reset software interrupt pointer
367
        ldr     r0,=CYGHWR_HAL_VECTOR_TABLE_BASE           // move vectors
368
        ldr     r1,.__exception_handlers
369
#if defined(CYG_HAL_STARTUP_RAM) && \
370
    !defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS)
371
        cmp     r7,#CPSR_SUPERVISOR_MODE
372
        beq     10f
373
#endif
374
        ldr     r2,[r1,#HAL_ARM_SWI_VECTOR_ADDR]   // software interrupt
375
        str     r2,[r0,#HAL_ARM_SWI_VECTOR_ADDR]
376
10:
377
        ldr     r2,[r1,#HAL_ARM_IRQ_VECTOR]   // IRQ
378
        str     r2,[r0,#HAL_ARM_IRQ_VECTOR]
379
        ldr     r2,[r1,#HAL_ARM_IRQ_VECTOR_ADDR]
380
        str     r2,[r0,#HAL_ARM_IRQ_VECTOR_ADDR]
381
        ldr     r2,[r1,#HAL_ARM_FIQ_VECTOR]   // FIQ
382
        str     r2,[r0,#HAL_ARM_FIQ_VECTOR]
383
        ldr     r2,[r1,#HAL_ARM_FIQ_VECTOR_ADDR]
384
        str     r2,[r0,#HAL_ARM_FIQ_VECTOR_ADDR]
385
        ldr     r2,[r1,#HAL_ARM_PREFETCH_VECTOR]   // abort (prefetch)
386
        str     r2,[r0,#HAL_ARM_PREFETCH_VECTOR]
387
        ldr     r2,[r1,#HAL_ARM_PREFETCH_VECTOR_ADDR]
388
        str     r2,[r0,#HAL_ARM_PREFETCH_VECTOR_ADDR]
389
        ldr     r2,[r1,#HAL_ARM_ABORT_VECTOR]   // abort (data)
390
        str     r2,[r0,#HAL_ARM_ABORT_VECTOR]
391
        ldr     r2,[r1,#HAL_ARM_ABORT_VECTOR_ADDR]
392
        str     r2,[r0,#HAL_ARM_ABORT_VECTOR_ADDR]
393
 
394
        LED 4
395
 
396
#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM)
397
        // Set up reset vector
398
        ldr     r0,=CYGHWR_HAL_VECTOR_TABLE_BASE
399
        ldr     r1,.__exception_handlers
400
# ifndef CYGSEM_HAL_KEEP_RESET_VECTOR
401
        ldr     r2,[r1,#HAL_ARM_RESET_VECTOR]    // reset vector instruction
402
        str     r2,[r0,#HAL_ARM_RESET_VECTOR]
403
#  ifndef CYGSEM_HAL_ROM_RESET_USES_JUMP // if using jump, reset vector address is not referenced
404
        ldr     r2,=warm_reset
405
        str     r2,[r0,#HAL_ARM_RESET_VECTOR_ADDR]
406
#  endif
407
# endif
408
        // Relocate [copy] data from ROM to RAM
409
        ldr     r3,.__rom_data_start
410
        ldr     r4,.__ram_data_start
411
        ldr     r5,.__ram_data_end
412
        cmp     r4,r5           // jump if no data to move
413
        beq     2f
414
        sub     r3,r3,#4        // loop adjustments
415
        sub     r4,r4,#4
416
1:      ldr     r0,[r3,#4]!     // copy info
417
        str     r0,[r4,#4]!
418
        cmp     r4,r5
419
        bne     1b
420
2:
421
#endif
422
 
423
        // initialize interrupt/exception environments
424
        ldr     sp,.__startup_stack
425
        mov     r0,#(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_IRQ_MODE)
426
        msr     cpsr,r0
427
        ldr     sp,.__exception_stack
428
        mov     r0,#(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_UNDEF_MODE)
429
        msr     cpsr,r0
430
        ldr     sp,.__exception_stack
431
 
432
        // initialize CPSR (machine state register)
433
        mov     r0,#(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_SUPERVISOR_MODE)
434
        msr     cpsr,r0
435
 
436
        // Note: some functions in LIBGCC1 will cause a "restore from SPSR"!!
437
        msr     spsr,r0
438
 
439
        // initialize stack
440
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
441
        // use interrupt stack for system initialization since it's bigger
442
        // than the "startup" stack in this configuration
443
        ldr     sp,.__interrupt_stack
444
#else
445
        ldr     sp,.__startup_stack
446
#endif
447
 
448
        // clear BSS
449
        ldr     r1,.__bss_start
450
        ldr     r2,.__bss_end
451
        mov     r0,#0
452
        cmp     r1,r2
453
        beq     2f
454
1:      str     r0,[r1],#4
455
        cmp     r2,r1
456
        bhi     1b
457
2:
458
 
459
        // Run kernel + application in THUMB mode
460
        THUMB_MODE(r1,10)
461
 
462
        LED 3
463
 
464
        // Call platform specific hardware initialization
465
        bl      hal_hardware_init
466
 
467
#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
468
        bl      initialize_stub
469
 
470
        // Now that stub is initialized, change vector. It is possible
471
        // to single-step through most of the init code, except the below.
472
        // Put a breakpoint at the call to cyg_hal_invoke_constructors to
473
        // pass over this bit (s-s depends on internal state in the stub).
474
#endif
475
 
476
#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) || \
477
    defined(CYGIMP_HAL_PROCESS_ALL_EXCEPTIONS)
478
        mov     r0,#0           // move vectors
479
        ldr     r1,=__exception_handlers
480
        ldr     r2,[r1,#0x04]   // undefined instruction
481
        str     r2,[r0,#0x04]
482
        ldr     r2,[r1,#0x24]
483
        str     r2,[r0,#0x24]
484
#endif
485
 
486
#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) \
487
    || defined(CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT)
488
        .extern hal_ctrlc_isr_init
489
        bl      hal_ctrlc_isr_init
490
#endif
491
 
492
        LED 2
493
 
494
        // Run through static constructors
495
        bl      cyg_hal_invoke_constructors
496
 
497
        LED 1
498
 
499
        // This starts up the eCos kernel
500
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
501
        ldr     r1,=__startup_stack
502
        mov     sp,r1
503
#endif
504
        bl      cyg_start
505
_start_hang:
506
        b       _start_hang
507
        .code   32
508
 
509
        .global reset_platform
510
        .type   reset_platform,function
511
reset_platform:
512
#ifdef CYGSEM_HAL_ROM_MONITOR
513
        // initialize CPSR (machine state register)
514
        mov     r0,#(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_SUPERVISOR_MODE)
515
        msr     cpsr,r0
516
        b       warm_reset
517
#else
518
        mov     r0,#0
519
        mov     pc,r0           // Jump to reset vector
520
#endif
521
 
522
init_done:
523
        .long   0xDEADB00B
524
 
525
//
526
// Exception handlers
527
// Assumption: get here from a non-user context [mode]
528
//             except in case of standalone app. running in user mode
529
//             (CYGOPT_HAL_ARM_WITH_USER_MODE should have been defined)
530
//
531
        .code   32
532
undefined_instruction:
533
        ldr     sp,.__undef_exception_stack     // get good stack
534
        stmfd   sp!,{r0-r5}                     // save some supervisor regs
535
        mrs     r1,spsr
536
        tst     r1,#CPSR_THUMB_ENABLE
537
        subeq   r0,lr,#4                // PC at time of interrupt (ARM)
538
        subne   r0,lr,#2                // PC at time of interrupt (thumb)
539
        mov     r2,#CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION
540
        mov     r3,sp
541
        b       call_exception_handler
542
 
543
        .code   32
544
software_interrupt:
545
        stmfd   sp!,{r8}
546
        ldr     r8,.__undef_exception_stack     // get good stack
547
        stmfd   r8!,{r0-r5}                     // save some supervisor regs
548
        mov     r3,r8
549
        ldmfd   sp!,{r8}
550
        mrs     r1,spsr
551
        tst     r1,#CPSR_THUMB_ENABLE
552
        subeq   r0,lr,#4                // PC at time of SWI (ARM)
553
        subne   r0,lr,#2                // PC at time of SWI (thumb)
554
        mov     r2,#CYGNUM_HAL_EXCEPTION_INTERRUPT
555
        b       call_exception_handler
556
 
557
        .code   32
558
abort_prefetch:
559
        ldr     sp,.__undef_exception_stack     // get good stack
560
        stmfd   sp!,{r0-r5}                     // save some supervisor regs
561
        sub     r0,lr,#4                        // PC at time of interrupt
562
        mrs     r1,spsr
563
        mov     r2,#CYGNUM_HAL_EXCEPTION_CODE_ACCESS
564
        mov     r3,sp
565
        b       call_exception_handler
566
 
567
        .code   32
568
abort_data:
569
        ldr     sp,.__undef_exception_stack     // get good stack
570
        stmfd   sp!,{r0-r5}                     // save some supervisor regs
571
        sub     r0,lr,#4                        // PC at time of interrupt
572
        mrs     r1,spsr
573
        mov     r2,#CYGNUM_HAL_EXCEPTION_DATA_ACCESS
574
        mov     r3,sp
575
        b       call_exception_handler
576
 
577
//
578
// Dispatch an exception handler.
579
 
580
        .code   32
581
call_exception_handler:
582
        //
583
        // On Entry:
584
        //
585
        // r4,r5 = scratch
586
        // r3 = pointer to temp save area
587
        // r2 = vector number
588
        // r1 = exception psr
589
        // r0 = exception pc
590
        //
591
        // [r3+20]: exception r5
592
        // [r3+16]: exception r4
593
        // [r3+12]: exception r3
594
        // [r3+8] : exception r2
595
        // [r3+4] : exception r1
596
        // [r3]   : exception r0
597
 
598
        mrs     r4,cpsr                 // switch to Supervisor Mode
599
        bic     r4,r4,#CPSR_MODE_BITS
600
        orr     r4,r4,#CPSR_SUPERVISOR_MODE
601
        msr     cpsr,r4
602
 
603
        mov     r5,sp                   // save original svc sp
604
        mov     r4,lr                   // and original svc lr
605
#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
606
        // Make sure we use the GDB stack.
607
        ldr     sp,.__GDB_stack
608
        cmp     r5,sp                   // already on GDB stack?
609
        bhi     10f
610
        ldr     r4,.__GDB_stack_base
611
        cmp     r5,r4
612
        movhi   sp,r5
613
10:
614
#endif
615
        //
616
        // r5 holds original svc sp, current sp is stack to use
617
        // r4 holds original svc lr, which must also be preserved
618
        //
619
 
620
        stmfd   sp!,{r0-r2,r4,r5}       // push svc_sp, svc_lr, vector, psr, pc
621
 
622
#ifdef CYGOPT_HAL_ARM_WITH_USER_MODE
623
        // did exception occur in user mode ?
624
        and     r2, r1, #CPSR_MODE_BITS
625
        cmp     r2, #CPSR_USER_MODE
626
        bne     1f
627
        stmfd   sp, {r8-r12, sp, lr}^   // get user mode regs
628
        nop
629
        sub     sp, sp, #4*7
630
        bal     2f
631
1:
632
#endif
633
        // switch to pre-exception mode to get banked regs
634
        mov     r0,sp                   // r0 survives mode switch
635
        mrs     r2,cpsr                 // Save current psr for return
636
        orr     r1,r1,#CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE
637
        bic     r1,r1,#CPSR_THUMB_ENABLE
638
        msr     cpsr,r1
639
        stmfd   r0!,{r8-r12,sp,lr}
640
        msr     cpsr,r2                 // back to svc mode
641
        mov     sp,r0                   // update stack pointer
642
2:
643
        // now save pre-exception r0-r7 on current stack
644
        ldmfd   r3,{r0-r5}
645
        stmfd   sp!,{r0-r7}
646
 
647
        // SP needs fixing if exception occured in SVC mode.
648
        // The original SVC LR is still in place so that
649
        // does not need to be fixed here.
650
        ldr     r1,[sp,#armreg_cpsr]
651
        and     r1,r1,#CPSR_MODE_BITS
652
        cmp     r1,#CPSR_SUPERVISOR_MODE
653
        ldreq   r1,[sp,#armreg_svcsp]
654
        streq   r1,[sp,#armreg_sp]
655
 
656
#ifdef  CYGHWR_HAL_ARM_DUMP_EXCEPTIONS
657
        mov     r0,sp
658
        ldr     r1,.__dump_procs
659
        ldr     r2,[sp,#armreg_vector]
660
        ldr     r1,[r1,r2,lsl #2]
661
        THUMB_MODE(r9,10)
662
        mov     lr,pc
663
        mov     pc,r1
664
#else
665
        THUMB_MODE(r9,10)
666
#endif
667
 
668
        // call exception handler
669
        mov     r0,sp
670
        bl      exception_handler
671
 
672
#ifdef  CYGHWR_HAL_ARM_DUMP_EXCEPTIONS
673
        mov     r0,sp
674
        bl      cyg_hal_report_exception_handler_returned
675
#endif
676
 
677
        ARM_MODE(r1,10)
678
 
679
        //
680
        // Return from exception
681
        //
682
return_from_exception:
683
 
684
        ldr     r0,[sp,#armreg_cpsr]
685
 
686
        // return to supervisor mode is simple
687
        and     r1,r0,#CPSR_MODE_BITS
688
        cmp     r1,#CPSR_SUPERVISOR_MODE
689
 
690
#ifndef CYGOPT_HAL_ARM_PRESERVE_SVC_SPSR
691
        msr     spsr,r0
692
        ldmeqfd sp,{r0-r14,pc}^
693
#else
694
        // we must take care of not corrupting the current (svc)
695
        // spsr which happens to be also the pre-exception spsr
696
        bne     1f
697
        tst     r0, #CPSR_THUMB_ENABLE
698
 
699
        // when returning to thumb/svc mode, there is no easy way to preserve
700
        // spsr. It is possible to do so, but would add a lot of instructions.
701
        // The purpose of CYGOPT_HAL_ARM_PRESERVE_SVC_SPSR is to allow stepping
702
        // through SWI exception handling code, so not preserving spsr in this
703
        // case should be okay.
704
        msrne   spsr,r0
705
        ldmnefd sp,{r0-r14,pc}^
706
 
707
        // we are returning to arm/svc mode thus we must restore the
708
        // pre-exception cpsr before returning to interrupted code
709
        msr     cpsr, r0
710
        ldmfd   sp, {r0-r14, pc}
711
1:
712
        // we are not returning to svc mode thus we can safely restore
713
        // svc spsr
714
        msr     spsr, r0
715
#endif
716
 
717
#ifdef CYGOPT_HAL_ARM_WITH_USER_MODE
718
        // are we returning to user mode ?
719
        and     r2, r1, #CPSR_MODE_BITS
720
        cmp     r2, #CPSR_USER_MODE
721
        add     r2, sp, #armreg_r8
722
        bne     1f
723
        ldmfd   r2, {r8-r14}^           // restore user mode regs
724
        nop
725
        bal     2f
726
1:
727
#else
728
        add     r2, sp, #armreg_r8
729
#endif
730
        //
731
        // return to other non-user modes is a little trickier
732
        //
733
 
734
        // switch to pre-exception mode and restore r8-r14
735
        mrs     r1,cpsr
736
        orr     r0,r0,#CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE
737
        bic     r0,r0,#CPSR_THUMB_ENABLE
738
        msr     cpsr,r0
739
        ldmfd   r2,{r8-r14}
740
        msr     cpsr, r1        // back to svc mode
741
 
742
2:
743
        // move sp,lr and pc for final load
744
        ldr     r0,[sp,#armreg_svcsp]
745
        str     r0,[sp,#armreg_r8]
746
        ldr     r0,[sp,#armreg_svclr]
747
        str     r0,[sp,#armreg_r9]
748
        ldr     r0,[sp,#armreg_pc]
749
        str     r0,[sp,#armreg_r10]
750
 
751
        // restore r0-r7,sp,lr and return from exception
752
        ldmfd   sp,{r0-r7,sp,lr,pc}^
753
 
754
#ifdef  CYGHWR_HAL_ARM_DUMP_EXCEPTIONS
755
__dump_procs:
756
        .word  0    // placeholder for reset
757
        .word  cyg_hal_report_undefined_instruction
758
        .word  cyg_hal_report_software_interrupt
759
        .word  cyg_hal_report_abort_prefetch
760
        .word  cyg_hal_report_abort_data
761
        .word  0    // reserved
762
#endif
763
 
764
 
765
// Handle device interrupts
766
// This is slightly more complicated than the other exception handlers because
767
// it needs to interface with the kernel (if present).
768
// Assumption: can get here from any mode, including user mode
769
// (spurious interrupt while standalone app. is running in user mode)
770
 
771
        .code   32
772
FIQ:
773
        // We can get here from any non-user mode.
774
        mrs     r8,spsr                 // CPSR at time of interrupt
775
        and     r9,r8,#CPSR_MODE_BITS   // isolate pre-interrupt mode
776
        cmp     r9,#CPSR_IRQ_MODE
777
        bne     1f
778
        // If FIQ interrupted IRQ mode, just return with FIQ disabled.
779
        // The common interrupt handling takes care of the rest.
780
        orr     r8,r8,#CPSR_FIQ_DISABLE
781
        msr     spsr,r8
782
        subs    pc,lr,#4
783
    1:
784
        // If FIQ interrupted other non-user mode, switch to IRQ mode and
785
        // fall through to IRQ handler.
786
        ldr     sp,.__exception_stack   // get good stack to save lr and spsr
787
        stmdb   sp,{r8,lr}
788
        mov     r8,#CPSR_IRQ_MODE|CPSR_FIQ_DISABLE|CPSR_IRQ_DISABLE
789
        msr     cpsr,r8                 // switch to IRQ mode
790
        ldr     sp,.__exception_stack   // get regs saved in FIQ mode
791
        ldmdb   sp,{sp,lr}
792
        msr     spsr,sp
793
 
794
        // now it looks like we got an IRQ instead of an FIQ except that
795
        // FIQ is disabled so we don't recurse.
796
IRQ:
797
        // Note: I use this exception stack while saving the context because
798
        // the current SP does not seem to be always valid in this CPU mode.
799
        ldr     sp,.__exception_stack   // get good stack
800
        stmfd   sp!,{r0-r5}             // save some supervisor regs
801
        sub     r0,lr,#4                // PC at time of interrupt
802
        mrs     r1,spsr
803
        mov     r2,#CYGNUM_HAL_VECTOR_IRQ
804
        mov     r3,sp
805
 
806
        mrs     r4,cpsr                 // switch to Supervisor Mode
807
        bic     r4,r4,#CPSR_MODE_BITS
808
        // When handling an IRQ we must disable FIQ unless the current
809
        // mode in CPSR is IRQ. If we were to get a FIQ while in another
810
        // mode, the FIQ handling code would transform the FIQ into an
811
        // IRQ and call the non-reentrant IRQ handler again. As a result,
812
        // for example, the stack pointer would be set to the beginning
813
        // of the exception_stack clobbering the registers we have just
814
        // saved.
815
        orr     r4,r4,#CPSR_SUPERVISOR_MODE|CPSR_FIQ_DISABLE
816
        msr     cpsr,r4
817
 
818
        mov     r5,sp                   // save original svc sp
819
        mov     r4,lr                   // save original svc lr
820
        stmfd   sp!,{r0-r2,r4,r5}       // push svc_sp, svc_lr, vector, psr, pc
821
 
822
#ifdef CYGOPT_HAL_ARM_WITH_USER_MODE
823
        // did exception occur in user mode ?
824
        and     r2, r1, #CPSR_MODE_BITS
825
        cmp     r2, #CPSR_USER_MODE
826
        bne     1f
827
        stmfd   sp, {r8-r12, sp, lr}^   // get user mode regs
828
        nop
829
        sub     sp, sp, #4*7
830
        bal     2f
831
1:
832
#endif
833
        // switch to pre-exception mode to get banked regs
834
        mov     r0,sp                   // r0 survives mode switch
835
        mrs     r2,cpsr                 // Save current psr for return
836
        orr     r1,r1,#CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE
837
        bic     r1,r1,#CPSR_THUMB_ENABLE
838
        msr     cpsr,r1
839
        stmfd   r0!,{r8-r12,sp,lr}
840
        msr     cpsr,r2                 // back to svc mode
841
        mov     sp,r0                   // update stack pointer
842
 
843
2:
844
        // now save pre-exception r0-r7 on current stack
845
        ldmfd   r3,{r0-r5}
846
        stmfd   sp!,{r0-r7}
847
 
848
        // sp needs fixing if exception occured in SVC mode.
849
        ldr     r1,[sp,#armreg_cpsr]
850
        and     r1,r1,#CPSR_MODE_BITS
851
        cmp     r1,#CPSR_SUPERVISOR_MODE
852
        ldreq   r1,[sp,#armreg_svcsp]
853
        streq   r1,[sp,#armreg_sp]
854
 
855
        mov     v6,sp                   // Save pointer to register frame
856
 
857
//      mov     r0,sp
858
//      bl      _show_frame_in
859
 
860
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
861
        // Switch to interrupt stack
862
        ldr     r2,.irq_level           // current number of nested interrupts
863
        ldr     r0,[r2]
864
        add     r1,r0,#1
865
        str     r1,[r2]                 // if was zero, switch stacks
866
        cmp     r0,#0
867
        moveq   r1,sp                   // save old stack pointer
868
        ldreq   sp,.__interrupt_stack
869
        stmeqfd sp!,{r1}
870
10:
871
#endif
872
 
873
        // The entire CPU state is now stashed on the stack,
874
        // increment the scheduler lock and handle the interrupt
875
 
876
#ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT
877
        .extern cyg_scheduler_sched_lock
878
        ldr     r3,.cyg_scheduler_sched_lock
879
        ldr     r4,[r3]
880
        add     r4,r4,#1
881
        str     r4,[r3]
882
#endif
883
 
884
        THUMB_MODE(r3,10)
885
 
886
        mov     r0,v6
887
        bl      hal_IRQ_handler         // determine interrupt source
888
        mov     v1,r0                   // returned vector #
889
 
890
#if defined(CYGPKG_KERNEL_INSTRUMENT) && \
891
    defined(CYGDBG_KERNEL_INSTRUMENT_INTR)
892
        ldr     r0,=RAISE_INTR          // arg0 = type = INTR,RAISE
893
        mov     r1,v1                   // arg1 = vector
894
        mov     r2,#0                   // arg2 = 0
895
        bl      cyg_instrument          // call instrument function
896
#endif
897
 
898
        ARM_MODE(r0,10)
899
 
900
        mov     r0,v1                   // vector #
901
 
902
#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) \
903
    || defined(CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT)
904
        // If we are supporting Ctrl-C interrupts from GDB, we must squirrel
905
        // away a pointer to the save interrupt state here so that we can
906
        // plant a breakpoint at some later time.
907
 
908
       .extern  hal_saved_interrupt_state
909
        ldr     r2,=hal_saved_interrupt_state
910
        str     v6,[r2]
911
#endif
912
 
913
        cmp     r0,#CYGNUM_HAL_INTERRUPT_NONE   // spurious interrupt
914
        bne     10f
915
 
916
#ifdef  CYGIMP_HAL_COMMON_INTERRUPTS_IGNORE_SPURIOUS
917
        // Acknowledge the interrupt
918
        THUMB_CALL(r1,12,hal_interrupt_acknowledge)
919
#else
920
        mov     r0,v6                   // register frame
921
        THUMB_CALL(r1,12,hal_spurious_IRQ)
922
#endif // CYGIMP_HAL_COMMON_INTERRUPTS_IGNORE_SPURIOUS
923
        b       spurious_IRQ
924
 
925
10:     ldr     r1,.hal_interrupt_data
926
        ldr     r1,[r1,v1,lsl #2]       // handler data
927
        ldr     r2,.hal_interrupt_handlers
928
        ldr     v3,[r2,v1,lsl #2]       // handler (indexed by vector #)
929
        mov     r2,v6                   // register frame (this is necessary
930
                                        // for the ISR too, for ^C detection)
931
 
932
#ifdef __thumb__
933
        ldr     lr,=10f
934
        bx      v3                      // invoke handler (thumb mode)
935
        .pool
936
        .code   16
937
        .thumb_func
938
IRQ_10T:
939
10:     ldr     r2,=15f
940
        bx      r2                      // switch back to ARM mode
941
        .pool
942
        .code   32
943
15:
944
IRQ_15A:
945
#else
946
        mov     lr,pc                   // invoke handler (call indirect
947
        mov     pc,v3                   // thru v3)
948
#endif
949
 
950
spurious_IRQ:
951
 
952
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
953
        // If we are returning from the last nested interrupt, move back
954
        // to the thread stack. interrupt_end() must be called on the
955
        // thread stack since it potentially causes a context switch.
956
        ldr     r2,.irq_level
957
        ldr     r3,[r2]
958
        subs    r1,r3,#1
959
        str     r1,[r2]
960
        ldreq   sp,[sp]         // This should be the saved stack pointer
961
#endif
962
        // The return value from the handler (in r0) will indicate whether a
963
        // DSR is to be posted. Pass this together with a pointer to the
964
        // interrupt object we have just used to the interrupt tidy up routine.
965
 
966
                              // don't run this for spurious interrupts!
967
        cmp     v1,#CYGNUM_HAL_INTERRUPT_NONE
968
        beq     17f
969
        ldr     r1,.hal_interrupt_objects
970
        ldr     r1,[r1,v1,lsl #2]
971
        mov     r2,v6           // register frame
972
 
973
        THUMB_MODE(r3,10)
974
 
975
        bl      interrupt_end   // post any bottom layer handler
976
                                // threads and call scheduler
977
        ARM_MODE(r1,10)
978
17:
979
 
980
//      mov     r0,sp
981
//      bl      show_frame_out
982
 
983
        // return from IRQ is same as return from exception
984
        b       return_from_exception
985
 
986
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
987
// Execute pending DSRs the interrupt stack
988
// Note: this can only be called from code running on a thread stack
989
FUNC_START_ARM(hal_interrupt_stack_call_pending_DSRs, r1)
990
        stmfd   sp!,{r4,r5,lr}
991
        // Disable interrupts
992
        mrs     r4,cpsr                 // disable IRQ's
993
        orr     r2,r4,#CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE
994
        bic     r5,r4,#CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE
995
        msr     cpsr,r2
996
        // Switch to interrupt stack
997
        mov     r3,sp                   // save old stack pointer
998
        ldr     sp,.__interrupt_stack
999
        stmfd   sp!,{r3}                // stored at top of interrupt stack
1000
        ldr     r2,.irq_level           // current number of nested interrupts
1001
        ldr     r3,[r2]
1002
        add     r3,r3,#1                // bump nesting level
1003
        str     r3,[r2]
1004
        msr     cpsr,r5                 // enable interrupts
1005
 
1006
        THUMB_MODE(r1,20)
1007
 
1008
        bl      cyg_interrupt_call_pending_DSRs
1009
 
1010
 
1011
        ARM_MODE(r1,22)
1012
 
1013
        // Disable interrupts
1014
        mrs     r1,cpsr                 // disable IRQ's
1015
        orr     r2,r1,#CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE
1016
        msr     cpsr,r2
1017
 
1018
        // Move back to the thread stack.
1019
        ldr     r2,.irq_level
1020
        ldr     r3,[r2]
1021
        sub     r3,r3,#1                // decrement nesting level
1022
        str     r3,[r2]
1023
        ldr     sp,[sp]                 // This should be the saved stack pointer
1024
        msr     cpsr,r4                 // restore interrupts to original state
1025
 
1026
#ifdef __thumb__
1027
        ldmfd   sp!,{r4,r5,lr}          // return
1028
        bx      lr
1029
#else
1030
        ldmfd   sp!,{r4,r5,pc}          // return
1031
#endif // __thumb__
1032
#endif // CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
1033
 
1034
// Thumb-only support functions
1035
#ifdef __thumb__
1036
 
1037
FUNC_START_ARM(hal_disable_interrupts, r1)
1038
        mrs     r0,cpsr                 // current state
1039
        orr     r1,r0,#0xC0             // mask both FIQ and IRQ
1040
        msr     cpsr,r1
1041
        bx      lr                      // exit, _old_ in r0
1042
 
1043
FUNC_START_ARM(hal_enable_interrupts, r1)
1044
        mrs     r0,cpsr                 // current state
1045
        bic     r1,r0,#0xC0             // mask both FIQ and IRQ
1046
        msr     cpsr,r1
1047
        bx      lr                      // exit
1048
 
1049
FUNC_START_ARM(hal_restore_interrupts, r1)
1050
        mrs     r1,cpsr                 // current state
1051
        bic     r1,r1,#0xC0             // mask out FIQ/IRQ bits
1052
        and     r0,r0,#0xC0             // keep only FIQ/IRQ
1053
        orr     r1,r1,r0                // mask both FIQ and IRQ
1054
        msr     cpsr,r1
1055
        bx      lr                      // exit
1056
 
1057
FUNC_START_ARM(hal_query_interrupts, r1)
1058
        mrs     r0,cpsr                 // current state
1059
        bx      lr                      // exit, state in r0
1060
 
1061
#endif // __thumb__
1062
 
1063
// Dummy/support functions
1064
 
1065
        .global __gccmain
1066
        .global _psr
1067
        .global _sp
1068
 
1069
#ifdef __thumb__
1070
        .code   16
1071
        .thumb_func
1072
__gccmain:
1073
        bx      lr
1074
 
1075
        .code   16
1076
        .thumb_func
1077
_psr:
1078
        ARM_MODE(r1,10)
1079
        mrs     r0,cpsr
1080
        bx      lr
1081
 
1082
        .code   16
1083
        .thumb_func
1084
_sp:
1085
        mov     r0,sp
1086
        bx      lr
1087
#else
1088
__gccmain:
1089
        mov     pc,lr
1090
 
1091
_psr:
1092
        mrs     r0,cpsr
1093
        mov     pc,lr
1094
 
1095
_sp:
1096
        mov     r0,sp
1097
        mov     pc,lr
1098
#endif
1099
 
1100
 
1101
//
1102
// Pointers to various objects.
1103
//
1104
#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
1105
PTR(__GDB_stack_base)
1106
PTR(__GDB_stack)
1107
#endif
1108
PTR(__startup_stack)
1109
PTR(__exception_stack)
1110
PTR(__undef_exception_stack)
1111
PTR(__bss_start)
1112
PTR(__bss_end)
1113
PTR(_end)
1114
PTR(__rom_data_start)
1115
PTR(__ram_data_start)
1116
PTR(__ram_data_end)
1117
PTR(hal_interrupt_handlers)
1118
PTR(hal_interrupt_data)
1119
PTR(hal_interrupt_objects)
1120
PTR(__exception_handlers)
1121
PTR(init_flag)
1122
#ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT
1123
PTR(cyg_scheduler_sched_lock)
1124
#endif
1125
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
1126
PTR(irq_level)
1127
PTR(__interrupt_stack)
1128
#endif
1129
#ifdef  CYGHWR_HAL_ARM_DUMP_EXCEPTIONS
1130
PTR(__dump_procs)
1131
#endif
1132
 
1133
//
1134
// Identification - useful to find out when a system was configured
1135
_eCos_id:
1136
        .asciz  "eCos : " __DATE__
1137
 
1138
 
1139
// -------------------------------------------------------------------------
1140
// Interrupt vector tables.
1141
// These tables contain the isr, data and object pointers used to deliver
1142
// interrupts to user code.
1143
 
1144
// Despite appearances, their sizes are not #defines, but .equ symbols
1145
// generated by magic without proper dependencies in arm.inc
1146
// Recompiling will not DTRT without manual intervention.
1147
 
1148
        .data
1149
 
1150
init_flag:
1151
        .balign 4
1152
        .long   0
1153
 
1154
        .extern hal_default_isr
1155
 
1156
        .globl  hal_interrupt_handlers
1157
hal_interrupt_handlers:
1158
        .rept   CYGNUM_HAL_ISR_COUNT
1159
        .long   hal_default_isr
1160
        .endr
1161
 
1162
        .globl  hal_interrupt_data
1163
hal_interrupt_data:
1164
        .rept   CYGNUM_HAL_ISR_COUNT
1165
        .long   0
1166
        .endr
1167
 
1168
        .globl  hal_interrupt_objects
1169
hal_interrupt_objects:
1170
        .rept   CYGNUM_HAL_ISR_COUNT
1171
        .long   0
1172
        .endr
1173
 
1174
// -------------------------------------------------------------------------
1175
// Temporary interrupt stack
1176
 
1177
        .section ".bss"
1178
 
1179
// Small stacks, only used for saving information between CPU modes
1180
__exception_stack_base:
1181
        .rept   32
1182
        .long   0
1183
        .endr
1184
__exception_stack:
1185
        .rept   32
1186
        .long   0
1187
        .endr
1188
__undef_exception_stack:
1189
 
1190
// Runtime stack used during all interrupt processing
1191
#ifndef CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE
1192
#define CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE 4096
1193
#endif
1194
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
1195
        .balign 16
1196
        .global cyg_interrupt_stack_base
1197
cyg_interrupt_stack_base:
1198
__interrupt_stack_base:
1199
        .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE
1200
        .byte 0
1201
        .endr
1202
        .balign 16
1203
        .global cyg_interrupt_stack
1204
cyg_interrupt_stack:
1205
__interrupt_stack:
1206
irq_level:
1207
        .long   0
1208
#endif
1209
 
1210
#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
1211
        .balign 16
1212
__GDB_stack_base:
1213
        .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE // rather than 1k
1214
        .byte 0
1215
        .endr
1216
__GDB_stack:
1217
#endif
1218
        .balign 16
1219
__startup_stack_base:
1220
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
1221
        .rept 512
1222
#else
1223
        .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE
1224
#endif
1225
        .byte 0
1226
        .endr
1227
        .balign 16
1228
__startup_stack:
1229
 
1230
#ifdef PLATFORM_EXTRAS
1231
#include PLATFORM_EXTRAS
1232
#endif
1233
 
1234
// --------------------------------------------------------------------------
1235
//  end of vectors.S

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.