X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=include%2Fasm-m32r%2Fthread_info.h;h=9f3a0fcf6e2b6ef350d1394fc96b6c85311e7510;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=de7d3f1ca0170b618246b72faef6b1fa16612308;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/include/asm-m32r/thread_info.h b/include/asm-m32r/thread_info.h index de7d3f1ca..9f3a0fcf6 100644 --- a/include/asm-m32r/thread_info.h +++ b/include/asm-m32r/thread_info.h @@ -1,12 +1,13 @@ -/* thread_info.h: i386 low-level thread information +#ifndef _ASM_M32R_THREAD_INFO_H +#define _ASM_M32R_THREAD_INFO_H + +/* thread_info.h: m32r low-level thread information * * Copyright (C) 2002 David Howells (dhowells@redhat.com) * - Incorporating suggestions made by Linus Torvalds and Dave Miller + * Copyright (C) 2004 Hirokazu Takata */ -#ifndef _ASM_THREAD_INFO_H -#define _ASM_THREAD_INFO_H - #ifdef __KERNEL__ #ifndef __ASSEMBLY__ @@ -30,7 +31,7 @@ struct thread_info { __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ mm_segment_t addr_limit; /* thread address space: - 0-0xBFFFFFFF for user-thead + 0-0xBFFFFFFF for user-thread 0-0xFFFFFFFF for kernel-thread */ struct restart_block restart_block; @@ -52,7 +53,7 @@ struct thread_info { #endif -#define PREEMPT_ACTIVE 0x4000000 +#define PREEMPT_ACTIVE 0x10000000 /* * macros/functions for gaining access to the thread information structure @@ -77,34 +78,64 @@ struct thread_info { #define init_thread_info (init_thread_union.thread_info) #define init_stack (init_thread_union.stack) +#define THREAD_SIZE (2*PAGE_SIZE) + /* how to get the thread information struct from C */ static inline struct thread_info *current_thread_info(void) { struct thread_info *ti; __asm__ __volatile__ ( - "ldi %0, #0xffffe000; \n\t" - "and %0, sp; \n\t" - : "=r" (ti) + "ldi %0, #%1 \n\t" + "and %0, sp \n\t" + : "=r" (ti) : "i" (~(THREAD_SIZE - 1)) ); return ti; } /* thread information allocation */ -#define THREAD_SIZE (2*PAGE_SIZE) -#define alloc_thread_info(task) \ - ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) -#define free_thread_info(ti) free_pages((unsigned long) (ti), 1) +#if CONFIG_DEBUG_STACK_USAGE +#define alloc_thread_info(tsk) \ + ({ \ + struct thread_info *ret; \ + \ + ret = kmalloc(THREAD_SIZE, GFP_KERNEL); \ + if (ret) \ + memset(ret, 0, THREAD_SIZE); \ + ret; \ + }) +#else +#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL) +#endif + +#define free_thread_info(info) kfree(info) #define get_thread_info(ti) get_task_struct((ti)->task) #define put_thread_info(ti) put_task_struct((ti)->task) +#define TI_FLAG_FAULT_CODE_SHIFT 28 + +static inline void set_thread_fault_code(unsigned int val) +{ + struct thread_info *ti = current_thread_info(); + ti->flags = (ti->flags & (~0 >> (32 - TI_FLAG_FAULT_CODE_SHIFT))) + | (val << TI_FLAG_FAULT_CODE_SHIFT); +} + +static inline unsigned int get_thread_fault_code(void) +{ + struct thread_info *ti = current_thread_info(); + return ti->flags >> TI_FLAG_FAULT_CODE_SHIFT; +} + #else /* !__ASSEMBLY__ */ +#define THREAD_SIZE 8192 + /* how to get the thread information struct from ASM */ #define GET_THREAD_INFO(reg) GET_THREAD_INFO reg .macro GET_THREAD_INFO reg - ldi \reg, #0xffffe000 + ldi \reg, #-THREAD_SIZE and \reg, sp .endm @@ -123,6 +154,8 @@ static inline struct thread_info *current_thread_info(void) #define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ #define TIF_IRET 5 /* return with iret */ #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ + /* 31..28 fault code */ +#define TIF_MEMDIE 17 #define _TIF_SYSCALL_TRACE (1<