diff options
Diffstat (limited to 'arch/um/include')
-rw-r--r-- | arch/um/include/common-offsets.h | 4 | ||||
-rw-r--r-- | arch/um/include/os.h | 4 | ||||
-rw-r--r-- | arch/um/include/skas_ptregs.h | 6 | ||||
-rw-r--r-- | arch/um/include/sysdep-i386/sc.h | 44 | ||||
-rw-r--r-- | arch/um/include/sysdep-i386/sigcontext.h | 10 | ||||
-rw-r--r-- | arch/um/include/sysdep-i386/thread.h | 11 | ||||
-rw-r--r-- | arch/um/include/sysdep-x86_64/sc.h | 45 | ||||
-rw-r--r-- | arch/um/include/sysdep-x86_64/sigcontext.h | 5 | ||||
-rw-r--r-- | arch/um/include/sysdep-x86_64/thread.h | 10 | ||||
-rw-r--r-- | arch/um/include/task.h | 9 | ||||
-rw-r--r-- | arch/um/include/user.h | 4 |
11 files changed, 147 insertions, 5 deletions
diff --git a/arch/um/include/common-offsets.h b/arch/um/include/common-offsets.h index 782ac3a3baf9..356390d1f8b9 100644 --- a/arch/um/include/common-offsets.h +++ b/arch/um/include/common-offsets.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* for use by sys-$SUBARCH/kernel-offsets.c */ | 1 | /* for use by sys-$SUBARCH/kernel-offsets.c */ |
2 | 2 | ||
3 | OFFSET(TASK_REGS, task_struct, thread.regs); | 3 | OFFSET(HOST_TASK_REGS, task_struct, thread.regs); |
4 | OFFSET(TASK_PID, task_struct, pid); | 4 | OFFSET(HOST_TASK_PID, task_struct, pid); |
5 | DEFINE(UM_KERN_PAGE_SIZE, PAGE_SIZE); | 5 | DEFINE(UM_KERN_PAGE_SIZE, PAGE_SIZE); |
6 | DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC); | 6 | DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC); |
7 | DEFINE_STR(UM_KERN_EMERG, KERN_EMERG); | 7 | DEFINE_STR(UM_KERN_EMERG, KERN_EMERG); |
diff --git a/arch/um/include/os.h b/arch/um/include/os.h index 583329d0a539..6f766e1faecc 100644 --- a/arch/um/include/os.h +++ b/arch/um/include/os.h | |||
@@ -157,6 +157,10 @@ extern int os_lock_file(int fd, int excl); | |||
157 | extern void os_early_checks(void); | 157 | extern void os_early_checks(void); |
158 | extern int can_do_skas(void); | 158 | extern int can_do_skas(void); |
159 | 159 | ||
160 | /* Make sure they are clear when running in TT mode. Required by | ||
161 | * SEGV_MAYBE_FIXABLE */ | ||
162 | #define clear_can_do_skas() do { ptrace_faultinfo = proc_mm = 0; } while (0) | ||
163 | |||
160 | /* mem.c */ | 164 | /* mem.c */ |
161 | extern int create_mem_file(unsigned long len); | 165 | extern int create_mem_file(unsigned long len); |
162 | 166 | ||
diff --git a/arch/um/include/skas_ptregs.h b/arch/um/include/skas_ptregs.h new file mode 100644 index 000000000000..73db19e9c077 --- /dev/null +++ b/arch/um/include/skas_ptregs.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __SKAS_PT_REGS_ | ||
2 | #define __SKAS_PT_REGS_ | ||
3 | |||
4 | #include <user_constants.h> | ||
5 | |||
6 | #endif | ||
diff --git a/arch/um/include/sysdep-i386/sc.h b/arch/um/include/sysdep-i386/sc.h new file mode 100644 index 000000000000..c57d1780ad37 --- /dev/null +++ b/arch/um/include/sysdep-i386/sc.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef __SYSDEP_I386_SC_H | ||
2 | #define __SYSDEP_I386_SC_H | ||
3 | |||
4 | #include <user_constants.h> | ||
5 | |||
6 | #define SC_OFFSET(sc, field) \ | ||
7 | *((unsigned long *) &(((char *) (sc))[HOST_##field])) | ||
8 | #define SC_FP_OFFSET(sc, field) \ | ||
9 | *((unsigned long *) &(((char *) (SC_FPSTATE(sc)))[HOST_##field])) | ||
10 | #define SC_FP_OFFSET_PTR(sc, field, type) \ | ||
11 | ((type *) &(((char *) (SC_FPSTATE(sc)))[HOST_##field])) | ||
12 | |||
13 | #define SC_IP(sc) SC_OFFSET(sc, SC_IP) | ||
14 | #define SC_SP(sc) SC_OFFSET(sc, SC_SP) | ||
15 | #define SC_FS(sc) SC_OFFSET(sc, SC_FS) | ||
16 | #define SC_GS(sc) SC_OFFSET(sc, SC_GS) | ||
17 | #define SC_DS(sc) SC_OFFSET(sc, SC_DS) | ||
18 | #define SC_ES(sc) SC_OFFSET(sc, SC_ES) | ||
19 | #define SC_SS(sc) SC_OFFSET(sc, SC_SS) | ||
20 | #define SC_CS(sc) SC_OFFSET(sc, SC_CS) | ||
21 | #define SC_EFLAGS(sc) SC_OFFSET(sc, SC_EFLAGS) | ||
22 | #define SC_EAX(sc) SC_OFFSET(sc, SC_EAX) | ||
23 | #define SC_EBX(sc) SC_OFFSET(sc, SC_EBX) | ||
24 | #define SC_ECX(sc) SC_OFFSET(sc, SC_ECX) | ||
25 | #define SC_EDX(sc) SC_OFFSET(sc, SC_EDX) | ||
26 | #define SC_EDI(sc) SC_OFFSET(sc, SC_EDI) | ||
27 | #define SC_ESI(sc) SC_OFFSET(sc, SC_ESI) | ||
28 | #define SC_EBP(sc) SC_OFFSET(sc, SC_EBP) | ||
29 | #define SC_TRAPNO(sc) SC_OFFSET(sc, SC_TRAPNO) | ||
30 | #define SC_ERR(sc) SC_OFFSET(sc, SC_ERR) | ||
31 | #define SC_CR2(sc) SC_OFFSET(sc, SC_CR2) | ||
32 | #define SC_FPSTATE(sc) SC_OFFSET(sc, SC_FPSTATE) | ||
33 | #define SC_SIGMASK(sc) SC_OFFSET(sc, SC_SIGMASK) | ||
34 | #define SC_FP_CW(sc) SC_FP_OFFSET(sc, SC_FP_CW) | ||
35 | #define SC_FP_SW(sc) SC_FP_OFFSET(sc, SC_FP_SW) | ||
36 | #define SC_FP_TAG(sc) SC_FP_OFFSET(sc, SC_FP_TAG) | ||
37 | #define SC_FP_IPOFF(sc) SC_FP_OFFSET(sc, SC_FP_IPOFF) | ||
38 | #define SC_FP_CSSEL(sc) SC_FP_OFFSET(sc, SC_FP_CSSEL) | ||
39 | #define SC_FP_DATAOFF(sc) SC_FP_OFFSET(sc, SC_FP_DATAOFF) | ||
40 | #define SC_FP_DATASEL(sc) SC_FP_OFFSET(sc, SC_FP_DATASEL) | ||
41 | #define SC_FP_ST(sc) SC_FP_OFFSET_PTR(sc, SC_FP_ST, struct _fpstate) | ||
42 | #define SC_FXSR_ENV(sc) SC_FP_OFFSET_PTR(sc, SC_FXSR_ENV, void) | ||
43 | |||
44 | #endif | ||
diff --git a/arch/um/include/sysdep-i386/sigcontext.h b/arch/um/include/sysdep-i386/sigcontext.h index 1fe729265167..23fd2644d7ed 100644 --- a/arch/um/include/sysdep-i386/sigcontext.h +++ b/arch/um/include/sysdep-i386/sigcontext.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #ifndef __SYS_SIGCONTEXT_I386_H | 6 | #ifndef __SYS_SIGCONTEXT_I386_H |
7 | #define __SYS_SIGCONTEXT_I386_H | 7 | #define __SYS_SIGCONTEXT_I386_H |
8 | 8 | ||
9 | #include "uml-config.h" | ||
9 | #include <sysdep/sc.h> | 10 | #include <sysdep/sc.h> |
10 | 11 | ||
11 | #define IP_RESTART_SYSCALL(ip) ((ip) -= 2) | 12 | #define IP_RESTART_SYSCALL(ip) ((ip) -= 2) |
@@ -26,7 +27,14 @@ | |||
26 | #define SC_START_SYSCALL(sc) do SC_EAX(sc) = -ENOSYS; while(0) | 27 | #define SC_START_SYSCALL(sc) do SC_EAX(sc) = -ENOSYS; while(0) |
27 | 28 | ||
28 | /* This is Page Fault */ | 29 | /* This is Page Fault */ |
29 | #define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) | 30 | #define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) |
31 | |||
32 | /* SKAS3 has no trap_no on i386, but get_skas_faultinfo() sets it to 0. */ | ||
33 | #ifdef UML_CONFIG_MODE_SKAS | ||
34 | #define SEGV_MAYBE_FIXABLE(fi) ((fi)->trap_no == 0 && ptrace_faultinfo) | ||
35 | #else | ||
36 | #define SEGV_MAYBE_FIXABLE(fi) 0 | ||
37 | #endif | ||
30 | 38 | ||
31 | extern unsigned long *sc_sigmask(void *sc_ptr); | 39 | extern unsigned long *sc_sigmask(void *sc_ptr); |
32 | extern int sc_get_fpregs(unsigned long buf, void *sc_ptr); | 40 | extern int sc_get_fpregs(unsigned long buf, void *sc_ptr); |
diff --git a/arch/um/include/sysdep-i386/thread.h b/arch/um/include/sysdep-i386/thread.h new file mode 100644 index 000000000000..e2bd6bae8b8a --- /dev/null +++ b/arch/um/include/sysdep-i386/thread.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef __UM_THREAD_H | ||
2 | #define __UM_THREAD_H | ||
3 | |||
4 | #include <kern_constants.h> | ||
5 | |||
6 | #define TASK_DEBUGREGS(task) ((unsigned long *) &(((char *) (task))[HOST_TASK_DEBUGREGS])) | ||
7 | #ifdef CONFIG_MODE_TT | ||
8 | #define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[HOST_TASK_EXTERN_PID])) | ||
9 | #endif | ||
10 | |||
11 | #endif | ||
diff --git a/arch/um/include/sysdep-x86_64/sc.h b/arch/um/include/sysdep-x86_64/sc.h new file mode 100644 index 000000000000..a160d9fcc596 --- /dev/null +++ b/arch/um/include/sysdep-x86_64/sc.h | |||
@@ -0,0 +1,45 @@ | |||
1 | #ifndef __SYSDEP_X86_64_SC_H | ||
2 | #define __SYSDEP_X86_64_SC_H | ||
3 | |||
4 | /* Copyright (C) 2003 - 2004 PathScale, Inc | ||
5 | * Released under the GPL | ||
6 | */ | ||
7 | |||
8 | #include <user_constants.h> | ||
9 | |||
10 | #define SC_OFFSET(sc, field) \ | ||
11 | *((unsigned long *) &(((char *) (sc))[HOST_##field])) | ||
12 | |||
13 | #define SC_RBX(sc) SC_OFFSET(sc, SC_RBX) | ||
14 | #define SC_RCX(sc) SC_OFFSET(sc, SC_RCX) | ||
15 | #define SC_RDX(sc) SC_OFFSET(sc, SC_RDX) | ||
16 | #define SC_RSI(sc) SC_OFFSET(sc, SC_RSI) | ||
17 | #define SC_RDI(sc) SC_OFFSET(sc, SC_RDI) | ||
18 | #define SC_RBP(sc) SC_OFFSET(sc, SC_RBP) | ||
19 | #define SC_RAX(sc) SC_OFFSET(sc, SC_RAX) | ||
20 | #define SC_R8(sc) SC_OFFSET(sc, SC_R8) | ||
21 | #define SC_R9(sc) SC_OFFSET(sc, SC_R9) | ||
22 | #define SC_R10(sc) SC_OFFSET(sc, SC_R10) | ||
23 | #define SC_R11(sc) SC_OFFSET(sc, SC_R11) | ||
24 | #define SC_R12(sc) SC_OFFSET(sc, SC_R12) | ||
25 | #define SC_R13(sc) SC_OFFSET(sc, SC_R13) | ||
26 | #define SC_R14(sc) SC_OFFSET(sc, SC_R14) | ||
27 | #define SC_R15(sc) SC_OFFSET(sc, SC_R15) | ||
28 | #define SC_IP(sc) SC_OFFSET(sc, SC_IP) | ||
29 | #define SC_SP(sc) SC_OFFSET(sc, SC_SP) | ||
30 | #define SC_CR2(sc) SC_OFFSET(sc, SC_CR2) | ||
31 | #define SC_ERR(sc) SC_OFFSET(sc, SC_ERR) | ||
32 | #define SC_TRAPNO(sc) SC_OFFSET(sc, SC_TRAPNO) | ||
33 | #define SC_CS(sc) SC_OFFSET(sc, SC_CS) | ||
34 | #define SC_FS(sc) SC_OFFSET(sc, SC_FS) | ||
35 | #define SC_GS(sc) SC_OFFSET(sc, SC_GS) | ||
36 | #define SC_EFLAGS(sc) SC_OFFSET(sc, SC_EFLAGS) | ||
37 | #define SC_SIGMASK(sc) SC_OFFSET(sc, SC_SIGMASK) | ||
38 | #if 0 | ||
39 | #define SC_ORIG_RAX(sc) SC_OFFSET(sc, SC_ORIG_RAX) | ||
40 | #define SC_DS(sc) SC_OFFSET(sc, SC_DS) | ||
41 | #define SC_ES(sc) SC_OFFSET(sc, SC_ES) | ||
42 | #define SC_SS(sc) SC_OFFSET(sc, SC_SS) | ||
43 | #endif | ||
44 | |||
45 | #endif | ||
diff --git a/arch/um/include/sysdep-x86_64/sigcontext.h b/arch/um/include/sysdep-x86_64/sigcontext.h index 2a78260d15a0..41073235e7ad 100644 --- a/arch/um/include/sysdep-x86_64/sigcontext.h +++ b/arch/um/include/sysdep-x86_64/sigcontext.h | |||
@@ -31,7 +31,10 @@ | |||
31 | #define SC_START_SYSCALL(sc) do SC_RAX(sc) = -ENOSYS; while(0) | 31 | #define SC_START_SYSCALL(sc) do SC_RAX(sc) = -ENOSYS; while(0) |
32 | 32 | ||
33 | /* This is Page Fault */ | 33 | /* This is Page Fault */ |
34 | #define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) | 34 | #define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) |
35 | |||
36 | /* No broken SKAS API, which doesn't pass trap_no, here. */ | ||
37 | #define SEGV_MAYBE_FIXABLE(fi) 0 | ||
35 | 38 | ||
36 | extern unsigned long *sc_sigmask(void *sc_ptr); | 39 | extern unsigned long *sc_sigmask(void *sc_ptr); |
37 | 40 | ||
diff --git a/arch/um/include/sysdep-x86_64/thread.h b/arch/um/include/sysdep-x86_64/thread.h new file mode 100644 index 000000000000..6a76a7f3683f --- /dev/null +++ b/arch/um/include/sysdep-x86_64/thread.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef __UM_THREAD_H | ||
2 | #define __UM_THREAD_H | ||
3 | |||
4 | #include <kern_constants.h> | ||
5 | |||
6 | #ifdef CONFIG_MODE_TT | ||
7 | #define TASK_EXTERN_PID(task) *((int *) &(((char *) (task))[HOST_TASK_EXTERN_PID])) | ||
8 | #endif | ||
9 | |||
10 | #endif | ||
diff --git a/arch/um/include/task.h b/arch/um/include/task.h new file mode 100644 index 000000000000..6375ba7203c9 --- /dev/null +++ b/arch/um/include/task.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef __TASK_H | ||
2 | #define __TASK_H | ||
3 | |||
4 | #include <kern_constants.h> | ||
5 | |||
6 | #define TASK_REGS(task) ((union uml_pt_regs *) &(((char *) (task))[HOST_TASK_REGS])) | ||
7 | #define TASK_PID(task) *((int *) &(((char *) (task))[HOST_TASK_PID])) | ||
8 | |||
9 | #endif | ||
diff --git a/arch/um/include/user.h b/arch/um/include/user.h index 57ee9e261228..0f865ef46918 100644 --- a/arch/um/include/user.h +++ b/arch/um/include/user.h | |||
@@ -14,7 +14,9 @@ extern void *um_kmalloc_atomic(int size); | |||
14 | extern void kfree(void *ptr); | 14 | extern void kfree(void *ptr); |
15 | extern int in_aton(char *str); | 15 | extern int in_aton(char *str); |
16 | extern int open_gdb_chan(void); | 16 | extern int open_gdb_chan(void); |
17 | extern int strlcpy(char *, const char *, int); | 17 | /* These use size_t, however unsigned long is correct on both i386 and x86_64. */ |
18 | extern unsigned long strlcpy(char *, const char *, unsigned long); | ||
19 | extern unsigned long strlcat(char *, const char *, unsigned long); | ||
18 | extern void *um_vmalloc(int size); | 20 | extern void *um_vmalloc(int size); |
19 | extern void vfree(void *ptr); | 21 | extern void vfree(void *ptr); |
20 | 22 | ||