Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

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