Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* 
0003  * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
0004  */
0005 
0006 #ifndef __UM_PROCESSOR_GENERIC_H
0007 #define __UM_PROCESSOR_GENERIC_H
0008 
0009 struct pt_regs;
0010 
0011 struct task_struct;
0012 
0013 #include <asm/ptrace.h>
0014 #include <sysdep/archsetjmp.h>
0015 
0016 #include <linux/prefetch.h>
0017 
0018 #include <asm/cpufeatures.h>
0019 
0020 struct mm_struct;
0021 
0022 struct thread_struct {
0023     struct pt_regs regs;
0024     struct pt_regs *segv_regs;
0025     int singlestep_syscall;
0026     void *fault_addr;
0027     jmp_buf *fault_catcher;
0028     struct task_struct *prev_sched;
0029     struct arch_thread arch;
0030     jmp_buf switch_buf;
0031     struct {
0032         int op;
0033         union {
0034             struct {
0035                 int pid;
0036             } fork, exec;
0037             struct {
0038                 int (*proc)(void *);
0039                 void *arg;
0040             } thread;
0041             struct {
0042                 void (*proc)(void *);
0043                 void *arg;
0044             } cb;
0045         } u;
0046     } request;
0047 };
0048 
0049 #define INIT_THREAD \
0050 { \
0051     .regs           = EMPTY_REGS,   \
0052     .fault_addr     = NULL, \
0053     .prev_sched     = NULL, \
0054     .arch           = INIT_ARCH_THREAD, \
0055     .request        = { 0 } \
0056 }
0057 
0058 static inline void release_thread(struct task_struct *task)
0059 {
0060 }
0061 
0062 /*
0063  * User space process size: 3GB (default).
0064  */
0065 extern unsigned long task_size;
0066 
0067 #define TASK_SIZE (task_size)
0068 
0069 #undef STACK_TOP
0070 #undef STACK_TOP_MAX
0071 
0072 extern unsigned long stacksizelim;
0073 
0074 #define STACK_ROOM  (stacksizelim)
0075 #define STACK_TOP   (TASK_SIZE - 2 * PAGE_SIZE)
0076 #define STACK_TOP_MAX   STACK_TOP
0077 
0078 /* This decides where the kernel will search for a free chunk of vm
0079  * space during mmap's.
0080  */
0081 #define TASK_UNMAPPED_BASE  (0x40000000)
0082 
0083 extern void start_thread(struct pt_regs *regs, unsigned long entry, 
0084              unsigned long stack);
0085 
0086 struct cpuinfo_um {
0087     unsigned long loops_per_jiffy;
0088     int ipi_pipe[2];
0089     int cache_alignment;
0090     union {
0091         __u32       x86_capability[NCAPINTS + NBUGINTS];
0092         unsigned long   x86_capability_alignment;
0093     };
0094 };
0095 
0096 extern struct cpuinfo_um boot_cpu_data;
0097 
0098 #define cpu_data (&boot_cpu_data)
0099 #define current_cpu_data boot_cpu_data
0100 #define cache_line_size()   (boot_cpu_data.cache_alignment)
0101 
0102 extern unsigned long get_thread_reg(int reg, jmp_buf *buf);
0103 #define KSTK_REG(tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf)
0104 extern unsigned long __get_wchan(struct task_struct *p);
0105 
0106 #endif