[PATCH] m68knommu: remove set_fs()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



m68knommu already does not distinguish between kernel and user address
spaces.  Stop defining set_fs() and thus uaccess_kernel() to avoid
confusion.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 arch/m68k/Kconfig                   |  2 +-
 arch/m68k/include/asm/processor.h   |  9 +++++++++
 arch/m68k/include/asm/segment.h     | 13 +++++++------
 arch/m68k/include/asm/thread_info.h | 10 ++++++++++
 arch/m68k/kernel/asm-offsets.c      |  2 ++
 arch/m68k/kernel/entry.S            |  8 ++++----
 arch/m68k/kernel/process.c          |  6 ++++--
 arch/m68k/mm/init.c                 |  3 ++-
 8 files changed, 39 insertions(+), 14 deletions(-)

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 96989ad46f66..1c60037e352a 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -32,7 +32,7 @@ config M68K
 	select NO_DMA if !MMU && !COLDFIRE
 	select OLD_SIGACTION
 	select OLD_SIGSUSPEND3
-	select SET_FS
+	select SET_FS if MMU
 	select UACCESS_MEMCPY if !MMU
 	select VIRT_TO_BUS
 	select ZONE_DMA
diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h
index 3750819ac5a1..ac04b5c8fe8d 100644
--- a/arch/m68k/include/asm/processor.h
+++ b/arch/m68k/include/asm/processor.h
@@ -79,7 +79,9 @@ struct thread_struct {
 	unsigned long  ksp;		/* kernel stack pointer */
 	unsigned long  usp;		/* user stack pointer */
 	unsigned short sr;		/* saved status register */
+#ifdef CONFIG_MMU
 	unsigned short fs;		/* saved fs (sfc, dfc) */
+#endif
 	unsigned long  crp[2];		/* cpu root pointer */
 	unsigned long  esp0;		/* points to SR of stack frame */
 	unsigned long  faddr;		/* info about last fault */
@@ -89,11 +91,18 @@ struct thread_struct {
 	unsigned char  fpstate[FPSTATESIZE];  /* floating point state */
 };
 
+#ifdef CONFIG_MMU
 #define INIT_THREAD  {							\
 	.ksp	= sizeof(init_stack) + (unsigned long) init_stack,	\
 	.sr	= PS_S,							\
 	.fs	= __KERNEL_DS,						\
 }
+#else
+#define INIT_THREAD  {							\
+	.ksp	= sizeof(init_stack) + (unsigned long) init_stack,	\
+	.sr	= PS_S,							\
+}
+#endif /* CONFIG_MMU */
 
 /*
  * ColdFire stack format sbould be 0x4 for an aligned usp (will always be
diff --git a/arch/m68k/include/asm/segment.h b/arch/m68k/include/asm/segment.h
index 2b5e68a71ef7..b134820425a5 100644
--- a/arch/m68k/include/asm/segment.h
+++ b/arch/m68k/include/asm/segment.h
@@ -2,19 +2,20 @@
 #ifndef _M68K_SEGMENT_H
 #define _M68K_SEGMENT_H
 
-/* define constants */
 /* Address spaces (FC0-FC2) */
 #define USER_DATA     (1)
+#define USER_PROGRAM  (2)
+#define SUPER_DATA    (5)
+#define SUPER_PROGRAM (6)
+#define CPU_SPACE     (7)
+
+#ifdef CONFIG_MMU
 #ifndef __USER_DS
 #define __USER_DS     (USER_DATA)
 #endif
-#define USER_PROGRAM  (2)
-#define SUPER_DATA    (5)
 #ifndef __KERNEL_DS
 #define __KERNEL_DS   (SUPER_DATA)
 #endif
-#define SUPER_PROGRAM (6)
-#define CPU_SPACE     (7)
 
 #ifndef __ASSEMBLY__
 
@@ -55,5 +56,5 @@ static inline void set_fs(mm_segment_t val)
 #define uaccess_kernel()	(get_fs().seg == KERNEL_DS.seg)
 
 #endif /* __ASSEMBLY__ */
-
+#endif /* CONFIG_MMU */
 #endif /* _M68K_SEGMENT_H */
diff --git a/arch/m68k/include/asm/thread_info.h b/arch/m68k/include/asm/thread_info.h
index 15a757073fa5..8741388d11af 100644
--- a/arch/m68k/include/asm/thread_info.h
+++ b/arch/m68k/include/asm/thread_info.h
@@ -27,19 +27,29 @@
 struct thread_info {
 	struct task_struct	*task;		/* main task structure */
 	unsigned long		flags;
+#ifdef CONFIG_MMU
 	mm_segment_t		addr_limit;	/* thread address space */
+#endif
 	int			preempt_count;	/* 0 => preemptable, <0 => BUG */
 	__u32			cpu;		/* should always be 0 on m68k */
 	unsigned long		tp_value;	/* thread pointer */
 };
 #endif /* __ASSEMBLY__ */
 
+#ifdef CONFIG_MMU
 #define INIT_THREAD_INFO(tsk)			\
 {						\
 	.task		= &tsk,			\
 	.addr_limit	= KERNEL_DS,		\
 	.preempt_count	= INIT_PREEMPT_COUNT,	\
 }
+#else
+#define INIT_THREAD_INFO(tsk)			\
+{						\
+	.task		= &tsk,			\
+	.preempt_count	= INIT_PREEMPT_COUNT,	\
+}
+#endif /* CONFIG_MMU */
 
 #ifndef __ASSEMBLY__
 /* how to get the thread information struct from C */
diff --git a/arch/m68k/kernel/asm-offsets.c b/arch/m68k/kernel/asm-offsets.c
index ccea355052ef..ff9dc90aca93 100644
--- a/arch/m68k/kernel/asm-offsets.c
+++ b/arch/m68k/kernel/asm-offsets.c
@@ -31,7 +31,9 @@ int main(void)
 	DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp));
 	DEFINE(THREAD_USP, offsetof(struct thread_struct, usp));
 	DEFINE(THREAD_SR, offsetof(struct thread_struct, sr));
+#ifdef CONFIG_MMU
 	DEFINE(THREAD_FS, offsetof(struct thread_struct, fs));
+#endif
 	DEFINE(THREAD_CRP, offsetof(struct thread_struct, crp));
 	DEFINE(THREAD_ESP0, offsetof(struct thread_struct, esp0));
 	DEFINE(THREAD_FPREG, offsetof(struct thread_struct, fp));
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
index 9dd76fbb7c6b..2e4054e26be6 100644
--- a/arch/m68k/kernel/entry.S
+++ b/arch/m68k/kernel/entry.S
@@ -335,11 +335,11 @@ resume:
 
 	/* save sr */
 	movew	%sr,%a0@(TASK_THREAD+THREAD_SR)
-
+#ifdef CONFIG_MMU
 	/* save fs (sfc,%dfc) (may be pointing to kernel memory) */
 	movec	%sfc,%d0
 	movew	%d0,%a0@(TASK_THREAD+THREAD_FS)
-
+#endif
 	/* save usp */
 	/* it is better to use a movel here instead of a movew 8*) */
 	movec	%usp,%d0
@@ -422,12 +422,12 @@ resume:
 	/* restore user stack pointer */
 	movel	%a1@(TASK_THREAD+THREAD_USP),%a0
 	movel	%a0,%usp
-
+#ifdef CONFIG_MMU
 	/* restore fs (sfc,%dfc) */
 	movew	%a1@(TASK_THREAD+THREAD_FS),%a0
 	movec	%a0,%sfc
 	movec	%a0,%dfc
-
+#endif
 	/* restore status register */
 	movew	%a1@(TASK_THREAD+THREAD_SR),%sr
 
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index db49f9091711..7b725f327658 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -92,7 +92,9 @@ void show_regs(struct pt_regs * regs)
 
 void flush_thread(void)
 {
+#ifdef CONFIG_MMU
 	current->thread.fs = __USER_DS;
+#endif
 #ifdef CONFIG_FPU
 	if (!FPU_IS_EMU) {
 		unsigned long zero = 0;
@@ -150,13 +152,13 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, unsigned long arg,
 
 	p->thread.ksp = (unsigned long)frame;
 	p->thread.esp0 = (unsigned long)&frame->regs;
-
+#ifdef CONFIG_MMU
 	/*
 	 * Must save the current SFC/DFC value, NOT the value when
 	 * the parent was last descheduled - RGH  10-08-96
 	 */
 	p->thread.fs = get_fs().seg;
-
+#endif
 	if (unlikely(p->flags & (PF_KTHREAD | PF_IO_WORKER))) {
 		/* kernel thread */
 		memset(frame, 0, sizeof(struct fork_frame));
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index 5d749e188246..3beec9644ae9 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -72,11 +72,12 @@ void __init paging_init(void)
 	if (!empty_zero_page)
 		panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
 		      __func__, PAGE_SIZE, PAGE_SIZE);
-
+#ifdef CONFIG_MMU
 	/*
 	 * Set up SFC/DFC registers (user data space).
 	 */
 	set_fs (USER_DS);
+#endif
 
 	max_zone_pfn[ZONE_DMA] = end_mem >> PAGE_SHIFT;
 	free_area_init(max_zone_pfn);
-- 
2.30.2




[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux