Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
9325 Boppan 1
; TODO: SPDX
2
 
9342 Boppan 3
if ~ defined win32
4
    format ELF
5
else
6
    format MS COFF
9325 Boppan 7
 
9342 Boppan 8
    macro c_public name, _alias, _argsize {
9
        if ~ _argsize eq nomangle
10
            if _alias eqtype 'string'
11
                if _argsize eqtype 1
12
                    public name as '_' # _alias # '@' # `_argsize
13
                else
14
                    public name as '_' # _alias
15
                end if
16
            else if _alias eqtype 1
17
                public name as '_' # `name # '@' # `_alias
18
            else
19
                public name as '_' # `name
20
            end if
21
        else
22
            public name as _alias
23
        end if
24
    }
25
 
26
    macro extrn name, _argsize {
27
        if _argsize eqtype 1
28
            extrn '_' # `name # '@' # `_argsize as name
29
        else
30
            extrn '_' # `name as name
31
        end if
32
    }
33
end if
34
 
9325 Boppan 35
__DEBUG__ = 1
36
__DEBUG_LEVEL__ = 1
37
 
38
UMKA_SHELL = 1
39
UMKA_FUSE  = 2
40
UMKA_OS    = 3
41
 
42
UMKA_MEMORY_BYTES = 256 SHL 20
43
 
9342 Boppan 44
c_public umka_sys_put_image_palette
45
c_public disk_add, 16
46
c_public disk_del, 4
47
c_public disk_list
48
c_public disk_media_changed,8
9325 Boppan 49
 
9342 Boppan 50
c_public xfs._.user_functions, 'xfs_user_functions'
51
c_public ext_user_functions
52
c_public fat_user_functions
53
c_public ntfs_user_functions
9325 Boppan 54
 
9342 Boppan 55
c_public i40, 'i40', nomangle
9325 Boppan 56
 
9342 Boppan 57
c_public coverage_begin
58
c_public coverage_end
9325 Boppan 59
 
9342 Boppan 60
c_public sha3_256_oneshot, 'hash_oneshot'
61
c_public kos_time_to_epoch
62
c_public umka_init
9325 Boppan 63
 
9342 Boppan 64
c_public current_process, 'kos_current_process'
65
c_public current_slot, 'kos_current_slot'
66
c_public current_slot_idx, 'kos_current_slot_idx'
9325 Boppan 67
 
9342 Boppan 68
c_public thread_count, 'kos_thread_count'
69
c_public TASK_TABLE, 'kos_task_table'
70
c_public TASK_BASE, 'kos_task_base'
71
c_public TASK_DATA, 'kos_task_data'
72
c_public SLOT_BASE, 'kos_slot_base'
73
c_public window_data, 'kos_window_data'
9325 Boppan 74
 
9342 Boppan 75
c_public WIN_STACK, 'kos_win_stack'
76
c_public WIN_POS, 'kos_win_pos'
77
c_public lfb_base, 'kos_lfb_base'
9325 Boppan 78
 
9342 Boppan 79
c_public RAMDISK, 'kos_ramdisk'
80
c_public ramdisk_init, 'kos_ramdisk_init'
9325 Boppan 81
 
9342 Boppan 82
c_public acpi_ssdt_cnt, 'kos_acpi_ssdt_cnt'
83
c_public acpi_ssdt_base, 'kos_acpi_ssdt_base'
84
c_public acpi_ssdt_size, 'kos_acpi_ssdt_size'
9325 Boppan 85
 
9342 Boppan 86
c_public stack_init, 'kos_stack_init'
87
c_public net_add_device
9325 Boppan 88
 
9342 Boppan 89
c_public draw_data
90
c_public img_background
91
c_public mem_BACKGROUND
92
c_public sys_background
93
c_public REDRAW_BACKGROUND, 'kos_redraw_background'
94
c_public new_sys_threads, 'kos_new_sys_threads', nomangle
95
c_public osloop, 'kos_osloop'
96
c_public set_mouse_data, 'kos_set_mouse_data', 20
97
c_public scheduler_current, 'kos_scheduler_current'
98
c_public eth_input, 'kos_eth_input'
99
c_public net_buff_alloc, 'kos_net_buff_alloc'
9325 Boppan 100
 
9342 Boppan 101
c_public mem_block_list
9325 Boppan 102
 
9342 Boppan 103
c_public acpi_dev_data, "kos_acpi_dev_data"
104
c_public acpi_dev_size, "kos_acpi_dev_size"
105
c_public kernel_alloc, "kos_kernel_alloc"
9325 Boppan 106
 
9342 Boppan 107
c_public window._.set_screen, 'kos_window_set_screen'
108
c_public _display, 'kos_display'
9325 Boppan 109
 
9342 Boppan 110
c_public BOOT, 'kos_boot'
9325 Boppan 111
 
112
macro cli {
113
        pushfd
114
        bts     dword[esp], 21
115
        popfd
116
}
117
 
118
macro sti {
119
        pushfd
120
        btr     dword[esp], 21
121
        popfd
122
}
123
 
124
        iretd   equ retd
125
 
126
lang fix en
127
 
128
macro int n {
129
  if n eq 0x40
130
        call    i40
131
  else
132
        int     n
133
  end if
134
}
135
 
136
section '.text' executable align 64
137
 
138
coverage_begin:
139
 
140
include 'macros.inc'
141
 
142
macro diff16 msg,blah2,blah3 {
143
  if msg eq "end of .data segment"
144
; fasm doesn't align on 65536, but ld script does
9342 Boppan 145
section '.bss.65k' writeable align 512
9325 Boppan 146
bss_base:
147
  end if
148
}
149
include 'proc32.inc'
150
include 'struct.inc'
151
macro BOOT_LO a {}
152
macro BOOT a {}
153
window_data equ __pew01
154
TASK_TABLE equ __pew02
155
TASK_BASE equ __pew03
156
TASK_DATA equ __pew04
157
CDDataBuf equ __pew06
158
idts equ __pew07
159
WIN_STACK equ __pew08
160
WIN_POS equ __pew09
161
FDD_BUFF equ __pew10
162
WIN_TEMP_XY equ __pew11
163
KEY_COUNT equ __pew12
164
KEY_BUFF equ __pew13
165
BTN_COUNT equ __pew14
166
BTN_BUFF equ __pew15
167
BTN_ADDR equ __pew16
168
MEM_AMOUNT equ __pew17
169
SYS_SHUTDOWN equ __pew18
170
SLOT_BASE equ __pew20
171
sys_proc equ __pew21
172
VGABasePtr equ __pew22
173
HEAP_BASE equ __pew23
174
;macro OS_BASE [x] {
175
;  OS_BASE equ os_base
176
;}
177
include 'const.inc'
178
restore window_data
179
restore TASK_TABLE
180
restore TASK_BASE,TASK_DATA,CDDataBuf,idts,WIN_STACK,WIN_POS
181
restore FDD_BUFF,WIN_TEMP_XY,KEY_COUNT,KEY_BUFF,BTN_COUNT,BTN_BUFF,BTN_ADDR
182
restore MEM_AMOUNT,SYS_SHUTDOWN,SLOT_BASE,sys_proc,VGABasePtr
183
restore HEAP_BASE
184
purge BOOT_LO,BOOT
185
 
186
LFB_BASE = lfb_base
187
 
188
macro save_ring3_context {
189
        pushad
190
}
191
 
192
macro restore_ring3_context {
193
        popad
194
}
195
 
196
macro add r, v {
197
  if v eq TASK_TABLE - (SLOT_BASE shr 3)
198
        push    r
199
        mov     r, SLOT_BASE
200
        shr     r, 3
201
        neg     r
202
        add     r, TASK_TABLE
203
        add     esp, 4
204
        add     r, [esp-4]
205
  else
206
        add     r, v
207
  end if
208
}
209
 
210
macro stdcall target, [args] {
211
common
212
  if target eq is_region_userspace
213
        cmp     esp, esp        ; ZF
214
  else
215
        stdcall target, args
216
  end if
217
}
218
 
219
include 'system.inc'
220
include 'fdo.inc'
221
 
222
include 'core/sync.inc'
223
;include 'core/sys32.inc'
224
macro call target {
225
  if target eq do_change_task
226
        call    _do_change_task
227
  else
228
        call    target
229
  end if
230
}
231
;macro mov r, v {
232
;  if r eq byte [current_slot_idx] & v eq bh
233
;        push    eax
234
;        mov     eax, ebx
235
;        sub     eax, SLOT_BASE
236
;        shr     eax, BSF sizeof.APPDATA
237
;        mov     [current_slot_idx], eax
238
;        pop     eax
239
;  else
240
;        mov     r, v
241
;  end if
242
;}
243
do_change_task equ hjk
244
irq0 equ jhg
245
include 'core/sched.inc'
246
purge call, mov
247
restore irq0
248
include 'core/syscall.inc'
249
;include 'core/fpu.inc'
250
;include 'core/memory.inc'
251
;include 'core/mtrr.inc'
252
include 'core/heap.inc'
253
include 'core/malloc.inc'
254
include 'core/taskman.inc'
255
include 'core/dll.inc'
256
;include 'core/peload.inc'
257
;include 'core/exports.inc'
258
include 'core/string.inc'
259
;include 'core/v86.inc'
260
include 'core/irq.inc'
261
include 'core/apic.inc'
262
include 'core/hpet.inc'
263
include 'core/timers.inc'
264
include 'core/clipboard.inc'
265
include 'core/slab.inc'
266
 
267
include 'posix/posix.inc'
268
 
269
;include 'boot/shutdown.inc'
270
 
271
include 'video/vesa20.inc'
272
include 'video/blitter.inc'
273
include 'video/vga.inc'
274
include 'video/cursors.inc'
275
include 'video/framebuffer.inc'
276
 
277
include 'gui/window.inc'
278
include 'gui/event.inc'
279
include 'gui/font.inc'
280
include 'gui/button.inc'
281
include 'gui/mouse.inc'
282
include 'gui/skincode.inc'
283
 
284
include 'hid/keyboard.inc'
285
include 'hid/mousedrv.inc'
286
;include 'hid/set_dtc.inc'      ; setting date,time,clock and alarm-clock
287
 
288
include 'sound/playnote.inc'
289
 
290
;include 'bus/pci/pci32.inc'
291
;include 'bus/usb/init.inc'
292
 
293
;include 'blkdev/flp_drv.inc'   ; floppy driver
294
;include 'blkdev/fdc.inc'
295
;include 'blkdev/cd_drv.inc'    ; CD driver
296
;include 'blkdev/ide_cache.inc' ; CD cache
297
;include 'blkdev/hd_drv.inc'    ; HDD driver
298
;include 'blkdev/bd_drv.inc'    ; BIOS disks driver
299
include 'blkdev/rd.inc'         ; ramdisk driver
300
include 'blkdev/disk.inc'
301
include 'blkdev/disk_cache.inc'
302
 
303
include 'fs/fs_lfn.inc'
304
 
305
include 'network/stack.inc'
306
 
307
include 'crc.inc'
308
include 'unicode.inc'
309
include 'acpi/acpi.inc'
310
 
311
include 'unpacker.inc'
312
 
313
LIBCRASH_CTX_LEN = 0x500   ; FIXME
314
include 'sha3.asm'
315
 
316
; TODO: stdcall attribute in umka.h
317
proc sha3_256_oneshot c uses ebx esi edi ebp, _ctx, _data, _len
318
        stdcall sha3_256.oneshot, [_ctx], [_data], [_len]
319
        ret
320
endp
321
 
322
proc kos_time_to_epoch c uses ebx esi edi ebp, _time
323
        mov     esi, [_time]
324
        call    fsCalculateTime
325
        add     eax, 978307200  ; epoch to 2001.01.01
326
        ret
327
endp
328
 
329
proc umka._.check_alignment
330
        mov     eax, HEAP_BASE
331
        and     eax, PAGE_SIZE - 1
332
        jz      @f
333
        mov     ecx, PAGE_SIZE
334
        sub     ecx, eax
335
        DEBUGF 4, "HEAP_BASE must be aligned on PAGE_SIZE: 0x%x", HEAP_BASE
336
        DEBUGF 4, ", add 0x%x or sub 0x%x\n", ecx, eax
337
        int3
338
@@:
339
        ret
340
endp
341
 
342
proc umka_init c uses ebx esi edi ebp
343
        mov     [umka_initialized], 1
344
        call    umka._.check_alignment
345
 
346
        mov     edi, endofcode
347
        mov     ecx, uglobals_size
348
        xor     eax, eax
349
        rep stosb
350
 
351
        mov     [xsave_area_size], 0x1000
352
 
353
        mov     ecx, pg_data.mutex
354
        call    mutex_init
355
 
356
        mov     ecx, disk_list_mutex
357
        call    mutex_init
358
 
359
        mov     ecx, keyboard_list_mutex
360
        call    mutex_init
361
 
362
        mov     ecx, unpack_mutex
363
        call    mutex_init
364
 
365
        mov     ecx, application_table_mutex
366
        call    mutex_init
367
 
368
        mov     ecx, ide_mutex
369
        call    mutex_init
370
        mov     ecx, ide_channel1_mutex
371
        call    mutex_init
372
        mov     ecx, ide_channel2_mutex
373
        call    mutex_init
374
        mov     ecx, ide_channel3_mutex
375
        call    mutex_init
376
        mov     ecx, ide_channel4_mutex
377
        call    mutex_init
378
        mov     ecx, ide_channel5_mutex
379
        call    mutex_init
380
        mov     ecx, ide_channel6_mutex
381
        call    mutex_init
382
 
383
        mov     [pg_data.mem_amount], UMKA_MEMORY_BYTES
384
        mov     [pg_data.pages_count], UMKA_MEMORY_BYTES / PAGE_SIZE
385
        mov     [pg_data.pages_free], UMKA_MEMORY_BYTES / PAGE_SIZE
386
        mov     eax, UMKA_MEMORY_BYTES SHR 12
387
        mov     [pg_data.kernel_pages], eax
388
        shr     eax, 10
389
        mov     [pg_data.kernel_tables], eax
390
        call    init_kernel_heap
391
        call    init_malloc
392
 
393
        mov     eax, sys_proc
394
        list_init eax
395
        add     eax, PROC.thr_list
396
        list_init eax
397
 
398
        mov     [BOOT.lfb], LFB_BASE
399
        call    init_video
400
 
401
        stdcall alloc_kernel_space, 0x50000         ; FIXME check size
402
        mov     [default_io_map], eax
403
 
404
        add     eax, 0x2000
405
        mov     [ipc_tmp], eax
406
        mov     ebx, 0x1000
407
 
408
        add     eax, 0x40000
409
        mov     [proc_mem_map], eax
410
 
411
        add     eax, 0x8000
412
        mov     [proc_mem_pdir], eax
413
 
414
        add     eax, ebx
415
        mov     [proc_mem_tab], eax
416
 
417
        add     eax, ebx
418
        mov     [tmp_task_ptab], eax
419
 
420
        add     eax, ebx
421
        mov     [ipc_pdir], eax
422
 
423
        add     eax, ebx
424
        mov     [ipc_ptab], eax
425
 
426
        stdcall kernel_alloc, (unpack.LZMA_BASE_SIZE+(unpack.LZMA_LIT_SIZE shl \
427
                (unpack.lc+unpack.lp)))*4
428
        mov     [unpack.p], eax
429
 
430
        call    init_events
431
        mov     eax, srv.fd-SRV.fd
432
        mov     [srv.fd], eax
433
        mov     [srv.bk], eax
434
 
435
        stdcall kernel_alloc, [_display.win_map_size]
436
        mov     [_display.win_map], eax
437
 
438
; set background
439
        movi    eax, 1
440
        mov     [BgrDrawMode], eax
441
        mov     [BgrDataWidth], eax
442
        mov     [BgrDataHeight], eax
443
        mov     [mem_BACKGROUND], 4
444
        mov     [img_background], static_background_data
445
 
446
; set clipboard
447
        xor     eax, eax
448
        mov     [clipboard_slots], eax
449
        mov     [clipboard_write_lock], eax
450
        stdcall kernel_alloc, 4096
451
        test    eax, eax
452
        jnz     @f
453
 
454
        dec     eax
455
@@:
456
        mov     [clipboard_main_list], eax
457
 
458
        mov     dword[sysdir_name], 'sys'
459
        mov     dword[sysdir_path], 'RD/1'
460
        mov     word[sysdir_path+4], 0
461
 
462
        ;call    ramdisk_init
463
 
464
        mov     [X_UNDER], 500
465
        mov     [Y_UNDER], 500
466
        mov     word[MOUSE_X], 40
467
        mov     word[MOUSE_Y], 30
468
 
469
        mov     eax, -1
470
        mov     edi, thr_slot_map+4
471
        mov     [edi-4], dword 0xFFFFFFF8
472
        stosd
473
        stosd
474
        stosd
475
        stosd
476
        stosd
477
        stosd
478
        stosd
479
 
480
        mov     [current_process], sys_proc
481
 
482
        mov     [current_slot_idx], 0
483
        mov     [thread_count], 0
484
 
485
        mov     eax, [xsave_area_size]
486
        add     eax, RING0_STACK_SIZE
487
        stdcall kernel_alloc, eax
488
        mov     ebx, eax
489
        mov     edx, SLOT_BASE+256*1
490
        call    setup_os_slot
491
        mov     dword[edx], 'IDLE'
492
        sub     [edx+APPDATA.saved_esp], 4
493
        mov     eax, [edx+APPDATA.saved_esp]
494
        mov     dword[eax], idle
495
        mov     ecx, IDLE_PRIORITY
496
        call    scheduler_add_thread
497
 
498
        mov     eax, [xsave_area_size]
499
        add     eax, RING0_STACK_SIZE
500
        stdcall kernel_alloc, eax
501
        mov     ebx, eax
502
        mov     edx, SLOT_BASE+256*2
503
        call    setup_os_slot
504
        mov     dword[edx], 'OS'
505
        sub     [edx+APPDATA.saved_esp], 4
506
        mov     eax, [edx+APPDATA.saved_esp]
507
        mov     dword[eax], 0
508
        xor     ecx, ecx
509
        call    scheduler_add_thread
510
 
511
        mov     [current_slot_idx], 2
512
        mov     [thread_count], 2
513
        mov     dword[TASK_BASE], TASK_TABLE + 2*sizeof.TASKDATA
514
        mov     [current_slot], SLOT_BASE+2*sizeof.APPDATA
515
        mov     [TASK_TABLE + 2*sizeof.TASKDATA + TASKDATA.pid], 2
516
 
517
        call    set_window_defaults
518
        call    init_background
519
        call    calculatebackground
520
        call    init_display
521
        mov     eax, [def_cursor]
522
        mov     [SLOT_BASE+APPDATA.cursor+sizeof.APPDATA], eax
523
        mov     [SLOT_BASE+APPDATA.cursor+sizeof.APPDATA*2], eax
524
 
525
        ; from set_variables
526
        xor     eax, eax
527
        mov     [BTN_ADDR], dword BUTTON_INFO   ; address of button list
528
        mov     byte [KEY_COUNT], al            ; keyboard buffer
529
        mov     byte [BTN_COUNT], al            ; button buffer
530
 
531
        mov     ebx, SLOT_BASE + 2*sizeof.APPDATA
532
        mov     word[cur_dir.path], '/'
533
        mov     [ebx+APPDATA.cur_dir], cur_dir
534
 
535
        ret
536
endp
537
 
9342 Boppan 538
c_public skin_udata
9325 Boppan 539
proc idle uses ebx esi edi
540
.loop:
541
        mov     ecx, 10000000
542
@@:
543
        loop    @b
544
;        DEBUGF 1, "1 idle\n"
545
        jmp     .loop
546
 
547
        ret
548
endp
549
 
9342 Boppan 550
extrn pci_read, 20
9325 Boppan 551
proc pci_read_reg uses ebx esi edi
552
        mov     ecx, eax
553
        and     ecx, 3
554
        movi    edx, 1
555
        shl     edx, cl
556
        push    edx     ; len
557
        movzx   edx, bl
558
        push    edx     ; offset
559
        movzx   edx, bh
560
        and     edx, 7
561
        push    edx     ; fun
562
        movzx   edx, bh
563
        shr     edx, 3
564
        push    edx     ; dev
565
        movzx   edx, ah
566
        push    edx     ; bus
567
        call    pci_read
568
        ret
569
endp
570
 
571
proc sys_msg_board
572
        cmp     cl, 0x0d
573
        jz      @f
9342 Boppan 574
if ~ defined win32
9325 Boppan 575
        pushad
576
        mov     eax, SYS_WRITE
577
        mov     ebx, STDOUT
578
        push    ecx
579
        mov     ecx, esp
580
        mov     edx, 1
581
        int     0x80
582
        pop     ecx
583
        popad
9342 Boppan 584
else
585
        extrn   putchar
586
 
587
        pushad
588
        push    ecx
589
        call    putchar
590
        add     esp, 4
591
        popad
592
end if
9325 Boppan 593
@@:
594
        ret
595
endp
596
 
597
proc delay_ms
598
 
599
        ret
600
endp
601
 
9342 Boppan 602
c_public umka_cli
9325 Boppan 603
proc umka_cli
604
        cli     ; macro
605
        ret
606
endp
607
 
9342 Boppan 608
c_public umka_sti
9325 Boppan 609
proc umka_sti
610
        sti     ; macro
611
        ret
612
endp
613
 
9338 Boppan 614
proc umka_sys_put_image_palette c, image, xsize, ysize, x, y, bpp, palette, row_offset
615
        pushad
616
        push    ebp
617
        mov     eax, 65
618
        mov     ebx, [image]
619
        mov     ecx, [xsize]
620
        shl     ecx, 16
621
        or      ecx, [ysize]
622
        mov     edx, [x]
623
        shl     edx, 16
624
        or      edx, [y]
625
        mov     esi, [bpp]
626
        mov     edi, [palette]
627
        mov     ebp, [row_offset]
628
        call    i40
629
        pop     ebp
630
        popad
631
        ret
632
endp
633
 
9325 Boppan 634
extrn reset_procmask
635
extrn get_fake_if
9342 Boppan 636
c_public irq0
9325 Boppan 637
proc irq0 c, _signo, _info, _context
638
        DEBUGF 2, "### irq0\n"
639
        pushfd
640
        cli
641
        pushad
642
 
643
        inc     [timer_ticks]
644
        call    updatecputimes
645
        ccall   reset_procmask
646
        ccall   get_fake_if, [_context]
647
        test    eax, eax
648
        jnz     @f
649
        DEBUGF 2, "### cli\n"
650
        jmp     .done
651
@@:
652
 
653
        mov     bl, SCHEDULE_ANY_PRIORITY
654
        call    find_next_task
655
        jz      .done  ; if there is only one running process
656
        call    _do_change_task
657
.done:
658
        popad
659
        popfd
660
        ret
661
endp
662
 
663
proc _do_change_task
664
        mov     eax, [current_slot]
665
        sub     eax, SLOT_BASE
666
        shr     eax, 8
667
        mov     ecx, ebx
668
        sub     ecx, SLOT_BASE
669
        shr     ecx, 8
670
        DEBUGF 2, "### switching task from %d to %d\n",eax,ecx
671
 
672
        mov     esi, ebx
673
        xchg    esi, [current_slot]
674
; set new stack after saving old
675
        mov     [esi+APPDATA.saved_esp], esp
676
        mov     esp, [ebx+APPDATA.saved_esp]
677
        ret
678
endp
679
 
680
proc map_io_mem _base, _size, _flags
681
        mov     eax, [_base]
682
        ret
683
endp
684
 
685
sysfn_saveramdisk:
686
sysfn_meminfo:
687
check_fdd_motor_status:
688
check_ATAPI_device_event:
689
check_fdd_motor_status_has_work?:
690
check_ATAPI_device_event_has_work?:
691
request_terminate:
692
system_shutdown:
693
terminate:
694
LoadMedium:
695
clear_CD_cache:
696
allow_medium_removal:
697
EjectMedium:
698
save_image:
699
init_sys_v86:
700
pci_enum:
701
load_pe_driver:
702
usb_init:
703
fdc_init:
704
mtrr_validate:
705
protect_from_terminate:
706
unprotect_from_terminate:
707
ReadCDWRetr:
708
WaitUnitReady:
709
prevent_medium_removal:
710
Read_TOC:
711
commit_pages:
712
release_pages:
713
lock_application_table:
714
unlock_application_table:
715
get_pg_addr:
716
free_page:
717
build_interrupt_table:
718
init_fpu:
719
init_mtrr:
720
create_trampoline_pgmap:
721
alloc_page:
722
pci_write_reg:
723
 
724
sys_settime:
725
sys_pcibios:
726
sys_IPC:
727
pci_api:
728
sys_resize_app_memory:
729
f68:
730
v86_irq:
731
test_cpu:
732
acpi_locate:
733
init_BIOS32:
734
mem_test:
735
init_mem:
736
init_page_map:
737
ahci_init:
738
        ret
739
 
740
alloc_pages:
741
        ret     4
742
create_ring_buffer:
743
        ret     8
744
map_page:
745
        ret     12
746
map_memEx:
747
        ret     20
748
 
749
sys_msg_board equ __pex0
750
delay_ms equ __pex1
751
 
752
include fix pew
753
macro pew x {}
754
macro pew x {inclu#de `x}
755
macro org x {}
756
macro format [x] {}
757
 
758
macro lea r, v {
759
  if v eq [(ecx-(TASK_TABLE and 1FFFFFFFh)-TASKDATA.state)*8+SLOT_BASE]
760
        int3
761
  else if v eq [(edx-(TASK_TABLE and 1FFFFFFFh))*8+SLOT_BASE]
762
        int3
763
  else
764
        lea     r, v
765
  end if
766
}
767
 
768
include 'kernel.asm'
769
 
770
purge lea,add,org,mov
771
restore lea,add,org,mov
772
purge sys_msg_board,delay_ms
773
restore sys_msg_board,delay_ms
774
 
775
coverage_end:
776
 
777
; fasm doesn't align on 65536, but ld script does
9342 Boppan 778
section '.data' readable writeable align 512
779
c_public umka_tool
9325 Boppan 780
umka_tool dd ?
9342 Boppan 781
c_public umka_initialized
9325 Boppan 782
umka_initialized dd 0
783
fpu_owner dd ?
784
 
785
BOOT boot_data
786
virtual at BOOT
787
BOOT_LO boot_data
788
end virtual
789
 
790
uglobal
791
align 64
792
os_base:        rb PAGE_SIZE
793
window_data:    rb sizeof.WDATA * 256
794
TASK_TABLE:     rb 16
795
TASK_BASE:      rd 4
796
TASK_DATA:      rd sizeof.TASKDATA * 255 / 4
797
CDDataBuf:      rb 0x1000
798
idts            rb IRQ_RESERVED * 8     ; IDT descriptor is 8 bytes long
799
WIN_STACK       rw 0x200        ; why not 0x100?
800
WIN_POS         rw 0x200
801
FDD_BUFF:       rb 0x400
802
WIN_TEMP_XY     rb 0x100
803
KEY_COUNT       db ?
804
KEY_BUFF        rb 255  ; 120*2 + 2*2 = 244 bytes, actually 255 bytes
805
BTN_COUNT       db ?
806
BTN_BUFF        rd 0x261
807
BTN_ADDR        dd ?
808
MEM_AMOUNT      rd 0x1d
809
SYS_SHUTDOWN    db ?
810
sys_proc:       rb sizeof.PROC * 256
811
                rb 0x10000 - (($-bss_base) AND (0x10000-1)) ; align on 0x10000
812
SLOT_BASE:      rb sizeof.APPDATA * 256
813
VGABasePtr      rb 640*480
814
                rb PAGE_SIZE - (($-bss_base) AND (PAGE_SIZE-1)) ; align on page
815
HEAP_BASE       rb UMKA_MEMORY_BYTES - (HEAP_BASE - os_base + \
816
                                        PAGE_SIZE * sizeof.MEM_BLOCK)
817
endg
818
 
819
uglobal
820
v86_irqhooks rd IRQ_RESERVED*2
821
cache_ide0  IDE_CACHE
822
cache_ide1  IDE_CACHE
823
DiskNumber db ?
824
ChannelNumber db ?
825
DevErrorCode dd ?
826
CDSectorAddress dd ?
827
CDDataBuf_pointer dd ?
828
allow_dma_access db ?
829
ide_mutex MUTEX
830
ide_channel1_mutex MUTEX
831
ide_channel2_mutex MUTEX
832
ide_channel3_mutex MUTEX
833
ide_channel4_mutex MUTEX
834
ide_channel5_mutex MUTEX
835
ide_channel6_mutex MUTEX
836
ide_channel7_mutex MUTEX
837
ide_channel8_mutex MUTEX
838
 
839
lfb_base        rd MAX_SCREEN_WIDTH*MAX_SCREEN_HEIGHT
840
 
841
align 4096
842
cur_dir:
843
.encoding rb 1
844
.path     rb maxPathLength
845
 
846
BgrAuxTable     rb  32768
847
BgrAuxTable     equ
848
SB16Buffer      rb  65536
849
SB16Buffer      equ
850
BUTTON_INFO     rb  64*1024
851
BUTTON_INFO     equ
852
endg
853
 
854
macro org x {
855
  if x eq (OS_BASE+0x0100000)
856
  else
857
    org x
858
  end if
859
}
860
 
861
macro align x {
862
  if x eq 65536
863
  else if x eq 4096
864
  else
865
    align x
866
  end if
867
}
868
 
869
macro assert [x] {}
870
include 'data32.inc'