KERNELLOAD =0xc0000000
endif
-ifeq ($(shell uname -m),ppc)
-CHECKS = checks
-endif
-
LINKFLAGS = -T arch/ppc/vmlinux.lds -Ttext $(KERNELLOAD) -Bstatic
CPPFLAGS := $(CPPFLAGS) -I$(TOPDIR)/arch/$(ARCH)
AFLAGS := $(AFLAGS) -I$(TOPDIR)/arch/$(ARCH)
CORE_FILES += arch/ppc/iSeries/iSeries.o
endif
-checks:
- @$(MAKE) -C arch/$(ARCH)/kernel checks
-
BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd pImage vmlinux.sm
# All the instructions talk about "make bzImage".
bzImage: zImage
-$(BOOT_TARGETS): $(CHECKS) vmlinux
+$(BOOT_TARGETS): vmlinux
@$(MAKEBOOT) $@
%_config: arch/ppc/configs/%_defconfig
cp -f arch/ppc/configs/$(@:config=defconfig) arch/ppc/defconfig
archclean:
- rm -f arch/ppc/kernel/{mk_defs,ppc_defs.h,find_name,checks}
+ rm -f arch/ppc/kernel/{mk_defs,ppc_defs.h,find_name}
rm -f arch/ppc/iSeries/ReleaseData.h
@$(MAKEBOOT) clean
if [ "$CONFIG_SMP" = "y" ]; then
bool ' Distribute interrupts on all CPUs by default' CONFIG_IRQ_ALL_CPUS
fi
+define_bool CONFIG_PREEMPT n
if [ "$CONFIG_6xx" = "y" -a "$CONFIG_8260" = "n" ];then
bool 'AltiVec Support' CONFIG_ALTIVEC
find_name : find_name.c
$(HOSTCC) $(HOSTCFLAGS) -o find_name find_name.c
-
-checks: checks.c
- $(HOSTCC) -I$(HPATH) $(HOSTCFLAGS) -D__KERNEL__ -fno-builtin -o checks checks.c
- ./checks
+++ /dev/null
-/*
- * BK Id: SCCS/s.checks.c 1.6 05/17/01 18:14:21 cort
- */
-#include <linux/errno.h>
-#include <linux/sched.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/smp.h>
-#include <linux/smp_lock.h>
-#include <linux/stddef.h>
-#include <linux/unistd.h>
-#include <linux/ptrace.h>
-#include <linux/slab.h>
-#include <linux/user.h>
-#include <linux/a.out.h>
-
-#include <asm/pgtable.h>
-#include <asm/uaccess.h>
-#include <asm/system.h>
-#include <asm/io.h>
-
-/*
- * Do various before compile checks of data structures
- * -- Cort
- */
-int main(void)
-{
- int ret = 0;
-#if 0
- if ( sizeof(struct thread_struct) % 16 )
- {
- printf("Thread struct is not modulo 16 bytes: "
- "%d bytes total, %d bytes off\n",
- sizeof(struct thread_struct),
- sizeof(struct thread_struct)%16);
- ret = -1;
- }
-#endif
-
- if ( sizeof(struct pt_regs) % 16 )
- {
- printf("pt_regs struct is not modulo 16 bytes: "
- "%d bytes total, %d bytes off\n",
- sizeof(struct pt_regs),
- sizeof(struct pt_regs)%16);
- ret = -1;
-
- }
-
- printf("Task size : %d bytes\n"
- "Tss size : %d bytes\n"
- "pt_regs size : %d bytes\n"
- "Kernel stack size: %d bytes\n",
- sizeof(struct task_struct), sizeof(struct thread_struct),
- sizeof(struct pt_regs),
- sizeof(union task_union) - sizeof(struct task_struct));
- return ret;
-}
#include <asm/page.h>
#include <asm/mmu.h>
#include <asm/cputable.h>
+#include <asm/thread_info.h>
#include <asm/ppc_asm.h>
#include "ppc_defs.h"
#ifdef CONFIG_PPC_ISERIES
beq- 10f
cmpi 0,r0,0x6666 /* Special case for 'sys_rt_sigreturn' */
beq- 16f
- lbz r10,SYSCALL_TRACE(r2)
- cmpwi r10,0
+ rlwinm r10,r1,0,0,18 /* current_thread_info() */
+ lwz r10,TI_FLAGS(r10)
+ andi. r10,r10,_TIF_SYSCALL_TRACE
bne- 50f
cmpli 0,r0,NR_syscalls
bge- 66f
.globl ret_from_fork
ret_from_fork:
bl schedule_tail
- lbz r0,SYSCALL_TRACE(r2)
- cmpwi r0,0
+ rlwinm r3,r1,0,0,18
+ lwz r3,TI_FLAGS(r3)
+ andi. r0,r3,_TIF_SYSCALL_TRACE
bnel- do_syscall_trace
b ret_from_except
REST_8GPRS(23,r1)
REST_GPR(31,r1)
- /* Hard-disable interrupts so that current->work can't change
- * between when we test it and when we return from the interrupt. */
+ /* Hard-disable interrupts so that current_thread_info()->flags
+ * can't change between when we test it and when we return
+ * from the interrupt. */
recheck:
mfmsr r10
rlwinm r0,r10,0,17,15 /* clear MSR_EE in r0 */
andi. r3,r3,MSR_PR
beq+ restore /* if not, just restore regs and return */
- /* Check current->work */
- lwz r3,TASK_WORK(r2)
- rlwinm. r0,r3,0,16,7 /* need_resched, sigpending, notify_resume */
+ /* Check current_thread_info()->flags */
+ rlwinm r3,r1,0,0,18
+ lwz r3,TI_FLAGS(r3)
+ andi. r0,r3,(_TIF_SIGPENDING|_TIF_NEED_RESCHED)
bne do_work
.globl ret_to_user_hook
ori r10,r10,MSR_EE
SYNC
mtmsr r10 /* hard-enable interrupts */
- rlwinm. r0,r3,0,0,7 /* test need_resched */
+ andi. r0,r3,_TIF_NEED_RESCHED
beq 1f
bl schedule
b recheck
1:
- rlwinm. r0,r3,0,16,23 /* test sigpending */
+ andi. r0,r3,_TIF_SIGPENDING
beq 2f
li r3,0
addi r4,r1,STACK_FRAME_OVERHEAD
bl do_signal
b recheck
2:
- /* nobody uses work.notify_resume yet */
- li r0,0
- stb r0,NOTIFY_RESUME(r2)
+ /* nobody uses the TIF_NOTIFY_RESUME bit yet */
b recheck
/*
#include <asm/pgtable.h>
#include <asm/cputable.h>
#include <asm/cache.h>
+#include <asm/thread_info.h>
#include <asm/ppc_asm.h>
#include "ppc_defs.h"
*/
stack_ovf:
addi r3,r1,STACK_FRAME_OVERHEAD
- lis r1,init_task_union@ha
- addi r1,r1,init_task_union@l
- addi r1,r1,TASK_UNION_SIZE-STACK_FRAME_OVERHEAD
+ lis r1,init_thread_union@ha
+ addi r1,r1,init_thread_union@l
+ addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
lis r24,StackOverflow@ha
addi r24,r24,StackOverflow@l
li r20,MSR_KERNEL
lwzx r2,r2,r24
/* stack */
- addi r1,r2,TASK_UNION_SIZE-STACK_FRAME_OVERHEAD
+ addi r1,r2,THREAD_SIZE-STACK_FRAME_OVERHEAD
li r0,0
tophys(r3,r1)
stw r0,0(r3)
bl call_setup_cpu
/* ptr to current */
- lis r2,init_task_union@h
- ori r2,r2,init_task_union@l
+ lis r2,init_task@h
+ ori r2,r2,init_task@l
/* Set up for using our exception vectors */
/* ptr to phys current thread */
tophys(r4,r2)
mtspr SPRG2,r3 /* 0 => r1 has kernel sp */
/* stack */
- addi r1,r2,TASK_UNION_SIZE
+ lis r1,init_thread_union@ha
+ addi r1,r1,init_thread_union@l
li r0,0
- stwu r0,-STACK_FRAME_OVERHEAD(r1)
+ stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
/*
* Do early bootinfo parsing, platform-specific initialization,
* and set up the MMU.
.data
.globl sdata
sdata:
+ .globl init_thread_union
+init_thread_union:
+ .space 8192
+
.globl empty_zero_page
empty_zero_page:
.space 4096
#include <asm/pgtable.h>
#include <asm/ibm4xx.h>
#include <asm/cputable.h>
+#include <asm/thread_info.h>
#include <asm/ppc_asm.h>
#include "ppc_defs.h"
stack_ovf:
addi r3,r1,STACK_FRAME_OVERHEAD
- lis r1,init_task_union@ha
- addi r1,r1,init_task_union@l
- addi r1,r1,TASK_UNION_SIZE - STACK_FRAME_OVERHEAD
+ lis r1,init_thread_union@ha
+ addi r1,r1,init_thread_union@l
+ addi r1,r1,THREAD_SIZE - STACK_FRAME_OVERHEAD
lis r24,StackOverflow@ha
addi r24,r24,StackOverflow@l
li r20,MSR_KERNEL
start_here:
/* ptr to current */
- lis r2,init_task_union@h
- ori r2,r2,init_task_union@l
+ lis r2,init_task@h
+ ori r2,r2,init_task@l
/* ptr to phys current thread */
tophys(r4,r2)
mtspr SPRG2,r3 /* 0 => r1 has kernel sp */
/* stack */
- addi r1,r2,TASK_UNION_SIZE
+ lis r1,init_thread_union@ha
+ addi r1,r1,init_thread_union@l
li r0,0
- stwu r0,-STACK_FRAME_OVERHEAD(r1)
+ stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
bl early_init /* We have to do this with MMU on */
*/
.data
_GLOBAL(sdata)
+_GLOBAL(init_thread_union)
+ .space 8192
_GLOBAL(empty_zero_page)
.space 4096
_GLOBAL(swapper_pg_dir)
#include <asm/cache.h>
#include <asm/pgtable.h>
#include <asm/cputable.h>
+#include <asm/thread_info.h>
#include <asm/ppc_asm.h>
#include "ppc_defs.h"
*/
stack_ovf:
addi r3,r1,STACK_FRAME_OVERHEAD
- lis r1,init_task_union@ha
- addi r1,r1,init_task_union@l
- addi r1,r1,TASK_UNION_SIZE-STACK_FRAME_OVERHEAD
+ lis r1,init_thread_union@ha
+ addi r1,r1,init_thread_union@l
+ addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
lis r24,StackOverflow@ha
addi r24,r24,StackOverflow@l
li r20,MSR_KERNEL
start_here:
/* ptr to current */
- lis r2,init_task_union@h
- ori r2,r2,init_task_union@l
+ lis r2,init_task@h
+ ori r2,r2,init_task@l
/* ptr to phys current thread */
tophys(r4,r2)
mtspr SPRG2,r3 /* 0 => r1 has kernel sp */
/* stack */
- addi r1,r2,TASK_UNION_SIZE
+ lis r1,init_thread_union@ha
+ addi r1,r1,init_thread_union@l
li r0,0
- stwu r0,-STACK_FRAME_OVERHEAD(r1)
+ stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
bl early_init /* We have to do this with MMU on */
.data
.globl sdata
sdata:
+ .globl init_thread_union
+init_thread_union:
+ .space 8192
+
.globl empty_zero_page
empty_zero_page:
.space 4096
#include <asm/mmu.h>
#include <asm/pgtable.h>
#include <asm/ppc_asm.h>
+#include <asm/thread_info.h>
#include "ppc_defs.h"
#include "iSeries_asm.h"
*/
stack_ovf:
addi r3,r1,STACK_FRAME_OVERHEAD
- lis r1,init_task_union@ha
- addi r1,r1,init_task_union@l
- addi r1,r1,TASK_UNION_SIZE-STACK_FRAME_OVERHEAD
+ lis r1,init_thread_union@ha
+ addi r1,r1,init_thread_union@l
+ addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
mfspr r24,SPRG1
li r20,0
stb r20,PACAPROCENABLED(r24) /* soft disable */
lwzx r2,r2,r24
/* stack */
- addi r1,r2,TASK_UNION_SIZE-STACK_FRAME_OVERHEAD
+ addi r1,r2,THREAD_SIZE-STACK_FRAME_OVERHEAD
li r0,0
stw r0,0(r1)
/* ptr to current */
- lis r2,init_task_union@h
- ori r2,r2,init_task_union@l
+ lis r2,init_task@h
+ ori r2,r2,init_task@l
/* Set up for using our exception vectors */
stb r3,PACAPROCENABLED(r11) /* Soft disabled */
- addi r1,r2,TASK_UNION_SIZE
+ lis r1,init_thread_union@ha
+ addi r1,r1,init_thread_union@l
li r0,0
- stwu r0,-STACK_FRAME_OVERHEAD(r1)
+ stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
/* fix klimit for system map */
lis r6,embedded_sysmap_end@ha
.globl sdata
sdata:
+ .globl init_thread_union
+init_thread_union:
+ .space 8192
+
.globl empty_zero_page
empty_zero_page:
.space 4096
#endif
#ifdef CONFIG_SMP
if (!do_power_save) {
- /*
- * Deal with another CPU just having chosen a thread to
- * run here:
- */
- unsigned long oldval;
-
- oldval = xchg(¤t->work, 0xff000000);
- if (!(oldval & 0xff000000)) {
- while (current->work.need_resched == -1)
- barrier(); /* Do Nothing */
+ if (!need_resched()) {
+ set_thread_flag(TIF_POLLING_NRFLAG);
+ while (!test_thread_flag(TIF_NEED_RESCHED))
+ barrier();
+ clear_thread_flag(TIF_POLLING_NRFLAG);
}
}
#endif
#include <asm/pgtable.h>
#include <asm/processor.h>
#include <asm/cputable.h>
+#include <asm/thread_info.h>
#ifdef CONFIG_PPC_ISERIES
#include <asm/iSeries/Paca.h>
int
main(void)
{
- /*DEFINE(KERNELBASE, KERNELBASE);*/
+ DEFINE(THREAD_SIZE, THREAD_SIZE);
+ DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
+ DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
DEFINE(STATE, offsetof(struct task_struct, state));
- DEFINE(NEXT_TASK, offsetof(struct task_struct, next_task));
DEFINE(THREAD, offsetof(struct task_struct, thread));
- DEFINE(CPU, offsetof(struct task_struct, cpu));
DEFINE(MM, offsetof(struct task_struct, mm));
DEFINE(ACTIVE_MM, offsetof(struct task_struct, active_mm));
DEFINE(TASK_STRUCT_SIZE, sizeof(struct task_struct));
DEFINE(LAST_SYSCALL, offsetof(struct thread_struct, last_syscall));
DEFINE(PT_REGS, offsetof(struct thread_struct, regs));
DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));
- DEFINE(TASK_WORK, offsetof(struct task_struct, work));
- DEFINE(NEED_RESCHED, offsetof(struct task_struct, work.need_resched));
- DEFINE(SYSCALL_TRACE, offsetof(struct task_struct, work.syscall_trace));
- DEFINE(SIGPENDING, offsetof(struct task_struct, work.sigpending));
- DEFINE(NOTIFY_RESUME, offsetof(struct task_struct, work.notify_resume));
DEFINE(THREAD_FPEXC_MODE, offsetof(struct thread_struct, fpexc_mode));
DEFINE(THREAD_FPR0, offsetof(struct thread_struct, fpr[0]));
DEFINE(THREAD_FPSCR, offsetof(struct thread_struct, fpscr));
DEFINE(THREAD_VSCR, offsetof(struct thread_struct, vscr));
#endif /* CONFIG_ALTIVEC */
/* Interrupt register frame */
- DEFINE(TASK_UNION_SIZE, sizeof(union task_union));
DEFINE(STACK_FRAME_OVERHEAD, STACK_FRAME_OVERHEAD);
DEFINE(INT_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs));
/* in fact we only use gpr0 - gpr9 and gpr20 - gpr23 */
static struct signal_struct init_signals = INIT_SIGNALS;
struct mm_struct init_mm = INIT_MM(init_mm);
-/* this is 16-byte aligned because it has a stack in it */
-union task_union __attribute((aligned(16))) init_task_union = {
- INIT_TASK(init_task_union.task)
-};
+/* initial task structure */
+struct task_struct init_task = INIT_TASK(init_task);
/* only used to get secondary processor up */
struct task_struct *current_set[NR_CPUS] = {&init_task, };
{
struct pt_regs *childregs, *kregs;
extern void ret_from_fork(void);
- unsigned long sp = (unsigned long)p + sizeof(union task_union);
+ unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE;
unsigned long childframe;
/* Copy registers */
void show_trace_task(struct task_struct *tsk)
{
- unsigned long stack_top = (unsigned long) tsk + THREAD_SIZE;
+ unsigned long stack_top = (unsigned long) tsk->thread_info + THREAD_SIZE;
unsigned long sp, prev_sp;
int count = 0;
unsigned long get_wchan(struct task_struct *p)
{
unsigned long ip, sp;
- unsigned long stack_page = (unsigned long) p;
+ unsigned long stack_page = (unsigned long) p->thread_info;
int count = 0;
if (!p || p == current || p->state == TASK_RUNNING)
return 0;
if ((unsigned long) data > _NSIG)
break;
if (request == PTRACE_SYSCALL) {
- if (!(child->ptrace & PT_SYSCALLTRACE)) {
- child->ptrace |= PT_SYSCALLTRACE;
- child->work.syscall_trace++;
- }
+ set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
} else {
- if (child->ptrace & PT_SYSCALLTRACE) {
- child->ptrace &= ~PT_SYSCALLTRACE;
- child->work.syscall_trace--;
- }
+ clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
}
child->exit_code = data;
/* make sure the single step bit is not set. */
ret = -EIO;
if ((unsigned long) data > _NSIG)
break;
- if (child->ptrace & PT_SYSCALLTRACE) {
- child->ptrace &= ~PT_SYSCALLTRACE;
- child->work.syscall_trace--;
- }
+ clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
set_single_step(child);
child->exit_code = data;
/* give it a chance to run. */
break;
}
out_tsk:
- free_task_struct(child);
+ put_task_struct(child);
out:
unlock_kernel();
return ret;
void do_syscall_trace(void)
{
- if ((current->ptrace & (PT_PTRACED|PT_SYSCALLTRACE))
- != (PT_PTRACED|PT_SYSCALLTRACE))
+ if (!test_thread_flag(TIF_SYSCALL_TRACE)
+ || !(current->ptrace & PT_PTRACED))
return;
current->exit_code = SIGTRAP;
current->state = TASK_STOPPED;
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/pmac_feature.h>
+#include <asm/thread_info.h>
#if defined CONFIG_KGDB
#include <asm/kgdb.h>
if (ppc_md.init != NULL) {
ppc_md.init();
}
- init_crc32();
+ return 0;
}
arch_initcall(ppc_init);
+/* Initial thread_info struct, copied into init_task_union */
+struct thread_info init_thread_values __initdata = INIT_THREAD_INFO(init_task);
+
/* Warning, IO base is not yet inited */
void __init setup_arch(char **cmdline_p)
{
extern char *klimit;
extern void do_init_bootmem(void);
+ /* initialize the thread_info for the init task */
+ init_thread_info = init_thread_values;
+
/* so udelay does something sensible, assume <= 1000 bogomips */
loops_per_jiffy = 500000000 / HZ;
kdev_t __init pmac_find_ide_boot(char *bootdevice, int n);
if (bootdevice == NULL)
- return 0;
+ return NODEV;
p = strrchr(bootdevice, '/');
if (p == NULL)
- return 0;
+ return NODEV;
n = p - bootdevice;
return pmac_find_ide_boot(bootdevice, n);
#endif
}
+static int initializing = 1;
+
+static int pmac_late_init(void)
+{
+ initializing = 0;
+ return 0;
+}
+
+late_initcall(pmac_late_init);
+
/* can't be __init - can be called whenever a disk is first accessed */
void __pmac
note_bootable_part(kdev_t dev, int part, int goodness)
static int found_boot = 0;
char *p;
- /* Do nothing if the root has been mounted already. */
- if (init_task.fs->rootmnt != NULL)
+ if (!initializing)
return;
if ((goodness <= current_root_goodness) &&
!kdev_same(ROOT_DEV, to_kdev_t(DEFAULT_ROOT_DEVICE)))
#define hardirq_exit(cpu) (local_irq_count(cpu)--)
#define synchronize_irq() do { } while (0)
+#define release_irqlock(cpu) do { } while (0)
#else /* CONFIG_SMP */
* temporary 2.4 hack
*/
for (i = 0; i < nents; i++) {
- if (sg[i].address && sg[i].page)
+ if (!sg[i].page)
BUG();
- else if (!sg[i].address && !sg[i].page)
- BUG();
-
- if (sg[i].address)
- sg[i].dma_address = virt_to_bus(sg[i].address);
- else
- sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset;
+ sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset;
}
return nents;
#define current_text_addr() ({ __label__ _l; _l: &&_l;})
#include <linux/config.h>
+#include <linux/stringify.h>
#include <asm/ptrace.h>
#include <asm/types.h>
#define _CHRP_Motorola 0x04 /* motorola chrp, the cobra */
#define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */
-#define __stringify(a) #a
#define _GLOBAL(n)\
.stabs __stringify(n:F-1),N_FUN,0,0,n;\
.globl n;\
return ((fpmode << 10) & MSR_FE0) | ((fpmode << 8) & MSR_FE1);
}
-/*
- * NOTE! The task struct and the stack go together
- */
-#define THREAD_SIZE (2*PAGE_SIZE)
-#define alloc_task_struct() \
- ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
-#define free_task_struct(p) free_pages((unsigned long)(p),1)
-#define get_task_struct(tsk) atomic_inc(&virt_to_page(tsk)->count)
-
/* in process.c - for early bootup debug -- Cort */
int ll_printk(const char *, ...);
void ll_puts(const char *);
-#define init_task (init_task_union.task)
-#define init_stack (init_task_union.stack)
-
/* In misc.c */
void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
/*
- * BK Id: SCCS/s.scatterlist.h 1.9 10/15/01 22:51:33 paulus
+ * BK Id: %F% %I% %G% %U% %#%
*/
#ifdef __KERNEL__
#ifndef _PPC_SCATTERLIST_H
#include <asm/dma.h>
struct scatterlist {
- struct page * page;
- unsigned int offset;
-
- dma_addr_t dma_address; /* phys/bus dma address */
- unsigned int length; /* length */
+ struct page *page;
+ unsigned int offset;
+ dma_addr_t dma_address;
+ unsigned int length;
};
/*
#define cpu_logical_map(cpu) (cpu)
#define cpu_number_map(x) (x)
-#define smp_processor_id() (current->cpu)
+#define smp_processor_id() (current_thread_info()->cpu)
extern int smp_hw_index[NR_CPUS];
#define hard_smp_processor_id() (smp_hw_index[smp_processor_id()])
--- /dev/null
+/* thread_info.h: PPC low-level thread information
+ * adapted from the i386 version by Paul Mackerras
+ *
+ * Copyright (C) 2002 David Howells (dhowells@redhat.com)
+ * - Incorporating suggestions made by Linus Torvalds and Dave Miller
+ */
+
+#ifndef _ASM_THREAD_INFO_H
+#define _ASM_THREAD_INFO_H
+
+#ifdef __KERNEL__
+
+#ifndef __ASSEMBLY__
+#include <asm/processor.h>
+
+/*
+ * low level task data.
+ */
+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 */
+};
+
+/*
+ * 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, \
+}
+
+#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)
+{
+ struct thread_info *ti;
+ __asm__("rlwinm %0,1,0,0,18" : "=r"(ti));
+ return ti;
+}
+
+/* thread information allocation */
+#define alloc_thread_info() ((struct thread_info *) \
+ __get_free_pages(GFP_KERNEL, 1))
+#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
+#define get_thread_info(ti) get_task_struct((ti)->task)
+#define put_thread_info(ti) put_task_struct((ti)->task)
+#define THREAD_SIZE (2*PAGE_SIZE)
+#endif /* __ASSEMBLY__ */
+
+/*
+ * thread information flag bit numbers
+ */
+#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
+#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
+#define TIF_SIGPENDING 2 /* signal pending */
+#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
+#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
+ TIF_NEED_RESCHED */
+
+/* as above, but as bit values */
+#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
+#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
+#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
+#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
+#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
+
+#endif /* __KERNEL__ */
+
+#endif /* _ASM_THREAD_INFO_H */