1 /* libgcc routines for RL78
3 Free Software Foundation, Inc.
4 Contributed by Red Hat.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published
10 by the Free Software Foundation; either version 3, or (at your
11 option) any later version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 License for more details.
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. */
27 /* RL78 Trampoline support
29 Since the RL78's RAM is not in the first 64k, we cannot "just" use a
30 function pointer to point to a trampoline on the stack. So, we
31 create N fixed trampolines that read from an array, and allocate
48 .type trampoline_\n, @function
49 movw ax, !trampoline_chain_\n
51 movw ax, !trampoline_addr_\n
53 .size trampoline_\n, .-trampoline_\n
82 /* Given the function pointer in R8 and the static chain
83 pointer in R10, allocate a trampoline and return its address in
87 .global ___trampoline_init
88 .type ___trampoline_init, @function
91 movw hl, #trampoline_array
93 movw ax, [hl + TO_ADDR]
100 cmpw ax, #trampoline_array_end
105 movw [hl + TO_ADDR], ax
107 movw [hl + TO_CHAIN], ax
109 movw [hl + TO_FRAME], ax
111 movw ax, [hl + TO_STUB]
115 .size ___trampoline_init, . - ___trampoline_init
117 .global ___trampoline_uninit
118 .type ___trampoline_uninit, @function
119 ___trampoline_uninit:
120 movw hl, #trampoline_array
124 movw ax, [hl + TO_FRAME]
129 movw [hl + TO_ADDR], ax
135 cmpw ax, #trampoline_array_end
139 .size ___trampoline_uninit, . - ___trampoline_uninit