Add PLAT_FLAT_INIT
Subsystems (3)
PATCH 1/1 Add PLAT_FLAT_INIT
This patch adds FLAT_PLAT_INIT macro which initialize registers of new process, same as ELF_PLAT_INIT does.
It is needed because startup routine (crt1) expects r4 has meaningful
value(even 0), though I can't find any ABI/specs around here.
Anyway I believe registers has fixed value when a process starts.
# BTW. Where fs/binfmt_flat.c patch should be sent to ?
--- arch/sh/include/asm/flat.h | 7 +++++++ fs/binfmt_flat.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletions(-)
arch/sh/include/asm/flat.h +7 -0
@@ -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 */
fs/binfmt_flat.c +3 -1
@@ -914,7 +914,9 @@ static int load_flat_binary(struct linux_binprm * bprm, struct pt_regs * regs)/* Stash our initial stack pointer into the mm structure */ current->mm->start_stack = (unsigned long )sp; - +#ifdef FLAT_PLAT_INIT +FLAT_PLAT_INIT (regs); +#endif DBG_FLT ("start_thread(regs=0x%x, entry=0x%x, start_stack=0x%x)\n" , (int )regs, (int )start_addr, (int )current->mm->start_stack);
Signature · 1 line
1.5.4.5
[ adding a few CCs.. ]
Quoted 54 lines · Takashi Yoshii
This patch adds
FLAT_PLAT_INITmacro which initialize registers of new process, same asELF_PLAT_INITdoes.It is needed because startup routine (crt1) expects r4 has meaningful value(even 0), though I can't find any ABI/specs around here. Anyway I believe registers has fixed value when a process starts.
# BTW. Where
fs/binfmt_flat.cpatch should be sent to ?Signed-off-by Takashi YOSHII <[email protected]>---
arch/sh/include/asm/flat.h | 7 +++++++ fs/binfmt_flat.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletions(-)arch/sh/include/asm/flat.h +7
-0@@ -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 */ fs/binfmt_flat.c +3
-1@@ -914,7 +914,9 @@ static int load_flat_binary(struct linux_binprm * bprm, struct pt_regs * regs)/* Stash our initial stack pointer into the mm structure */ current->mm->start_stack = (unsigned long )sp; - +#ifdef FLAT_PLAT_INIT +FLAT_PLAT_INIT (regs); +#endif DBG_FLT ("start_thread(regs=0x%x, entry=0x%x, start_stack=0x%x)\n" , (int )regs, (int )start_addr, (int )current->mm->start_stack);Signature · 7 lines
-- 1.5.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html