Subversion Repositories Kolibri OS

Rev

Rev 7122 | Rev 7126 | 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: 7124 $
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
 
2288 clevermous 162
IRQ_PIC        equ    0
163
IRQ_APIC       equ    1
164
 
2381 hidnplayr 165
struct  TSS
166
        _back       rw 2
167
        _esp0       rd 1
168
        _ss0        rw 2
169
        _esp1       rd 1
170
        _ss1        rw 2
171
        _esp2       rd 1
172
        _ss2        rw 2
173
        _cr3        rd 1
174
        _eip        rd 1
175
        _eflags     rd 1
176
        _eax        rd 1
177
        _ecx        rd 1
178
        _edx        rd 1
179
        _ebx        rd 1
180
        _esp        rd 1
181
        _ebp        rd 1
182
        _esi        rd 1
183
        _edi        rd 1
184
        _es         rw 2
185
        _cs         rw 2
186
        _ss         rw 2
187
        _ds         rw 2
188
        _fs         rw 2
189
        _gs         rw 2
190
        _ldt        rw 2
191
        _trap       rw 1
192
        _io         rw 1
193
                    rb 24
194
        _io_map_0   rb 4096
195
        _io_map_1   rb 4096
196
ends
2288 clevermous 197
 
4700 mario79 198
DRIVE_DATA_SIZE     equ 16
3627 Serge 199
 
2288 clevermous 200
OS_BASE             equ 0x80000000
201
 
202
window_data         equ (OS_BASE+0x0001000)
203
 
204
CURRENT_TASK        equ (OS_BASE+0x0003000)
205
TASK_COUNT          equ (OS_BASE+0x0003004)
206
TASK_BASE           equ (OS_BASE+0x0003010)
207
TASK_DATA           equ (OS_BASE+0x0003020)
208
TASK_EVENT          equ (OS_BASE+0x0003020)
209
 
3732 Serge 210
CDDataBuf           equ (OS_BASE+0x0005000)
211
 
212
;unused                 0x6000 - 0x8fff
213
 
214
BOOT_VARS           equ (OS_BASE)               ;0x9000
215
 
2288 clevermous 216
idts                equ (OS_BASE+0x000B100)
217
WIN_STACK           equ (OS_BASE+0x000C000)
218
WIN_POS             equ (OS_BASE+0x000C400)
3727 Serge 219
FDD_BUFF            equ (OS_BASE+0x000D000)     ;512
2288 clevermous 220
 
221
WIN_TEMP_XY         equ (OS_BASE+0x000F300)
222
KEY_COUNT           equ (OS_BASE+0x000F400)
4588 mario79 223
KEY_BUFF            equ (OS_BASE+0x000F401) ; 120*2 + 2*2 = 244 bytes, actually 255 bytes
2288 clevermous 224
 
225
BTN_COUNT           equ (OS_BASE+0x000F500)
226
BTN_BUFF            equ (OS_BASE+0x000F501)
227
 
228
 
229
BTN_ADDR            equ (OS_BASE+0x000FE88)
230
MEM_AMOUNT          equ (OS_BASE+0x000FE8C)
231
 
232
SYS_SHUTDOWN        equ (OS_BASE+0x000FF00)
233
TASK_ACTIVATE       equ (OS_BASE+0x000FF01)
234
 
2513 mario79 235
 
2288 clevermous 236
TMP_STACK_TOP       equ 0x006CC00
237
 
5130 serge 238
sys_proc            equ (OS_BASE+0x006F000)
2288 clevermous 239
 
240
SLOT_BASE           equ (OS_BASE+0x0080000)
241
 
242
VGABasePtr          equ (OS_BASE+0x00A0000)
243
 
3727 Serge 244
CLEAN_ZONE          equ (_CLEAN_ZONE-OS_BASE)
245
 
2288 clevermous 246
UPPER_KERNEL_PAGES  equ (OS_BASE+0x0400000)
247
 
248
virtual at              (OS_BASE+0x05FFF80)
249
  tss  TSS
250
end virtual
251
 
252
HEAP_BASE           equ (OS_BASE+0x0800000)
253
HEAP_MIN_SIZE       equ 0x01000000
254
 
255
page_tabs           equ 0xFDC00000
256
app_page_tabs       equ 0xFDC00000
257
kernel_tabs         equ (page_tabs+ (OS_BASE shr 10))   ;0xFDE00000
258
master_tab          equ (page_tabs+ (page_tabs shr 10)) ;0xFDFF70000
259
 
260
LFB_BASE            equ 0xFE000000
261
 
262
 
263
new_app_base        equ 0;
264
 
265
twdw                equ 0x2000   ;(CURRENT_TASK-window_data)
266
 
267
std_application_base_address   equ new_app_base
7124 dunkaist 268
RING0_STACK_SIZE    equ 0x2000
2288 clevermous 269
 
270
REG_SS              equ (RING0_STACK_SIZE-4)
271
REG_APP_ESP         equ (RING0_STACK_SIZE-8)
272
REG_EFLAGS          equ (RING0_STACK_SIZE-12)
273
REG_CS              equ (RING0_STACK_SIZE-16)
274
REG_EIP             equ (RING0_STACK_SIZE-20)
275
REG_EAX             equ (RING0_STACK_SIZE-24)
276
REG_ECX             equ (RING0_STACK_SIZE-28)
277
REG_EDX             equ (RING0_STACK_SIZE-32)
278
REG_EBX             equ (RING0_STACK_SIZE-36)
279
REG_ESP             equ (RING0_STACK_SIZE-40)  ;RING0_STACK_SIZE-20
280
REG_EBP             equ (RING0_STACK_SIZE-44)
281
REG_ESI             equ (RING0_STACK_SIZE-48)
282
REG_EDI             equ (RING0_STACK_SIZE-52)
283
REG_RET             equ (RING0_STACK_SIZE-56)  ;irq0.return
284
 
285
 
5130 serge 286
PAGE_SIZE           equ 4096
287
 
2288 clevermous 288
PG_UNMAP            equ 0x000
5356 serge 289
PG_READ             equ 0x001
2288 clevermous 290
PG_WRITE            equ 0x002
5356 serge 291
PG_USER             equ 0x004
292
PG_PCD              equ 0x008
293
PG_PWT              equ 0x010
5360 serge 294
PG_ACCESSED         equ 0x020
295
PG_DIRTY            equ 0x040
296
PG_PAT              equ 0x080
2288 clevermous 297
PG_GLOBAL           equ 0x100
298
PG_SHARED           equ 0x200
299
 
5356 serge 300
PG_SWR              equ 0x003 ; (PG_WRITE+PG_READ)
301
PG_UR               equ 0x005 ; (PG_USER+PG_READ)
302
PG_UWR              equ 0x007 ; (PG_USER+PG_WRITE+PG_READ)
303
PG_NOCACHE          equ 0x018 ; (PG_PCD+PG_PWT)
304
 
305
PDE_LARGE           equ 0x080
306
 
5360 serge 307
PAT_WB              equ 0x000
308
PAT_WC              equ 0x008
309
PAT_UCM             equ 0x010
310
PAT_UC              equ 0x018
311
 
312
PAT_TYPE_UC         equ 0
313
PAT_TYPE_WC         equ 1
314
PAT_TYPE_WB         equ 6
315
PAT_TYPE_UCM        equ 7
316
 
317
PAT_VALUE           equ 0x00070106; (UC<<24)|(UCM<<16)|(WC<<8)|WB
318
 
2288 clevermous 319
;;;;;;;;;;;boot time variables
320
 
2466 Serge 321
BOOT_BPP            equ 0x9000    ;byte   bits per pixel
322
BOOT_PITCH          equ 0x9001    ;word   scanline length
2288 clevermous 323
BOOT_VESA_MODE      equ 0x9008    ;word   vesa video mode
2466 Serge 324
BOOT_X_RES          equ 0x900A    ;word   X res
325
BOOT_Y_RES          equ 0x900C    ;word   Y res
2288 clevermous 326
BOOT_BANK_SW        equ 0x9014    ;dword  Vesa 1.2 pm bank switch
327
BOOT_LFB            equ 0x9018    ;dword  Vesa 2.0 LFB address
328
BOOT_MTRR           equ 0x901C    ;byte   0 or 1 : enable MTRR graphics acceleration
7122 dunkaist 329
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 330
BOOT_DEBUG_PRINT    equ 0x901E    ;byte   If nonzero, duplicates debug output to the screen.
7122 dunkaist 331
BOOT_DMA            equ 0x901F    ;byte   DMA write : 1=yes, 2=no
2288 clevermous 332
BOOT_PCI_DATA       equ 0x9020    ;8bytes pci data
7121 dunkaist 333
BOOT_SHUTDOWN_TYPE  equ 0x9030    ;byte   shutdown type (see sysfn 18.9)
2288 clevermous 334
BOOT_MEM_AMOUNT     equ 0x9034    ;dword  memory amount
335
 
2466 Serge 336
BOOT_APM_ENTRY      equ 0x9040
337
BOOT_APM_VERSION    equ 0x9044
7122 dunkaist 338
BOOT_APM_FLAGS      equ 0x9046
2466 Serge 339
BOOT_APM_CODE_32    equ 0x9050
340
BOOT_APM_CODE_16    equ 0x9052
341
BOOT_APM_DATA_16    equ 0x9054
342
 
7122 dunkaist 343
BOOT_BIOS_HD_CNT     equ 0x907F   ; byte   number of BIOS hard disks
344
BOOT_BIOS_HD         equ 0x9080   ; Nbytes BIOS hard disks
345
BOOT_MEMMAP_BLOCK_CNT equ 0x9100  ; word   available physical memory map: number of blocks
346
BOOT_MEMMAP_BLOCKS   equ 0x9104   ; available physical memory map: blocks, i.e. e820entry structs
347
MAX_MEMMAP_BLOCKS   equ 32
348
 
2288 clevermous 349
TMP_FILE_NAME       equ     0
350
TMP_CMD_LINE        equ  1024
351
TMP_ICON_OFFS       equ  1280
352
 
353
 
354
EVENT_REDRAW       equ 0x00000001
355
EVENT_KEY          equ 0x00000002
356
EVENT_BUTTON       equ 0x00000004
357
EVENT_BACKGROUND   equ 0x00000010
358
EVENT_MOUSE        equ 0x00000020
359
EVENT_IPC          equ 0x00000040
360
EVENT_NETWORK      equ 0x00000080
361
EVENT_DEBUG        equ 0x00000100
3545 hidnplayr 362
EVENT_NETWORK2     equ 0x00000200
363
EVENT_EXTENDED     equ 0x00000400
2288 clevermous 364
 
365
EV_INTR            equ 1
366
 
6244 serge 367
STDIN_FILENO       equ 0
368
STDOUT_FILENO      equ 1
369
STDERR_FILENO      equ 2
6079 serge 370
 
6244 serge 371
SYSTEM_SHUTDOWN    equ 2
372
SYSTEM_REBOOT      equ 3
373
SYSTEM_RESTART     equ 4
374
 
6790 0CodErr 375
BLIT_CLIENT_RELATIVE equ 0x20000000
376
 
6079 serge 377
struct SYSCALL_STACK
378
        _eip            dd ?
379
        _edi            dd ?    ;  +4
380
        _esi            dd ?    ;  +8
381
        _ebp            dd ?    ; +12
382
        _esp            dd ?    ; +16
383
        _ebx            dd ?    ; +20
384
        _edx            dd ?    ; +24
385
        _ecx            dd ?    ; +28
386
        _eax            dd ?    ; +32
2384 hidnplayr 387
ends
2288 clevermous 388
 
6079 serge 389
struct  LHEAD
390
        next            dd ?   ;next object in list
391
        prev            dd ?   ;prev object in list
392
ends
2288 clevermous 393
 
6079 serge 394
struct  MUTEX_WAITER
395
        list    LHEAD
396
        task    dd ?
397
        type    dd ?
398
ends
399
 
400
struct  MUTEX
401
        wait_list       LHEAD
402
        count           dd ?
403
ends
404
 
405
struct  RWSEM
406
        wait_list       LHEAD
407
        count           dd ?
408
ends
409
 
410
struct  FUTEX
411
        list            LHEAD
412
        magic           dd ?
413
        handle          dd ?
414
        destroy         dd ?
415
 
416
        wait_list       LHEAD
417
        pointer         dd ?
418
        flags           dd ?
419
ends
420
 
421
FUTEX_INIT      equ 0
422
FUTEX_DESTROY   equ 1
423
FUTEX_WAIT      equ 2
424
FUTEX_WAKE      equ 3
425
 
6926 serge 426
struct  FILED
427
        list            LHEAD
428
        magic           rd 1
429
        handle          rd 1
430
        destroy         rd 1
6929 serge 431
        mode            rd 1
6926 serge 432
        file            rd 1
433
ends
434
 
435
struct  PIPE
436
        pipe_ops        rd 1
437
        buffer          rd 1
438
        readers         rd 1
439
        writers         rd 1
440
 
441
        pipe_lock       MUTEX
442
        count           rd 1
443
 
444
        read_end        rd 1
445
        write_end       rd 1
446
        rlist           LHEAD
447
        wlist           LHEAD
448
ends
449
 
6079 serge 450
struct  PROC
451
        list            LHEAD
452
        thr_list        LHEAD
453
        heap_lock       MUTEX
454
        heap_base       rd 1
455
        heap_top        rd 1
456
        mem_used        rd 1
457
        dlls_list_ptr   rd 1
458
        pdt_0_phys      rd 1
459
        pdt_1_phys      rd 1
460
        io_map_0        rd 1
461
        io_map_1        rd 1
462
 
463
        ht_lock         rd 1
6802 pathoswith 464
        ht_free         rd 1                ;htab[0] stdin
465
        ht_next         rd 1                ;htab[1] stdout
466
        htab            rd 1024-PROC.htab/4 ;htab[2] stderr
6079 serge 467
        pdt_0           rd 1024
468
ends
469
 
470
struct  DBG_REGS
471
        dr0             dd ?
472
        dr1             dd ?
473
        dr2             dd ?
474
        dr3             dd ?
475
        dr7             dd ?
476
ends
477
 
478
struct  POINT
479
        x       dd ?
480
        y       dd ?
481
ends
482
 
483
struct  RECT
484
        left    dd ?
485
        top     dd ?
486
        right   dd ?
487
        bottom  dd ?
488
ends
489
 
490
struct  BOX
491
        left    dd ?
492
        top     dd ?
493
        width   dd ?
494
        height  dd ?
495
ends
496
 
497
struct  APPDATA
498
        app_name        rb 11
499
                        rb 5
500
 
501
        list            LHEAD           ;+16
502
        process         dd ?            ;+24
503
        fpu_state       dd ?            ;+28
504
        exc_handler     dd ?            ;+32
505
        except_mask     dd ?            ;+36
506
        pl0_stack       dd ?            ;+40
507
        cursor          dd ?            ;+44
508
        fd_ev           dd ?            ;+48
509
        bk_ev           dd ?            ;+52
510
        fd_obj          dd ?            ;+56
511
        bk_obj          dd ?            ;+60
512
        saved_esp       dd ?            ;+64
513
        io_map          rd 2            ;+68
514
        dbg_state       dd ?            ;+76
515
        cur_dir         dd ?            ;+80
516
        wait_timeout    dd ?            ;+84
517
        saved_esp0      dd ?            ;+88
518
        wait_begin      dd ?            ;+92   +++
519
        wait_test       dd ?            ;+96   +++
520
        wait_param      dd ?            ;+100  +++
521
        tls_base        dd ?            ;+104
522
                        dd ?            ;+108
523
        event_filter    dd ?            ;+112
524
        draw_bgr_x      dd ?            ;+116
525
        draw_bgr_y      dd ?            ;+120
526
                        dd ?            ;+124
527
        wnd_shape       dd ?            ;+128
528
        wnd_shape_scale dd ?            ;+132
529
                        dd ?            ;+136
530
                        dd ?            ;+140
531
        saved_box       BOX             ;+144
532
        ipc_start       dd ?            ;+160
533
        ipc_size        dd ?            ;+164
534
        event_mask      dd ?            ;+168
535
        debugger_slot   dd ?            ;+172
536
        terminate_protection dd ?       ;+176
537
        keyboard_mode   db ?            ;+180
6802 pathoswith 538
        captionEncoding db ?
539
                        rb 2
6318 serge 540
        exec_params     dd ?            ;+184
6079 serge 541
        dbg_event_mem   dd ?            ;+188
542
        dbg_regs        DBG_REGS        ;+192
543
        wnd_caption     dd ?            ;+212
544
        wnd_clientbox   BOX             ;+216
545
        priority        dd ?            ;+232
546
        in_schedule     LHEAD           ;+236
547
ends
548
 
549
APP_OBJ_OFFSET  equ 48
550
APP_EV_OFFSET   equ 40
551
 
552
struct  TASKDATA
553
        event_mask      dd ?
554
        pid             dd ?
555
                        dw ?
556
        state           db ?
557
                        db ?
558
                        dw ?
559
        wnd_number      db ?
560
                        db ?
561
        mem_start       dd ?
562
        counter_sum     dd ?
563
        counter_add     dd ?
564
        cpu_usage       dd ?
565
ends
566
 
567
TSTATE_RUNNING        = 0
568
TSTATE_RUN_SUSPENDED  = 1
569
TSTATE_WAIT_SUSPENDED = 2
570
TSTATE_ZOMBIE         = 3
571
TSTATE_TERMINATING    = 4
572
TSTATE_WAITING        = 5
573
TSTATE_FREE           = 9
574
 
575
; constants definition
576
WSTATE_NORMAL    = 00000000b
577
WSTATE_MAXIMIZED = 00000001b
578
WSTATE_MINIMIZED = 00000010b
579
WSTATE_ROLLEDUP  = 00000100b
580
 
581
WSTATE_REDRAW    = 00000001b
582
WSTATE_WNDDRAWN  = 00000010b
583
 
584
WSTYLE_HASCAPTION     = 00010000b
585
WSTYLE_CLIENTRELATIVE = 00100000b
586
 
587
ZPOS_DESKTOP            = -2
588
ZPOS_ALWAYS_BACK        = -1
589
ZPOS_NORMAL             = 0
590
ZPOS_ALWAYS_TOP         = 1     ;ZPOS_ALWAYS_TOP is always last and has max number!
591
; structures definition
592
struct  WDATA
593
        box             BOX
594
        cl_workarea     dd ?
595
        cl_titlebar     dd ?
596
        cl_frames       dd ?
597
        z_modif         db ?
598
        fl_wstate       db ?
599
        fl_wdrawn       db ?
600
        fl_redraw       db ?
601
ends
602
 
603
label WDATA.fl_wstyle byte at WDATA.cl_workarea + 3
604
 
605
 
2384 hidnplayr 606
struct  SYS_VARS
607
        bpp             dd ?
608
        scanline        dd ?
609
        vesa_mode       dd ?
610
        x_res           dd ?
611
        y_res           dd ?
612
ends
2288 clevermous 613
 
2384 hidnplayr 614
struct  APPOBJ                  ; common object header
615
        magic           dd ?    ;
616
        destroy         dd ?    ; internal destructor
617
        fd              dd ?    ; next object in list
618
        bk              dd ?    ; prev object in list
619
        pid             dd ?    ; owner id
620
ends
2288 clevermous 621
 
2384 hidnplayr 622
struct  CURSOR          APPOBJ
623
        base            dd ?   ;allocated memory
624
        hot_x           dd ?   ;hotspot coords
625
        hot_y           dd ?
2288 clevermous 626
 
2384 hidnplayr 627
        list_next       dd ?   ;next cursor in cursor list
628
        list_prev       dd ?   ;prev cursor in cursor list
629
        dev_obj         dd ?   ;device depended data
630
ends
2288 clevermous 631
 
632
 
2384 hidnplayr 633
struct  EVENT           APPOBJ
634
        id              dd ?   ;event uid
635
        state           dd ?   ;internal flags
636
        code            dd ?
637
                        rd 5
638
ends
2288 clevermous 639
 
640
 
2384 hidnplayr 641
struct  SMEM
642
        bk              dd ?
643
        fd              dd ?    ;+4
644
        base            dd ?    ;+8
645
        size            dd ?    ;+12
646
        access          dd ?    ;+16
647
        refcount        dd ?    ;+20
648
        name            rb 32   ;+24
649
ends
2288 clevermous 650
 
2384 hidnplayr 651
struct  SMAP            APPOBJ
652
        base            dd ?   ;mapped base
653
        parent          dd ?   ;SMEM
654
ends
2288 clevermous 655
 
2384 hidnplayr 656
struct  DLLDESCR
657
        bk              dd ?
658
        fd              dd ?    ;+4
659
        data            dd ?    ;+8
660
        size            dd ?    ;+12
661
        timestamp       dq ?
662
        refcount        dd ?
663
        defaultbase     dd ?
664
        coff_hdr        dd ?
665
        symbols_ptr     dd ?
666
        symbols_num     dd ?
667
        symbols_lim     dd ?
668
        exports         dd ?   ;export table
669
        name            rb 260
670
ends
2288 clevermous 671
 
2384 hidnplayr 672
struct  HDLL
673
        fd              dd ?   ;next object in list
674
        bk              dd ?   ;prev object in list
675
        pid             dd ?   ;owner id
2288 clevermous 676
 
2384 hidnplayr 677
        base            dd ?   ;mapped base
678
        size            dd ?   ;mapped size
679
        refcount        dd ?   ;reference counter for this process and this lib
680
        parent          dd ?   ;DLLDESCR
681
ends
2288 clevermous 682
 
683
 
2384 hidnplayr 684
struct  BOOT_DATA
685
        bpp             dd ?
686
        scanline        dd ?
687
        vesa_mode       dd ?
688
        x_res           dd ?
689
        y_res           dd ?
690
        mouse_port      dd ?
691
        bank_switch     dd ?
692
        lfb             dd ?
693
        vesa_mem        dd ?
694
        log             dd ?
695
        direct_lfb      dd ?
696
        pci_data        dd ?
697
                        dd ?
698
        ide_base        dd ?
699
        mem_amount      dd ?
700
        pages_count     dd ?
701
        pagemap_size    dd ?
702
        kernel_max      dd ?
703
        kernel_pages    dd ?
704
        kernel_tables   dd ?
2288 clevermous 705
 
2384 hidnplayr 706
        cpu_vendor      dd ?
707
                        dd ?
708
                        dd ?
709
        cpu_sign        dd ?
710
        cpu_info        dd ?
711
        cpu_caps        dd ?
712
                        dd ?
713
                        dd ?
714
ends
2288 clevermous 715
 
5351 serge 716
struct  display_t
717
        x               dd ?
718
        y               dd ?
719
        width           dd ?
720
        height          dd ?
721
        bits_per_pixel  dd ?
722
        vrefresh        dd ?
6263 serge 723
        current_lfb     dd ?
5351 serge 724
        lfb_pitch       dd ?
725
 
726
        win_map_lock    RWSEM
727
        win_map         dd ?
728
        win_map_pitch   dd ?
729
        win_map_size    dd ?
730
 
731
        modes           dd ?
732
        ddev            dd ?
733
        connector       dd ?
734
        crtc            dd ?
735
 
736
        cr_list.next    dd ?
737
        cr_list.prev    dd ?
738
 
739
        cursor          dd ?
740
 
741
        init_cursor     dd ?
742
        select_cursor   dd ?
743
        show_cursor     dd ?
744
        move_cursor     dd ?
745
        restore_cursor  dd ?
746
        disable_mouse   dd ?
747
        mask_seqno      dd ?
748
        check_mouse     dd ?
749
        check_m_pixel   dd ?
750
 
751
        bytes_per_pixel dd ?
752
ends
753
 
6079 serge 754
struct  DISPMODE
755
        width   dw ?
756
        height  dw ?
757
        bpp     dw ?
758
        freq    dw ?
759
ends
5351 serge 760
 
6079 serge 761
 
3393 clevermous 762
struct  PCIDEV
763
        bk              dd ?
764
        fd              dd ?
765
        vendor_device_id dd ?
766
        class           dd ?
767
        devfn           db ?
768
        bus             db ?
4418 clevermous 769
                        rb 2
770
        owner           dd ? ; pointer to SRV or 0
3393 clevermous 771
ends
772
 
6079 serge 773
struct  IDE_DATA
774
        ProgrammingInterface dd ?
775
        Interrupt            dw ?
776
        RegsBaseAddres       dw ?
777
        BAR0_val             dw ?
778
        BAR1_val             dw ?
779
        BAR2_val             dw ?
780
        BAR3_val             dw ?
781
        dma_hdd_channel_1    db ?
782
        dma_hdd_channel_2    db ?
6816 dunkaist 783
        pcidev               dd ?       ; pointer to corresponding PCIDEV structure
6079 serge 784
ends
785
 
786
struct  IDE_CACHE
787
        pointer              dd ?
788
        size                 dd ?   ; not use
789
        data_pointer         dd ?
790
        system_data_size     dd ?   ; not use
791
        appl_data_size       dd ?   ; not use
792
        system_data          dd ?
793
        appl_data            dd ?
794
        system_sad_size      dd ?
795
        appl_sad_size        dd ?
796
        search_start         dd ?
797
        appl_search_start    dd ?
798
ends
799
 
800
struct  IDE_DEVICE
801
        UDMA_possible_modes  db ?
802
        UDMA_set_mode        db ?
803
ends
804
 
3395 clevermous 805
; The following macro assume that we are on uniprocessor machine.
806
; Serious work is needed for multiprocessor machines.
807
macro spin_lock_irqsave spinlock
808
{
809
        pushf
810
        cli
811
}
812
macro spin_unlock_irqrestore spinlock
813
{
814
        popf
815
}
816
macro spin_lock_irq spinlock
817
{
818
        cli
819
}
820
macro spin_unlock_irq spinlock
821
{
822
        sti
823
}
824
 
2384 hidnplayr 825
struct  MEM_STATE
826
        mutex           MUTEX
827
        smallmap        dd ?
828
        treemap         dd ?
829
        topsize         dd ?
830
        top             dd ?
831
        smallbins       rd 4*32
832
        treebins        rd 32
833
ends
2288 clevermous 834
 
2384 hidnplayr 835
struct  PG_DATA
836
        mem_amount      dd ?
837
        vesa_mem        dd ?
838
        pages_count     dd ?
839
        pages_free      dd ?
840
        pages_faults    dd ?
841
        pagemap_size    dd ?
842
        kernel_pages    dd ?
843
        kernel_tables   dd ?
844
        sys_page_dir    dd ?
845
        mutex           MUTEX
846
ends
2288 clevermous 847
 
2384 hidnplayr 848
struct  SRV
849
        srv_name        rb 16    ;ASCIIZ string
850
        magic           dd ?     ;+0x10 ;'SRV '
851
        size            dd ?     ;+0x14 ;size of structure SRV
852
        fd              dd ?     ;+0x18 ;next SRV descriptor
853
        bk              dd ?     ;+0x1C ;prev SRV descriptor
854
        base            dd ?     ;+0x20 ;service base address
855
        entry           dd ?     ;+0x24 ;service START function
856
        srv_proc        dd ?     ;+0x28 ;user mode service handler
857
        srv_proc_ex     dd ?     ;+0x2C ;kernel mode service handler
858
ends
2288 clevermous 859
 
3520 clevermous 860
struct USBSRV
861
        srv             SRV
862
        usb_func        dd ?
863
ends
864
 
865
struct USBFUNC
866
        strucsize       dd ?
867
        add_device      dd ?
868
        device_disconnect dd ?
869
ends
870
 
2288 clevermous 871
DRV_ENTRY    equ  1
872
DRV_EXIT     equ -1
873
 
2384 hidnplayr 874
struct  COFF_HEADER
875
        machine         dw ?
876
        nSections       dw ?
877
        DataTime        dd ?
878
        pSymTable       dd ?
879
        nSymbols        dd ?
880
        optHeader       dw ?
881
        flags           dw ?
882
ends
2288 clevermous 883
 
2384 hidnplayr 884
struct  COFF_SECTION
885
        Name            rb 8
886
        VirtualSize     dd ?
887
        VirtualAddress  dd ?
888
        SizeOfRawData   dd ?
889
        PtrRawData      dd ?
890
        PtrReloc        dd ?
891
        PtrLinenumbers  dd ?
892
        NumReloc        dw ?
893
        NumLinenum      dw ?
894
        Characteristics dd ?
895
ends
2288 clevermous 896
 
2384 hidnplayr 897
struct  COFF_RELOC
898
        VirtualAddress  dd ?
899
        SymIndex        dd ?
900
        Type            dw ?
901
ends
2288 clevermous 902
 
2384 hidnplayr 903
struct  COFF_SYM
904
        Name            rb 8
905
        Value           dd ?
906
        SectionNumber   dw ?
907
        Type            dw ?
908
        StorageClass    db ?
909
        NumAuxSymbols   db ?
910
ends
2288 clevermous 911
 
5039 clevermous 912
struct  STRIPPED_PE_HEADER
913
        Signature           dw ?
914
        Characteristics     dw ?
915
        AddressOfEntryPoint dd ?
916
        ImageBase           dd ?
917
        SectionAlignmentLog db ?
918
        FileAlignmentLog    db ?
919
        MajorOSVersion      db ?
920
        MinorOSVersion      db ?
921
        SizeOfImage         dd ?
922
        SizeOfStackReserve  dd ?
923
        SizeOfHeapReserve   dd ?
924
        SizeOfHeaders       dd ?
925
        Subsystem           db ?
926
        NumberOfRvaAndSizes db ?
927
        NumberOfSections    dw ?
928
ends
929
STRIPPED_PE_SIGNATURE = 0x4503 ; 'PE' xor 'S'
930
SPE_DIRECTORY_IMPORT    = 0
931
SPE_DIRECTORY_EXPORT    = 1
932
SPE_DIRECTORY_BASERELOC = 2
933
 
2384 hidnplayr 934
struct  IOCTL
935
        handle          dd ?
936
        io_code         dd ?
937
        input           dd ?
938
        inp_size        dd ?
939
        output          dd ?
940
        out_size        dd ?
941
ends
2288 clevermous 942
 
2384 hidnplayr 943
struct  IRQH
944
        list            LHEAD
945
        handler         dd ?   ;handler roututine
946
        data            dd ?   ;user-specific data
3506 clevermous 947
        num_ints        dd ?   ;how many times handled
2414 Serge 948
ends
7122 dunkaist 949
 
950
struct DQ
951
        lo dd ?
952
        hi dd ?
953
ends
954
 
955
struct e820entry
956
        addr DQ ?
957
        size DQ ?
958
        type dd ?
959
ends
960