* Move some macros which should belong to uaccess.h to uaccess.h * Move INIT_THREAD_INFO to init_task.c, because it's the only place where it is used. * Rename the mem_seg field to addr_limit to be consistent with other architectures and to be able to use the generic uaccess.h
Signed-off-by: Lars-Peter Clausen <[email protected]> --- arch/lm32/include/asm/thread_info.h | 46 +++++-------------------------- arch/lm32/include/asm/uaccess.h | 9 +++++- arch/lm32/kernel/asm-offsets.c | 1 + arch/lm32/kernel/init_task.c | 52 +++++++++------------------------- 4 files changed, 29 insertions(+), 79 deletions(-) diff --git a/arch/lm32/include/asm/thread_info.h b/arch/lm32/include/asm/thread_info.h index 7f09a18..011b908 100644 --- a/arch/lm32/include/asm/thread_info.h +++ b/arch/lm32/include/asm/thread_info.h @@ -22,47 +22,24 @@ typedef unsigned long mm_segment_t; -#define USER_DS (0x5) -#define KERNEL_DS (0xA) - -#define segment_eq(a,b) ((a) == (b)) - - /* * low level task data. * If you change this, change the TI_* offsets below to match. */ struct thread_info { - struct task_struct *task; /* main task structure */ - struct exec_domain *exec_domain; /* execution domain */ - unsigned long flags; /* low level flags */ - int cpu; /* cpu we're on */ - int preempt_count; /* 0 => preemptable, <0 => BUG */ - struct restart_block restart_block; - mm_segment_t mem_seg; + struct task_struct *task; /* main task structure */ + struct exec_domain *exec_domain; /* execution domain */ + unsigned long flags; /* low level flags */ + unsigned int cpu; /* cpu we're on */ + int preempt_count; /* 0 => preemptable, <0 => BUG */ + struct restart_block restart_block; + mm_segment_t addr_limit; }; -/* - * macros/functions for gaining access to the thread information structure - */ -#define INIT_THREAD_INFO(tsk) \ -{ \ - .task = &tsk, \ - .exec_domain = &default_exec_domain, \ - .flags = 0, \ - .cpu = 0, \ - .preempt_count = INIT_PREEMPT_COUNT, \ - .restart_block = { \ - .fn = do_no_restart_syscall, \ - }, \ - .mem_seg = KERNEL_DS, \ -} - #define init_thread_info (init_thread_union.thread_info) #define init_stack (init_thread_union.stack) - /* how to get the thread information struct from C */ static inline struct thread_info *current_thread_info(void) __attribute_const__; @@ -76,15 +53,6 @@ static inline struct thread_info *current_thread_info(void) #endif /* __ASSEMBLY__ */ /* - * Offsets in thread_info structure, used in assembly code - */ -#define TI_TASK 0 -#define TI_EXECDOMAIN 4 -#define TI_FLAGS 8 -#define TI_CPU 12 -#define TI_PRE_COUNT 16 - -/* * thread information flag bit numbers */ #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ diff --git a/arch/lm32/include/asm/uaccess.h b/arch/lm32/include/asm/uaccess.h index 8b7bd3f..63722d4 100644 --- a/arch/lm32/include/asm/uaccess.h +++ b/arch/lm32/include/asm/uaccess.h @@ -185,9 +185,14 @@ clear_user(void *to, unsigned long n) #define __clear_user clear_user +#define USER_DS (0x5) +#define KERNEL_DS (0xA) + +#define segment_eq(a,b) ((a) == (b)) + static inline mm_segment_t get_fs(void) { - return current_thread_info()->mem_seg; + return current_thread_info()->addr_limit; } static inline mm_segment_t get_ds(void) @@ -198,7 +203,7 @@ static inline mm_segment_t get_ds(void) static inline void set_fs(mm_segment_t val) { - current_thread_info()->mem_seg = val; + current_thread_info()->addr_limit = val; } #endif /* _LM32_ASM_UACCESS_H */ diff --git a/arch/lm32/kernel/asm-offsets.c b/arch/lm32/kernel/asm-offsets.c index 02eab85..c332401 100644 --- a/arch/lm32/kernel/asm-offsets.c +++ b/arch/lm32/kernel/asm-offsets.c @@ -108,6 +108,7 @@ void output_thread_info_defines(void) DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); + DEFINE(TI_ADDR_LIMIT, offsetof(struct thread_info, addr_limit)); DEFINE(_THREAD_SIZE, THREAD_SIZE); BLANK(); } diff --git a/arch/lm32/kernel/init_task.c b/arch/lm32/kernel/init_task.c index c46a26a..72a5eef 100644 --- a/arch/lm32/kernel/init_task.c +++ b/arch/lm32/kernel/init_task.c @@ -1,50 +1,15 @@ -/* - * (C) Copyright 2007 - * Theobroma Systems <www.theobroma-systems.com> - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -/* - * Based on - * - * linux/arch/arm/kernel/init_task.c - */ #include <linux/mm.h> #include <linux/module.h> -#include <linux/fs.h> #include <linux/sched.h> -#include <linux/init.h> #include <linux/init_task.h> #include <linux/mqueue.h> #include <linux/hardirq.h> +#include <asm/thread_info.h> #include <asm/uaccess.h> -#include <asm/pgtable.h> -//static struct fs_struct init_fs = INIT_FS; -//static struct files_struct init_files = INIT_FILES; static struct signal_struct init_signals = INIT_SIGNALS(init_signals); static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); -//struct mm_struct init_mm = INIT_MM(init_mm); - -EXPORT_SYMBOL(init_mm); /* * Initial thread structure. @@ -57,7 +22,19 @@ EXPORT_SYMBOL(init_mm); * The things we do for performance.. */ union thread_union init_thread_union __init_task_data = - { INIT_THREAD_INFO(init_task) }; +{ +{ + .task = &init_task, + .exec_domain = &default_exec_domain, + .flags = 0, + .cpu = 0, + .preempt_count = INIT_PREEMPT_COUNT, + .restart_block = { + .fn = do_no_restart_syscall, + }, + .addr_limit = KERNEL_DS, +} +}; /* * Initial task structure. @@ -65,5 +42,4 @@ union thread_union init_thread_union __init_task_data = * All other task structs will be allocated on slabs in fork.c */ struct task_struct init_task = INIT_TASK(init_task); - EXPORT_SYMBOL(init_task); -- 1.7.2.3 _______________________________________________ http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org IRC: #milkymist@Freenode Twitter: www.twitter.com/milkymistvj Ideas? http://milkymist.uservoice.com
