Subversion Repositories Kolibri OS

Rev

Rev 7124 | Rev 7129 | 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: 7126 $
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
360
 
7122 dunkaist 361
BOOT_BIOS_HD_CNT     equ 0x907F   ; byte   number of BIOS hard disks
362
BOOT_BIOS_HD         equ 0x9080   ; Nbytes BIOS hard disks
363
BOOT_MEMMAP_BLOCK_CNT equ 0x9100  ; word   available physical memory map: number of blocks
364
BOOT_MEMMAP_BLOCKS   equ 0x9104   ; available physical memory map: blocks, i.e. e820entry structs
365
MAX_MEMMAP_BLOCKS   equ 32
366
 
2288 clevermous 367
TMP_FILE_NAME       equ     0
368
TMP_CMD_LINE        equ  1024
369
TMP_ICON_OFFS       equ  1280
370
 
371
 
372
EVENT_REDRAW       equ 0x00000001
373
EVENT_KEY          equ 0x00000002
374
EVENT_BUTTON       equ 0x00000004
375
EVENT_BACKGROUND   equ 0x00000010
376
EVENT_MOUSE        equ 0x00000020
377
EVENT_IPC          equ 0x00000040
378
EVENT_NETWORK      equ 0x00000080
379
EVENT_DEBUG        equ 0x00000100
3545 hidnplayr 380
EVENT_NETWORK2     equ 0x00000200
381
EVENT_EXTENDED     equ 0x00000400
2288 clevermous 382
 
383
EV_INTR            equ 1
384
 
6244 serge 385
STDIN_FILENO       equ 0
386
STDOUT_FILENO      equ 1
387
STDERR_FILENO      equ 2
6079 serge 388
 
6244 serge 389
SYSTEM_SHUTDOWN    equ 2
390
SYSTEM_REBOOT      equ 3
391
SYSTEM_RESTART     equ 4
392
 
6790 0CodErr 393
BLIT_CLIENT_RELATIVE equ 0x20000000
394
 
6079 serge 395
struct SYSCALL_STACK
396
        _eip            dd ?
397
        _edi            dd ?    ;  +4
398
        _esi            dd ?    ;  +8
399
        _ebp            dd ?    ; +12
400
        _esp            dd ?    ; +16
401
        _ebx            dd ?    ; +20
402
        _edx            dd ?    ; +24
403
        _ecx            dd ?    ; +28
404
        _eax            dd ?    ; +32
2384 hidnplayr 405
ends
2288 clevermous 406
 
6079 serge 407
struct  LHEAD
408
        next            dd ?   ;next object in list
409
        prev            dd ?   ;prev object in list
410
ends
2288 clevermous 411
 
6079 serge 412
struct  MUTEX_WAITER
413
        list    LHEAD
414
        task    dd ?
415
        type    dd ?
416
ends
417
 
418
struct  MUTEX
419
        wait_list       LHEAD
420
        count           dd ?
421
ends
422
 
423
struct  RWSEM
424
        wait_list       LHEAD
425
        count           dd ?
426
ends
427
 
428
struct  FUTEX
429
        list            LHEAD
430
        magic           dd ?
431
        handle          dd ?
432
        destroy         dd ?
433
 
434
        wait_list       LHEAD
435
        pointer         dd ?
436
        flags           dd ?
437
ends
438
 
439
FUTEX_INIT      equ 0
440
FUTEX_DESTROY   equ 1
441
FUTEX_WAIT      equ 2
442
FUTEX_WAKE      equ 3
443
 
6926 serge 444
struct  FILED
445
        list            LHEAD
446
        magic           rd 1
447
        handle          rd 1
448
        destroy         rd 1
6929 serge 449
        mode            rd 1
6926 serge 450
        file            rd 1
451
ends
452
 
453
struct  PIPE
454
        pipe_ops        rd 1
455
        buffer          rd 1
456
        readers         rd 1
457
        writers         rd 1
458
 
459
        pipe_lock       MUTEX
460
        count           rd 1
461
 
462
        read_end        rd 1
463
        write_end       rd 1
464
        rlist           LHEAD
465
        wlist           LHEAD
466
ends
467
 
6079 serge 468
struct  PROC
469
        list            LHEAD
470
        thr_list        LHEAD
471
        heap_lock       MUTEX
472
        heap_base       rd 1
473
        heap_top        rd 1
474
        mem_used        rd 1
475
        dlls_list_ptr   rd 1
476
        pdt_0_phys      rd 1
477
        pdt_1_phys      rd 1
478
        io_map_0        rd 1
479
        io_map_1        rd 1
480
 
481
        ht_lock         rd 1
6802 pathoswith 482
        ht_free         rd 1                ;htab[0] stdin
483
        ht_next         rd 1                ;htab[1] stdout
484
        htab            rd 1024-PROC.htab/4 ;htab[2] stderr
6079 serge 485
        pdt_0           rd 1024
486
ends
487
 
488
struct  DBG_REGS
489
        dr0             dd ?
490
        dr1             dd ?
491
        dr2             dd ?
492
        dr3             dd ?
493
        dr7             dd ?
494
ends
495
 
496
struct  POINT
497
        x       dd ?
498
        y       dd ?
499
ends
500
 
501
struct  RECT
502
        left    dd ?
503
        top     dd ?
504
        right   dd ?
505
        bottom  dd ?
506
ends
507
 
508
struct  BOX
509
        left    dd ?
510
        top     dd ?
511
        width   dd ?
512
        height  dd ?
513
ends
514
 
515
struct  APPDATA
516
        app_name        rb 11
517
                        rb 5
518
 
519
        list            LHEAD           ;+16
520
        process         dd ?            ;+24
521
        fpu_state       dd ?            ;+28
522
        exc_handler     dd ?            ;+32
523
        except_mask     dd ?            ;+36
524
        pl0_stack       dd ?            ;+40
525
        cursor          dd ?            ;+44
526
        fd_ev           dd ?            ;+48
527
        bk_ev           dd ?            ;+52
528
        fd_obj          dd ?            ;+56
529
        bk_obj          dd ?            ;+60
530
        saved_esp       dd ?            ;+64
531
        io_map          rd 2            ;+68
532
        dbg_state       dd ?            ;+76
533
        cur_dir         dd ?            ;+80
534
        wait_timeout    dd ?            ;+84
535
        saved_esp0      dd ?            ;+88
536
        wait_begin      dd ?            ;+92   +++
537
        wait_test       dd ?            ;+96   +++
538
        wait_param      dd ?            ;+100  +++
539
        tls_base        dd ?            ;+104
540
                        dd ?            ;+108
541
        event_filter    dd ?            ;+112
542
        draw_bgr_x      dd ?            ;+116
543
        draw_bgr_y      dd ?            ;+120
544
                        dd ?            ;+124
545
        wnd_shape       dd ?            ;+128
546
        wnd_shape_scale dd ?            ;+132
547
                        dd ?            ;+136
548
                        dd ?            ;+140
549
        saved_box       BOX             ;+144
550
        ipc_start       dd ?            ;+160
551
        ipc_size        dd ?            ;+164
552
        event_mask      dd ?            ;+168
553
        debugger_slot   dd ?            ;+172
554
        terminate_protection dd ?       ;+176
555
        keyboard_mode   db ?            ;+180
6802 pathoswith 556
        captionEncoding db ?
557
                        rb 2
6318 serge 558
        exec_params     dd ?            ;+184
6079 serge 559
        dbg_event_mem   dd ?            ;+188
560
        dbg_regs        DBG_REGS        ;+192
561
        wnd_caption     dd ?            ;+212
562
        wnd_clientbox   BOX             ;+216
563
        priority        dd ?            ;+232
564
        in_schedule     LHEAD           ;+236
565
ends
566
 
567
APP_OBJ_OFFSET  equ 48
568
APP_EV_OFFSET   equ 40
569
 
570
struct  TASKDATA
571
        event_mask      dd ?
572
        pid             dd ?
573
                        dw ?
574
        state           db ?
575
                        db ?
576
                        dw ?
577
        wnd_number      db ?
578
                        db ?
579
        mem_start       dd ?
580
        counter_sum     dd ?
581
        counter_add     dd ?
582
        cpu_usage       dd ?
583
ends
584
 
585
TSTATE_RUNNING        = 0
586
TSTATE_RUN_SUSPENDED  = 1
587
TSTATE_WAIT_SUSPENDED = 2
588
TSTATE_ZOMBIE         = 3
589
TSTATE_TERMINATING    = 4
590
TSTATE_WAITING        = 5
591
TSTATE_FREE           = 9
592
 
593
; constants definition
594
WSTATE_NORMAL    = 00000000b
595
WSTATE_MAXIMIZED = 00000001b
596
WSTATE_MINIMIZED = 00000010b
597
WSTATE_ROLLEDUP  = 00000100b
598
 
599
WSTATE_REDRAW    = 00000001b
600
WSTATE_WNDDRAWN  = 00000010b
601
 
602
WSTYLE_HASCAPTION     = 00010000b
603
WSTYLE_CLIENTRELATIVE = 00100000b
604
 
605
ZPOS_DESKTOP            = -2
606
ZPOS_ALWAYS_BACK        = -1
607
ZPOS_NORMAL             = 0
608
ZPOS_ALWAYS_TOP         = 1     ;ZPOS_ALWAYS_TOP is always last and has max number!
609
; structures definition
610
struct  WDATA
611
        box             BOX
612
        cl_workarea     dd ?
613
        cl_titlebar     dd ?
614
        cl_frames       dd ?
615
        z_modif         db ?
616
        fl_wstate       db ?
617
        fl_wdrawn       db ?
618
        fl_redraw       db ?
619
ends
620
 
621
label WDATA.fl_wstyle byte at WDATA.cl_workarea + 3
622
 
623
 
2384 hidnplayr 624
struct  SYS_VARS
625
        bpp             dd ?
626
        scanline        dd ?
627
        vesa_mode       dd ?
628
        x_res           dd ?
629
        y_res           dd ?
630
ends
2288 clevermous 631
 
2384 hidnplayr 632
struct  APPOBJ                  ; common object header
633
        magic           dd ?    ;
634
        destroy         dd ?    ; internal destructor
635
        fd              dd ?    ; next object in list
636
        bk              dd ?    ; prev object in list
637
        pid             dd ?    ; owner id
638
ends
2288 clevermous 639
 
2384 hidnplayr 640
struct  CURSOR          APPOBJ
641
        base            dd ?   ;allocated memory
642
        hot_x           dd ?   ;hotspot coords
643
        hot_y           dd ?
2288 clevermous 644
 
2384 hidnplayr 645
        list_next       dd ?   ;next cursor in cursor list
646
        list_prev       dd ?   ;prev cursor in cursor list
647
        dev_obj         dd ?   ;device depended data
648
ends
2288 clevermous 649
 
650
 
2384 hidnplayr 651
struct  EVENT           APPOBJ
652
        id              dd ?   ;event uid
653
        state           dd ?   ;internal flags
654
        code            dd ?
655
                        rd 5
656
ends
2288 clevermous 657
 
658
 
2384 hidnplayr 659
struct  SMEM
660
        bk              dd ?
661
        fd              dd ?    ;+4
662
        base            dd ?    ;+8
663
        size            dd ?    ;+12
664
        access          dd ?    ;+16
665
        refcount        dd ?    ;+20
666
        name            rb 32   ;+24
667
ends
2288 clevermous 668
 
2384 hidnplayr 669
struct  SMAP            APPOBJ
670
        base            dd ?   ;mapped base
671
        parent          dd ?   ;SMEM
672
ends
2288 clevermous 673
 
2384 hidnplayr 674
struct  DLLDESCR
675
        bk              dd ?
676
        fd              dd ?    ;+4
677
        data            dd ?    ;+8
678
        size            dd ?    ;+12
679
        timestamp       dq ?
680
        refcount        dd ?
681
        defaultbase     dd ?
682
        coff_hdr        dd ?
683
        symbols_ptr     dd ?
684
        symbols_num     dd ?
685
        symbols_lim     dd ?
686
        exports         dd ?   ;export table
687
        name            rb 260
688
ends
2288 clevermous 689
 
2384 hidnplayr 690
struct  HDLL
691
        fd              dd ?   ;next object in list
692
        bk              dd ?   ;prev object in list
693
        pid             dd ?   ;owner id
2288 clevermous 694
 
2384 hidnplayr 695
        base            dd ?   ;mapped base
696
        size            dd ?   ;mapped size
697
        refcount        dd ?   ;reference counter for this process and this lib
698
        parent          dd ?   ;DLLDESCR
699
ends
2288 clevermous 700
 
701
 
2384 hidnplayr 702
struct  BOOT_DATA
703
        bpp             dd ?
704
        scanline        dd ?
705
        vesa_mode       dd ?
706
        x_res           dd ?
707
        y_res           dd ?
708
        mouse_port      dd ?
709
        bank_switch     dd ?
710
        lfb             dd ?
711
        vesa_mem        dd ?
712
        log             dd ?
713
        direct_lfb      dd ?
714
        pci_data        dd ?
715
                        dd ?
716
        ide_base        dd ?
717
        mem_amount      dd ?
718
        pages_count     dd ?
719
        pagemap_size    dd ?
720
        kernel_max      dd ?
721
        kernel_pages    dd ?
722
        kernel_tables   dd ?
2288 clevermous 723
 
2384 hidnplayr 724
        cpu_vendor      dd ?
725
                        dd ?
726
                        dd ?
727
        cpu_sign        dd ?
728
        cpu_info        dd ?
729
        cpu_caps        dd ?
730
                        dd ?
731
                        dd ?
732
ends
2288 clevermous 733
 
5351 serge 734
struct  display_t
735
        x               dd ?
736
        y               dd ?
737
        width           dd ?
738
        height          dd ?
739
        bits_per_pixel  dd ?
740
        vrefresh        dd ?
6263 serge 741
        current_lfb     dd ?
5351 serge 742
        lfb_pitch       dd ?
743
 
744
        win_map_lock    RWSEM
745
        win_map         dd ?
746
        win_map_pitch   dd ?
747
        win_map_size    dd ?
748
 
749
        modes           dd ?
750
        ddev            dd ?
751
        connector       dd ?
752
        crtc            dd ?
753
 
754
        cr_list.next    dd ?
755
        cr_list.prev    dd ?
756
 
757
        cursor          dd ?
758
 
759
        init_cursor     dd ?
760
        select_cursor   dd ?
761
        show_cursor     dd ?
762
        move_cursor     dd ?
763
        restore_cursor  dd ?
764
        disable_mouse   dd ?
765
        mask_seqno      dd ?
766
        check_mouse     dd ?
767
        check_m_pixel   dd ?
768
 
769
        bytes_per_pixel dd ?
770
ends
771
 
6079 serge 772
struct  DISPMODE
773
        width   dw ?
774
        height  dw ?
775
        bpp     dw ?
776
        freq    dw ?
777
ends
5351 serge 778
 
6079 serge 779
 
3393 clevermous 780
struct  PCIDEV
781
        bk              dd ?
782
        fd              dd ?
783
        vendor_device_id dd ?
784
        class           dd ?
785
        devfn           db ?
786
        bus             db ?
4418 clevermous 787
                        rb 2
788
        owner           dd ? ; pointer to SRV or 0
3393 clevermous 789
ends
790
 
6079 serge 791
struct  IDE_DATA
792
        ProgrammingInterface dd ?
793
        Interrupt            dw ?
794
        RegsBaseAddres       dw ?
795
        BAR0_val             dw ?
796
        BAR1_val             dw ?
797
        BAR2_val             dw ?
798
        BAR3_val             dw ?
799
        dma_hdd_channel_1    db ?
800
        dma_hdd_channel_2    db ?
6816 dunkaist 801
        pcidev               dd ?       ; pointer to corresponding PCIDEV structure
6079 serge 802
ends
803
 
804
struct  IDE_CACHE
805
        pointer              dd ?
806
        size                 dd ?   ; not use
807
        data_pointer         dd ?
808
        system_data_size     dd ?   ; not use
809
        appl_data_size       dd ?   ; not use
810
        system_data          dd ?
811
        appl_data            dd ?
812
        system_sad_size      dd ?
813
        appl_sad_size        dd ?
814
        search_start         dd ?
815
        appl_search_start    dd ?
816
ends
817
 
818
struct  IDE_DEVICE
819
        UDMA_possible_modes  db ?
820
        UDMA_set_mode        db ?
821
ends
822
 
3395 clevermous 823
; The following macro assume that we are on uniprocessor machine.
824
; Serious work is needed for multiprocessor machines.
825
macro spin_lock_irqsave spinlock
826
{
827
        pushf
828
        cli
829
}
830
macro spin_unlock_irqrestore spinlock
831
{
832
        popf
833
}
834
macro spin_lock_irq spinlock
835
{
836
        cli
837
}
838
macro spin_unlock_irq spinlock
839
{
840
        sti
841
}
842
 
2384 hidnplayr 843
struct  MEM_STATE
844
        mutex           MUTEX
845
        smallmap        dd ?
846
        treemap         dd ?
847
        topsize         dd ?
848
        top             dd ?
849
        smallbins       rd 4*32
850
        treebins        rd 32
851
ends
2288 clevermous 852
 
2384 hidnplayr 853
struct  PG_DATA
854
        mem_amount      dd ?
855
        vesa_mem        dd ?
856
        pages_count     dd ?
857
        pages_free      dd ?
858
        pages_faults    dd ?
859
        pagemap_size    dd ?
860
        kernel_pages    dd ?
861
        kernel_tables   dd ?
862
        sys_page_dir    dd ?
863
        mutex           MUTEX
864
ends
2288 clevermous 865
 
2384 hidnplayr 866
struct  SRV
867
        srv_name        rb 16    ;ASCIIZ string
868
        magic           dd ?     ;+0x10 ;'SRV '
869
        size            dd ?     ;+0x14 ;size of structure SRV
870
        fd              dd ?     ;+0x18 ;next SRV descriptor
871
        bk              dd ?     ;+0x1C ;prev SRV descriptor
872
        base            dd ?     ;+0x20 ;service base address
873
        entry           dd ?     ;+0x24 ;service START function
874
        srv_proc        dd ?     ;+0x28 ;user mode service handler
875
        srv_proc_ex     dd ?     ;+0x2C ;kernel mode service handler
876
ends
2288 clevermous 877
 
3520 clevermous 878
struct USBSRV
879
        srv             SRV
880
        usb_func        dd ?
881
ends
882
 
883
struct USBFUNC
884
        strucsize       dd ?
885
        add_device      dd ?
886
        device_disconnect dd ?
887
ends
888
 
2288 clevermous 889
DRV_ENTRY    equ  1
890
DRV_EXIT     equ -1
891
 
2384 hidnplayr 892
struct  COFF_HEADER
893
        machine         dw ?
894
        nSections       dw ?
895
        DataTime        dd ?
896
        pSymTable       dd ?
897
        nSymbols        dd ?
898
        optHeader       dw ?
899
        flags           dw ?
900
ends
2288 clevermous 901
 
2384 hidnplayr 902
struct  COFF_SECTION
903
        Name            rb 8
904
        VirtualSize     dd ?
905
        VirtualAddress  dd ?
906
        SizeOfRawData   dd ?
907
        PtrRawData      dd ?
908
        PtrReloc        dd ?
909
        PtrLinenumbers  dd ?
910
        NumReloc        dw ?
911
        NumLinenum      dw ?
912
        Characteristics dd ?
913
ends
2288 clevermous 914
 
2384 hidnplayr 915
struct  COFF_RELOC
916
        VirtualAddress  dd ?
917
        SymIndex        dd ?
918
        Type            dw ?
919
ends
2288 clevermous 920
 
2384 hidnplayr 921
struct  COFF_SYM
922
        Name            rb 8
923
        Value           dd ?
924
        SectionNumber   dw ?
925
        Type            dw ?
926
        StorageClass    db ?
927
        NumAuxSymbols   db ?
928
ends
2288 clevermous 929
 
5039 clevermous 930
struct  STRIPPED_PE_HEADER
931
        Signature           dw ?
932
        Characteristics     dw ?
933
        AddressOfEntryPoint dd ?
934
        ImageBase           dd ?
935
        SectionAlignmentLog db ?
936
        FileAlignmentLog    db ?
937
        MajorOSVersion      db ?
938
        MinorOSVersion      db ?
939
        SizeOfImage         dd ?
940
        SizeOfStackReserve  dd ?
941
        SizeOfHeapReserve   dd ?
942
        SizeOfHeaders       dd ?
943
        Subsystem           db ?
944
        NumberOfRvaAndSizes db ?
945
        NumberOfSections    dw ?
946
ends
947
STRIPPED_PE_SIGNATURE = 0x4503 ; 'PE' xor 'S'
948
SPE_DIRECTORY_IMPORT    = 0
949
SPE_DIRECTORY_EXPORT    = 1
950
SPE_DIRECTORY_BASERELOC = 2
951
 
2384 hidnplayr 952
struct  IOCTL
953
        handle          dd ?
954
        io_code         dd ?
955
        input           dd ?
956
        inp_size        dd ?
957
        output          dd ?
958
        out_size        dd ?
959
ends
2288 clevermous 960
 
2384 hidnplayr 961
struct  IRQH
962
        list            LHEAD
963
        handler         dd ?   ;handler roututine
964
        data            dd ?   ;user-specific data
3506 clevermous 965
        num_ints        dd ?   ;how many times handled
2414 Serge 966
ends
7122 dunkaist 967
 
968
struct DQ
969
        lo dd ?
970
        hi dd ?
971
ends
972
 
973
struct e820entry
974
        addr DQ ?
975
        size DQ ?
976
        type dd ?
977
ends
978