blob: 445d4495be17a96db05417fa08b08f08741ff6b9 [file] [log] [blame]
wdenkbb2d9272003-06-25 22:26:29 +00001/*
2 * linux/include/asm-arm/processor.h
3 *
4 * Copyright (C) 1995-2002 Russell King
5 *
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 */
10
11#ifndef __ASM_ARM_PROCESSOR_H
12#define __ASM_ARM_PROCESSOR_H
13
14/*
15 * Default implementation of macro that returns current
16 * instruction pointer ("program counter").
17 */
18#define current_text_addr() ({ __label__ _l; _l: &&_l;})
19
20#define FP_SIZE 35
21
22struct fp_hard_struct {
23 unsigned int save[FP_SIZE]; /* as yet undefined */
24};
25
26struct fp_soft_struct {
27 unsigned int save[FP_SIZE]; /* undefined information */
28};
29
30union fp_state {
31 struct fp_hard_struct hard;
32 struct fp_soft_struct soft;
33};
34
35typedef unsigned long mm_segment_t; /* domain register */
36
37#ifdef __KERNEL__
38
39#define EISA_bus 0
40#define MCA_bus 0
41#define MCA_bus__is_a_macro
42
43#include <asm/atomic.h>
44#include <asm/ptrace.h>
45#if 0 /* XXX###XXX */
46#include <asm/arch/memory.h>
47#endif /* XXX###XXX */
48#include <asm/proc/processor.h>
49#include <asm/types.h>
50
51union debug_insn {
52 u32 arm;
53 u16 thumb;
54};
55
56struct debug_entry {
57 u32 address;
58 union debug_insn insn;
59};
60
61struct debug_info {
62 int nsaved;
63 struct debug_entry bp[2];
64};
65
66struct thread_struct {
67 atomic_t refcount;
68 /* fault info */
69 unsigned long address;
70 unsigned long trap_no;
71 unsigned long error_code;
72 /* floating point */
73 union fp_state fpstate;
74 /* debugging */
75 struct debug_info debug;
76 /* context info */
77 struct context_save_struct *save;
78 EXTRA_THREAD_STRUCT
79};
80
81#define INIT_THREAD { \
82 refcount: ATOMIC_INIT(1), \
83 EXTRA_THREAD_STRUCT_INIT \
84}
85
86/*
87 * Return saved PC of a blocked thread.
88 */
89static inline unsigned long thread_saved_pc(struct thread_struct *t)
90{
91 return t->save ? pc_pointer(t->save->pc) : 0;
92}
93
94static inline unsigned long thread_saved_fp(struct thread_struct *t)
95{
96 return t->save ? t->save->fp : 0;
97}
98
99/* Forward declaration, a strange C thing */
100struct task_struct;
101
102/* Free all resources held by a thread. */
103extern void release_thread(struct task_struct *);
104
105/* Copy and release all segment info associated with a VM */
106#define copy_segments(tsk, mm) do { } while (0)
107#define release_segments(mm) do { } while (0)
108
109unsigned long get_wchan(struct task_struct *p);
110
111#define THREAD_SIZE (8192)
112
113extern struct task_struct *alloc_task_struct(void);
114extern void __free_task_struct(struct task_struct *);
115#define get_task_struct(p) atomic_inc(&(p)->thread.refcount)
116#define free_task_struct(p) \
117 do { \
118 if (atomic_dec_and_test(&(p)->thread.refcount)) \
119 __free_task_struct((p)); \
120 } while (0)
121
122#define init_task (init_task_union.task)
123#define init_stack (init_task_union.stack)
124
125#define cpu_relax() barrier()
126
127/*
128 * Create a new kernel thread
129 */
130extern int arch_kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
131
132#endif
133
134#endif /* __ASM_ARM_PROCESSOR_H */