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