sh: Provide a FLAT_PLAT_INIT() definition.
authorTakashi YOSHII <yoshii.takashi@renesas.com>
Mon, 11 Aug 2008 11:12:52 +0000 (20:12 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Mon, 11 Aug 2008 11:17:55 +0000 (20:17 +0900)
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>
arch/sh/include/asm/flat.h

index 0cc800299e06176ddda13085fa5369a48e19fdf1..d3b2b4f109e36ec68a61c7244ef7d4d48e9c335f 100644 (file)
 #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 */