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