]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - arch/m68k/include/asm/processor.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-bionic-kernel.git] / arch / m68k / include / asm / processor.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
633ea5d7
GU
2/*
3 * include/asm-m68k/processor.h
4 *
5 * Copyright (C) 1995 Hamish Macdonald
6 */
7
8#ifndef __ASM_M68K_PROCESSOR_H
9#define __ASM_M68K_PROCESSOR_H
10
11/*
12 * Default implementation of macro that returns current
13 * instruction pointer ("program counter").
14 */
15#define current_text_addr() ({ __label__ _l; _l: &&_l;})
16
17#include <linux/thread_info.h>
18#include <asm/segment.h>
19#include <asm/fpu.h>
20#include <asm/ptrace.h>
21
22static inline unsigned long rdusp(void)
23{
1c83af5f 24#ifdef CONFIG_COLDFIRE_SW_A7
633ea5d7
GU
25 extern unsigned int sw_usp;
26 return sw_usp;
49148020 27#else
1c83af5f
GU
28 register unsigned long usp __asm__("a0");
29 /* move %usp,%a0 */
30 __asm__ __volatile__(".word 0x4e68" : "=a" (usp));
633ea5d7
GU
31 return usp;
32#endif
33}
34
35static inline void wrusp(unsigned long usp)
36{
1c83af5f 37#ifdef CONFIG_COLDFIRE_SW_A7
633ea5d7
GU
38 extern unsigned int sw_usp;
39 sw_usp = usp;
40#else
1c83af5f
GU
41 register unsigned long a0 __asm__("a0") = usp;
42 /* move %a0,%usp */
43 __asm__ __volatile__(".word 0x4e60" : : "a" (a0) );
633ea5d7
GU
44#endif
45}
46
47/*
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.
50 */
cc24c405 51#ifdef CONFIG_MMU
2c9b82ad
GU
52#if defined(CONFIG_COLDFIRE)
53#define TASK_SIZE (0xC0000000UL)
54#elif defined(CONFIG_SUN3)
633ea5d7 55#define TASK_SIZE (0x0E000000UL)
2c9b82ad
GU
56#else
57#define TASK_SIZE (0xF0000000UL)
633ea5d7 58#endif
cc24c405
GU
59#else
60#define TASK_SIZE (0xFFFFFFFFUL)
61#endif
633ea5d7
GU
62
63#ifdef __KERNEL__
64#define STACK_TOP TASK_SIZE
65#define STACK_TOP_MAX STACK_TOP
66#endif
67
68/* This decides where the kernel will search for a free chunk of vm
69 * space during mmap's.
70 */
71#ifdef CONFIG_MMU
2c9b82ad
GU
72#if defined(CONFIG_COLDFIRE)
73#define TASK_UNMAPPED_BASE 0x60000000UL
74#elif defined(CONFIG_SUN3)
633ea5d7 75#define TASK_UNMAPPED_BASE 0x0A000000UL
2c9b82ad
GU
76#else
77#define TASK_UNMAPPED_BASE 0xC0000000UL
633ea5d7
GU
78#endif
79#define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr)
80#else
81#define TASK_UNMAPPED_BASE 0
82#endif
83
84struct 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 */
92 int signo, code;
93 unsigned long fp[8*3];
94 unsigned long fpcntl[3]; /* fp control regs */
95 unsigned char fpstate[FPSTATESIZE]; /* floating point state */
633ea5d7
GU
96};
97
98#define INIT_THREAD { \
99 .ksp = sizeof(init_stack) + (unsigned long) init_stack, \
100 .sr = PS_S, \
101 .fs = __KERNEL_DS, \
633ea5d7
GU
102}
103
0973c687
GU
104/*
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.
107 */
108#ifdef CONFIG_COLDFIRE
109#define setframeformat(_regs) do { (_regs)->format = 0x4; } while(0)
110#else
111#define setframeformat(_regs) do { } while (0)
112#endif
113
633ea5d7
GU
114/*
115 * Do necessary setup to start up a newly executed thread.
116 */
117static inline void start_thread(struct pt_regs * regs, unsigned long pc,
118 unsigned long usp)
119{
633ea5d7
GU
120 regs->pc = pc;
121 regs->sr &= ~0x2000;
0973c687 122 setframeformat(regs);
633ea5d7
GU
123 wrusp(usp);
124}
125
633ea5d7
GU
126/* Forward declaration, a strange C thing */
127struct task_struct;
128
129/* Free all resources held by a thread. */
130static inline void release_thread(struct task_struct *dead_task)
131{
132}
133
633ea5d7
GU
134unsigned long get_wchan(struct task_struct *p);
135
136#define KSTK_EIP(tsk) \
137 ({ \
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; \
142 eip; })
143#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
144
c23b6538
GU
145#define task_pt_regs(tsk) ((struct pt_regs *) ((tsk)->thread.esp0))
146
633ea5d7
GU
147#define cpu_relax() barrier()
148
49148020 149#endif