1 /* SPDX-License-Identifier: GPL-2.0 */
3 * include/asm-m68k/processor.h
5 * Copyright (C) 1995 Hamish Macdonald
8 #ifndef __ASM_M68K_PROCESSOR_H
9 #define __ASM_M68K_PROCESSOR_H
12 * Default implementation of macro that returns current
13 * instruction pointer ("program counter").
15 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
17 #include <linux/thread_info.h>
18 #include <asm/segment.h>
20 #include <asm/ptrace.h>
22 static inline unsigned long rdusp(void)
24 #ifdef CONFIG_COLDFIRE_SW_A7
25 extern unsigned int sw_usp
;
28 register unsigned long usp
__asm__("a0");
30 __asm__
__volatile__(".word 0x4e68" : "=a" (usp
));
35 static inline void wrusp(unsigned long usp
)
37 #ifdef CONFIG_COLDFIRE_SW_A7
38 extern unsigned int sw_usp
;
41 register unsigned long a0
__asm__("a0") = usp
;
43 __asm__
__volatile__(".word 0x4e60" : : "a" (a0
) );
48 * User space process size: 3.75GB. This is hardcoded into a few places,
49 * so don't change it unless you know what you are doing.
52 #if defined(CONFIG_COLDFIRE)
53 #define TASK_SIZE (0xC0000000UL)
54 #elif defined(CONFIG_SUN3)
55 #define TASK_SIZE (0x0E000000UL)
57 #define TASK_SIZE (0xF0000000UL)
60 #define TASK_SIZE (0xFFFFFFFFUL)
64 #define STACK_TOP TASK_SIZE
65 #define STACK_TOP_MAX STACK_TOP
68 /* This decides where the kernel will search for a free chunk of vm
69 * space during mmap's.
72 #if defined(CONFIG_COLDFIRE)
73 #define TASK_UNMAPPED_BASE 0x60000000UL
74 #elif defined(CONFIG_SUN3)
75 #define TASK_UNMAPPED_BASE 0x0A000000UL
77 #define TASK_UNMAPPED_BASE 0xC0000000UL
79 #define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr)
81 #define TASK_UNMAPPED_BASE 0
84 struct thread_struct
{
85 unsigned long ksp
; /* kernel stack pointer */
86 unsigned long usp
; /* user stack pointer */
87 unsigned short sr
; /* saved status register */
88 unsigned short fs
; /* saved fs (sfc, dfc) */
89 unsigned long crp
[2]; /* cpu root pointer */
90 unsigned long esp0
; /* points to SR of stack frame */
91 unsigned long faddr
; /* info about last fault */
93 unsigned long fp
[8*3];
94 unsigned long fpcntl
[3]; /* fp control regs */
95 unsigned char fpstate
[FPSTATESIZE
]; /* floating point state */
98 #define INIT_THREAD { \
99 .ksp = sizeof(init_stack) + (unsigned long) init_stack, \
105 * ColdFire stack format sbould be 0x4 for an aligned usp (will always be
106 * true on thread creation). We need to set this explicitly.
108 #ifdef CONFIG_COLDFIRE
109 #define setframeformat(_regs) do { (_regs)->format = 0x4; } while(0)
111 #define setframeformat(_regs) do { } while (0)
115 * Do necessary setup to start up a newly executed thread.
117 static inline void start_thread(struct pt_regs
* regs
, unsigned long pc
,
122 setframeformat(regs
);
126 /* Forward declaration, a strange C thing */
129 /* Free all resources held by a thread. */
130 static inline void release_thread(struct task_struct
*dead_task
)
134 unsigned long get_wchan(struct task_struct
*p
);
136 #define KSTK_EIP(tsk) \
138 unsigned long eip = 0; \
139 if ((tsk)->thread.esp0 > PAGE_SIZE && \
140 (virt_addr_valid((tsk)->thread.esp0))) \
141 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
143 #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
145 #define task_pt_regs(tsk) ((struct pt_regs *) ((tsk)->thread.esp0))
147 #define cpu_relax() barrier()