All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] H8/300 update (3/9) pic support
Date: Wed, 12 May 2004 01:36:43 +0900	[thread overview]
Message-ID: <m2y8nyrkdg.wl%ysato@users.sourceforge.jp> (raw)

- add PIC binary support

-- 
Yoshinori Sato
<ysato@users.sourceforge.jp>

diff -Nru linux-2.6.6/arch/h8300/kernel/signal.c linux-2.6.6-h8300/arch/h8300/kernel/signal.c
--- linux-2.6.6/arch/h8300/kernel/signal.c	2004-05-11 14:30:09.000000000 +0900
+++ linux-2.6.6-h8300/arch/h8300/kernel/signal.c	2004-05-11 23:04:06.000000000 +0900
@@ -192,6 +192,7 @@
 	regs->er1 = context.sc_er1;
 	regs->er2 = context.sc_er2;
 	regs->er3 = context.sc_er3;
+	regs->er5 = context.sc_er5;
 	regs->ccr = (regs->ccr & 0x10)|(context.sc_ccr & 0xef);
 	regs->pc = context.sc_pc;
 	regs->orig_er0 = -1;		/* disable syscall checks */
@@ -308,6 +309,7 @@
 	sc->sc_er1 = regs->er1;
 	sc->sc_er2 = regs->er2;
 	sc->sc_er3 = regs->er3;
+	sc->sc_er5 = regs->er5;
 	sc->sc_ccr = regs->ccr;
 	sc->sc_pc = regs->pc;
 }
@@ -384,6 +386,7 @@
 			   ? current_thread_info()->exec_domain->signal_invmap[sig]
 		          : sig);
 	regs->er1 = (unsigned long)&(frame->sc);
+	regs->er5 = current->mm->start_data;	/* GOT base */
 
 	return;
 
@@ -435,7 +438,8 @@
 		     : sig);
 	regs->er1 = (unsigned long)&(frame->info);
 	regs->er2 = (unsigned long)&frame->uc;
+	regs->er5 = current->mm->start_data;	/* GOT base */
 
 	return;
 
diff -Nru linux-2.6.6/fs/bifmt_flat.c linux-2.6.6-h8300/fs/binfmt_flat.c
--- linux-2.6.6/fs/binfmt_flat.c	2004-05-11 14:30:12.000000000 +0900
+++ linux-2.6.6-h8300/fs/binfmt_flat.c	2004-05-12 01:19:34.000000000 +0900
@@ -723,7 +723,7 @@
 				return -ENOEXEC;
 
 			/* Get the pointer's value.  */
-			addr = flat_get_addr_from_rp(rp, relval);
+			addr = flat_get_addr_from_rp(rp, relval, flags);
 			if (addr != 0) {
 				/*
 				 * Do the relocation.  PIC relocs in the data section are
diff -Nru linux-2.6.6/include/asm-h8300/flat.h linux-2.6.6-h8300/include/asm-h8300/flat.h
--- linux-2.6.6/include/asm-h8300/flat.h	2004-01-09 15:59:02.000000000 +0900
+++ linux-2.6.6-h8300/include/asm-h8300/flat.h	2004-05-11 23:03:42.000000000 +0900
@@ -18,7 +18,8 @@
  */
 
 #define	flat_get_relocate_addr(rel)		(rel)
-#define flat_get_addr_from_rp(rp, relval)       (get_unaligned(rp) & 0x0ffffff)
+#define flat_get_addr_from_rp(rp, relval, flags) \
+        (get_unaligned(rp) & ((flags & FLAT_FLAG_GOTPIC) ? 0xffffffff: 0x00ffffff))
 #define flat_put_addr_at_rp(rp, addr, rel) \
 	put_unaligned (((*(char *)(rp)) << 24) | ((addr) & 0x00ffffff), rp)
 
diff -Nru linux-2.6.6/include/asm-h8300/processor.h linux-2.6.6-h8300/include/asm-h8300/processor.h
--- linux-2.6.6/include/asm-h8300/processor.h	2004-05-11 14:30:47.000000000 +0900
+++ linux-2.6.6-h8300/include/asm-h8300/processor.h	2004-05-11 23:03:42.000000000 +0900
@@ -23,12 +23,12 @@
 #include <asm/ptrace.h>
 #include <asm/current.h>
 
-extern inline unsigned long rdusp(void) {
+static inline unsigned long rdusp(void) {
 	extern unsigned int	sw_usp;
 	return(sw_usp);
 }
 
-extern inline void wrusp(unsigned long usp) {
+static inline void wrusp(unsigned long usp) {
 	extern unsigned int	sw_usp;
 	sw_usp = usp;
 }
@@ -61,9 +61,15 @@
 	} breakinfo;
 };
 
-#define INIT_THREAD  { \
-	sizeof(init_stack) + (unsigned long) init_stack, 0, \
-	PS_S,  0, {(unsigned short *)-1, 0}, \
+#define INIT_THREAD  {						\
+	.ksp  = sizeof(init_stack) + (unsigned long)init_stack, \
+	.usp  = 0,						\
+	.ccr  = PS_S,						\
+	.esp0 = 0,						\
+	.breakinfo = {						\
+		.addr = (unsigned short *)-1,			\
+		.inst = 0					\
+	}							\
 }
 
 /*
@@ -78,6 +84,7 @@
 	set_fs(USER_DS);           /* reads from user space */  \
   	(_regs)->pc = (_pc);				        \
 	(_regs)->ccr &= 0x00;	   /* clear kernel flag */      \
+	(_regs)->er5 = current->mm->start_data;	/* GOT base */  \
 	wrusp((unsigned long)(_usp) - sizeof(unsigned long)*3);	\
 } while(0)
 #endif
@@ -88,6 +95,7 @@
 	(_regs)->pc = (_pc);				        \
 	(_regs)->ccr = 0x00;	   /* clear kernel flag */      \
 	(_regs)->exr = 0x78;       /* enable all interrupts */  \
+	(_regs)->er5 = current->mm->start_data;	/* GOT base */  \
 	/* 14 = space for retaddr(4), vector(4), er0(4) and ext(2) on stack */ \
 	wrusp(((unsigned long)(_usp)) - 14);                    \
 } while(0)
diff -Nru linux-2.6.6/include/asm-m68knommu/flat.h linux-2.6.6-h8300/include/asm-m68knommu/flat.h
--- linux-2.6.6/include/asm-m68knommu/flat.h	2004-01-09 16:00:02.000000000 +0900
+++ linux-2.6.6-h8300/include/asm-m68knommu/flat.h	2004-05-11 23:03:42.000000000 +0900
@@ -9,7 +9,7 @@
 #define	flat_argvp_envp_on_stack()		1
 #define	flat_old_ram_flag(flags)		(flags)
 #define	flat_reloc_valid(reloc, size)		((reloc) <= (size))
-#define	flat_get_addr_from_rp(rp, relval)	get_unaligned(rp)
+#define	flat_get_addr_from_rp(rp, relval, flags)	get_unaligned(rp)
 #define	flat_put_addr_at_rp(rp, val, relval)	put_unaligned(val,rp)
 #define	flat_get_relocate_addr(rel)		(rel)
 
diff -Nru linux-2.6.6/include/asm-sh/flat.h linux-2.6.6-h8300/include/asm-sh/flat.h
--- linux-2.6.6/include/asm-sh/flat.h	2004-05-11 14:29:41.000000000 +0900
+++ linux-2.6.6-h8300/include/asm-sh/flat.h	2004-05-11 23:03:42.000000000 +0900
@@ -16,7 +16,7 @@
 #define	flat_argvp_envp_on_stack()		1
 #define	flat_old_ram_flag(flags)		(flags)
 #define	flat_reloc_valid(reloc, size)		((reloc) <= (size))
-#define	flat_get_addr_from_rp(rp, relval)	get_unaligned(rp)
+#define	flat_get_addr_from_rp(rp, relval, flags)	get_unaligned(rp)
 #define	flat_put_addr_at_rp(rp, val, relval)	put_unaligned(val,rp)
 #define	flat_get_relocate_addr(rel)		(rel)
 
diff -Nru linux-2.6.6/include/asm-v850/flat.h linux-2.6.6-h8300/include/asm-v850/flat.h
--- linux-2.6.6/include/asm-v850/flat.h	2004-01-09 15:59:19.000000000 +0900
+++ linux-2.6.6-h8300/include/asm-v850/flat.h	2004-05-11 23:03:42.000000000 +0900
@@ -45,7 +45,8 @@
    RELVAL is the raw relocation-table entry from which RP is derived.
    For the v850, RP should always be half-word aligned.  */
 static inline unsigned long flat_get_addr_from_rp (unsigned long *rp,
-						   unsigned long relval)
+						   unsigned long relval,
+						   unsigned long flags)
 {
 	short *srp = (short *)rp;
 

             reply	other threads:[~2004-05-11 16:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-11 16:36 Yoshinori Sato [this message]
2004-05-14 12:38 ` [PATCH] H8/300 update (3/9) pic support Yoshinori Sato

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=m2y8nyrkdg.wl%ysato@users.sourceforge.jp \
    --to=ysato@users.sourceforge.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.