Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


vm86.h
001: #ifndef _ASM_X86_VM86_H
002: #define _ASM_X86_VM86_H
003: 
004: /*
005:  * I'm guessing at the VIF/VIP flag usage, but hope that this is how
006:  * the Pentium uses them. Linux will return from vm86 mode when both
007:  * VIF and VIP is set.
008:  *
009:  * On a Pentium, we could probably optimize the virtual flags directly
010:  * in the eflags register instead of doing it "by hand" in vflags...
011:  *
012:  * Linus
013:  */
014: 
015: #include <asm/processor-flags.h>
016: 
017: #define BIOSSEG         0x0f000
018: 
019: #define CPU_086         0
020: #define CPU_186         1
021: #define CPU_286         2
022: #define CPU_386         3
023: #define CPU_486         4
024: #define CPU_586         5
025: 
026: /*
027:  * Return values for the 'vm86()' system call
028:  */
029: #define VM86_TYPE(retval)       ((retval) & 0xff)
030: #define VM86_ARG(retval)        ((retval) >> 8)
031: 
032: #define VM86_SIGNAL     0       /* return due to signal */
033: #define VM86_UNKNOWN    1       /* unhandled GP fault
034:                                    - IO-instruction or similar */
035: #define VM86_INTx       2       /* int3/int x instruction (ARG = x) */
036: #define VM86_STI        3       /* sti/popf/iret instruction enabled
037:                                    virtual interrupts */
038: 
039: /*
040:  * Additional return values when invoking new vm86()
041:  */
042: #define VM86_PICRETURN  4       /* return due to pending PIC request */
043: #define VM86_TRAP       6       /* return due to DOS-debugger request */
044: 
045: /*
046:  * function codes when invoking new vm86()
047:  */
048: #define VM86_PLUS_INSTALL_CHECK 0
049: #define VM86_ENTER              1
050: #define VM86_ENTER_NO_BYPASS    2
051: #define VM86_REQUEST_IRQ        3
052: #define VM86_FREE_IRQ           4
053: #define VM86_GET_IRQ_BITS       5
054: #define VM86_GET_AND_RESET_IRQ  6
055: 
056: /*
057:  * This is the stack-layout seen by the user space program when we have
058:  * done a translation of "SAVE_ALL" from vm86 mode. The real kernel layout
059:  * is 'kernel_vm86_regs' (see below).
060:  */
061: 
062: struct vm86_regs {
063: /*
064:  * normal regs, with special meaning for the segment descriptors..
065:  */
066:         long ebx;
067:         long ecx;
068:         long edx;
069:         long esi;
070:         long edi;
071:         long ebp;
072:         long eax;
073:         long __null_ds;
074:         long __null_es;
075:         long __null_fs;
076:         long __null_gs;
077:         long orig_eax;
078:         long eip;
079:         unsigned short cs, __csh;
080:         long eflags;
081:         long esp;
082:         unsigned short ss, __ssh;
083: /*
084:  * these are specific to v86 mode:
085:  */
086:         unsigned short es, __esh;
087:         unsigned short ds, __dsh;
088:         unsigned short fs, __fsh;
089:         unsigned short gs, __gsh;
090: };
091: 
092: struct revectored_struct {
093:         unsigned long __map[8];                 /* 256 bits */
094: };
095: 
096: struct vm86_struct {
097:         struct vm86_regs regs;
098:         unsigned long flags;
099:         unsigned long screen_bitmap;
100:         unsigned long cpu_type;
101:         struct revectored_struct int_revectored;
102:         struct revectored_struct int21_revectored;
103: };
104: 
105: /*
106:  * flags masks
107:  */
108: #define VM86_SCREEN_BITMAP      0x0001
109: 
110: struct vm86plus_info_struct {
111:         unsigned long force_return_for_pic:1;
112:         unsigned long vm86dbg_active:1;       /* for debugger */
113:         unsigned long vm86dbg_TFpendig:1;     /* for debugger */
114:         unsigned long unused:28;
115:         unsigned long is_vm86pus:1;           /* for vm86 internal use */
116:         unsigned char vm86dbg_intxxtab[32];   /* for debugger */
117: };
118: struct vm86plus_struct {
119:         struct vm86_regs regs;
120:         unsigned long flags;
121:         unsigned long screen_bitmap;
122:         unsigned long cpu_type;
123:         struct revectored_struct int_revectored;
124:         struct revectored_struct int21_revectored;
125:         struct vm86plus_info_struct vm86plus;
126: };
127: 
128: 
129: #endif /* _ASM_X86_VM86_H */
130: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/