Subversion Repositories Kolibri OS

Rev

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

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