locking/core: Introduce cpu_relax_yield()
[linux-2.6-block.git] / arch / microblaze / include / asm / processor.h
CommitLineData
4511ec15 1/*
5233806d
MS
2 * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
3 * Copyright (C) 2008-2009 PetaLogix
4511ec15
MS
4 * Copyright (C) 2006 Atmark Techno, Inc.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#ifndef _ASM_MICROBLAZE_PROCESSOR_H
12#define _ASM_MICROBLAZE_PROCESSOR_H
13
14#include <asm/ptrace.h>
15#include <asm/setup.h>
16#include <asm/registers.h>
2921e2bd
MS
17#include <asm/entry.h>
18#include <asm/current.h>
4511ec15
MS
19
20# ifndef __ASSEMBLY__
21/* from kernel/cpu/mb.c */
22extern const struct seq_operations cpuinfo_op;
23
24# define cpu_relax() barrier()
79ab11cd 25# define cpu_relax_yield() cpu_relax()
3a6bfbc9 26# define cpu_relax_lowlatency() cpu_relax()
4511ec15 27
2eba318e
MS
28#define task_pt_regs(tsk) \
29 (((struct pt_regs *)(THREAD_SIZE + task_stack_page(tsk))) - 1)
30
e1c4bd08
MS
31/* Do necessary setup to start up a newly executed thread. */
32void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp);
33
0dd90aa9 34extern void ret_from_fork(void);
2319295d 35extern void ret_from_kernel_thread(void);
0dd90aa9 36
5233806d
MS
37# endif /* __ASSEMBLY__ */
38
39# ifndef CONFIG_MMU
4511ec15
MS
40/*
41 * User space process size: memory size
42 *
43 * TASK_SIZE on MMU cpu is usually 1GB. However, on no-MMU arch, both
44 * user processes and the kernel is on the same memory region. They
45 * both share the memory space and that is limited by the amount of
46 * physical memory. thus, we set TASK_SIZE == amount of total memory.
47 */
48# define TASK_SIZE (0x81000000 - 0x80000000)
49
50/*
51 * Default implementation of macro that returns current
52 * instruction pointer ("program counter").
53 */
54# define current_text_addr() ({ __label__ _l; _l: &&_l; })
55
56/*
57 * This decides where the kernel will search for a free chunk of vm
58 * space during mmap's. We won't be using it
59 */
60# define TASK_UNMAPPED_BASE 0
61
62/* definition in include/linux/sched.h */
63struct task_struct;
64
65/* thread_struct is gone. use thread_info instead. */
66struct thread_struct { };
67# define INIT_THREAD { }
68
4511ec15
MS
69/* Free all resources held by a thread. */
70static inline void release_thread(struct task_struct *dead_task)
71{
72}
73
4511ec15
MS
74extern unsigned long thread_saved_pc(struct task_struct *t);
75
76extern unsigned long get_wchan(struct task_struct *p);
77
4511ec15
MS
78# define KSTK_EIP(tsk) (0)
79# define KSTK_ESP(tsk) (0)
80
5233806d
MS
81# else /* CONFIG_MMU */
82
83/*
84 * This is used to define STACK_TOP, and with MMU it must be below
85 * kernel base to select the correct PGD when handling MMU exceptions.
86 */
87# define TASK_SIZE (CONFIG_KERNEL_START)
88
89/*
90 * This decides where the kernel will search for a free chunk of vm
91 * space during mmap's.
92 */
93# define TASK_UNMAPPED_BASE (TASK_SIZE / 8 * 3)
94
95# define THREAD_KSP 0
96
97# ifndef __ASSEMBLY__
98
99/*
100 * Default implementation of macro that returns current
101 * instruction pointer ("program counter").
102 */
103# define current_text_addr() ({ __label__ _l; _l: &&_l; })
104
105/* If you change this, you must change the associated assembly-languages
106 * constants defined below, THREAD_*.
107 */
108struct thread_struct {
109 /* kernel stack pointer (must be first field in structure) */
110 unsigned long ksp;
111 unsigned long ksp_limit; /* if ksp <= ksp_limit stack overflow */
112 void *pgdir; /* root of page-table tree */
113 struct pt_regs *regs; /* Pointer to saved register state */
114};
115
116# define INIT_THREAD { \
117 .ksp = sizeof init_stack + (unsigned long)init_stack, \
118 .pgdir = swapper_pg_dir, \
119}
120
5233806d 121/* Free all resources held by a thread. */
ace526eb 122static inline void release_thread(struct task_struct *dead_task)
5233806d
MS
123{
124}
125
5233806d
MS
126/* Return saved (kernel) PC of a blocked thread. */
127# define thread_saved_pc(tsk) \
128 ((tsk)->thread.regs ? (tsk)->thread.regs->r15 : 0)
129
130unsigned long get_wchan(struct task_struct *p);
131
132/* The size allocated for kernel stacks. This _must_ be a power of two! */
133# define KERNEL_STACK_SIZE 0x2000
134
135/* Return some info about the user process TASK. */
136# define task_tos(task) ((unsigned long)(task) + KERNEL_STACK_SIZE)
137# define task_regs(task) ((struct pt_regs *)task_tos(task) - 1)
138
139# define task_pt_regs_plus_args(tsk) \
6e83557c 140 ((void *)task_pt_regs(tsk))
5233806d
MS
141
142# define task_sp(task) (task_regs(task)->r1)
143# define task_pc(task) (task_regs(task)->pc)
144/* Grotty old names for some. */
145# define KSTK_EIP(task) (task_pc(task))
146# define KSTK_ESP(task) (task_sp(task))
147
148/* FIXME */
149# define deactivate_mm(tsk, mm) do { } while (0)
150
151# define STACK_TOP TASK_SIZE
152# define STACK_TOP_MAX STACK_TOP
153
c40d04df
DH
154#ifdef CONFIG_DEBUG_FS
155extern struct dentry *of_debugfs_root;
156#endif
157
5233806d
MS
158# endif /* __ASSEMBLY__ */
159# endif /* CONFIG_MMU */
4511ec15 160#endif /* _ASM_MICROBLAZE_PROCESSOR_H */