Subversion Repositories Kolibri OS

Rev

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