1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
4 * Copyright (C) 2008-2009 PetaLogix
5 * Copyright (C) 2006 Atmark Techno, Inc.
8 #ifndef _ASM_MICROBLAZE_PROCESSOR_H
9 #define _ASM_MICROBLAZE_PROCESSOR_H
11 #include <asm/ptrace.h>
12 #include <asm/setup.h>
13 #include <asm/registers.h>
14 #include <asm/entry.h>
15 #include <asm/current.h>
18 /* from kernel/cpu/mb.c */
19 extern const struct seq_operations cpuinfo_op
;
21 # define cpu_relax() barrier()
23 #define task_pt_regs(tsk) \
24 (((struct pt_regs *)(THREAD_SIZE + task_stack_page(tsk))) - 1)
26 /* Do necessary setup to start up a newly executed thread. */
27 void start_thread(struct pt_regs
*regs
, unsigned long pc
, unsigned long usp
);
29 extern void ret_from_fork(void);
30 extern void ret_from_kernel_thread(void);
32 # endif /* __ASSEMBLY__ */
35 * This is used to define STACK_TOP, and with MMU it must be below
36 * kernel base to select the correct PGD when handling MMU exceptions.
38 # define TASK_SIZE (CONFIG_KERNEL_START)
41 * This decides where the kernel will search for a free chunk of vm
42 * space during mmap's.
44 # define TASK_UNMAPPED_BASE (TASK_SIZE / 8 * 3)
50 /* If you change this, you must change the associated assembly-languages
51 * constants defined below, THREAD_*.
53 struct thread_struct
{
54 /* kernel stack pointer (must be first field in structure) */
56 unsigned long ksp_limit
; /* if ksp <= ksp_limit stack overflow */
57 void *pgdir
; /* root of page-table tree */
58 struct pt_regs
*regs
; /* Pointer to saved register state */
61 # define INIT_THREAD { \
62 .ksp = sizeof init_stack + (unsigned long)init_stack, \
63 .pgdir = swapper_pg_dir, \
66 /* Free all resources held by a thread. */
67 static inline void release_thread(struct task_struct
*dead_task
)
71 unsigned long get_wchan(struct task_struct
*p
);
73 /* The size allocated for kernel stacks. This _must_ be a power of two! */
74 # define KERNEL_STACK_SIZE 0x2000
76 /* Return some info about the user process TASK. */
77 # define task_tos(task) ((unsigned long)(task) + KERNEL_STACK_SIZE)
78 # define task_regs(task) ((struct pt_regs *)task_tos(task) - 1)
80 # define task_pt_regs_plus_args(tsk) \
81 ((void *)task_pt_regs(tsk))
83 # define task_sp(task) (task_regs(task)->r1)
84 # define task_pc(task) (task_regs(task)->pc)
85 /* Grotty old names for some. */
86 # define KSTK_EIP(task) (task_pc(task))
87 # define KSTK_ESP(task) (task_sp(task))
89 # define STACK_TOP TASK_SIZE
90 # define STACK_TOP_MAX STACK_TOP
92 #ifdef CONFIG_DEBUG_FS
93 extern struct dentry
*of_debugfs_root
;
96 # endif /* __ASSEMBLY__ */
97 #endif /* _ASM_MICROBLAZE_PROCESSOR_H */