public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
* [PATCH 0/3] m68k: flat file load fix and cleanup
@ 2016-07-22  0:40 Greg Ungerer
  2016-07-22  0:40 ` [PATCH 1/3] m68k: fix bFLT executable running on MMU enabled systems Greg Ungerer
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Greg Ungerer @ 2016-07-22  0:40 UTC (permalink / raw)
  To: linux-m68k; +Cc: Greg Ungerer


The following 3 patches fix m68k loading of flat binaries on MMU-enabled
systems, and then based on that we can cleanup and combine some common
code.

Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
 b/arch/m68k/include/asm/flat.h      |    8 +++++++-
 b/arch/m68k/include/asm/processor.h |   15 +--------------
 2 files changed, 8 insertions(+), 15 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] m68k: fix bFLT executable running on MMU enabled systems
  2016-07-22  0:40 [PATCH 0/3] m68k: flat file load fix and cleanup Greg Ungerer
@ 2016-07-22  0:40 ` Greg Ungerer
  2016-07-22  0:40 ` [PATCH 2/3] m68k: fix file path comment Greg Ungerer
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Greg Ungerer @ 2016-07-22  0:40 UTC (permalink / raw)
  To: linux-m68k; +Cc: Greg Ungerer

Even after recent changes to support running flat format executables on
MMU enabled systems (by nicolas.pitre@linaro.org) they still failed to
run on m68k/ColdFire MMU enabled systems. On trying to run a flat format
binary the application would immediately crash with a SIGSEGV.

Code to setup the D5 register with the base of the application data
region was only in the non-MMU code path, so it was not being set for
the MMU enabled case. Flat binaries on m68k/ColdFire use this to support
GOT/PIC flat built application code.

Fix this so that D5 is always setup when loading/running a bFLT executable
on m68k systems.

Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
 arch/m68k/include/asm/flat.h      | 6 ++++++
 arch/m68k/include/asm/processor.h | 2 --
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/m68k/include/asm/flat.h b/arch/m68k/include/asm/flat.h
index f3f592d..a97c479 100644
--- a/arch/m68k/include/asm/flat.h
+++ b/arch/m68k/include/asm/flat.h
@@ -19,4 +19,10 @@ static inline int flat_set_persistent(unsigned long relval,
 	return 0;
 }
 
+#define FLAT_PLAT_INIT(regs) \
+	do { \
+		if (current->mm) \
+			(regs)->d5 = current->mm->start_data; \
+	} while (0)
+
 #endif /* __M68KNOMMU_FLAT_H__ */
diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h
index a6ce2ec..46672d1 100644
--- a/arch/m68k/include/asm/processor.h
+++ b/arch/m68k/include/asm/processor.h
@@ -131,8 +131,6 @@ extern int handle_kernel_fault(struct pt_regs *regs);
 do {                                                    \
 	(_regs)->pc = (_pc);                            \
 	setframeformat(_regs);                          \
-	if (current->mm)                                \
-		(_regs)->d5 = current->mm->start_data;  \
 	(_regs)->sr &= ~0x2000;                         \
 	wrusp(_usp);                                    \
 } while(0)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] m68k: fix file path comment
  2016-07-22  0:40 [PATCH 0/3] m68k: flat file load fix and cleanup Greg Ungerer
  2016-07-22  0:40 ` [PATCH 1/3] m68k: fix bFLT executable running on MMU enabled systems Greg Ungerer
@ 2016-07-22  0:40 ` Greg Ungerer
  2016-07-22  0:40 ` [PATCH 3/3] m68k: use same start_thread() on MMU and no-MMU Greg Ungerer
  2016-07-29  4:39 ` [PATCH 0/3] m68k: flat file load fix and cleanup Greg Ungerer
  3 siblings, 0 replies; 5+ messages in thread
From: Greg Ungerer @ 2016-07-22  0:40 UTC (permalink / raw)
  To: linux-m68k; +Cc: Greg Ungerer

Remove the wrong full path name of this file.

Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
 arch/m68k/include/asm/flat.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/m68k/include/asm/flat.h b/arch/m68k/include/asm/flat.h
index a97c479..00c392b0 100644
--- a/arch/m68k/include/asm/flat.h
+++ b/arch/m68k/include/asm/flat.h
@@ -1,5 +1,5 @@
 /*
- * include/asm-m68knommu/flat.h -- uClinux flat-format executables
+ * flat.h -- uClinux flat-format executables
  */
 
 #ifndef __M68KNOMMU_FLAT_H__
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] m68k: use same start_thread() on MMU and no-MMU
  2016-07-22  0:40 [PATCH 0/3] m68k: flat file load fix and cleanup Greg Ungerer
  2016-07-22  0:40 ` [PATCH 1/3] m68k: fix bFLT executable running on MMU enabled systems Greg Ungerer
  2016-07-22  0:40 ` [PATCH 2/3] m68k: fix file path comment Greg Ungerer
@ 2016-07-22  0:40 ` Greg Ungerer
  2016-07-29  4:39 ` [PATCH 0/3] m68k: flat file load fix and cleanup Greg Ungerer
  3 siblings, 0 replies; 5+ messages in thread
From: Greg Ungerer @ 2016-07-22  0:40 UTC (permalink / raw)
  To: linux-m68k; +Cc: Greg Ungerer

The MMU and no-MMU versions of start_thread() are now identical, so use
the same common code for both.

Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
 arch/m68k/include/asm/processor.h | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h
index 46672d1..c84a218 100644
--- a/arch/m68k/include/asm/processor.h
+++ b/arch/m68k/include/asm/processor.h
@@ -110,7 +110,6 @@ struct thread_struct {
 #define setframeformat(_regs)	do { } while (0)
 #endif
 
-#ifdef CONFIG_MMU
 /*
  * Do necessary setup to start up a newly executed thread.
  */
@@ -123,24 +122,14 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,
 	wrusp(usp);
 }
 
+#ifdef CONFIG_MMU
 extern int handle_kernel_fault(struct pt_regs *regs);
-
 #else
-
-#define start_thread(_regs, _pc, _usp)                  \
-do {                                                    \
-	(_regs)->pc = (_pc);                            \
-	setframeformat(_regs);                          \
-	(_regs)->sr &= ~0x2000;                         \
-	wrusp(_usp);                                    \
-} while(0)
-
 static inline  int handle_kernel_fault(struct pt_regs *regs)
 {
 	/* Any fault in kernel is fatal on non-mmu */
 	return 0;
 }
-
 #endif
 
 /* Forward declaration, a strange C thing */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] m68k: flat file load fix and cleanup
  2016-07-22  0:40 [PATCH 0/3] m68k: flat file load fix and cleanup Greg Ungerer
                   ` (2 preceding siblings ...)
  2016-07-22  0:40 ` [PATCH 3/3] m68k: use same start_thread() on MMU and no-MMU Greg Ungerer
@ 2016-07-29  4:39 ` Greg Ungerer
  3 siblings, 0 replies; 5+ messages in thread
From: Greg Ungerer @ 2016-07-29  4:39 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k

Hi Geert,

On 22/07/16 10:40, Greg Ungerer wrote:
> The following 3 patches fix m68k loading of flat binaries on MMU-enabled
> systems, and then based on that we can cleanup and combine some common
> code.
> 
> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
> ---
>  b/arch/m68k/include/asm/flat.h      |    8 +++++++-
>  b/arch/m68k/include/asm/processor.h |   15 +--------------
>  2 files changed, 8 insertions(+), 15 deletions(-)

Do you have any objection to me pushing these via the m68knommu
tree to Linus later next week?

They should only effect non-MMU targets.

Regards
Greg

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-07-29  4:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-22  0:40 [PATCH 0/3] m68k: flat file load fix and cleanup Greg Ungerer
2016-07-22  0:40 ` [PATCH 1/3] m68k: fix bFLT executable running on MMU enabled systems Greg Ungerer
2016-07-22  0:40 ` [PATCH 2/3] m68k: fix file path comment Greg Ungerer
2016-07-22  0:40 ` [PATCH 3/3] m68k: use same start_thread() on MMU and no-MMU Greg Ungerer
2016-07-29  4:39 ` [PATCH 0/3] m68k: flat file load fix and cleanup Greg Ungerer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox