Commit 3a18dd05 authored by Hirokazu Takata's avatar Hirokazu Takata Committed by Linus Torvalds

[PATCH] m32r: include/asm-m32r/thread_info.h minor updates

- Use THREAD_SIZE for __ASSEMBLY__ portion.
- Update comments.
- Fix a typo: user-thead --> user-thread.

NOTE: Now there are two THREAD_SIZE definitions in the following patch,
one is in C part and the other is in __ASSEMBLY__ part.
I'm going to consolidate these THREAD_SIZE definitions.  So, I have to
change PAGE_SIZE definition of include/asm-m32r/page.h to be includable
into asm portion...
Signed-off-by: default avatarHirokazu Takata <takata@linux-m32r.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1b56ca0a
/* 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 <takata at linux-m32r.org>
*/
#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;
......@@ -77,22 +78,23 @@ 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)
......@@ -116,10 +118,12 @@ static inline unsigned int get_thread_fault_code(void)
#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
......@@ -162,4 +166,4 @@ static inline unsigned int get_thread_fault_code(void)
#endif /* __KERNEL__ */
#endif /* _ASM_THREAD_INFO_H */
#endif /* _ASM_M32R_THREAD_INFO_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment