Subversion Repositories Kolibri OS

Rev

Rev 7126 | Rev 7130 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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