x86/vm86: Move vm86 fields out of 'thread_struct'
[deliverable/linux.git] / arch / x86 / include / asm / vm86.h
CommitLineData
1965aae3
PA
1#ifndef _ASM_X86_VM86_H
2#define _ASM_X86_VM86_H
1da177e4 3
6330a30a 4#include <asm/ptrace.h>
af170c50 5#include <uapi/asm/vm86.h>
9831bfb2 6
1da177e4
LT
7/*
8 * This is the (kernel) stack-layout when we have done a "SAVE_ALL" from vm86
9 * mode - the main change is that the old segment descriptors aren't
10 * useful any more and are forced to be zero by the kernel (and the
11 * hardware when a trap occurs), and the real segment descriptors are
12 * at the end of the structure. Look at ptrace.h to see the "normal"
13 * setup. For user space layout see 'struct vm86_regs' above.
14 */
15
16struct kernel_vm86_regs {
17/*
18 * normal regs, with special meaning for the segment descriptors..
19 */
49d26b6e 20 struct pt_regs pt;
1da177e4
LT
21/*
22 * these are specific to v86 mode:
23 */
24 unsigned short es, __esh;
25 unsigned short ds, __dsh;
26 unsigned short fs, __fsh;
27 unsigned short gs, __gsh;
28};
29
30struct kernel_vm86_struct {
31 struct kernel_vm86_regs regs;
32/*
33 * the below part remains on the kernel stack while we are in VM86 mode.
34 * 'tss.esp0' then contains the address of VM86_TSS_ESP0 below, and when we
35 * get forced back from VM86, the CPU and "SAVE_ALL" will restore the above
36 * 'struct kernel_vm86_regs' with the then actual values.
37 * Therefore, pt_regs in fact points to a complete 'kernel_vm86_struct'
38 * in kernelspace, hence we need not reget the data from userspace.
39 */
40#define VM86_TSS_ESP0 flags
41 unsigned long flags;
42 unsigned long screen_bitmap;
43 unsigned long cpu_type;
44 struct revectored_struct int_revectored;
45 struct revectored_struct int21_revectored;
46 struct vm86plus_info_struct vm86plus;
47 struct pt_regs *regs32; /* here we save the pointer to the old regs */
48/*
49 * The below is not part of the structure, but the stack layout continues
50 * this way. In front of 'return-eip' may be some data, depending on
51 * compilation, so we don't rely on this and save the pointer to 'oldregs'
52 * in 'regs32' above.
53 * However, with GCC-2.7.2 and the current CFLAGS you see exactly this:
54
55 long return-eip; from call to vm86()
56 struct pt_regs oldregs; user space registers as saved by syscall
57 */
58};
59
9fda6a06
BG
60struct vm86 {
61 struct vm86plus_struct __user *vm86_info;
62 unsigned long screen_bitmap;
63 unsigned long v86flags;
64 unsigned long v86mask;
65 unsigned long saved_sp0;
66};
67
64ca9004
MM
68#ifdef CONFIG_VM86
69
1da177e4
LT
70void handle_vm86_fault(struct kernel_vm86_regs *, long);
71int handle_vm86_trap(struct kernel_vm86_regs *, long, int);
e04f99c9 72struct pt_regs *save_v86_state(struct kernel_vm86_regs *);
1da177e4 73
64ca9004
MM
74struct task_struct;
75void release_vm86_irqs(struct task_struct *);
76
9fda6a06
BG
77#define free_vm86(t) do { \
78 struct thread_struct *__t = (t); \
79 if (__t->vm86 != NULL) { \
80 kfree(__t->vm86); \
81 __t->vm86 = NULL; \
82 } \
83} while (0)
84
64ca9004
MM
85#else
86
87#define handle_vm86_fault(a, b)
88#define release_vm86_irqs(a)
89
9e8a935b
JP
90static inline int handle_vm86_trap(struct kernel_vm86_regs *a, long b, int c)
91{
64ca9004
MM
92 return 0;
93}
94
9fda6a06
BG
95#define free_vm86(t) do { } while(0)
96
64ca9004
MM
97#endif /* CONFIG_VM86 */
98
1965aae3 99#endif /* _ASM_X86_VM86_H */
This page took 0.79382 seconds and 5 git commands to generate.