From: Takashi Yoshii <yoshii.takashi@renesas.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH] Add PLAT_FLAT_INIT
Date: Wed, 06 Aug 2008 07:11:24 +0000 [thread overview]
Message-ID: <48994E9C.7030102@renesas.com> (raw)
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 ?
Signed-off-by: Takashi YOSHII <yoshii.takashi@renesas.com>
---
arch/sh/include/asm/flat.h | 7 +++++++
fs/binfmt_flat.c | 4 +++-
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/arch/sh/include/asm/flat.h b/arch/sh/include/asm/flat.h
index 0cc8002..d3b2b4f 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 */
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index c65d431..77ceae4 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -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);
--
1.5.4.5
next reply other threads:[~2008-08-06 7:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-06 7:11 Takashi Yoshii [this message]
2008-08-06 8:17 ` [PATCH] Add PLAT_FLAT_INIT Paul Mundt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48994E9C.7030102@renesas.com \
--to=yoshii.takashi@renesas.com \
--cc=linux-sh@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox