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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [libgloss/] [arm/] [trap.S] - Blame information for rev 857

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
        /* Run-time exception support */
2
#if !defined(__thumb2__)
3
#include "swi.h"
4
 
5
/* .text is used instead of .section .text so it works with arm-aout too.  */
6
        .text
7
        .align 0
8
        .global __rt_stkovf_split_big
9
        .global __rt_stkovf_split_small
10
 
11
/* The following functions are provided for software stack checking.
12
   If hardware stack-checking is being used then the code can be
13
   compiled without the PCS entry checks, and simply rely on VM
14
   management to extend the stack for a thread.
15
 
16
   The stack extension event occurs when the PCS function entry code
17
   would result in a stack-pointer beneath the stack-limit register
18
   value.  The system relies on the following map:
19
 
20
        +-----------------------------------+ <-- end of stack block
21
        | ...                               |
22
        | ...                               |
23
        | active stack                      |
24
        | ...                               | <-- sp (stack-pointer) somewhere in here
25
        | ...                               |
26
        +-----------------------------------+ <-- sl (stack-limit)
27
        | stack-extension handler workspace |
28
        +-----------------------------------+ <-- base of stack block
29
 
30
   The "stack-extension handler workspace" is an amount of memory in
31
   which the stack overflow support code must execute.  It must be
32
   large enough to deal with the worst case path through the extension
33
   code.  At the moment the compiler expects this to be AT LEAST
34
   256bytes.  It uses this fact to code functions with small local
35
   data usage within the overflow space.
36
 
37
   In a true target environment We may need to increase the space
38
   between sl and the true limit to allow for the stack extension
39
   code, SWI handlers and for undefined instruction handlers of the
40
   target environment.  */
41
 
42
__rt_stkovf_split_small:
43
        mov     ip,sp   @ Ensure we can calculate the stack required
44
        @ and fall through to...
45
__rt_stkovf_split_big:
46
        @ in:   sp = current stack-pointer (beneath stack-limit)
47
        @       sl = current stack-limit
48
        @       ip = low stack point we require for the current function
49
        @       lr = return address into the current function
50
        @       fp = frame-pointer
51
        @               original sp --> +----------------------------------+
52
        @                               | pc (12 ahead of PCS entry store) |
53
        @               current fp ---> +----------------------------------+
54
        @                               | lr (on entry) pc (on exit)       |
55
        @                               +----------------------------------+
56
        @                               | sp ("original sp" on entry)      |
57
        @                               +----------------------------------+
58
        @                               | fp (on entry to function)        |
59
        @                               +----------------------------------+
60
        @                               |                                  |
61
        @                               | ..argument and work registers..  |
62
        @                               |                                  |
63
        @               current sp ---> +----------------------------------+
64
        @
65
        @ The "current sl" is somewhere between "original sp" and "current sp"
66
        @ but above "true sl". The "current sl" should be at least 256bytes
67
        @ above the "true sl". The 256byte stack guard should be large enough
68
        @ to deal with the worst case function entry stacking (160bytes) plus
69
        @ the stack overflow handler stacking requirements, plus the stack
70
        @ required for the memory allocation routines.
71
        @
72
        @ Normal PCS entry (before stack overflow check) can stack 16
73
        @ standard registers (64bytes) and 8 floating point registers
74
        @ (96bytes). This gives a minimum stack guard of 160bytes (excluding
75
        @ the stack required for the code). (Actually only a maximum of
76
        @ 14standard registers are ever stacked on entry to a function).
77
        @
78
        @ NOTE: Structure returns are performed by the caller allocating a
79
        @       dummy space on the stack and passing in a "phantom" arg1 into
80
        @       the function. This means that we do not need to worry about
81
        @       preserving the stack under "sp" even on function return.
82
        @
83
        @        Code should never poke values beneath sp. The sp register
84
        @        should always be "dropped" first to cover the data. This
85
        @        protects the data against any events that may try and use
86
        @        the stack.
87
 
88
        SUB     ip, sp, ip      @ extra stack required for function
89
        @ Add stack extension code here.  If desired a new stack chunk
90
        @ can be allocated, and the register state updated suitably.
91
 
92
        @ We now know how much extra stack the function requires.
93
        @ Terminate the program for the moment:
94
        swi     SWI_Exit
95
#endif

powered by: WebSVN 2.1.0

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