Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / asm-arm / processor.h
blob4a9845997a75b861dce954441f57c1c8dbc09e7c
1 /*
2 * linux/include/asm-arm/processor.h
4 * Copyright (C) 1995-1999 Russell King
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
11 #ifndef __ASM_ARM_PROCESSOR_H
12 #define __ASM_ARM_PROCESSOR_H
15 * Default implementation of macro that returns current
16 * instruction pointer ("program counter").
18 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
20 #ifdef __KERNEL__
22 #include <asm/ptrace.h>
23 #include <asm/procinfo.h>
24 #include <asm/types.h>
26 #define KERNEL_STACK_SIZE PAGE_SIZE
28 union debug_insn {
29 u32 arm;
30 u16 thumb;
33 struct debug_entry {
34 u32 address;
35 union debug_insn insn;
38 struct debug_info {
39 int nsaved;
40 struct debug_entry bp[2];
43 struct thread_struct {
44 /* fault info */
45 unsigned long address;
46 unsigned long trap_no;
47 unsigned long error_code;
48 /* debugging */
49 struct debug_info debug;
52 #define INIT_THREAD { }
54 #define start_thread(regs,pc,sp) \
55 ({ \
56 unsigned long *stack = (unsigned long *)sp; \
57 set_fs(USER_DS); \
58 memzero(regs->uregs, sizeof(regs->uregs)); \
59 if (current->personality & ADDR_LIMIT_32BIT) \
60 regs->ARM_cpsr = USR_MODE; \
61 else \
62 regs->ARM_cpsr = USR26_MODE; \
63 if (elf_hwcap & HWCAP_THUMB && pc & 1) \
64 regs->ARM_cpsr |= PSR_T_BIT; \
65 regs->ARM_pc = pc & ~1; /* pc */ \
66 regs->ARM_sp = sp; /* sp */ \
67 regs->ARM_r2 = stack[2]; /* r2 (envp) */ \
68 regs->ARM_r1 = stack[1]; /* r1 (argv) */ \
69 regs->ARM_r0 = stack[0]; /* r0 (argc) */ \
72 /* Forward declaration, a strange C thing */
73 struct task_struct;
75 /* Free all resources held by a thread. */
76 extern void release_thread(struct task_struct *);
78 /* Prepare to copy thread state - unlazy all lazy status */
79 #define prepare_to_copy(tsk) do { } while (0)
81 unsigned long get_wchan(struct task_struct *p);
83 #define cpu_relax() barrier()
86 * Create a new kernel thread
88 extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
90 #define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)->thread_info))[1019])
91 #define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)->thread_info))[1017])
94 * Prefetching support - only ARMv5.
96 #if __LINUX_ARM_ARCH__ >= 5
98 #define ARCH_HAS_PREFETCH
99 #define prefetch(ptr) \
100 ({ \
101 __asm__ __volatile__( \
102 "pld\t%0" \
104 : "o" (*(char *)(ptr)) \
105 : "cc"); \
108 #define ARCH_HAS_PREFETCHW
109 #define prefetchw(ptr) prefetch(ptr)
111 #define ARCH_HAS_SPINLOCK_PREFETCH
112 #define spin_lock_prefetch(x) do { } while (0)
114 #endif
116 #endif
118 #endif /* __ASM_ARM_PROCESSOR_H */