xref: /openbmc/linux/arch/um/include/asm/processor-generic.h (revision b181f7029bd71238ac2754ce7052dffd69432085)
1f2f4bf5aSAlex Dewar /* SPDX-License-Identifier: GPL-2.0 */
28ede0bdbSAl Viro /*
38ede0bdbSAl Viro  * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
48ede0bdbSAl Viro  */
58ede0bdbSAl Viro 
68ede0bdbSAl Viro #ifndef __UM_PROCESSOR_GENERIC_H
78ede0bdbSAl Viro #define __UM_PROCESSOR_GENERIC_H
88ede0bdbSAl Viro 
98ede0bdbSAl Viro struct pt_regs;
108ede0bdbSAl Viro 
118ede0bdbSAl Viro struct task_struct;
128ede0bdbSAl Viro 
1337185b33SAl Viro #include <asm/ptrace.h>
1437185b33SAl Viro #include <sysdep/archsetjmp.h>
158ede0bdbSAl Viro 
16607647abSRichard Weinberger #include <linux/prefetch.h>
17607647abSRichard Weinberger 
18d8fb32f4SAnton Ivanov #include <asm/cpufeatures.h>
19d8fb32f4SAnton Ivanov 
208ede0bdbSAl Viro struct mm_struct;
218ede0bdbSAl Viro 
228ede0bdbSAl Viro struct thread_struct {
238ede0bdbSAl Viro 	struct pt_regs regs;
24f72c22e4SRichard Weinberger 	struct pt_regs *segv_regs;
258ede0bdbSAl Viro 	int singlestep_syscall;
268ede0bdbSAl Viro 	void *fault_addr;
278ede0bdbSAl Viro 	jmp_buf *fault_catcher;
288ede0bdbSAl Viro 	struct task_struct *prev_sched;
298ede0bdbSAl Viro 	struct arch_thread arch;
308ede0bdbSAl Viro 	jmp_buf switch_buf;
318ede0bdbSAl Viro 	struct {
328ede0bdbSAl Viro 		int op;
338ede0bdbSAl Viro 		union {
348ede0bdbSAl Viro 			struct {
358ede0bdbSAl Viro 				int pid;
368ede0bdbSAl Viro 			} fork, exec;
378ede0bdbSAl Viro 			struct {
388ede0bdbSAl Viro 				int (*proc)(void *);
398ede0bdbSAl Viro 				void *arg;
408ede0bdbSAl Viro 			} thread;
418ede0bdbSAl Viro 			struct {
428ede0bdbSAl Viro 				void (*proc)(void *);
438ede0bdbSAl Viro 				void *arg;
448ede0bdbSAl Viro 			} cb;
458ede0bdbSAl Viro 		} u;
468ede0bdbSAl Viro 	} request;
478ede0bdbSAl Viro };
488ede0bdbSAl Viro 
498ede0bdbSAl Viro #define INIT_THREAD \
508ede0bdbSAl Viro { \
518ede0bdbSAl Viro 	.regs		   	= EMPTY_REGS,	\
528ede0bdbSAl Viro 	.fault_addr		= NULL, \
538ede0bdbSAl Viro 	.prev_sched		= NULL, \
548ede0bdbSAl Viro 	.arch			= INIT_ARCH_THREAD, \
558ede0bdbSAl Viro 	.request		= { 0 } \
568ede0bdbSAl Viro }
578ede0bdbSAl Viro 
588ede0bdbSAl Viro /*
598ede0bdbSAl Viro  * User space process size: 3GB (default).
608ede0bdbSAl Viro  */
618ede0bdbSAl Viro extern unsigned long task_size;
628ede0bdbSAl Viro 
638ede0bdbSAl Viro #define TASK_SIZE (task_size)
648ede0bdbSAl Viro 
658ede0bdbSAl Viro #undef STACK_TOP
668ede0bdbSAl Viro #undef STACK_TOP_MAX
678ede0bdbSAl Viro 
688ede0bdbSAl Viro extern unsigned long stacksizelim;
698ede0bdbSAl Viro 
708ede0bdbSAl Viro #define STACK_ROOM	(stacksizelim)
718ede0bdbSAl Viro #define STACK_TOP	(TASK_SIZE - 2 * PAGE_SIZE)
728ede0bdbSAl Viro #define STACK_TOP_MAX	STACK_TOP
738ede0bdbSAl Viro 
748ede0bdbSAl Viro /* This decides where the kernel will search for a free chunk of vm
758ede0bdbSAl Viro  * space during mmap's.
768ede0bdbSAl Viro  */
778ede0bdbSAl Viro #define TASK_UNMAPPED_BASE	(0x40000000)
788ede0bdbSAl Viro 
798ede0bdbSAl Viro extern void start_thread(struct pt_regs *regs, unsigned long entry,
808ede0bdbSAl Viro 			 unsigned long stack);
818ede0bdbSAl Viro 
828ede0bdbSAl Viro struct cpuinfo_um {
838ede0bdbSAl Viro 	unsigned long loops_per_jiffy;
848ede0bdbSAl Viro 	int ipi_pipe[2];
85d8fb32f4SAnton Ivanov 	int cache_alignment;
86d8fb32f4SAnton Ivanov 	union {
87d8fb32f4SAnton Ivanov 		__u32		x86_capability[NCAPINTS + NBUGINTS];
88d8fb32f4SAnton Ivanov 		unsigned long	x86_capability_alignment;
89d8fb32f4SAnton Ivanov 	};
908ede0bdbSAl Viro };
918ede0bdbSAl Viro 
928ede0bdbSAl Viro extern struct cpuinfo_um boot_cpu_data;
938ede0bdbSAl Viro 
94*2f2be510SPeter Foley #define cpu_data(cpu)    boot_cpu_data
958ede0bdbSAl Viro #define current_cpu_data boot_cpu_data
96d8fb32f4SAnton Ivanov #define cache_line_size()	(boot_cpu_data.cache_alignment)
978ede0bdbSAl Viro 
988ede0bdbSAl Viro #define KSTK_REG(tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf)
9942a20f86SKees Cook extern unsigned long __get_wchan(struct task_struct *p);
1008ede0bdbSAl Viro 
1018ede0bdbSAl Viro #endif
102