Subversion Repositories Kolibri OS

Rev

Rev 9967 | Rev 10002 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9967 Rev 9968
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
7
 
8
$Revision: 9967 $
8
$Revision: 9968 $
9
 
9
 
10
 
10
 
11
dpl0    =  10010000b      ; data read       dpl0
11
dpl0    =  10010000b      ; data read       dpl0
12
drw0    =  10010010b      ; data read/write dpl0
12
drw0    =  10010010b      ; data read/write dpl0
13
drw3    =  11110010b      ; data read/write dpl3
13
drw3    =  11110010b      ; data read/write dpl3
14
cpl0    =  10011010b      ; code read dpl0
14
cpl0    =  10011010b      ; code read dpl0
15
cpl3    =  11111010b      ; code read dpl3
15
cpl3    =  11111010b      ; code read dpl3
16
 
16
 
17
D32     =  01000000b      ; 32bit segment
17
D32     =  01000000b      ; 32bit segment
18
G32     =  10000000b      ; page gran
18
G32     =  10000000b      ; page gran
19
 
19
 
20
;;;;;;;;;;; task manager errors ;;;;;;;;;;
20
;;;;;;;;;;; task manager errors ;;;;;;;;;;
21
 
21
 
22
TASKMAN_ERROR_OUT_OF_MEMORY      = 30 ; 0x1E
22
TASKMAN_ERROR_OUT_OF_MEMORY      = 30 ; 0x1E
23
TASKMAN_ERROR_NOT_A_EXECUTABLE   = 31 ; 0x1F
23
TASKMAN_ERROR_NOT_A_EXECUTABLE   = 31 ; 0x1F
24
TASKMAN_ERROR_TOO_MANY_PROCESSES = 32 ; 0x20
24
TASKMAN_ERROR_TOO_MANY_PROCESSES = 32 ; 0x20
25
 
25
 
26
;;;;;;;;;;;;cpu_caps flags;;;;;;;;;;;;;;;;
26
;;;;;;;;;;;;cpu_caps flags;;;;;;;;;;;;;;;;
27
 
27
 
28
CPU_386        = 3
28
CPU_386        = 3
29
CPU_486        = 4
29
CPU_486        = 4
30
CPU_PENTIUM    = 5
30
CPU_PENTIUM    = 5
31
CPU_P6         = 6
31
CPU_P6         = 6
32
CPU_PENTIUM4   = 0x0F
32
CPU_PENTIUM4   = 0x0F
33
 
33
 
34
CAPS_FPU       =    00 ;on-chip x87 floating point unit
34
CAPS_FPU       =    00 ;on-chip x87 floating point unit
35
CAPS_VME       =    01 ;virtual-mode enhancements
35
CAPS_VME       =    01 ;virtual-mode enhancements
36
CAPS_DE        =    02 ;debugging extensions
36
CAPS_DE        =    02 ;debugging extensions
37
CAPS_PSE       =    03 ;page-size extensions
37
CAPS_PSE       =    03 ;page-size extensions
38
CAPS_TSC       =    04 ;time stamp counter
38
CAPS_TSC       =    04 ;time stamp counter
39
CAPS_MSR       =    05 ;model-specific registers
39
CAPS_MSR       =    05 ;model-specific registers
40
CAPS_PAE       =    06 ;physical-address extensions
40
CAPS_PAE       =    06 ;physical-address extensions
41
CAPS_MCE       =    07 ;machine check exception
41
CAPS_MCE       =    07 ;machine check exception
42
CAPS_CX8       =    08 ;CMPXCHG8B instruction
42
CAPS_CX8       =    08 ;CMPXCHG8B instruction
43
CAPS_APIC      =    09 ;on-chip advanced programmable
43
CAPS_APIC      =    09 ;on-chip advanced programmable
44
                       ;interrupt controller
44
                       ;interrupt controller
45
;                   10 ;unused
45
;                   10 ;unused
46
CAPS_SEP       =    11 ;SYSENTER and SYSEXIT instructions
46
CAPS_SEP       =    11 ;SYSENTER and SYSEXIT instructions
47
CAPS_MTRR      =    12 ;memory-type range registers
47
CAPS_MTRR      =    12 ;memory-type range registers
48
CAPS_PGE       =    13 ;page global extension
48
CAPS_PGE       =    13 ;page global extension
49
CAPS_MCA       =    14 ;machine check architecture
49
CAPS_MCA       =    14 ;machine check architecture
50
CAPS_CMOV      =    15 ;conditional move instructions
50
CAPS_CMOV      =    15 ;conditional move instructions
51
CAPS_PAT       =    16 ;page attribute table
51
CAPS_PAT       =    16 ;page attribute table
52
 
52
 
53
CAPS_PSE36     =    17 ;page-size extensions
53
CAPS_PSE36     =    17 ;page-size extensions
54
CAPS_PSN       =    18 ;processor serial number
54
CAPS_PSN       =    18 ;processor serial number
55
CAPS_CLFLUSH   =    19 ;CLFUSH instruction
55
CAPS_CLFLUSH   =    19 ;CLFUSH instruction
56
 
56
 
57
CAPS_DS        =    21 ;debug store
57
CAPS_DS        =    21 ;debug store
58
CAPS_ACPI      =    22 ;thermal monitor and software
58
CAPS_ACPI      =    22 ;thermal monitor and software
59
                       ;controlled clock supported
59
                       ;controlled clock supported
60
CAPS_MMX       =    23 ;MMX instructions
60
CAPS_MMX       =    23 ;MMX instructions
61
CAPS_FXSR      =    24 ;FXSAVE and FXRSTOR instructions
61
CAPS_FXSR      =    24 ;FXSAVE and FXRSTOR instructions
62
CAPS_SSE       =    25 ;SSE instructions
62
CAPS_SSE       =    25 ;SSE instructions
63
CAPS_SSE2      =    26 ;SSE2 instructions
63
CAPS_SSE2      =    26 ;SSE2 instructions
64
CAPS_SS        =    27 ;self-snoop
64
CAPS_SS        =    27 ;self-snoop
65
CAPS_HTT       =    28 ;hyper-threading technology
65
CAPS_HTT       =    28 ;hyper-threading technology
66
CAPS_TM        =    29 ;thermal monitor supported
66
CAPS_TM        =    29 ;thermal monitor supported
67
CAPS_IA64      =    30 ;IA64 capabilities
67
CAPS_IA64      =    30 ;IA64 capabilities
68
CAPS_PBE       =    31 ;pending break enable
68
CAPS_PBE       =    31 ;pending break enable
69
 
69
 
70
;ecx
70
;ecx
71
CAPS_SSE3      =    32 ;SSE3 instructions
71
CAPS_SSE3      =    32 ;SSE3 instructions
72
;                   33
72
;                   33
73
;                   34
73
;                   34
74
CAPS_MONITOR   =    35 ;MONITOR/MWAIT instructions
74
CAPS_MONITOR   =    35 ;MONITOR/MWAIT instructions
75
CAPS_DS_CPL    =    36 ;
75
CAPS_DS_CPL    =    36 ;
76
CAPS_VMX       =    37 ;virtual mode extensions
76
CAPS_VMX       =    37 ;virtual mode extensions
77
;                   38 ;
77
;                   38 ;
78
CAPS_EST       =    39 ;enhansed speed step
78
CAPS_EST       =    39 ;enhansed speed step
79
CAPS_TM2       =    40 ;thermal monitor2 supported
79
CAPS_TM2       =    40 ;thermal monitor2 supported
80
;                   41
80
;                   41
81
CAPS_CID       =    42 ;
81
CAPS_CID       =    42 ;
82
;                   43
82
;                   43
83
;                   44
83
;                   44
84
CAPS_CX16      =    45 ;CMPXCHG16B instruction
84
CAPS_CX16      =    45 ;CMPXCHG16B instruction
85
CAPS_xTPR      =    46 ;
85
CAPS_xTPR      =    46 ;
86
CAPS_XSAVE     =    32 + 26 ; XSAVE and XRSTOR instructions
86
CAPS_XSAVE     =    32 + 26 ; XSAVE and XRSTOR instructions
87
CAPS_OSXSAVE   =    32 + 27
87
CAPS_OSXSAVE   =    32 + 27
88
; A value of 1 indicates that the OS has set CR4.OSXSAVE[bit 18] to enable
88
; A value of 1 indicates that the OS has set CR4.OSXSAVE[bit 18] to enable
89
; XSETBV/XGETBV instructions to access XCR0 and to support processor extended
89
; XSETBV/XGETBV instructions to access XCR0 and to support processor extended
90
; state management using XSAVE/XRSTOR.
90
; state management using XSAVE/XRSTOR.
91
CAPS_AVX       =    32 + 28 ; not AVX2
91
CAPS_AVX       =    32 + 28 ; not AVX2
92
;
92
;
93
;reserved
93
;reserved
94
;
94
;
95
;ext edx /ecx
95
;ext edx /ecx
96
CAPS_SYSCAL    =    64 ;
96
CAPS_SYSCAL    =    64 ;
97
CAPS_XD        =    65 ;execution disable
97
CAPS_XD        =    65 ;execution disable
98
CAPS_FFXSR     =    66 ;
98
CAPS_FFXSR     =    66 ;
99
CAPS_RDTSCP    =    67 ;
99
CAPS_RDTSCP    =    67 ;
100
CAPS_X64       =    68 ;
100
CAPS_X64       =    68 ;
101
CAPS_3DNOW     =    69 ;
101
CAPS_3DNOW     =    69 ;
102
CAPS_3DNOWEXT  =    70 ;
102
CAPS_3DNOWEXT  =    70 ;
103
CAPS_LAHF      =    71 ;
103
CAPS_LAHF      =    71 ;
104
CAPS_CMP_LEG   =    72 ;
104
CAPS_CMP_LEG   =    72 ;
105
CAPS_SVM       =    73 ;secure virual machine
105
CAPS_SVM       =    73 ;secure virual machine
106
CAPS_ALTMOVCR8 =    74 ;
106
CAPS_ALTMOVCR8 =    74 ;
107
 
107
 
108
; CPU MSR names
108
; CPU MSR names
109
MSR_SYSENTER_CS         =     0x174
109
MSR_SYSENTER_CS         =     0x174
110
MSR_SYSENTER_ESP        =     0x175
110
MSR_SYSENTER_ESP        =     0x175
111
MSR_SYSENTER_EIP        =     0x176
111
MSR_SYSENTER_EIP        =     0x176
112
MSR_CR_PAT              =     0x277
112
MSR_CR_PAT              =     0x277
113
MSR_MTRR_DEF_TYPE       =     0x2FF
113
MSR_MTRR_DEF_TYPE       =     0x2FF
114
 
114
 
115
MSR_AMD_EFER            =     0xC0000080      ; Extended Feature Enable Register
115
MSR_AMD_EFER            =     0xC0000080      ; Extended Feature Enable Register
116
MSR_AMD_STAR            =     0xC0000081      ; SYSCALL/SYSRET Target Address Register
116
MSR_AMD_STAR            =     0xC0000081      ; SYSCALL/SYSRET Target Address Register
117
 
117
 
118
CR0_PE         =    0x00000001   ;protected mode
118
CR0_PE         =    0x00000001   ;protected mode
119
CR0_MP         =    0x00000002   ;monitor fpu
119
CR0_MP         =    0x00000002   ;monitor fpu
120
CR0_EM         =    0x00000004   ;fpu emulation
120
CR0_EM         =    0x00000004   ;fpu emulation
121
CR0_TS         =    0x00000008   ;task switch
121
CR0_TS         =    0x00000008   ;task switch
122
CR0_ET         =    0x00000010   ;extension type hardcoded to 1
122
CR0_ET         =    0x00000010   ;extension type hardcoded to 1
123
CR0_NE         =    0x00000020   ;numeric error
123
CR0_NE         =    0x00000020   ;numeric error
124
CR0_WP         =    0x00010000   ;write protect
124
CR0_WP         =    0x00010000   ;write protect
125
CR0_AM         =    0x00040000   ;alignment check
125
CR0_AM         =    0x00040000   ;alignment check
126
CR0_NW         =    0x20000000   ;not write-through
126
CR0_NW         =    0x20000000   ;not write-through
127
CR0_CD         =    0x40000000   ;cache disable
127
CR0_CD         =    0x40000000   ;cache disable
128
CR0_PG         =    0x80000000   ;paging
128
CR0_PG         =    0x80000000   ;paging
129
 
129
 
130
 
130
 
131
CR4_VME        =    0x000001
131
CR4_VME        =    0x000001
132
CR4_PVI        =    0x000002
132
CR4_PVI        =    0x000002
133
CR4_TSD        =    0x000004
133
CR4_TSD        =    0x000004
134
CR4_DE         =    0x000008
134
CR4_DE         =    0x000008
135
CR4_PSE        =    0x000010
135
CR4_PSE        =    0x000010
136
CR4_PAE        =    0x000020
136
CR4_PAE        =    0x000020
137
CR4_MCE        =    0x000040
137
CR4_MCE        =    0x000040
138
CR4_PGE        =    0x000080
138
CR4_PGE        =    0x000080
139
CR4_PCE        =    0x000100
139
CR4_PCE        =    0x000100
140
CR4_OSFXSR     =    0x000200
140
CR4_OSFXSR     =    0x000200
141
CR4_OSXMMEXPT  =    0x000400
141
CR4_OSXMMEXPT  =    0x000400
142
CR4_OSXSAVE    =    0x040000
142
CR4_OSXSAVE    =    0x040000
143
 
143
 
144
XCR0_FPU_MMX   =    0x0001
144
XCR0_FPU_MMX   =    0x0001
145
XCR0_SSE       =    0x0002
145
XCR0_SSE       =    0x0002
146
XCR0_AVX       =    0x0004
146
XCR0_AVX       =    0x0004
147
XCR0_MPX       =    0x0018
147
XCR0_MPX       =    0x0018
148
XCR0_AVX512    =    0x00e0
148
XCR0_AVX512    =    0x00e0
149
 
149
 
150
MXCSR_IE       =    0x0001
150
MXCSR_IE       =    0x0001
151
MXCSR_DE       =    0x0002
151
MXCSR_DE       =    0x0002
152
MXCSR_ZE       =    0x0004
152
MXCSR_ZE       =    0x0004
153
MXCSR_OE       =    0x0008
153
MXCSR_OE       =    0x0008
154
MXCSR_UE       =    0x0010
154
MXCSR_UE       =    0x0010
155
MXCSR_PE       =    0x0020
155
MXCSR_PE       =    0x0020
156
MXCSR_DAZ      =    0x0040
156
MXCSR_DAZ      =    0x0040
157
MXCSR_IM       =    0x0080
157
MXCSR_IM       =    0x0080
158
MXCSR_DM       =    0x0100
158
MXCSR_DM       =    0x0100
159
MXCSR_ZM       =    0x0200
159
MXCSR_ZM       =    0x0200
160
MXCSR_OM       =    0x0400
160
MXCSR_OM       =    0x0400
161
MXCSR_UM       =    0x0800
161
MXCSR_UM       =    0x0800
162
MXCSR_PM       =    0x1000
162
MXCSR_PM       =    0x1000
163
MXCSR_FZ       =    0x8000
163
MXCSR_FZ       =    0x8000
164
 
164
 
165
MXCSR_INIT     = MXCSR_IM + MXCSR_DM + MXCSR_ZM + MXCSR_OM + MXCSR_UM + MXCSR_PM
165
MXCSR_INIT     = MXCSR_IM + MXCSR_DM + MXCSR_ZM + MXCSR_OM + MXCSR_UM + MXCSR_PM
166
 
166
 
167
EFLAGS_CF      =    0x000001  ; carry flag
167
EFLAGS_CF      =    0x000001  ; carry flag
168
EFLAGS_PF      =    0x000004  ; parity flag
168
EFLAGS_PF      =    0x000004  ; parity flag
169
EFLAGS_AF      =    0x000010  ; auxiliary flag
169
EFLAGS_AF      =    0x000010  ; auxiliary flag
170
EFLAGS_ZF      =    0x000040  ; zero flag
170
EFLAGS_ZF      =    0x000040  ; zero flag
171
EFLAGS_SF      =    0x000080  ; sign flag
171
EFLAGS_SF      =    0x000080  ; sign flag
172
EFLAGS_TF      =    0x000100  ; trap flag
172
EFLAGS_TF      =    0x000100  ; trap flag
173
EFLAGS_IF      =    0x000200  ; interrupt flag
173
EFLAGS_IF      =    0x000200  ; interrupt flag
174
EFLAGS_DF      =    0x000400  ; direction flag
174
EFLAGS_DF      =    0x000400  ; direction flag
175
EFLAGS_OF      =    0x000800  ; overflow flag
175
EFLAGS_OF      =    0x000800  ; overflow flag
176
EFLAGS_IOPL    =    0x003000  ; i/o priviledge level
176
EFLAGS_IOPL    =    0x003000  ; i/o priviledge level
177
EFLAGS_NT      =    0x004000  ; nested task flag
177
EFLAGS_NT      =    0x004000  ; nested task flag
178
EFLAGS_RF      =    0x010000  ; resume flag
178
EFLAGS_RF      =    0x010000  ; resume flag
179
EFLAGS_VM      =    0x020000  ; virtual 8086 mode flag
179
EFLAGS_VM      =    0x020000  ; virtual 8086 mode flag
180
EFLAGS_AC      =    0x040000  ; alignment check flag
180
EFLAGS_AC      =    0x040000  ; alignment check flag
181
EFLAGS_VIF     =    0x080000  ; virtual interrupt flag
181
EFLAGS_VIF     =    0x080000  ; virtual interrupt flag
182
EFLAGS_VIP     =    0x100000  ; virtual interrupt pending
182
EFLAGS_VIP     =    0x100000  ; virtual interrupt pending
183
EFLAGS_ID      =    0x200000  ; id flag
183
EFLAGS_ID      =    0x200000  ; id flag
184
 
184
 
185
IRQ_PIC        =    0
185
IRQ_PIC        =    0
186
IRQ_APIC       =    1
186
IRQ_APIC       =    1
187
 
187
 
188
struct  TSS
188
struct  TSS
189
        _back       rw 2
189
        _back       rw 2
190
        _esp0       rd 1
190
        _esp0       rd 1
191
        _ss0        rw 2
191
        _ss0        rw 2
192
        _esp1       rd 1
192
        _esp1       rd 1
193
        _ss1        rw 2
193
        _ss1        rw 2
194
        _esp2       rd 1
194
        _esp2       rd 1
195
        _ss2        rw 2
195
        _ss2        rw 2
196
        _cr3        rd 1
196
        _cr3        rd 1
197
        _eip        rd 1
197
        _eip        rd 1
198
        _eflags     rd 1
198
        _eflags     rd 1
199
        _eax        rd 1
199
        _eax        rd 1
200
        _ecx        rd 1
200
        _ecx        rd 1
201
        _edx        rd 1
201
        _edx        rd 1
202
        _ebx        rd 1
202
        _ebx        rd 1
203
        _esp        rd 1
203
        _esp        rd 1
204
        _ebp        rd 1
204
        _ebp        rd 1
205
        _esi        rd 1
205
        _esi        rd 1
206
        _edi        rd 1
206
        _edi        rd 1
207
        _es         rw 2
207
        _es         rw 2
208
        _cs         rw 2
208
        _cs         rw 2
209
        _ss         rw 2
209
        _ss         rw 2
210
        _ds         rw 2
210
        _ds         rw 2
211
        _fs         rw 2
211
        _fs         rw 2
212
        _gs         rw 2
212
        _gs         rw 2
213
        _ldt        rw 2
213
        _ldt        rw 2
214
        _trap       rw 1
214
        _trap       rw 1
215
        _io         rw 1
215
        _io         rw 1
216
                    rb 24
216
                    rb 24
217
        _io_map_0   rb 4096
217
        _io_map_0   rb 4096
218
        _io_map_1   rb 4096
218
        _io_map_1   rb 4096
219
ends
219
ends
220
 
220
 
221
struct kernel_header
221
struct kernel_header
222
        jump       rb 3  ; jmp start_of_code
222
        jump       rb 3  ; jmp start_of_code
223
        signature  rb 10 ; 'KolibriOS '
223
        signature  rb 10 ; 'KolibriOS '
224
        version    rb 19 ; ASCII string
224
        version    rb 19 ; ASCII string
225
        b32_offset dd ?  ; offset of the 32-bit entry point in kernel binary
225
        b32_offset dd ?  ; offset of the 32-bit entry point in kernel binary
226
 
226
 
227
; uefi4kos adds the kernel's load address to the offset above and jumps directly
227
; uefi4kos adds the kernel's load address to the offset above and jumps directly
228
; to 32-bit entry point, skipping the real mode code part. This way the same
228
; to 32-bit entry point, skipping the real mode code part. This way the same
229
; KERNEL.MNT file can be booted on BIOS as well as on UEFI.
229
; KERNEL.MNT file can be booted on BIOS as well as on UEFI.
230
ends
230
ends
231
 
231
 
232
DRIVE_DATA_SIZE     = 16
232
DRIVE_DATA_SIZE     = 16
233
 
233
 
234
OS_BASE             = 0x80000000
234
OS_BASE             = 0x80000000
235
 
235
 
236
window_data         = OS_BASE + 0x0001000
236
window_data         = OS_BASE + 0x0001000
237
background_window   = window_data + sizeof.WDATA
237
background_window   = window_data + sizeof.WDATA
238
 
238
 
239
BOOT_VARS           = 0x9000
239
BOOT_VARS           = 0x9000
240
KERNEL_BASE         = 0x10000
240
KERNEL_BASE         = 0x10000
241
RAMDISK_BASE        = 0x100000
241
RAMDISK_BASE        = 0x100000
242
 
242
 
243
idts                = OS_BASE + 0x000B100
243
idts                = OS_BASE + 0x000B100
244
WIN_STACK           = OS_BASE + 0x000C000
244
WIN_STACK           = OS_BASE + 0x000C000
245
WIN_POS             = OS_BASE + 0x000C400
245
WIN_POS             = OS_BASE + 0x000C400
246
FDD_BUFF            = OS_BASE + 0x000D000     ;512
246
FDD_BUFF            = OS_BASE + 0x000D000     ;512
247
 
247
 
248
WIN_TEMP_XY         = OS_BASE + 0x000F300
248
WIN_TEMP_XY         = OS_BASE + 0x000F300
249
KEY_COUNT           = OS_BASE + 0x000F400
249
KEY_COUNT           = OS_BASE + 0x000F400
250
KEY_BUFF            = OS_BASE + 0x000F401 ; 120*2 + 2*2 = 244 bytes, actually 255 bytes
250
KEY_BUFF            = OS_BASE + 0x000F401 ; 120*2 + 2*2 = 244 bytes, actually 255 bytes
251
 
251
 
252
BTN_COUNT           = OS_BASE + 0x000F500
252
BTN_COUNT           = OS_BASE + 0x000F500
253
BTN_BUFF            = OS_BASE + 0x000F501
253
BTN_BUFF            = OS_BASE + 0x000F501
254
 
254
 
255
 
255
 
256
BTN_ADDR            = OS_BASE + 0x000FE88
256
BTN_ADDR            = OS_BASE + 0x000FE88
257
MEM_AMOUNT          = OS_BASE + 0x000FE8C
257
MEM_AMOUNT          = OS_BASE + 0x000FE8C
258
 
258
 
259
SYS_SHUTDOWN        = OS_BASE + 0x000FF00
259
SYS_SHUTDOWN        = OS_BASE + 0x000FF00
260
 
260
 
261
 
261
 
262
TMP_STACK_TOP       = 0x008CC00
262
TMP_STACK_TOP       = 0x008CC00
263
 
263
 
264
sys_proc            = OS_BASE + 0x008E000
264
sys_proc            = OS_BASE + 0x008E000
265
 
265
 
266
SLOT_BASE           = OS_BASE + 0x0090000
266
SLOT_BASE           = OS_BASE + 0x0090000
267
 
267
 
268
VGABasePtr          = OS_BASE + 0x00A0000
268
VGABasePtr          = OS_BASE + 0x00A0000
269
 
269
 
270
virtual at            OS_BASE + 0x05FFF80
270
virtual at            OS_BASE + 0x05FFF80
271
  tss  TSS
271
  tss  TSS
272
end virtual
272
end virtual
273
 
273
 
274
HEAP_BASE           = OS_BASE + 0x0800000
274
HEAP_BASE           = OS_BASE + 0x0800000
275
HEAP_MIN_SIZE       = 0x01000000
275
HEAP_MIN_SIZE       = 0x01000000
276
 
276
 
277
page_tabs           = 0xFDC00000
277
page_tabs           = 0xFDC00000
278
app_page_tabs       = 0xFDC00000
278
app_page_tabs       = 0xFDC00000
279
kernel_tabs         = page_tabs + (OS_BASE shr 10)   ;0xFDE00000
279
kernel_tabs         = page_tabs + (OS_BASE shr 10)   ;0xFDE00000
280
master_tab          = page_tabs + (page_tabs shr 10) ;0xFDFF70000
280
master_tab          = page_tabs + (page_tabs shr 10) ;0xFDFF70000
281
 
281
 
282
LFB_BASE            = 0xFE000000
282
LFB_BASE            = 0xFE000000
283
 
283
 
284
std_application_base_address   = 0
284
std_application_base_address   = 0
285
RING0_STACK_SIZE    = 0x2000
285
RING0_STACK_SIZE    = 0x2000
286
 
286
 
287
REG_SS              = RING0_STACK_SIZE -  4
287
REG_SS              = RING0_STACK_SIZE -  4
288
REG_APP_ESP         = RING0_STACK_SIZE -  8
288
REG_APP_ESP         = RING0_STACK_SIZE -  8
289
REG_EFLAGS          = RING0_STACK_SIZE - 12
289
REG_EFLAGS          = RING0_STACK_SIZE - 12
290
REG_CS              = RING0_STACK_SIZE - 16
290
REG_CS              = RING0_STACK_SIZE - 16
291
REG_EIP             = RING0_STACK_SIZE - 20
291
REG_EIP             = RING0_STACK_SIZE - 20
292
REG_EAX             = RING0_STACK_SIZE - 24
292
REG_EAX             = RING0_STACK_SIZE - 24
293
REG_ECX             = RING0_STACK_SIZE - 28
293
REG_ECX             = RING0_STACK_SIZE - 28
294
REG_EDX             = RING0_STACK_SIZE - 32
294
REG_EDX             = RING0_STACK_SIZE - 32
295
REG_EBX             = RING0_STACK_SIZE - 36
295
REG_EBX             = RING0_STACK_SIZE - 36
296
REG_ESP             = RING0_STACK_SIZE - 40  ;RING0_STACK_SIZE-20
296
REG_ESP             = RING0_STACK_SIZE - 40  ;RING0_STACK_SIZE-20
297
REG_EBP             = RING0_STACK_SIZE - 44
297
REG_EBP             = RING0_STACK_SIZE - 44
298
REG_ESI             = RING0_STACK_SIZE - 48
298
REG_ESI             = RING0_STACK_SIZE - 48
299
REG_EDI             = RING0_STACK_SIZE - 52
299
REG_EDI             = RING0_STACK_SIZE - 52
300
REG_RET             = RING0_STACK_SIZE - 56  ;irq0.return
300
REG_RET             = RING0_STACK_SIZE - 56  ;irq0.return
301
 
301
 
302
 
302
 
303
PAGE_SIZE           = 4096
303
PAGE_SIZE           = 4096
304
 
304
 
305
PG_UNMAP            = 0x000
305
PG_UNMAP            = 0x000
306
PG_READ             = 0x001
306
PG_READ             = 0x001
307
PG_WRITE            = 0x002
307
PG_WRITE            = 0x002
308
PG_USER             = 0x004
308
PG_USER             = 0x004
309
PG_PCD              = 0x008
309
PG_PCD              = 0x008
310
PG_PWT              = 0x010
310
PG_PWT              = 0x010
311
PG_ACCESSED         = 0x020
311
PG_ACCESSED         = 0x020
312
PG_DIRTY            = 0x040
312
PG_DIRTY            = 0x040
313
PG_PAT              = 0x080
313
PG_PAT              = 0x080
314
PG_GLOBAL           = 0x100
314
PG_GLOBAL           = 0x100
315
PG_SHARED           = 0x200
315
PG_SHARED           = 0x200
316
 
316
 
317
PG_SWR              = 0x003 ; PG_WRITE + PG_READ
317
PG_SWR              = 0x003 ; PG_WRITE + PG_READ
318
PG_UR               = 0x005 ; PG_USER + PG_READ
318
PG_UR               = 0x005 ; PG_USER + PG_READ
319
PG_UWR              = 0x007 ; PG_USER + PG_WRITE + PG_READ
319
PG_UWR              = 0x007 ; PG_USER + PG_WRITE + PG_READ
320
PG_NOCACHE          = 0x018 ; PG_PCD + PG_PWT
320
PG_NOCACHE          = 0x018 ; PG_PCD + PG_PWT
321
 
321
 
322
PDE_LARGE           = 0x080
322
PDE_LARGE           = 0x080
323
 
323
 
324
MEM_WB              = 6     ; write-back memory
324
MEM_WB              = 6     ; write-back memory
325
MEM_WC              = 1     ; write combined memory
325
MEM_WC              = 1     ; write combined memory
326
MEM_UC              = 0     ; uncached memory
326
MEM_UC              = 0     ; uncached memory
327
 
327
 
328
PAT_WB              = 0x000
328
PAT_WB              = 0x000
329
PAT_WC              = 0x008
329
PAT_WC              = 0x008
330
PAT_UCM             = 0x010
330
PAT_UCM             = 0x010
331
PAT_UC              = 0x018
331
PAT_UC              = 0x018
332
 
332
 
333
PAT_TYPE_UC         = 0
333
PAT_TYPE_UC         = 0
334
PAT_TYPE_WC         = 1
334
PAT_TYPE_WC         = 1
335
PAT_TYPE_WB         = 6
335
PAT_TYPE_WB         = 6
336
PAT_TYPE_UCM        = 7
336
PAT_TYPE_UCM        = 7
337
 
337
 
338
PAT_VALUE           = 0x00070106; (UC<<24)|(UCM<<16)|(WC<<8)|WB
338
PAT_VALUE           = 0x00070106; (UC<<24)|(UCM<<16)|(WC<<8)|WB
339
 
339
 
340
MAX_MEMMAP_BLOCKS   = 32
340
MAX_MEMMAP_BLOCKS   = 32
341
 
341
 
342
EVENT_REDRAW       = 0x00000001
342
EVENT_REDRAW       = 0x00000001
343
EVENT_KEY          = 0x00000002
343
EVENT_KEY          = 0x00000002
344
EVENT_BUTTON       = 0x00000004
344
EVENT_BUTTON       = 0x00000004
345
EVENT_BACKGROUND   = 0x00000010
345
EVENT_BACKGROUND   = 0x00000010
346
EVENT_MOUSE        = 0x00000020
346
EVENT_MOUSE        = 0x00000020
347
EVENT_IPC          = 0x00000040
347
EVENT_IPC          = 0x00000040
348
EVENT_NETWORK      = 0x00000080
348
EVENT_NETWORK      = 0x00000080
349
EVENT_DEBUG        = 0x00000100
349
EVENT_DEBUG        = 0x00000100
350
EVENT_NETWORK2     = 0x00000200
350
EVENT_NETWORK2     = 0x00000200
351
EVENT_EXTENDED     = 0x00000400
351
EVENT_EXTENDED     = 0x00000400
352
 
352
 
353
EVM_MOUSE_FILTER  = 0x80000000  ; see in macros.inc for apps
353
EVM_MOUSE_FILTER  = 0x80000000  ; see in macros.inc for apps
354
EVM_CURSOR_FILTER = 0x40000000
354
EVM_CURSOR_FILTER = 0x40000000
355
 
355
 
356
EV_INTR            = 1
356
EV_INTR            = 1
357
 
357
 
358
STDIN_FILENO       = 0
358
STDIN_FILENO       = 0
359
STDOUT_FILENO      = 1
359
STDOUT_FILENO      = 1
360
STDERR_FILENO      = 2
360
STDERR_FILENO      = 2
361
 
361
 
362
SYSTEM_SHUTDOWN    = 2
362
SYSTEM_SHUTDOWN    = 2
363
SYSTEM_REBOOT      = 3
363
SYSTEM_REBOOT      = 3
364
SYSTEM_RESTART     = 4
364
SYSTEM_RESTART     = 4
365
 
365
 
366
BLIT_CLIENT_RELATIVE = 0x20000000
366
BLIT_CLIENT_RELATIVE = 0x20000000
367
 
367
 
368
struct SYSCALL_STACK
368
struct SYSCALL_STACK
369
        eip     dd ?    ;  +0
369
        eip     dd ?    ;  +0
370
        edi     dd ?    ;  +4
370
        edi     dd ?    ;  +4
371
        esi     dd ?    ;  +8
371
        esi     dd ?    ;  +8
372
        ebp     dd ?    ; +12
372
        ebp     dd ?    ; +12
373
        esp     dd ?    ; +16
373
        esp     dd ?    ; +16
374
        ebx     dd ?    ; +20
374
        ebx     dd ?    ; +20
375
        edx     dd ?    ; +24
375
        edx     dd ?    ; +24
376
        ecx     dd ?    ; +28
376
        ecx     dd ?    ; +28
377
        eax     dd ?    ; +32
377
        eax     dd ?    ; +32
378
ends
378
ends
379
 
379
 
380
struct  LHEAD
380
struct  LHEAD
381
        next            dd ?   ;next object in list
381
        next            dd ?   ;next object in list
382
        prev            dd ?   ;prev object in list
382
        prev            dd ?   ;prev object in list
383
ends
383
ends
384
 
384
 
385
struct  MUTEX_WAITER
385
struct  MUTEX_WAITER
386
        list    LHEAD
386
        list    LHEAD
387
        task    dd ?
387
        task    dd ?
388
        type    dd ?
388
        type    dd ?
389
ends
389
ends
390
 
390
 
391
struct  MUTEX
391
struct  MUTEX
392
        wait_list       LHEAD
392
        wait_list       LHEAD
393
        count           dd ?
393
        count           dd ?
394
ends
394
ends
395
 
395
 
396
struct  RWSEM
396
struct  RWSEM
397
        wait_list       LHEAD
397
        wait_list       LHEAD
398
        count           dd ?
398
        count           dd ?
399
ends
399
ends
400
 
400
 
401
struct  FUTEX
401
struct  FUTEX
402
        list            LHEAD
402
        list            LHEAD
403
        magic           dd ?
403
        magic           dd ?
404
        handle          dd ?
404
        handle          dd ?
405
        destroy         dd ?
405
        destroy         dd ?
406
 
406
 
407
        wait_list       LHEAD
407
        wait_list       LHEAD
408
        pointer         dd ?
408
        pointer         dd ?
409
        flags           dd ?
409
        flags           dd ?
410
ends
410
ends
411
 
411
 
412
FUTEX_INIT      = 0
412
FUTEX_INIT      = 0
413
FUTEX_DESTROY   = 1
413
FUTEX_DESTROY   = 1
414
FUTEX_WAIT      = 2
414
FUTEX_WAIT      = 2
415
FUTEX_WAKE      = 3
415
FUTEX_WAKE      = 3
416
 
416
 
417
struct  FILED
417
struct  FILED
418
        list            LHEAD
418
        list            LHEAD
419
        magic           rd 1
419
        magic           rd 1
420
        handle          rd 1
420
        handle          rd 1
421
        destroy         rd 1
421
        destroy         rd 1
422
        mode            rd 1
422
        mode            rd 1
423
        file            rd 1
423
        file            rd 1
424
ends
424
ends
425
 
425
 
426
struct  PIPE
426
struct  PIPE
427
        pipe_ops        rd 1
427
        pipe_ops        rd 1
428
        buffer          rd 1
428
        buffer          rd 1
429
        readers         rd 1
429
        readers         rd 1
430
        writers         rd 1
430
        writers         rd 1
431
 
431
 
432
        pipe_lock       MUTEX
432
        pipe_lock       MUTEX
433
        count           rd 1
433
        count           rd 1
434
 
434
 
435
        read_end        rd 1
435
        read_end        rd 1
436
        write_end       rd 1
436
        write_end       rd 1
437
        rlist           LHEAD
437
        rlist           LHEAD
438
        wlist           LHEAD
438
        wlist           LHEAD
439
ends
439
ends
440
 
440
 
441
struct  PROC
441
struct  PROC
442
        list            LHEAD
442
        list            LHEAD
443
        thr_list        LHEAD
443
        thr_list        LHEAD
444
        heap_lock       MUTEX
444
        heap_lock       MUTEX
445
        heap_base       rd 1
445
        heap_base       rd 1
446
        heap_top        rd 1
446
        heap_top        rd 1
447
        mem_used        rd 1
447
        mem_used        rd 1
448
        dlls_list_ptr   rd 1
448
        dlls_list_ptr   rd 1
449
        pdt_0_phys      rd 1
449
        pdt_0_phys      rd 1
450
        pdt_1_phys      rd 1
450
        pdt_1_phys      rd 1
451
        io_map_0        rd 1
451
        io_map_0        rd 1
452
        io_map_1        rd 1
452
        io_map_1        rd 1
453
 
453
 
454
        ht_lock         rd 1
454
        ht_lock         rd 1
455
        ht_free         rd 1                ;htab[0] stdin
455
        ht_free         rd 1                ;htab[0] stdin
456
        ht_next         rd 1                ;htab[1] stdout
456
        ht_next         rd 1                ;htab[1] stdout
457
        htab            rd 1024-PROC.htab/4 ;htab[2] stderr
457
        htab            rd 1024-PROC.htab/4 ;htab[2] stderr
458
        pdt_0           rd 1024
458
        pdt_0           rd 1024
459
ends
459
ends
460
 
460
 
461
struct  DBG_REGS
461
struct  DBG_REGS
462
        dr0             dd ?
462
        dr0             dd ?
463
        dr1             dd ?
463
        dr1             dd ?
464
        dr2             dd ?
464
        dr2             dd ?
465
        dr3             dd ?
465
        dr3             dd ?
466
        dr7             dd ?
466
        dr7             dd ?
467
ends
467
ends
468
 
468
 
469
struct  POINT
469
struct  POINT
470
        x       dd ?
470
        x       dd ?
471
        y       dd ?
471
        y       dd ?
472
ends
472
ends
473
 
473
 
474
struct  RECT
474
struct  RECT
475
        left    dd ?
475
        left    dd ?
476
        top     dd ?
476
        top     dd ?
477
        right   dd ?
477
        right   dd ?
478
        bottom  dd ?
478
        bottom  dd ?
479
ends
479
ends
480
 
480
 
481
struct  BOX
481
struct  BOX
482
        left    dd ?
482
        left    dd ?
483
        top     dd ?
483
        top     dd ?
484
        width   dd ?
484
        width   dd ?
485
        height  dd ?
485
        height  dd ?
486
ends
486
ends
487
 
487
 
488
struct process_information
488
struct process_information
489
        cpu_usage             dd ?  ; +0
489
        cpu_usage             dd ?  ; +0
490
        window_stack_position dw ?  ; +4
490
        window_stack_position dw ?  ; +4
491
        window_stack_value    dw ?  ; +6
491
        window_stack_value    dw ?  ; +6
492
                              dw ?  ; +8
492
                              dw ?  ; +8
493
        process_name          rb 12 ; +10
493
        process_name          rb 12 ; +10
494
        memory_start          dd ?  ; +22
494
        memory_start          dd ?  ; +22
495
        used_memory           dd ?  ; +26
495
        used_memory           dd ?  ; +26
496
        PID                   dd ?  ; +30
496
        PID                   dd ?  ; +30
497
        box                   BOX   ; +34
497
        box                   BOX   ; +34
498
        slot_state            dw ?  ; +50
498
        slot_state            dw ?  ; +50
499
                              dw ?  ; +52
499
                              dw ?  ; +52
500
        client_box            BOX   ; +54
500
        client_box            BOX   ; +54
501
        wnd_state             db ?  ; +70
501
        wnd_state             db ?  ; +70
502
ends
502
ends
503
 
503
 
504
struct  APPDATA
504
struct  APPDATA
505
        app_name        rb 11
505
        app_name        rb 11
506
                        rb 5
506
                        rb 5
507
 
507
 
508
        list            LHEAD           ;+16
508
        list            LHEAD           ;+16
509
        process         dd ?            ;+24
509
        process         dd ?            ;+24
510
        fpu_state       dd ?            ;+28
510
        fpu_state       dd ?            ;+28
511
        exc_handler     dd ?            ;+32
511
        exc_handler     dd ?            ;+32
512
        except_mask     dd ?            ;+36
512
        except_mask     dd ?            ;+36
513
        pl0_stack       dd ?            ;+40
513
        pl0_stack       dd ?            ;+40
514
                        dd ?            ;+44
514
                        dd ?            ;+44
515
        fd_ev           dd ?            ;+48
515
        fd_ev           dd ?            ;+48
516
        bk_ev           dd ?            ;+52
516
        bk_ev           dd ?            ;+52
517
        fd_obj          dd ?            ;+56
517
        fd_obj          dd ?            ;+56
518
        bk_obj          dd ?            ;+60
518
        bk_obj          dd ?            ;+60
519
        saved_esp       dd ?            ;+64
519
        saved_esp       dd ?            ;+64
520
        io_map          rd 2            ;+68
520
        io_map          rd 2            ;+68
521
        dbg_state       dd ?            ;+76
521
        dbg_state       dd ?            ;+76
522
        cur_dir         dd ?            ;+80   ; directory this thread
522
        cur_dir         dd ?            ;+80   ; directory this thread
523
        wait_timeout    dd ?            ;+84
523
        wait_timeout    dd ?            ;+84
524
        saved_esp0      dd ?            ;+88
524
        saved_esp0      dd ?            ;+88
525
        wait_begin      dd ?            ;+92   +++
525
        wait_begin      dd ?            ;+92   +++
526
        wait_test       dd ?            ;+96   +++
526
        wait_test       dd ?            ;+96   +++
527
        wait_param      dd ?            ;+100  +++
527
        wait_param      dd ?            ;+100  +++
528
        tls_base        dd ?            ;+104
528
        tls_base        dd ?            ;+104
529
        event_mask      dd ?            ;+108   stores event types allowed for task
529
        event_mask      dd ?            ;+108   stores event types allowed for task
530
        tid             dd ?            ;+112   thread id
530
        tid             dd ?            ;+112   thread id
531
                        dd ?            ;+116
531
                        dd ?            ;+116
532
                        dd ?            ;+120
532
                        dd ?            ;+120
533
        state           db ?            ;+124   thread state
533
        state           db ?            ;+124   thread state
534
        wnd_number      db ?            ;+125
534
        wnd_number      db ?            ;+125
535
                        dw ?            ;+126
535
                        dw ?            ;+126
536
        window          dd ?            ;+128   ptr WDATA
536
        window          dd ?            ;+128   ptr WDATA
537
                        dd ?            ;+132
537
                        dd ?            ;+132
538
                        dd ?            ;+136
538
                        dd ?            ;+136
539
        counter_sum     dd ?            ;+140
539
        counter_sum     dd ?            ;+140
540
                        rd 4            ;+144
540
                        rd 4            ;+144
541
        ipc_start       dd ?            ;+160
541
        ipc_start       dd ?            ;+160
542
        ipc_size        dd ?            ;+164
542
        ipc_size        dd ?            ;+164
543
        occurred_events dd ?            ;+168  ; mask which accumulates occurred events
543
        occurred_events dd ?            ;+168  ; mask which accumulates occurred events
544
        debugger_slot   dd ?            ;+172  ; index in SLOT_BASE array
544
        debugger_slot   dd ?            ;+172  ; index in SLOT_BASE array
545
        terminate_protection dd ?       ;+176
545
        terminate_protection dd ?       ;+176
546
        keyboard_mode   db ?            ;+180
546
        keyboard_mode   db ?            ;+180
547
                        rb 3
547
                        rb 3
548
        exec_params     dd ?            ;+184
548
        exec_params     dd ?            ;+184
549
        dbg_event_mem   dd ?            ;+188
549
        dbg_event_mem   dd ?            ;+188
550
        dbg_regs        DBG_REGS        ;+192
550
        dbg_regs        DBG_REGS        ;+192
551
                        dd ?            ;+212
551
                        dd ?            ;+212
552
                        rd 4            ;+216
552
                        rd 4            ;+216
553
        priority        dd ?            ;+232
553
        priority        dd ?            ;+232
554
        in_schedule     LHEAD           ;+236
554
        in_schedule     LHEAD           ;+236
555
        counter_add     dd ?            ;+244
555
        counter_add     dd ?            ;+244
556
        cpu_usage       dd ?            ;+248
556
        cpu_usage       dd ?            ;+248
557
                        dd ?            ;+252  ; temporary place to save cursor
557
                        dd ?            ;+252  ; temporary place to save cursor
558
ends
558
ends
559
 
559
 
560
assert sizeof.APPDATA = 256
560
assert sizeof.APPDATA = 256
561
 
561
 
562
APP_OBJ_OFFSET  = 48
562
APP_OBJ_OFFSET  = 48
563
APP_EV_OFFSET   = 40
563
APP_EV_OFFSET   = 40
564
 
564
 
565
; Thread states:
565
; Thread states:
566
TSTATE_RUNNING        = 0
566
TSTATE_RUNNING        = 0
567
TSTATE_RUN_SUSPENDED  = 1
567
TSTATE_RUN_SUSPENDED  = 1
568
TSTATE_WAIT_SUSPENDED = 2
568
TSTATE_WAIT_SUSPENDED = 2
569
TSTATE_ZOMBIE         = 3
569
TSTATE_ZOMBIE         = 3
570
TSTATE_TERMINATING    = 4
570
TSTATE_TERMINATING    = 4
571
TSTATE_WAITING        = 5
571
TSTATE_WAITING        = 5
572
TSTATE_FREE           = 9
572
TSTATE_FREE           = 9
573
 
573
 
574
; Window constants:
574
; Window constants:
575
WSTATE_NORMAL    = 00000000b
575
WSTATE_NORMAL    = 00000000b
576
WSTATE_MAXIMIZED = 00000001b
576
WSTATE_MAXIMIZED = 00000001b
577
WSTATE_MINIMIZED = 00000010b
577
WSTATE_MINIMIZED = 00000010b
578
WSTATE_ROLLEDUP  = 00000100b
578
WSTATE_ROLLEDUP  = 00000100b
579
WSTATE_USED      = 10000000b
579
WSTATE_USED      = 10000000b
580
 
580
 
581
; fl_redraw
581
; fl_redraw
582
WSTATE_REDRAW    = 00000001b
582
WSTATE_REDRAW    = 00000001b
583
WSTATE_WNDDRAWN  = 00000010b
583
WSTATE_WNDDRAWN  = 00000010b
584
 
584
 
585
WSTYLE_HASCAPTION     = 00010000b
585
WSTYLE_HASCAPTION     = 00010000b
586
WSTYLE_CLIENTRELATIVE = 00100000b
586
WSTYLE_CLIENTRELATIVE = 00100000b
587
 
587
 
588
ZPOS_DESKTOP            = -2
588
ZPOS_DESKTOP            = -2
589
ZPOS_ALWAYS_BACK        = -1
589
ZPOS_ALWAYS_BACK        = -1
590
ZPOS_NORMAL             = 0
590
ZPOS_NORMAL             = 0
591
ZPOS_ALWAYS_TOP         = 1     ;ZPOS_ALWAYS_TOP is always last and has max number!
591
ZPOS_ALWAYS_TOP         = 1     ;ZPOS_ALWAYS_TOP is always last and has max number!
592
 
592
 
593
; Window structure:
593
; Window structure:
594
struct  WDATA
594
struct  WDATA
595
        box             BOX
595
        box             BOX
596
        cl_workarea     dd ?
596
        cl_workarea     dd ?
597
        cl_titlebar     dd ?
597
        cl_titlebar     dd ?
598
        cl_frames       dd ?
598
        cl_frames       dd ?
599
        z_modif         db ?
599
        z_modif         db ?
600
        fl_wstate       db ?
600
        fl_wstate       db ?
601
        fl_wdrawn       db ?
601
        fl_wdrawn       db ?
602
        fl_redraw       db ?
602
        fl_redraw       db ?
603
        clientbox       BOX
603
        clientbox       BOX
604
        shape           dd ?
604
        shape           dd ?
605
        shape_scale     dd ?
605
        shape_scale     dd ?
606
        caption         dd ?
606
        caption         dd ?
607
        captionEncoding db ?
607
        captionEncoding db ?
608
                        rb 3
608
                        rb 3
609
        saved_box       BOX
609
        saved_box       BOX
610
        cursor          dd ?
610
        cursor          dd ?
611
        temp_cursor     dd ?
611
        temp_cursor     dd ?
612
        draw_bgr_x      dd ?
612
        draw_bgr_x      dd ?
613
        draw_bgr_y      dd ?
613
        draw_bgr_y      dd ?
614
        draw_data       RECT
614
        draw_data       RECT
615
        thread          dd ? ; prt APPDATA
615
        thread          dd ? ; ptr APPDATA
616
                        rb 12
616
                        rb 12
617
ends
617
ends
618
 
618
 
619
label WDATA.fl_wstyle byte at WDATA.cl_workarea + 3
619
label WDATA.fl_wstyle byte at WDATA.cl_workarea + 3
620
 
620
 
621
assert sizeof.WDATA = 128
621
assert sizeof.WDATA = 128
622
 
622
 
623
struct  SYS_VARS
623
struct  SYS_VARS
624
        bpp             dd ?
624
        bpp             dd ?
625
        scanline        dd ?
625
        scanline        dd ?
626
        vesa_mode       dd ?
626
        vesa_mode       dd ?
627
        x_res           dd ?
627
        x_res           dd ?
628
        y_res           dd ?
628
        y_res           dd ?
629
ends
629
ends
630
 
630
 
631
struct  APPOBJ                  ; common object header
631
struct  APPOBJ                  ; common object header
632
        magic           dd ?    ;
632
        magic           dd ?    ;
633
        destroy         dd ?    ; internal destructor
633
        destroy         dd ?    ; internal destructor
634
        fd              dd ?    ; next object in list
634
        fd              dd ?    ; next object in list
635
        bk              dd ?    ; prev object in list
635
        bk              dd ?    ; prev object in list
636
        pid             dd ?    ; owner id
636
        pid             dd ?    ; owner id
637
ends
637
ends
638
 
638
 
639
struct  CURSOR          APPOBJ
639
struct  CURSOR          APPOBJ
640
        base            dd ?   ;allocated memory
640
        base            dd ?   ;allocated memory
641
        hot_x           dd ?   ;hotspot coords
641
        hot_x           dd ?   ;hotspot coords
642
        hot_y           dd ?
642
        hot_y           dd ?
643
 
643
 
644
        list_next       dd ?   ;next cursor in cursor list
644
        list_next       dd ?   ;next cursor in cursor list
645
        list_prev       dd ?   ;prev cursor in cursor list
645
        list_prev       dd ?   ;prev cursor in cursor list
646
        dev_obj         dd ?   ;device depended data
646
        dev_obj         dd ?   ;device depended data
647
ends
647
ends
648
 
648
 
649
 
649
 
650
struct  EVENT           APPOBJ
650
struct  EVENT           APPOBJ
651
        id              dd ?   ;event uid
651
        id              dd ?   ;event uid
652
        state           dd ?   ;internal flags
652
        state           dd ?   ;internal flags
653
        code            dd ?
653
        code            dd ?
654
                        rd 5
654
                        rd 5
655
ends
655
ends
656
 
656
 
657
 
657
 
658
struct  SMEM
658
struct  SMEM
659
        bk              dd ?
659
        bk              dd ?
660
        fd              dd ?    ;+4
660
        fd              dd ?    ;+4
661
        base            dd ?    ;+8
661
        base            dd ?    ;+8
662
        size            dd ?    ;+12
662
        size            dd ?    ;+12
663
        access          dd ?    ;+16
663
        access          dd ?    ;+16
664
        refcount        dd ?    ;+20
664
        refcount        dd ?    ;+20
665
        name            rb 32   ;+24
665
        name            rb 32   ;+24
666
ends
666
ends
667
 
667
 
668
struct  SMAP            APPOBJ
668
struct  SMAP            APPOBJ
669
        base            dd ?   ;mapped base
669
        base            dd ?   ;mapped base
670
        parent          dd ?   ;SMEM
670
        parent          dd ?   ;SMEM
671
ends
671
ends
672
 
672
 
673
struct  DLLDESCR
673
struct  DLLDESCR
674
        bk              dd ?
674
        bk              dd ?
675
        fd              dd ?    ;+4
675
        fd              dd ?    ;+4
676
        data            dd ?    ;+8
676
        data            dd ?    ;+8
677
        size            dd ?    ;+12
677
        size            dd ?    ;+12
678
        timestamp       dq ?
678
        timestamp       dq ?
679
        refcount        dd ?
679
        refcount        dd ?
680
        defaultbase     dd ?
680
        defaultbase     dd ?
681
        coff_hdr        dd ?
681
        coff_hdr        dd ?
682
        symbols_ptr     dd ?
682
        symbols_ptr     dd ?
683
        symbols_num     dd ?
683
        symbols_num     dd ?
684
        symbols_lim     dd ?
684
        symbols_lim     dd ?
685
        exports         dd ?   ;export table
685
        exports         dd ?   ;export table
686
        name            rb 260
686
        name            rb 260
687
ends
687
ends
688
 
688
 
689
struct  HDLL
689
struct  HDLL
690
        fd              dd ?   ;next object in list
690
        fd              dd ?   ;next object in list
691
        bk              dd ?   ;prev object in list
691
        bk              dd ?   ;prev object in list
692
        pid             dd ?   ;owner id
692
        pid             dd ?   ;owner id
693
 
693
 
694
        base            dd ?   ;mapped base
694
        base            dd ?   ;mapped base
695
        size            dd ?   ;mapped size
695
        size            dd ?   ;mapped size
696
        refcount        dd ?   ;reference counter for this process and this lib
696
        refcount        dd ?   ;reference counter for this process and this lib
697
        parent          dd ?   ;DLLDESCR
697
        parent          dd ?   ;DLLDESCR
698
ends
698
ends
699
 
699
 
700
struct DQ
700
struct DQ
701
        union
701
        union
702
                lo    dd ?
702
                lo    dd ?
703
                hi_be dd ?      ; big endian
703
                hi_be dd ?      ; big endian
704
        ends
704
        ends
705
        union
705
        union
706
                hi    dd ?
706
                hi    dd ?
707
                lo_be dd ?
707
                lo_be dd ?
708
        ends
708
        ends
709
ends
709
ends
710
 
710
 
711
struct e820entry
711
struct e820entry
712
        addr DQ ?
712
        addr DQ ?
713
        size DQ ?
713
        size DQ ?
714
        type dd ?
714
        type dd ?
715
ends
715
ends
716
 
716
 
717
RD_LOAD_FROM_FLOPPY = 1
717
RD_LOAD_FROM_FLOPPY = 1
718
RD_LOAD_FROM_HD     = 2
718
RD_LOAD_FROM_HD     = 2
719
RD_LOAD_FROM_MEMORY = 3
719
RD_LOAD_FROM_MEMORY = 3
720
RD_LOAD_FROM_FORMAT = 4
720
RD_LOAD_FROM_FORMAT = 4
721
RD_LOAD_FROM_NONE   = 5
721
RD_LOAD_FROM_NONE   = 5
722
 
722
 
723
struct boot_pci_data
723
struct boot_pci_data
724
        access_mechanism db ?
724
        access_mechanism db ?
725
        last_bus         db ?
725
        last_bus         db ?
726
        version          dw ?   ; bcd minor, then major
726
        version          dw ?   ; bcd minor, then major
727
        pm_entry         dd ?   ; physical address of protected-mode entry point
727
        pm_entry         dd ?   ; physical address of protected-mode entry point
728
ends
728
ends
729
 
729
 
730
struct  boot_data
730
struct  boot_data
731
        bpp             db ?    ; bits per pixel
731
        bpp             db ?    ; bits per pixel
732
        pitch           dw ?    ; scanline length
732
        pitch           dw ?    ; scanline length
733
                        db ?
733
                        db ?
734
                        dd ?
734
                        dd ?
735
        vesa_mode       dw ?
735
        vesa_mode       dw ?
736
        x_res           dw ?
736
        x_res           dw ?
737
        y_res           dw ?
737
        y_res           dw ?
738
                        dw ?
738
                        dw ?
739
                        dd ?
739
                        dd ?
740
        bank_switch     dd ?    ; Vesa 1.2 pm bank switch
740
        bank_switch     dd ?    ; Vesa 1.2 pm bank switch
741
        lfb             dd ?    ; Vesa 2.0 LFB address
741
        lfb             dd ?    ; Vesa 2.0 LFB address
742
        mtrr            db ?    ; 0 or 1: enable MTRR graphics acceleration
742
        mtrr            db ?    ; 0 or 1: enable MTRR graphics acceleration
743
        launcher_start  db ?    ; 0 or 1: start the first app (right now it's
743
        launcher_start  db ?    ; 0 or 1: start the first app (right now it's
744
                                ; LAUNCHER) after kernel is loaded
744
                                ; LAUNCHER) after kernel is loaded
745
        debug_print     db ?    ; if nonzero, duplicates debug output to the screen
745
        debug_print     db ?    ; if nonzero, duplicates debug output to the screen
746
        dma             db ?    ; DMA write: 1=yes, 2=no
746
        dma             db ?    ; DMA write: 1=yes, 2=no
747
        pci_data        boot_pci_data
747
        pci_data        boot_pci_data
748
                        rb 8
748
                        rb 8
749
        shutdown_type   db ?    ; see sysfn 18.9
749
        shutdown_type   db ?    ; see sysfn 18.9
750
                        rb 15
750
                        rb 15
751
        apm_entry       dd ?    ; entry point of APM BIOS
751
        apm_entry       dd ?    ; entry point of APM BIOS
752
        apm_version     dw ?    ; BCD
752
        apm_version     dw ?    ; BCD
753
        apm_flags       dw ?
753
        apm_flags       dw ?
754
                        rb 8
754
                        rb 8
755
        apm_code_32     dw ?
755
        apm_code_32     dw ?
756
        apm_code_16     dw ?
756
        apm_code_16     dw ?
757
        apm_data_16     dw ?
757
        apm_data_16     dw ?
758
        rd_load_from    db ?    ; Device to load ramdisk from, RD_LOAD_FROM_*
758
        rd_load_from    db ?    ; Device to load ramdisk from, RD_LOAD_FROM_*
759
                        db ?
759
                        db ?
760
        kernel_restart  dw ?
760
        kernel_restart  dw ?
761
        sys_disk        dw ?    ; Device to mount on /sys/, see loader_doc.txt for details
761
        sys_disk        dw ?    ; Device to mount on /sys/, see loader_doc.txt for details
762
        acpi_rsdp       dd ?
762
        acpi_rsdp       dd ?
763
        syspath         rb 0x17
763
        syspath         rb 0x17
764
        devicesdat_data dd ?
764
        devicesdat_data dd ?
765
        devicesdat_size dd ?
765
        devicesdat_size dd ?
766
        bios_hd_cnt     db ?    ; number of BIOS hard disks
766
        bios_hd_cnt     db ?    ; number of BIOS hard disks
767
        bios_hd         rb 0x80 ; BIOS hard disks
767
        bios_hd         rb 0x80 ; BIOS hard disks
768
        memmap_block_cnt dd ?   ; available physical memory map: number of blocks
768
        memmap_block_cnt dd ?   ; available physical memory map: number of blocks
769
        memmap_blocks   e820entry
769
        memmap_blocks   e820entry
770
                        rb sizeof.e820entry * (MAX_MEMMAP_BLOCKS - 1)
770
                        rb sizeof.e820entry * (MAX_MEMMAP_BLOCKS - 1)
771
ends
771
ends
772
 
772
 
773
virtual at BOOT_VARS
773
virtual at BOOT_VARS
774
        BOOT_LO boot_data
774
        BOOT_LO boot_data
775
end virtual
775
end virtual
776
virtual at OS_BASE + BOOT_VARS
776
virtual at OS_BASE + BOOT_VARS
777
        BOOT boot_data
777
        BOOT boot_data
778
end virtual
778
end virtual
779
 
779
 
780
MAX_SCREEN_WIDTH  = 3840
780
MAX_SCREEN_WIDTH  = 3840
781
MAX_SCREEN_HEIGHT = 2160
781
MAX_SCREEN_HEIGHT = 2160
782
 
782
 
783
struct  display_t
783
struct  display_t
784
        x               dd ?
784
        x               dd ?
785
        y               dd ?
785
        y               dd ?
786
        width           dd ?
786
        width           dd ?
787
        height          dd ?
787
        height          dd ?
788
        bits_per_pixel  dd ?
788
        bits_per_pixel  dd ?
789
        vrefresh        dd ?
789
        vrefresh        dd ?
790
        current_lfb     dd ?
790
        current_lfb     dd ?
791
        lfb_pitch       dd ?
791
        lfb_pitch       dd ?
792
 
792
 
793
        win_map_lock    RWSEM
793
        win_map_lock    RWSEM
794
        win_map         dd ?
794
        win_map         dd ?
795
        win_map_pitch   dd ?
795
        win_map_pitch   dd ?
796
        win_map_size    dd ?
796
        win_map_size    dd ?
797
 
797
 
798
        modes           dd ?
798
        modes           dd ?
799
        ddev            dd ?
799
        ddev            dd ?
800
        connector       dd ?
800
        connector       dd ?
801
        crtc            dd ?
801
        crtc            dd ?
802
 
802
 
803
        cr_list.next    dd ?
803
        cr_list.next    dd ?
804
        cr_list.prev    dd ?
804
        cr_list.prev    dd ?
805
 
805
 
806
        cursor          dd ?
806
        cursor          dd ?
807
 
807
 
808
        init_cursor     dd ?
808
        init_cursor     dd ?
809
        select_cursor   dd ?
809
        select_cursor   dd ?
810
        show_cursor     dd ?
810
        show_cursor     dd ?
811
        move_cursor     dd ?
811
        move_cursor     dd ?
812
        restore_cursor  dd ?
812
        restore_cursor  dd ?
813
        disable_mouse   dd ?
813
        disable_mouse   dd ?
814
        mask_seqno      dd ?
814
        mask_seqno      dd ?
815
        check_mouse     dd ?
815
        check_mouse     dd ?
816
        check_m_pixel   dd ?
816
        check_m_pixel   dd ?
817
 
817
 
818
        bytes_per_pixel dd ?
818
        bytes_per_pixel dd ?
819
 
819
 
820
        put_pixel       dd ?
820
        put_pixel       dd ?
821
        put_rect        dd ?
821
        put_rect        dd ?
822
        put_image       dd ?
822
        put_image       dd ?
823
        put_line        dd ?
823
        put_line        dd ?
824
        get_pixel       dd ?
824
        get_pixel       dd ?
825
        get_rect        dd ?
825
        get_rect        dd ?
826
        get_image       dd ?
826
        get_image       dd ?
827
        get_line        dd ?
827
        get_line        dd ?
828
ends
828
ends
829
 
829
 
830
struct  DISPMODE
830
struct  DISPMODE
831
        width   dw ?
831
        width   dw ?
832
        height  dw ?
832
        height  dw ?
833
        bpp     dw ?
833
        bpp     dw ?
834
        freq    dw ?
834
        freq    dw ?
835
ends
835
ends
836
 
836
 
837
 
837
 
838
struct  PCIDEV
838
struct  PCIDEV
839
        bk              dd ?
839
        bk              dd ?
840
        fd              dd ?
840
        fd              dd ?
841
        vendor_device_id dd ?
841
        vendor_device_id dd ?
842
        class           dd ?
842
        class           dd ?
843
        devfn           db ?
843
        devfn           db ?
844
        bus             db ?
844
        bus             db ?
845
                        rb 2
845
                        rb 2
846
        owner           dd ? ; pointer to SRV or 0
846
        owner           dd ? ; pointer to SRV or 0
847
ends
847
ends
848
 
848
 
849
struct  IDE_DATA
849
struct  IDE_DATA
850
        ProgrammingInterface dd ?
850
        ProgrammingInterface dd ?
851
        Interrupt            dw ?
851
        Interrupt            dw ?
852
        RegsBaseAddres       dw ?
852
        RegsBaseAddres       dw ?
853
        BAR0_val             dw ?
853
        BAR0_val             dw ?
854
        BAR1_val             dw ?
854
        BAR1_val             dw ?
855
        BAR2_val             dw ?
855
        BAR2_val             dw ?
856
        BAR3_val             dw ?
856
        BAR3_val             dw ?
857
        dma_hdd_channel_1    db ?
857
        dma_hdd_channel_1    db ?
858
        dma_hdd_channel_2    db ?
858
        dma_hdd_channel_2    db ?
859
        pcidev               dd ?       ; pointer to corresponding PCIDEV structure
859
        pcidev               dd ?       ; pointer to corresponding PCIDEV structure
860
ends
860
ends
861
 
861
 
862
struct  IDE_CACHE
862
struct  IDE_CACHE
863
        pointer              dd ?
863
        pointer              dd ?
864
        size                 dd ?   ; not use
864
        size                 dd ?   ; not use
865
        data_pointer         dd ?
865
        data_pointer         dd ?
866
        system_data_size     dd ?   ; not use
866
        system_data_size     dd ?   ; not use
867
        appl_data_size       dd ?   ; not use
867
        appl_data_size       dd ?   ; not use
868
        system_data          dd ?
868
        system_data          dd ?
869
        appl_data            dd ?
869
        appl_data            dd ?
870
        system_sad_size      dd ?
870
        system_sad_size      dd ?
871
        appl_sad_size        dd ?
871
        appl_sad_size        dd ?
872
        search_start         dd ?
872
        search_start         dd ?
873
        appl_search_start    dd ?
873
        appl_search_start    dd ?
874
ends
874
ends
875
 
875
 
876
struct  IDE_DEVICE
876
struct  IDE_DEVICE
877
        UDMA_possible_modes  db ?
877
        UDMA_possible_modes  db ?
878
        UDMA_set_mode        db ?
878
        UDMA_set_mode        db ?
879
ends
879
ends
880
 
880
 
881
; The following macro assume that we are on uniprocessor machine.
881
; The following macro assume that we are on uniprocessor machine.
882
; Serious work is needed for multiprocessor machines.
882
; Serious work is needed for multiprocessor machines.
883
macro spin_lock_irqsave spinlock
883
macro spin_lock_irqsave spinlock
884
{
884
{
885
        pushf
885
        pushf
886
        cli
886
        cli
887
}
887
}
888
macro spin_unlock_irqrestore spinlock
888
macro spin_unlock_irqrestore spinlock
889
{
889
{
890
        popf
890
        popf
891
}
891
}
892
macro spin_lock_irq spinlock
892
macro spin_lock_irq spinlock
893
{
893
{
894
        cli
894
        cli
895
}
895
}
896
macro spin_unlock_irq spinlock
896
macro spin_unlock_irq spinlock
897
{
897
{
898
        sti
898
        sti
899
}
899
}
900
 
900
 
901
struct  MEM_STATE
901
struct  MEM_STATE
902
        mutex           MUTEX
902
        mutex           MUTEX
903
        smallmap        dd ?
903
        smallmap        dd ?
904
        treemap         dd ?
904
        treemap         dd ?
905
        topsize         dd ?
905
        topsize         dd ?
906
        top             dd ?
906
        top             dd ?
907
        smallbins       rd 4*32
907
        smallbins       rd 4*32
908
        treebins        rd 32
908
        treebins        rd 32
909
ends
909
ends
910
 
910
 
911
struct  PG_DATA
911
struct  PG_DATA
912
        mem_amount      dd ?
912
        mem_amount      dd ?
913
        vesa_mem        dd ?
913
        vesa_mem        dd ?
914
        pages_count     dd ?
914
        pages_count     dd ?
915
        pages_free      dd ?
915
        pages_free      dd ?
916
        pages_faults    dd ?
916
        pages_faults    dd ?
917
        pagemap_size    dd ?
917
        pagemap_size    dd ?
918
        kernel_pages    dd ?
918
        kernel_pages    dd ?
919
        kernel_tables   dd ?
919
        kernel_tables   dd ?
920
        sys_page_dir    dd ?
920
        sys_page_dir    dd ?
921
        mutex           MUTEX
921
        mutex           MUTEX
922
ends
922
ends
923
 
923
 
924
struct  SRV
924
struct  SRV
925
        srv_name        rb 16    ;ASCIIZ string
925
        srv_name        rb 16    ;ASCIIZ string
926
        magic           dd ?     ;+0x10 ;'SRV '
926
        magic           dd ?     ;+0x10 ;'SRV '
927
        size            dd ?     ;+0x14 ;size of structure SRV
927
        size            dd ?     ;+0x14 ;size of structure SRV
928
        fd              dd ?     ;+0x18 ;next SRV descriptor
928
        fd              dd ?     ;+0x18 ;next SRV descriptor
929
        bk              dd ?     ;+0x1C ;prev SRV descriptor
929
        bk              dd ?     ;+0x1C ;prev SRV descriptor
930
        base            dd ?     ;+0x20 ;service base address
930
        base            dd ?     ;+0x20 ;service base address
931
        entry           dd ?     ;+0x24 ;service START function
931
        entry           dd ?     ;+0x24 ;service START function
932
        srv_proc        dd ?     ;+0x28 ;user mode service handler
932
        srv_proc        dd ?     ;+0x28 ;user mode service handler
933
        srv_proc_ex     dd ?     ;+0x2C ;kernel mode service handler
933
        srv_proc_ex     dd ?     ;+0x2C ;kernel mode service handler
934
ends
934
ends
935
 
935
 
936
struct USBSRV
936
struct USBSRV
937
        srv             SRV
937
        srv             SRV
938
        usb_func        dd ?
938
        usb_func        dd ?
939
ends
939
ends
940
 
940
 
941
struct USBFUNC
941
struct USBFUNC
942
        strucsize       dd ?
942
        strucsize       dd ?
943
        add_device      dd ?
943
        add_device      dd ?
944
        device_disconnect dd ?
944
        device_disconnect dd ?
945
ends
945
ends
946
 
946
 
947
DRV_ENTRY    =  1
947
DRV_ENTRY    =  1
948
DRV_EXIT     = -1
948
DRV_EXIT     = -1
949
 
949
 
950
struct  COFF_HEADER
950
struct  COFF_HEADER
951
        machine         dw ?
951
        machine         dw ?
952
        nSections       dw ?
952
        nSections       dw ?
953
        DataTime        dd ?
953
        DataTime        dd ?
954
        pSymTable       dd ?
954
        pSymTable       dd ?
955
        nSymbols        dd ?
955
        nSymbols        dd ?
956
        optHeader       dw ?
956
        optHeader       dw ?
957
        flags           dw ?
957
        flags           dw ?
958
ends
958
ends
959
 
959
 
960
struct  COFF_SECTION
960
struct  COFF_SECTION
961
        Name            rb 8
961
        Name            rb 8
962
        VirtualSize     dd ?
962
        VirtualSize     dd ?
963
        VirtualAddress  dd ?
963
        VirtualAddress  dd ?
964
        SizeOfRawData   dd ?
964
        SizeOfRawData   dd ?
965
        PtrRawData      dd ?
965
        PtrRawData      dd ?
966
        PtrReloc        dd ?
966
        PtrReloc        dd ?
967
        PtrLinenumbers  dd ?
967
        PtrLinenumbers  dd ?
968
        NumReloc        dw ?
968
        NumReloc        dw ?
969
        NumLinenum      dw ?
969
        NumLinenum      dw ?
970
        Characteristics dd ?
970
        Characteristics dd ?
971
ends
971
ends
972
 
972
 
973
struct  COFF_RELOC
973
struct  COFF_RELOC
974
        VirtualAddress  dd ?
974
        VirtualAddress  dd ?
975
        SymIndex        dd ?
975
        SymIndex        dd ?
976
        Type            dw ?
976
        Type            dw ?
977
ends
977
ends
978
 
978
 
979
struct  COFF_SYM
979
struct  COFF_SYM
980
        Name            rb 8
980
        Name            rb 8
981
        Value           dd ?
981
        Value           dd ?
982
        SectionNumber   dw ?
982
        SectionNumber   dw ?
983
        Type            dw ?
983
        Type            dw ?
984
        StorageClass    db ?
984
        StorageClass    db ?
985
        NumAuxSymbols   db ?
985
        NumAuxSymbols   db ?
986
ends
986
ends
987
 
987
 
988
struct  STRIPPED_PE_HEADER
988
struct  STRIPPED_PE_HEADER
989
        Signature           dw ?
989
        Signature           dw ?
990
        Characteristics     dw ?
990
        Characteristics     dw ?
991
        AddressOfEntryPoint dd ?
991
        AddressOfEntryPoint dd ?
992
        ImageBase           dd ?
992
        ImageBase           dd ?
993
        SectionAlignmentLog db ?
993
        SectionAlignmentLog db ?
994
        FileAlignmentLog    db ?
994
        FileAlignmentLog    db ?
995
        MajorOSVersion      db ?
995
        MajorOSVersion      db ?
996
        MinorOSVersion      db ?
996
        MinorOSVersion      db ?
997
        SizeOfImage         dd ?
997
        SizeOfImage         dd ?
998
        SizeOfStackReserve  dd ?
998
        SizeOfStackReserve  dd ?
999
        SizeOfHeapReserve   dd ?
999
        SizeOfHeapReserve   dd ?
1000
        SizeOfHeaders       dd ?
1000
        SizeOfHeaders       dd ?
1001
        Subsystem           db ?
1001
        Subsystem           db ?
1002
        NumberOfRvaAndSizes db ?
1002
        NumberOfRvaAndSizes db ?
1003
        NumberOfSections    dw ?
1003
        NumberOfSections    dw ?
1004
ends
1004
ends
1005
STRIPPED_PE_SIGNATURE = 0x4503 ; 'PE' xor 'S'
1005
STRIPPED_PE_SIGNATURE = 0x4503 ; 'PE' xor 'S'
1006
SPE_DIRECTORY_IMPORT    = 0
1006
SPE_DIRECTORY_IMPORT    = 0
1007
SPE_DIRECTORY_EXPORT    = 1
1007
SPE_DIRECTORY_EXPORT    = 1
1008
SPE_DIRECTORY_BASERELOC = 2
1008
SPE_DIRECTORY_BASERELOC = 2
1009
 
1009
 
1010
struct  IOCTL
1010
struct  IOCTL
1011
        handle          dd ?
1011
        handle          dd ?
1012
        io_code         dd ?
1012
        io_code         dd ?
1013
        input           dd ?
1013
        input           dd ?
1014
        inp_size        dd ?
1014
        inp_size        dd ?
1015
        output          dd ?
1015
        output          dd ?
1016
        out_size        dd ?
1016
        out_size        dd ?
1017
ends
1017
ends
1018
 
1018
 
1019
struct  IRQH
1019
struct  IRQH
1020
        list            LHEAD
1020
        list            LHEAD
1021
        handler         dd ?   ;handler roututine
1021
        handler         dd ?   ;handler roututine
1022
        data            dd ?   ;user-specific data
1022
        data            dd ?   ;user-specific data
1023
        num_ints        dd ?   ;how many times handled
1023
        num_ints        dd ?   ;how many times handled
1024
ends
1024
ends
1025
 
1025
 
1026
MAX_MEMMAP_BLOCKS>
1026
MAX_MEMMAP_BLOCKS>
1027
 
1027
 
1028
MAX_MEMMAP_BLOCKS>
1028
MAX_MEMMAP_BLOCKS>
1029
 
1029
 
1030
MAX_MEMMAP_BLOCKS>
1030
MAX_MEMMAP_BLOCKS>
1031
 
1031
 
1032
MAX_MEMMAP_BLOCKS>
1032
MAX_MEMMAP_BLOCKS>
1033
 
1033
 
1034
MAX_MEMMAP_BLOCKS>
1034
MAX_MEMMAP_BLOCKS>
1035
 
1035
 
1036
MAX_MEMMAP_BLOCKS>
1036
MAX_MEMMAP_BLOCKS>