18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef __UM_PROCESSOR_GENERIC_H
78c2ecf20Sopenharmony_ci#define __UM_PROCESSOR_GENERIC_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cistruct pt_regs;
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_cistruct task_struct;
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <asm/ptrace.h>
148c2ecf20Sopenharmony_ci#include <registers.h>
158c2ecf20Sopenharmony_ci#include <sysdep/archsetjmp.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#include <linux/prefetch.h>
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_cistruct mm_struct;
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_cistruct thread_struct {
228c2ecf20Sopenharmony_ci	struct pt_regs regs;
238c2ecf20Sopenharmony_ci	struct pt_regs *segv_regs;
248c2ecf20Sopenharmony_ci	int singlestep_syscall;
258c2ecf20Sopenharmony_ci	void *fault_addr;
268c2ecf20Sopenharmony_ci	jmp_buf *fault_catcher;
278c2ecf20Sopenharmony_ci	struct task_struct *prev_sched;
288c2ecf20Sopenharmony_ci	struct arch_thread arch;
298c2ecf20Sopenharmony_ci	jmp_buf switch_buf;
308c2ecf20Sopenharmony_ci	struct {
318c2ecf20Sopenharmony_ci		int op;
328c2ecf20Sopenharmony_ci		union {
338c2ecf20Sopenharmony_ci			struct {
348c2ecf20Sopenharmony_ci				int pid;
358c2ecf20Sopenharmony_ci			} fork, exec;
368c2ecf20Sopenharmony_ci			struct {
378c2ecf20Sopenharmony_ci				int (*proc)(void *);
388c2ecf20Sopenharmony_ci				void *arg;
398c2ecf20Sopenharmony_ci			} thread;
408c2ecf20Sopenharmony_ci			struct {
418c2ecf20Sopenharmony_ci				void (*proc)(void *);
428c2ecf20Sopenharmony_ci				void *arg;
438c2ecf20Sopenharmony_ci			} cb;
448c2ecf20Sopenharmony_ci		} u;
458c2ecf20Sopenharmony_ci	} request;
468c2ecf20Sopenharmony_ci};
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#define INIT_THREAD \
498c2ecf20Sopenharmony_ci{ \
508c2ecf20Sopenharmony_ci	.regs		   	= EMPTY_REGS,	\
518c2ecf20Sopenharmony_ci	.fault_addr		= NULL, \
528c2ecf20Sopenharmony_ci	.prev_sched		= NULL, \
538c2ecf20Sopenharmony_ci	.arch			= INIT_ARCH_THREAD, \
548c2ecf20Sopenharmony_ci	.request		= { 0 } \
558c2ecf20Sopenharmony_ci}
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_cistatic inline void release_thread(struct task_struct *task)
588c2ecf20Sopenharmony_ci{
598c2ecf20Sopenharmony_ci}
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_cistatic inline void mm_copy_segments(struct mm_struct *from_mm,
628c2ecf20Sopenharmony_ci				    struct mm_struct *new_mm)
638c2ecf20Sopenharmony_ci{
648c2ecf20Sopenharmony_ci}
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci/*
678c2ecf20Sopenharmony_ci * User space process size: 3GB (default).
688c2ecf20Sopenharmony_ci */
698c2ecf20Sopenharmony_ciextern unsigned long task_size;
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci#define TASK_SIZE (task_size)
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#undef STACK_TOP
748c2ecf20Sopenharmony_ci#undef STACK_TOP_MAX
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ciextern unsigned long stacksizelim;
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci#define STACK_ROOM	(stacksizelim)
798c2ecf20Sopenharmony_ci#define STACK_TOP	(TASK_SIZE - 2 * PAGE_SIZE)
808c2ecf20Sopenharmony_ci#define STACK_TOP_MAX	STACK_TOP
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci/* This decides where the kernel will search for a free chunk of vm
838c2ecf20Sopenharmony_ci * space during mmap's.
848c2ecf20Sopenharmony_ci */
858c2ecf20Sopenharmony_ci#define TASK_UNMAPPED_BASE	(0x40000000)
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ciextern void start_thread(struct pt_regs *regs, unsigned long entry,
888c2ecf20Sopenharmony_ci			 unsigned long stack);
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_cistruct cpuinfo_um {
918c2ecf20Sopenharmony_ci	unsigned long loops_per_jiffy;
928c2ecf20Sopenharmony_ci	int ipi_pipe[2];
938c2ecf20Sopenharmony_ci};
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ciextern struct cpuinfo_um boot_cpu_data;
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci#define cpu_data (&boot_cpu_data)
988c2ecf20Sopenharmony_ci#define current_cpu_data boot_cpu_data
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci#define KSTK_REG(tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf)
1018c2ecf20Sopenharmony_ciextern unsigned long get_wchan(struct task_struct *p);
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci#endif
104