Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
164 serge 1
 
2
 
3
cpl0    equ  10011010b      ; code read dpl0
4
cpl3    equ  11111010b      ; code read dpl3
5
6
D32     equ  01000000b      ; 32bit segment
7
 
8
9
10
 
11
 
12
CPU_386        equ 3
13
 
14
CPU_PENTIUM    equ 5
15
CPU_P6         equ 6
16
CPU_PENTIUM4   equ 0x0F
17
18
CAPS_FPU       equ    00 ;on-chip x87 floating point unit
19
 
20
CAPS_DE        equ    02 ;debugging extensions
21
CAPS_PSE       equ    03 ;page-size extensions
22
CAPS_TSC       equ    04 ;time stamp counter
23
CAPS_MSR       equ    05 ;model-specific registers
24
CAPS_PAE       equ    06 ;physical-address extensions
25
CAPS_MCE       equ    07 ;machine check exception
26
CAPS_CX8       equ    08 ;CMPXCHG8B instruction
27
CAPS_APIC      equ    09 ;on-chip advanced programmable
28
                         ; interrupt controller
29
;                     10 ;unused
30
CAPS_SEP       equ    11 ;SYSENTER and SYSEXIT instructions
31
CAPS_MTRR      equ    12 ;memory-type range registers
32
CAPS_PGE       equ    13 ;page global extension
33
CAPS_MCA       equ    14 ;machine check architecture
34
CAPS_CMOV      equ    15 ;conditional move instructions
35
CAPS_PAT       equ    16 ;page attribute table
36
37
CAPS_PSE36     equ    17 ;page-size extensions
38
 
39
CAPS_CLFLUSH   equ    19 ;CLFUSH instruction
40
41
CAPS_DS        equ    21 ;debug store
42
 
43
                         ;controlled clock supported
44
CAPS_MMX       equ    23 ;MMX instructions
45
CAPS_FXSR      equ    24 ;FXSAVE and FXRSTOR instructions
46
CAPS_SSE       equ    25 ;SSE instructions
47
CAPS_SSE2      equ    26 ;SSE2 instructions
48
CAPS_SS        equ    27 ;self-snoop
49
CAPS_HTT       equ    28 ;hyper-threading technology
50
CAPS_TM        equ    29 ;thermal monitor supported
51
CAPS_IA64      equ    30 ;IA64 capabilities
52
CAPS_PBE       equ    31 ;pending break enable
53
54
;ecx
55
 
56
;                     33
57
;                     34
58
CAPS_MONITOR   equ    35 ;MONITOR/MWAIT instructions
59
CAPS_DS_CPL    equ    36 ;
60
CAPS_VMX       equ    37 ;virtual mode extensions
61
;                     38 ;
62
CAPS_EST       equ    39 ;enhansed speed step
63
CAPS_TM2       equ    40 ;thermal monitor2 supported
64
;                     41
65
CAPS_CID       equ    42 ;
66
;                     43
67
;                     44
68
CAPS_CX16      equ    45 ;CMPXCHG16B instruction
69
CAPS_xTPR      equ    46 ;
70
;
71
;reserved
72
;
73
;ext edx /ecx
74
CAPS_SYSCAL    equ    64 ;
75
CAPS_XD        equ    65 ;execution disable
76
CAPS_FFXSR     equ    66 ;
77
CAPS_RDTSCP    equ    67 ;
78
CAPS_X64       equ    68 ;
79
CAPS_3DNOW     equ    69 ;
80
CAPS_3DNOWEXT  equ    70 ;
81
CAPS_LAHF      equ    71 ;
82
CAPS_CMP_LEG   equ    72 ;
83
CAPS_SVM       equ    73 ;secure virual machine
84
CAPS_ALTMOVCR8 equ    74 ;
85
86
; CPU MSR names
87
 
378 serge 88
MSR_SYSENTER_ESP	equ	0x175
375 Ghost 89
MSR_SYSENTER_EIP	equ	0x176
90
MSR_AMD_EFER		equ	0xC0000080	; Extended Feature Enable Register
91
MSR_AMD_STAR		equ	0xC0000081	; SYSCALL/SYSRET Target Address Register
92
93
CR0_PE         equ    0x00000001   ;protected mode
164 serge 94
 
168 serge 95
CR0_EM         equ    0x00000004   ;fpu emulation
96
CR0_TS         equ    0x00000008   ;task switch
97
CR0_ET         equ    0x00000010   ;extension type hardcoded to 1
98
CR0_NE         equ    0x00000020   ;numeric error
99
CR0_WP         equ    0x00010000   ;write protect
100
CR0_AM         equ    0x00040000   ;alignment check
101
CR0_NW         equ    0x20000000   ;not write-through
102
CR0_CD         equ    0x40000000   ;cache disable
103
CR0_PG         equ    0x80000000   ;paging
104
105
106
 
107
 
164 serge 108
CR4_TSD        equ    0x0004
109
CR4_DE         equ    0x0008
110
CR4_PSE        equ    0x0010
111
CR4_PAE        equ    0x0020
112
CR4_MCE        equ    0x0040
113
CR4_PGE        equ    0x0080
114
CR4_PCE        equ    0x0100
115
CR4_OSFXSR     equ    0x0200
116
CR4_OSXMMEXPT  equ    0x0400
117
118
SSE_IE         equ    0x0001
119
 
168 serge 120
SSE_ZE         equ    0x0004
121
SSE_OE         equ    0x0008
122
SSE_UE         equ    0x0010
123
SSE_PE         equ    0x0020
124
SSE_DAZ        equ    0x0040
125
SSE_IM         equ    0x0080
126
SSE_DM         equ    0x0100
127
SSE_ZM         equ    0x0200
128
SSE_OM         equ    0x0400
129
SSE_UM         equ    0x0800
130
SSE_PM         equ    0x1000
131
SSE_FZ         equ    0x8000
132
133
SSE_INIT equ (SSE_IM+SSE_DM+SSE_ZM+SSE_OM+SSE_UM+SSE_PM)
164 serge 134
 
168 serge 135
OS_BASE             equ 0
164 serge 136
 
380 serge 137
window_data         equ (OS_BASE+0x0000000)
164 serge 138
 
380 serge 139
CURRENT_TASK        equ (OS_BASE+0x0003000)
164 serge 140
 
380 serge 141
TASK_BASE           equ (OS_BASE+0x0003010)
142
TASK_DATA           equ (OS_BASE+0x0003020)
143
TASK_EVENT          equ (OS_BASE+0x0003020)
144
145
mouseunder          equ (OS_BASE+0x0006900)
164 serge 146
 
380 serge 147
ACTIVE_PROC_STACK   equ (OS_BASE+0x000A400)
148
idts                equ (OS_BASE+0x000B100)
149
WIN_STACK           equ (OS_BASE+0x000C000)
150
WIN_POS             equ (OS_BASE+0x000C400)
151
FDD_BUFF            equ (OS_BASE+0x000D000)
152
FDD_DATA            equ (OS_BASE+0x000D000)
153
154
ENABLE_TASKSWITCH   equ (OS_BASE+0x000E000)
164 serge 155
 
380 serge 156
GETPIXEL            equ (OS_BASE+0x000E024)
157
BANK_SWITCH         equ (OS_BASE+0x000E030)
158
159
MOUSE_PICTURE       equ (OS_BASE+0x000F200)
164 serge 160
 
380 serge 161
XY_TEMP             equ (OS_BASE+0x000F300)
162
KEY_COUNT           equ (OS_BASE+0x000F400)
163
KEY_BUFF            equ (OS_BASE+0x000F401)
164
165
BTN_COUNT           equ (OS_BASE+0x000F500)
164 serge 166
 
380 serge 167
168
CPU_FREQ            equ (OS_BASE+0x000F600)
164 serge 169
 
380 serge 170
171
PS2_CHUNK           equ (OS_BASE+0x000FB00)
164 serge 172
 
380 serge 173
MOUSE_Y             equ (OS_BASE+0x000FB0C)
174
175
MOUSE_COLOR_MEM     equ (OS_BASE+0x000FB10)
164 serge 176
 
380 serge 177
BTN_DOWN            equ (OS_BASE+0x000FB40)
178
MOUSE_DOWN          equ (OS_BASE+0x000FB44)
179
X_UNDER             equ (OS_BASE+0x000FB4A)
180
Y_UNDER             equ (OS_BASE+0x000FB4C)
181
ScreenBPP           equ (OS_BASE+0x000FBF1)
182
MOUSE_BUFF_COUNT    equ (OS_BASE+0x000FCFF)
183
LFBAddress          equ (OS_BASE+0x000FE80)
184
MEM_AMOUNT          equ (OS_BASE+0x000FE8C)
185
;LFBSize             equ (OS_BASE+0x02f9050)
186
187
SCR_X_SIZE          equ (OS_BASE+0x000FE00)
164 serge 188
 
380 serge 189
SCR_BYTES_PER_LINE  equ (OS_BASE+0x000FE08)
190
SCR_MODE            equ (OS_BASE+0x000FE0C)
191
192
BTN_ADDR            equ (OS_BASE+0x000FE88)
164 serge 193
 
380 serge 194
TASK_ACTIVATE       equ (OS_BASE+0x000FF01)
195
196
REDRAW_BACKGROUND   equ (OS_BASE+0x000FFF0)
164 serge 197
 
380 serge 198
MOUSE_BACKGROUND    equ (OS_BASE+0x000FFF4)
199
DONT_DRAW_MOUSE     equ (OS_BASE+0x000FFF5)
200
DONT_SWITCH         equ (OS_BASE+0x000FFFF)
201
202
STACK_TOP           equ (OS_BASE+0x003EC00)
164 serge 203
 
380 serge 204
FONT_II             equ (OS_BASE+0x003EC00)
164 serge 205
 
380 serge 206
DISK_DATA           equ (OS_BASE+0x0040000)
207
SLOT_BASE           equ (OS_BASE+0x0080000)
208
TMP_BUFF            equ (OS_BASE+0x0090000)
209
210
VGABasePtr          equ (OS_BASE+0x00A0000)
164 serge 211
 
380 serge 212
RAMDISK             equ (OS_BASE+0x0100000)
164 serge 213
 
380 serge 214
FLOPPY_FAT          equ (OS_BASE+0x0282000)
215
SB16_Status         equ (OS_BASE+0x02B0000)
216
BUTTON_INFO         equ (OS_BASE+0x02C0000)
217
RESERVED_PORTS      equ (OS_BASE+0x02D0000)
218
IRQ_SAVE            equ (OS_BASE+0x02E0000)
219
SYS_VAR             equ (OS_BASE+0x02f0000)
220
IMG_BACKGROUND      equ (OS_BASE+0x0300000)
221
WinMapAddress       equ (OS_BASE+0x0460000)
222
display_data        equ (OS_BASE+0x0460000)
223
HD_CACHE            equ (OS_BASE+0x0600000)
224
stack_data_start    equ (OS_BASE+0x0700000)
225
eth_data_start      equ (OS_BASE+0x0700000)
226
stack_data          equ (OS_BASE+0x0704000)
227
stack_data_end      equ (OS_BASE+0x071ffff)
228
VMODE_BASE          equ (OS_BASE+0x0760000)
229
resendQ             equ (OS_BASE+0x0770000)
230
231
;skin_data          equ (OS_BASE+0x0778000)
164 serge 232
 
380 serge 233
164 serge 234
 
378 serge 235
 
380 serge 236
237
HEAP_BASE           equ (OS_BASE+0x98B000)
164 serge 238
 
380 serge 239
LFB_BASE            equ 0x7DC00000
164 serge 240
 
378 serge 241
page_tabs           equ 0x7FC00000
164 serge 242
 
378 serge 243
app_page_tabs       equ 0x7FE00000
244
245
sys_pgdir           equ OS_BASE+0x00050000
164 serge 246
 
378 serge 247
sys_pgmap           equ OS_BASE+0x00052000
248
249
164 serge 250
 
251
 
252
 
378 serge 253
twdw                equ (CURRENT_TASK-window_data)
254
 
188 serge 255
std_application_base_address   equ new_app_base
164 serge 256
 
257
378 serge 258
;PAGES_USED          equ 4
164 serge 259
 
378 serge 260
PG_UNMAP            equ 0x000
375 Ghost 261
 
188 serge 262
PG_WRITE            equ 0x002
263
PG_SW               equ 0x003
264
PG_USER             equ 0x005
265
PG_UW               equ 0x007
266
PG_NOCACHE          equ 0x018
267
PG_LARGE            equ 0x080
268
PG_GLOBAL           equ 0x100
269
270
;;;;;;;;;;;boot time variables
164 serge 271
 
272
;BOOT_BPP            equ 0x9000    ;byte   bits per pixel
273
 
274
BOOT_VESA_MODE      equ 0x9008    ;word   vesa video mode
275
;;BOOT_X_RES          equ 0x900A    ;word   X res
276
;;BOOT_Y_RES          equ 0x900C    ;word   Y res
277
;;BOOT_MOUSE_PORT     equ 0x9010    ;byte   mouse port  - not used
278
BOOT_BANK_SW        equ 0x9014    ;dword  Vesa 1.2 pm bank switch
279
BOOT_LFB            equ 0x9018    ;dword  Vesa 2.0 LFB address
280
BOOT_MTRR           equ 0x901C    ;byte   0 or 1 : enable MTRR graphics acceleration
281
BOOT_LOG            equ 0x901D    ;byte   not used anymore (0 or 1 : enable system log display)
282
BOOT_DIRECT_LFB     equ 0x901E    ;byte   0 or 1 : enable direct lfb write, paging disabled
283
BOOT_PCI_DATA       equ 0x9020    ;8bytes pci data
284
BOOT_VRR            equ 0x9030    ;byte   VRR start enabled 1, 2-no
285
BOOT_IDE_BASE_ADDR  equ 0x9031   ;word   IDEContrRegsBaseAddr
286
BOOT_MEM_AMOUNT     equ 0x9034    ;dword  memory amount
287
288
TMP_FILE_NAME       equ     0
289
 
290
TMP_ICON_OFFS       equ  1280
291
292
293
 
294
 
295
EVENT_BUTTON       equ 0x00000004
296
EVENT_BACKGROUND   equ 0x00000010
297
EVENT_MOUSE        equ 0x00000020
298
EVENT_IPC          equ 0x00000040
299
EVENT_NETWORK      equ 0x00000080
300
EVENT_DEBUG        equ 0x00000100
301
EVENT_EXTENDED     equ 0x00000200
302
227 serge 303
EV_INTR            equ 1
164 serge 304
 
305
struc SYS_VARS
306
 
307
  .scanline       dd ?
308
  .vesa_mode      dd ?
309
  .x_res          dd ?
310
  .y_res          dd ?
311
  .cpu_caps       dd ?
312
                  dd ?
313
                  dd ?
314
                  dd ?
315
}
316
317
struc APPOBJ           ;common object header
318
 
281 serge 319
   .magic       dd ?   ;
320
   .destroy     dd ?   ;internal destructor
321
   .fd          dd ?   ;next object in list
322
   .bk          dd ?   ;prev object in list
323
   .pid         dd ?   ;owner id
324
};
325
326
virtual at 0
327
 
328
end virtual
329
330
APP_OBJ_OFFSET  equ 48
331
 
332
354 serge 333
struc CURSOR
281 serge 334
 
221 serge 335
   .magic       dd ?   ;'CURS'
281 serge 336
   .destroy     dd ?   ;internal destructor
337
   .fd          dd ?   ;next object in list
338
   .bk          dd ?   ;prev object in list
339
   .pid         dd ?   ;owner id
340
341
 ;cursor data
342
 
343
   .hot_x       dd ?   ;hotspot coords
344
   .hot_y       dd ?
345
}
221 serge 346
virtual at 0
347
  CURSOR CURSOR
348
end virtual
349
350
CURSOR_SIZE     equ 32
351
 
281 serge 352
struc EVENT
221 serge 353
 
354 serge 354
   .magic       dd ?   ;'EVNT'
355
   .destroy     dd ?   ;internal destructor
356
   .fd          dd ?   ;next object in list
357
   .bk          dd ?   ;prev object in list
358
   .pid         dd ?   ;owner id
359
360
   .id          dd ?   ;event uid
361
 
362
   .code        dd ?
363
                rd 5
364
}
365
EVENT_SIZE  equ 52
366
367
virtual at 0
368
 
369
end virtual
370
371
372
 
373
 
374
 
375
   .mutex         rd 1
376
   .refcount      rd 1
377
   .heap_base     rd 1
378
   .heap_top      rd 1
379
   .app_mem       rd 1
380
}
381
382
HEAP_DATA_SIZE  equ 20
383
 
384
  HEAP_DATA HEAP_DATA
385
end virtual
386
387
struc BOOT_DATA
388
 
164 serge 389
  .scanline       dd ?
390
  .vesa_mode      dd ?
391
  .x_res          dd ?
392
  .y_res          dd ?
393
  .mouse_port     dd ?
394
  .bank_switch    dd ?
395
  .lfb            dd ?
396
  .vesa_mem       dd ?
397
  .log            dd ?
398
  .direct_lfb     dd ?
399
  .pci_data       dd ?
400
;                  dd ?
401
  .vrr            dd ?
402
  .ide_base       dd ?
403
  .mem_amount     dd ?
404
  .pages_count    dd ?
405
  .pagemap_size   dd ?
406
  .kernel_max     dd ?
407
  .kernel_pages   dd ?
408
  .kernel_tables  dd ?
409
410
  .cpu_vendor     dd ?
411
 
412
                  dd ?
413
  .cpu_sign       dd ?
414
  .cpu_info       dd ?
415
  .cpu_caps       dd ?
416
                  dd ?
417
                  dd ?
418
}
419
420
virtual at 0
421
 
422
end virtual
423
424
struc MEM_STATE
425
 
276 serge 426
   .smallmap          rd 1
427
   .treemap           rd 1
428
   .topsize           rd 1
429
   .top               rd 1
430
   .smallbins         rd 4*32
431
   .treebins          rd 32
432
}
433
434
struc PG_DATA
435
 
164 serge 436
  .vesa_mem          dd ?
437
  .pages_count       dd ?
438
  .pages_free        dd ?
439
  .pages_faults      dd ?
440
  .pagemap_size      dd ?
441
  .kernel_max        dd ?
442
  .kernel_pages      dd ?
443
  .kernel_tables     dd ?
444
  .sys_page_dir      dd ?
445
  .pg_mutex          dd ?
446
}
447
448
;struc LIB
449
 
278 serge 450
;  .lib_base         dd ?
378 serge 451
;  .lib_start        dd ?
452
;  .export           dd ?
453
;  .import           dd ?
454
;}
455
278 serge 456
struc SRV
164 serge 457
 
458
  .magic             dd ?     ;+0x10 ;'SRV '
278 serge 459
  .size              dd ?     ;+0x14 ;size of structure SRV
460
  .fd                dd ?     ;+0x18 ;next SRV descriptor
461
  .bk                dd ?     ;+0x1C ;prev SRV descriptor
462
  .base              dd ?     ;+0x20 ;service base address
463
  .entry             dd ?     ;+0x24 ;service START function
464
  .srv_proc          dd ?     ;+0x28 ;main service handler
465
}
466
164 serge 467
SRV_FD_OFFSET  equ 0x18
468
 
278 serge 469
470
struc COFF_HEADER
471
 
164 serge 472
   .nSections        dw ?
473
   .DataTime         dd ?
474
   .pSymTable        dd ?
475
   .nSymbols         dd ?
476
   .optHeader        dw ?
477
   .flags            dw ?
478
};
479
480
481
 
482
 
483
   .VirtualSize      dd ?
484
   .VirtualAddress   dd ?
485
   .SizeOfRawData    dd ?
486
   .PtrRawData       dd ?
487
   .PtrReloc         dd ?
488
   .PtrLinenumbers   dd ?
489
   .NumReloc         dw ?
490
   .NumLinenum       dw ?
491
   .Characteristics  dd ?
492
}
493
COFF_SECTION_SIZE equ 40
494
206 serge 495
struc COFF_RELOC
164 serge 496
 
497
   .SymIndex         dd ?
498
   .Type             dw ?
499
}
500
501
struc COFF_SYM
502
 
503
   .Value            dd ?
504
   .SectionNumber    dw ?
505
   .Type             dw ?
506
   .StorageClass     db ?
507
   .NumAuxSymbols    db ?
508
}
509
CSYM_SIZE equ 18
510
188 serge 511
struc IOCTL
164 serge 512
 
513
   .io_code          dd ?
514
   .input            dd ?
515
   .inp_size         dd ?
516
   .output           dd ?
517
   .out_size         dd ?
518
}
519
520
virtual at 0
521
 
522
end virtual
523
524
;virtual at 0
525
 
278 serge 526
;end virtual
527
528
virtual at 0
164 serge 529
 
530
end virtual
531
532
virtual at 0
533
 
534
end virtual
188 serge 535
536
virtual at 0
537
 
538
end virtual
164 serge 539
540
virtual at 0
541
 
542
end virtual
543
544
virtual at 0
545
 
546
end virtual
547