Subversion Repositories Kolibri OS

Rev

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