2 * linux/include/asm-arm/processor.h
4 * Copyright (C) 1995 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.
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;})
22 struct fp_hard_struct
{
23 unsigned int save
[FP_SIZE
]; /* as yet undefined */
26 struct fp_soft_struct
{
27 unsigned int save
[FP_SIZE
]; /* undefined information */
31 struct fp_hard_struct hard
;
32 struct fp_soft_struct soft
;
35 typedef unsigned long mm_segment_t
; /* domain register */
42 #include <asm/atomic.h>
43 #include <asm/ptrace.h>
44 #include <asm/arch/memory.h>
45 #include <asm/proc/processor.h>
50 unsigned long address
;
55 struct thread_struct
{
58 unsigned long address
;
59 unsigned long trap_no
;
60 unsigned long error_code
;
62 union fp_state fpstate
;
64 struct debug_info debug
;
66 struct context_save_struct
*save
;
72 vm_page_prot: PAGE_SHARED, \
73 vm_flags: VM_READ | VM_WRITE | VM_EXEC, \
77 #define INIT_THREAD { \
78 refcount: ATOMIC_INIT(1), \
79 EXTRA_THREAD_STRUCT_INIT \
83 * Return saved PC of a blocked thread.
85 extern __inline__
unsigned long thread_saved_pc(struct thread_struct
*t
)
87 return t
->save
? pc_pointer(t
->save
->pc
) : 0;
90 extern __inline__
unsigned long get_css_fp(struct thread_struct
*t
)
92 return t
->save
? t
->save
->fp
: 0;
95 asmlinkage
void ret_from_sys_call(void) __asm__("ret_from_sys_call");
97 extern __inline__
void init_thread_css(struct context_save_struct
*save
)
100 save
->pc
|= (unsigned long)ret_from_sys_call
;
103 /* Forward declaration, a strange C thing */
106 /* Free all resources held by a thread. */
107 extern void release_thread(struct task_struct
*);
109 unsigned long get_wchan(struct task_struct
*p
);
111 #define THREAD_SIZE (8192)
113 extern struct task_struct
*alloc_task_struct(void);
114 extern void __free_task_struct(struct task_struct
*);
115 #define get_task_struct(p) atomic_inc(&(p)->thread.refcount)
116 #define free_task_struct(p) \
118 if (atomic_dec_and_test(&(p)->thread.refcount)) \
119 __free_task_struct((p)); \
122 #define init_task (init_task_union.task)
123 #define init_stack (init_task_union.stack)
126 * Create a new kernel thread
128 extern int kernel_thread(int (*fn
)(void *), void *arg
, unsigned long flags
);
132 #endif /* __ASM_ARM_PROCESSOR_H */