vm86.h 2.5 KB

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