This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch] INITIALIZE_TRAMPOLINE on arm--netbsd
- From: Krister Walfridsson <cato at df dot lth dot se>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 7 Sep 2002 20:51:15 +0200 (MEST)
- Subject: [Patch] INITIALIZE_TRAMPOLINE on arm--netbsd
Nested functions does not work on arm--netbsd because of the instruction
cache not being flushed. This is implemented in the patch below, in
essentially the same way as is done in linux-gas.h.
Bootstrapped and regtested on arm-unknown-netbsd1.5Y (where it fixes
40 test failures.)
Ok to install?
/Krister
2002-09-07 Krister Walfridsson <cato@df.lth.se>
* config/arm/netbsd.h (INITIALIZE_TRAMPOLINE): Redefine.
(CLEAR_INSN_CACHE): Define.
Index: netbsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/netbsd.h,v
retrieving revision 1.19
diff -c -r1.19 netbsd.h
*** netbsd.h 29 May 2002 21:31:48 -0000 1.19
--- netbsd.h 7 Sep 2002 18:40:33 -0000
***************
*** 147,149 ****
--- 147,176 ----
requirements. */
#undef DEFAULT_STRUCTURE_SIZE_BOUNDARY
#define DEFAULT_STRUCTURE_SIZE_BOUNDARY 8
+
+ /* Emit code to set up a trampoline and synchronise the caches. */
+ #undef INITIALIZE_TRAMPOLINE
+ #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
+ { \
+ emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 8)), \
+ (CXT)); \
+ emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 12)), \
+ (FNADDR)); \
+ emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"), \
+ 0, VOIDmode, 2, TRAMP, Pmode, \
+ plus_constant (TRAMP, TRAMPOLINE_SIZE), Pmode); \
+ }
+
+ /* Clear the instruction cache from `BEG' to `END'. This makes a
+ call to the ARM32_SYNC_ICACHE architecture specific syscall. */
+ #define CLEAR_INSN_CACHE(BEG, END) \
+ { \
+ extern int sysarch(int number, void *args); \
+ struct { \
+ unsigned int addr; \
+ int len; \
+ } s; \
+ s.addr = (unsigned int)(BEG); \
+ s.len = (END) - (BEG); \
+ (void)sysarch(0, &s); \
+ }