Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
2288 clevermous 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
7132 dunkaist 3
;; Copyright (C) KolibriOS team 2004-2017. All rights reserved. ;;
2288 clevermous 4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
8
$Revision: 7132 $
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
 
7132 dunkaist 232
BOOT_VARS           equ 0x9000
3732 Serge 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
 
7122 dunkaist 337
MAX_MEMMAP_BLOCKS   equ 32
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
 
7132 dunkaist 673
struct DQ
674
        lo dd ?
675
        hi dd ?
676
ends
2288 clevermous 677
 
7132 dunkaist 678
struct e820entry
679
        addr DQ ?
680
        size DQ ?
681
        type dd ?
682
ends
2288 clevermous 683
 
7132 dunkaist 684
struct  boot_data
685
        bpp             db ?    ; bits per pixel
686
        pitch           dw ?    ; scanline length
687
                        db ?
2384 hidnplayr 688
                        dd ?
7132 dunkaist 689
        vesa_mode       dw ?
690
        x_res           dw ?
691
        y_res           dw ?
692
                        dw ?
2384 hidnplayr 693
                        dd ?
7132 dunkaist 694
        bank_switch     dd ?    ; Vesa 1.2 pm bank switch
695
        lfb             dd ?    ; Vesa 2.0 LFB address
696
        mtrr            db ?    ; 0 or 1: enable MTRR graphics acceleration
697
        launcher_start  db ?    ; 0 or 1: start the first app (right now it's LAUNCHER) after kernel is loaded
698
        debug_print     db ?    ; if nonzero, duplicates debug output to the screen
699
        dma             db ?    ; DMA write: 1=yes, 2=no
700
        pci_data        rb 8
701
                        rb 8
702
        shutdown_type   db ?    ; see sysfn 18.9
703
                        rb 15
704
        apm_entry       dd ?    ; entry point of APM BIOS
705
        apm_version     dw ?    ; BCD
706
        apm_flags       dw ?
707
                        rb 8
708
        apm_code_32     dw ?
709
        apm_code_16     dw ?
710
        apm_data_16     dw ?
711
        dev             db ?
712
                        db ?
713
        kernel_restart  dw ?
714
        bx_from_load    dw ?
715
        ; low byte: a,b,c,d -- hdX, r -- rdX
716
        ; high byte: symbol 'X' as in the line above, e.g. '1', not 1
717
        ; see loader_doc.txt for details
718
        acpi_rsdp       dd ?
719
                        rb 0x1f
720
        bios_hd_cnt     db ?    ; number of BIOS hard disks
721
        bios_hd         rb 0x80 ; BIOS hard disks
722
        memmap_block_cnt dd ?   ; available physical memory map: number of blocks
723
        memmap_blocks   e820entry
724
                        rb sizeof.e820entry * (MAX_MEMMAP_BLOCKS - 1)
2384 hidnplayr 725
ends
2288 clevermous 726
 
7132 dunkaist 727
virtual at BOOT_VARS
728
        BOOT_LO boot_data
729
end virtual
730
virtual at OS_BASE + BOOT_VARS
731
        BOOT boot_data
732
end virtual
733
 
5351 serge 734
struct  display_t
735
        x               dd ?
736
        y               dd ?
737
        width           dd ?
738
        height          dd ?
739
        bits_per_pixel  dd ?
740
        vrefresh        dd ?
6263 serge 741
        current_lfb     dd ?
5351 serge 742
        lfb_pitch       dd ?
743
 
744
        win_map_lock    RWSEM
745
        win_map         dd ?
746
        win_map_pitch   dd ?
747
        win_map_size    dd ?
748
 
749
        modes           dd ?
750
        ddev            dd ?
751
        connector       dd ?
752
        crtc            dd ?
753
 
754
        cr_list.next    dd ?
755
        cr_list.prev    dd ?
756
 
757
        cursor          dd ?
758
 
759
        init_cursor     dd ?
760
        select_cursor   dd ?
761
        show_cursor     dd ?
762
        move_cursor     dd ?
763
        restore_cursor  dd ?
764
        disable_mouse   dd ?
765
        mask_seqno      dd ?
766
        check_mouse     dd ?
767
        check_m_pixel   dd ?
768
 
769
        bytes_per_pixel dd ?
770
ends
771
 
6079 serge 772
struct  DISPMODE
773
        width   dw ?
774
        height  dw ?
775
        bpp     dw ?
776
        freq    dw ?
777
ends
5351 serge 778
 
6079 serge 779
 
3393 clevermous 780
struct  PCIDEV
781
        bk              dd ?
782
        fd              dd ?
783
        vendor_device_id dd ?
784
        class           dd ?
785
        devfn           db ?
786
        bus             db ?
4418 clevermous 787
                        rb 2
788
        owner           dd ? ; pointer to SRV or 0
3393 clevermous 789
ends
790
 
6079 serge 791
struct  IDE_DATA
792
        ProgrammingInterface dd ?
793
        Interrupt            dw ?
794
        RegsBaseAddres       dw ?
795
        BAR0_val             dw ?
796
        BAR1_val             dw ?
797
        BAR2_val             dw ?
798
        BAR3_val             dw ?
799
        dma_hdd_channel_1    db ?
800
        dma_hdd_channel_2    db ?
6816 dunkaist 801
        pcidev               dd ?       ; pointer to corresponding PCIDEV structure
6079 serge 802
ends
803
 
804
struct  IDE_CACHE
805
        pointer              dd ?
806
        size                 dd ?   ; not use
807
        data_pointer         dd ?
808
        system_data_size     dd ?   ; not use
809
        appl_data_size       dd ?   ; not use
810
        system_data          dd ?
811
        appl_data            dd ?
812
        system_sad_size      dd ?
813
        appl_sad_size        dd ?
814
        search_start         dd ?
815
        appl_search_start    dd ?
816
ends
817
 
818
struct  IDE_DEVICE
819
        UDMA_possible_modes  db ?
820
        UDMA_set_mode        db ?
821
ends
822
 
3395 clevermous 823
; The following macro assume that we are on uniprocessor machine.
824
; Serious work is needed for multiprocessor machines.
825
macro spin_lock_irqsave spinlock
826
{
827
        pushf
828
        cli
829
}
830
macro spin_unlock_irqrestore spinlock
831
{
832
        popf
833
}
834
macro spin_lock_irq spinlock
835
{
836
        cli
837
}
838
macro spin_unlock_irq spinlock
839
{
840
        sti
841
}
842
 
2384 hidnplayr 843
struct  MEM_STATE
844
        mutex           MUTEX
845
        smallmap        dd ?
846
        treemap         dd ?
847
        topsize         dd ?
848
        top             dd ?
849
        smallbins       rd 4*32
850
        treebins        rd 32
851
ends
2288 clevermous 852
 
2384 hidnplayr 853
struct  PG_DATA
854
        mem_amount      dd ?
855
        vesa_mem        dd ?
856
        pages_count     dd ?
857
        pages_free      dd ?
858
        pages_faults    dd ?
859
        pagemap_size    dd ?
860
        kernel_pages    dd ?
861
        kernel_tables   dd ?
862
        sys_page_dir    dd ?
863
        mutex           MUTEX
864
ends
2288 clevermous 865
 
2384 hidnplayr 866
struct  SRV
867
        srv_name        rb 16    ;ASCIIZ string
868
        magic           dd ?     ;+0x10 ;'SRV '
869
        size            dd ?     ;+0x14 ;size of structure SRV
870
        fd              dd ?     ;+0x18 ;next SRV descriptor
871
        bk              dd ?     ;+0x1C ;prev SRV descriptor
872
        base            dd ?     ;+0x20 ;service base address
873
        entry           dd ?     ;+0x24 ;service START function
874
        srv_proc        dd ?     ;+0x28 ;user mode service handler
875
        srv_proc_ex     dd ?     ;+0x2C ;kernel mode service handler
876
ends
2288 clevermous 877
 
3520 clevermous 878
struct USBSRV
879
        srv             SRV
880
        usb_func        dd ?
881
ends
882
 
883
struct USBFUNC
884
        strucsize       dd ?
885
        add_device      dd ?
886
        device_disconnect dd ?
887
ends
888
 
2288 clevermous 889
DRV_ENTRY    equ  1
890
DRV_EXIT     equ -1
891
 
2384 hidnplayr 892
struct  COFF_HEADER
893
        machine         dw ?
894
        nSections       dw ?
895
        DataTime        dd ?
896
        pSymTable       dd ?
897
        nSymbols        dd ?
898
        optHeader       dw ?
899
        flags           dw ?
900
ends
2288 clevermous 901
 
2384 hidnplayr 902
struct  COFF_SECTION
903
        Name            rb 8
904
        VirtualSize     dd ?
905
        VirtualAddress  dd ?
906
        SizeOfRawData   dd ?
907
        PtrRawData      dd ?
908
        PtrReloc        dd ?
909
        PtrLinenumbers  dd ?
910
        NumReloc        dw ?
911
        NumLinenum      dw ?
912
        Characteristics dd ?
913
ends
2288 clevermous 914
 
2384 hidnplayr 915
struct  COFF_RELOC
916
        VirtualAddress  dd ?
917
        SymIndex        dd ?
918
        Type            dw ?
919
ends
2288 clevermous 920
 
2384 hidnplayr 921
struct  COFF_SYM
922
        Name            rb 8
923
        Value           dd ?
924
        SectionNumber   dw ?
925
        Type            dw ?
926
        StorageClass    db ?
927
        NumAuxSymbols   db ?
928
ends
2288 clevermous 929
 
5039 clevermous 930
struct  STRIPPED_PE_HEADER
931
        Signature           dw ?
932
        Characteristics     dw ?
933
        AddressOfEntryPoint dd ?
934
        ImageBase           dd ?
935
        SectionAlignmentLog db ?
936
        FileAlignmentLog    db ?
937
        MajorOSVersion      db ?
938
        MinorOSVersion      db ?
939
        SizeOfImage         dd ?
940
        SizeOfStackReserve  dd ?
941
        SizeOfHeapReserve   dd ?
942
        SizeOfHeaders       dd ?
943
        Subsystem           db ?
944
        NumberOfRvaAndSizes db ?
945
        NumberOfSections    dw ?
946
ends
947
STRIPPED_PE_SIGNATURE = 0x4503 ; 'PE' xor 'S'
948
SPE_DIRECTORY_IMPORT    = 0
949
SPE_DIRECTORY_EXPORT    = 1
950
SPE_DIRECTORY_BASERELOC = 2
951
 
2384 hidnplayr 952
struct  IOCTL
953
        handle          dd ?
954
        io_code         dd ?
955
        input           dd ?
956
        inp_size        dd ?
957
        output          dd ?
958
        out_size        dd ?
959
ends
2288 clevermous 960
 
2384 hidnplayr 961
struct  IRQH
962
        list            LHEAD
963
        handler         dd ?   ;handler roututine
964
        data            dd ?   ;user-specific data
3506 clevermous 965
        num_ints        dd ?   ;how many times handled
2414 Serge 966
ends
7122 dunkaist 967