summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi YOSHII <yoshii.takashi@renesas.com>2008-08-11 20:12:52 +0900
committerPaul Mundt <lethal@linux-sh.org>2008-08-11 20:17:55 +0900
commit9b9d6b2a4f6df5544a10de44760755fe757259e5 (patch)
treeb476a3bbd7328b649980834bdcf7232005870a74
parent74c27c43ebd020fcb65364613503f6c08dc6f535 (diff)
sh: Provide a FLAT_PLAT_INIT() definition.
SH needs this in order to make sure that r4 has a sane value at process entry time, which the libc expects has already been taken care of. Fixes random crashes in flat binaries. Signed-off-by: Takashi YOSHII <yoshii.takashi@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/include/asm/flat.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/sh/include/asm/flat.h b/arch/sh/include/asm/flat.h
index 0cc800299e0..d3b2b4f109e 100644
--- a/arch/sh/include/asm/flat.h
+++ b/arch/sh/include/asm/flat.h
@@ -21,4 +21,11 @@
#define flat_get_relocate_addr(rel) (rel)
#define flat_set_persistent(relval, p) ({ (void)p; 0; })
+#define FLAT_PLAT_INIT(_r) \
+ do { _r->regs[0]=0; _r->regs[1]=0; _r->regs[2]=0; _r->regs[3]=0; \
+ _r->regs[4]=0; _r->regs[5]=0; _r->regs[6]=0; _r->regs[7]=0; \
+ _r->regs[8]=0; _r->regs[9]=0; _r->regs[10]=0; _r->regs[11]=0; \
+ _r->regs[12]=0; _r->regs[13]=0; _r->regs[14]=0; \
+ _r->sr = SR_FD; } while (0)
+
#endif /* __ASM_SH_FLAT_H */