vm86.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 vm86 {
  27. struct vm86plus_struct __user *user_vm86;
  28. struct pt_regs regs32;
  29. unsigned long veflags;
  30. unsigned long veflags_mask;
  31. unsigned long saved_sp0;
  32. unsigned long flags;
  33. unsigned long screen_bitmap;
  34. unsigned long cpu_type;
  35. struct revectored_struct int_revectored;
  36. struct revectored_struct int21_revectored;
  37. struct vm86plus_info_struct vm86plus;
  38. };
  39. #ifdef CONFIG_VM86
  40. void handle_vm86_fault(struct kernel_vm86_regs *, long);
  41. int handle_vm86_trap(struct kernel_vm86_regs *, long, int);
  42. void save_v86_state(struct kernel_vm86_regs *, int);
  43. struct task_struct;
  44. #define free_vm86(t) do { \
  45. struct thread_struct *__t = (t); \
  46. if (__t->vm86 != NULL) { \
  47. kfree(__t->vm86); \
  48. __t->vm86 = NULL; \
  49. } \
  50. } while (0)
  51. /*
  52. * Support for VM86 programs to request interrupts for
  53. * real mode hardware drivers:
  54. */
  55. #define FIRST_VM86_IRQ 3
  56. #define LAST_VM86_IRQ 15
  57. static inline int invalid_vm86_irq(int irq)
  58. {
  59. return irq < FIRST_VM86_IRQ || irq > LAST_VM86_IRQ;
  60. }
  61. void release_vm86_irqs(struct task_struct *);
  62. #else
  63. #define handle_vm86_fault(a, b)
  64. #define release_vm86_irqs(a)
  65. static inline int handle_vm86_trap(struct kernel_vm86_regs *a, long b, int c)
  66. {
  67. return 0;
  68. }
  69. static inline void save_v86_state(struct kernel_vm86_regs *a, int b) { }
  70. #define free_vm86(t) do { } while(0)
  71. #endif /* CONFIG_VM86 */
  72. #endif /* _ASM_X86_VM86_H */