2017-10-18 22:19:53 +02:00
|
|
|
format ELF
|
|
|
|
|
2018-05-04 20:18:09 +02:00
|
|
|
__DEBUG__ = 1
|
2017-11-02 21:41:11 +01:00
|
|
|
__DEBUG_LEVEL__ = 1
|
2017-10-18 22:19:53 +02:00
|
|
|
|
2020-05-11 05:38:44 +02:00
|
|
|
UMKA_SHELL = 1
|
|
|
|
UMKA_FUSE = 2
|
|
|
|
UMKA_OS = 3
|
|
|
|
|
|
|
|
UMKA_MEMORY_BYTES = 128 SHL 20
|
|
|
|
UMKA_DISPLAY_WIDTH = 400
|
|
|
|
UMKA_DISPLAY_HEIGHT = 300
|
|
|
|
|
2020-02-21 00:18:40 +01:00
|
|
|
public disk_add
|
|
|
|
public disk_del
|
|
|
|
public disk_list
|
|
|
|
public disk_media_changed
|
|
|
|
|
|
|
|
public xfs._.user_functions as 'xfs_user_functions'
|
|
|
|
public ext_user_functions
|
|
|
|
public fat_user_functions
|
|
|
|
public ntfs_user_functions
|
|
|
|
|
|
|
|
public i40
|
|
|
|
|
|
|
|
public coverage_begin
|
|
|
|
public coverage_end
|
|
|
|
|
|
|
|
public sha3_256_oneshot as 'hash_oneshot'
|
|
|
|
public kos_time_to_epoch
|
|
|
|
public kos_init
|
|
|
|
|
2020-05-09 06:34:28 +02:00
|
|
|
public monitor_thread
|
2020-05-09 04:15:57 +02:00
|
|
|
public CURRENT_TASK as 'kos_current_task'
|
|
|
|
public current_slot as 'kos_current_slot'
|
|
|
|
public TASK_COUNT as 'kos_task_count'
|
2020-05-10 06:21:49 +02:00
|
|
|
public TASK_BASE as 'kos_task_base'
|
|
|
|
;public task_base_addr as 'kos_task_base'
|
2020-05-09 04:15:57 +02:00
|
|
|
public task_data_addr as 'kos_task_data'
|
|
|
|
public slot_base_addr as 'kos_slot_base'
|
|
|
|
|
2020-02-21 00:18:40 +01:00
|
|
|
public win_stack_addr as 'kos_win_stack'
|
|
|
|
public win_pos_addr as 'kos_win_pos'
|
|
|
|
public lfb_base_addr as 'kos_lfb_base'
|
2019-10-09 01:35:47 +02:00
|
|
|
|
2020-05-06 23:33:32 +02:00
|
|
|
public enable_acpi
|
2020-05-02 00:09:42 +02:00
|
|
|
public acpi_ssdt_cnt as 'kos_acpi_ssdt_cnt'
|
|
|
|
public kos_acpi_ssdt_base
|
|
|
|
public kos_acpi_ssdt_size
|
2020-05-20 13:03:22 +02:00
|
|
|
public acpi_usage as 'kos_acpi_usage'
|
2020-05-02 00:09:42 +02:00
|
|
|
|
2020-05-06 23:33:32 +02:00
|
|
|
public stack_init
|
|
|
|
public net_add_device
|
|
|
|
|
2020-05-11 05:38:44 +02:00
|
|
|
public draw_data
|
|
|
|
public img_background
|
|
|
|
public BgrDataWidth
|
|
|
|
public BgrDataHeight
|
|
|
|
public mem_BACKGROUND
|
|
|
|
public sys_background
|
|
|
|
public REDRAW_BACKGROUND
|
|
|
|
public background_defined
|
|
|
|
|
2020-05-09 05:41:32 +02:00
|
|
|
macro cli {
|
|
|
|
pushfd
|
|
|
|
btr dword[esp], 21
|
|
|
|
popfd
|
|
|
|
}
|
|
|
|
|
|
|
|
macro sti {
|
|
|
|
pushfd
|
|
|
|
bts dword[esp], 21
|
|
|
|
popfd
|
|
|
|
}
|
|
|
|
|
2020-02-06 04:19:20 +01:00
|
|
|
iretd equ retd
|
2020-02-04 22:53:24 +01:00
|
|
|
|
|
|
|
lang fix en
|
2020-02-10 06:09:17 +01:00
|
|
|
|
2020-02-08 19:27:29 +01:00
|
|
|
macro int n {
|
|
|
|
if n eq 0x40
|
|
|
|
call i40
|
|
|
|
else
|
|
|
|
int n
|
|
|
|
end if
|
|
|
|
}
|
2019-10-09 01:35:47 +02:00
|
|
|
|
2020-02-10 06:09:17 +01:00
|
|
|
UEFI = 1
|
2020-02-09 02:48:16 +01:00
|
|
|
|
|
|
|
MAX_PRIORITY = 0 ; highest, used for kernel tasks
|
|
|
|
USER_PRIORITY = 1 ; default
|
|
|
|
IDLE_PRIORITY = 2 ; lowest, only IDLE thread goes here
|
|
|
|
|
2020-02-06 04:19:20 +01:00
|
|
|
section '.text' executable align 32
|
|
|
|
|
2019-10-09 01:35:47 +02:00
|
|
|
coverage_begin:
|
|
|
|
|
2018-04-23 12:09:46 +02:00
|
|
|
include 'macros.inc'
|
2020-02-09 02:48:16 +01:00
|
|
|
macro diff16 msg,blah2,blah3 {
|
|
|
|
if msg eq "end of .data segment"
|
|
|
|
section '.bss' writeable align 64
|
|
|
|
end if
|
2020-02-04 22:53:24 +01:00
|
|
|
}
|
2017-10-18 22:19:53 +02:00
|
|
|
include 'proc32.inc'
|
|
|
|
include 'struct.inc'
|
2020-02-09 02:48:16 +01:00
|
|
|
macro BOOT_LO a {}
|
|
|
|
macro BOOT a {}
|
2020-02-10 06:09:17 +01:00
|
|
|
window_data equ twer
|
|
|
|
CURRENT_TASK equ twer2
|
|
|
|
TASK_COUNT equ gyads
|
|
|
|
SLOT_BASE equ gfdskh
|
2017-10-18 22:19:53 +02:00
|
|
|
include 'const.inc'
|
2020-02-10 06:09:17 +01:00
|
|
|
restore window_data
|
|
|
|
restore CURRENT_TASK
|
|
|
|
restore TASK_COUNT
|
|
|
|
restore SLOT_BASE
|
2020-02-09 02:48:16 +01:00
|
|
|
purge BOOT_LO,BOOT
|
|
|
|
|
|
|
|
LFB_BASE = lfb_base
|
|
|
|
|
2020-02-10 06:09:17 +01:00
|
|
|
;window_data = os_base + 0x00001000
|
|
|
|
;CURRENT_TASK = os_base + 0x00003000
|
|
|
|
;TASK_COUNT = os_base + 0x00003004
|
2020-02-09 02:48:16 +01:00
|
|
|
TASK_BASE = os_base + 0x00003010
|
|
|
|
TASK_DATA = os_base + 0x00003020
|
|
|
|
TASK_EVENT = os_base + 0x00003020
|
|
|
|
CDDataBuf = os_base + 0x00005000
|
|
|
|
idts = os_base + 0x0000B100
|
|
|
|
WIN_STACK = os_base + 0x0000C000
|
|
|
|
WIN_POS = os_base + 0x0000C400
|
|
|
|
FDD_BUFF = os_base + 0x0000D000
|
|
|
|
WIN_TEMP_XY = os_base + 0x0000F300
|
|
|
|
KEY_COUNT = os_base + 0x0000F400
|
|
|
|
KEY_BUFF = os_base + 0x0000F401 ; 120*2 + 2*2 = 244 bytes, actually 255 bytes
|
|
|
|
BTN_COUNT = os_base + 0x0000F500
|
|
|
|
BTN_BUFF = os_base + 0x0000F501
|
|
|
|
BTN_ADDR = os_base + 0x0000FE88
|
|
|
|
MEM_AMOUNT = os_base + 0x0000FE8C
|
|
|
|
SYS_SHUTDOWN = os_base + 0x0000FF00
|
|
|
|
TASK_ACTIVATE = os_base + 0x0000FF01
|
|
|
|
sys_proc = os_base + 0x0006F000
|
|
|
|
SLOT_BASE = os_base + 0x00080000
|
|
|
|
VGABasePtr = os_base + 0x000A0000
|
|
|
|
UPPER_KERNEL_PAGES = os_base + 0x00400000
|
|
|
|
HEAP_BASE = os_base + 0x00800000
|
2020-02-04 22:53:24 +01:00
|
|
|
|
2017-10-18 22:19:53 +02:00
|
|
|
include 'system.inc'
|
2019-10-13 03:17:29 +02:00
|
|
|
include 'fdo.inc'
|
2018-05-04 20:18:09 +02:00
|
|
|
include 'blkdev/disk.inc'
|
|
|
|
include 'blkdev/disk_cache.inc'
|
|
|
|
include 'fs/fs_lfn.inc'
|
|
|
|
include 'crc.inc'
|
2020-02-28 03:18:09 +01:00
|
|
|
include 'unicode.inc'
|
2020-05-02 00:09:42 +02:00
|
|
|
include 'acpi/acpi.inc'
|
2020-02-08 16:10:45 +01:00
|
|
|
include 'core/string.inc'
|
|
|
|
include 'core/malloc.inc'
|
|
|
|
include 'core/heap.inc'
|
2020-02-04 22:53:24 +01:00
|
|
|
include 'core/dll.inc'
|
2020-05-10 08:21:20 +02:00
|
|
|
;include 'core/sched.inc'
|
2020-02-08 16:10:45 +01:00
|
|
|
include 'core/taskman.inc'
|
2020-02-10 06:09:17 +01:00
|
|
|
include 'core/timers.inc'
|
2020-02-09 02:48:16 +01:00
|
|
|
include 'core/clipboard.inc'
|
2020-02-07 03:26:27 +01:00
|
|
|
include 'core/syscall.inc'
|
2020-02-04 22:53:24 +01:00
|
|
|
include 'video/framebuffer.inc'
|
|
|
|
include 'video/vesa20.inc'
|
|
|
|
include 'video/vga.inc'
|
2020-02-07 03:26:27 +01:00
|
|
|
include 'video/blitter.inc'
|
2020-02-04 22:53:24 +01:00
|
|
|
include 'video/cursors.inc'
|
2020-02-09 02:48:16 +01:00
|
|
|
include 'sound/playnote.inc'
|
2020-02-04 22:53:24 +01:00
|
|
|
include 'unpacker.inc'
|
|
|
|
include 'gui/window.inc'
|
|
|
|
include 'gui/button.inc'
|
|
|
|
include 'gui/skincode.inc'
|
|
|
|
include 'gui/font.inc'
|
2020-02-07 03:26:27 +01:00
|
|
|
include 'gui/event.inc'
|
|
|
|
include 'gui/mouse.inc'
|
|
|
|
include 'hid/keyboard.inc'
|
2020-02-10 06:09:17 +01:00
|
|
|
include 'hid/mousedrv.inc'
|
|
|
|
include 'network/stack.inc'
|
2020-02-20 04:41:53 +01:00
|
|
|
|
2019-10-21 04:51:56 +02:00
|
|
|
include 'sha3.asm'
|
|
|
|
|
|
|
|
proc sha3_256_oneshot c uses ebx esi edi ebp, _ctx, _data, _len
|
|
|
|
stdcall sha3_256.oneshot, [_ctx], [_data], [_len]
|
|
|
|
ret
|
|
|
|
endp
|
|
|
|
|
2019-10-13 03:17:29 +02:00
|
|
|
proc kos_time_to_epoch c uses ebx esi edi ebp, _time
|
|
|
|
mov esi, [_time]
|
2018-04-24 18:51:48 +02:00
|
|
|
call fsCalculateTime
|
|
|
|
add eax, 978307200 ; epoch to 2001.01.01
|
|
|
|
ret
|
2019-10-13 03:17:29 +02:00
|
|
|
endp
|
2018-04-24 18:51:48 +02:00
|
|
|
|
2020-02-04 22:53:24 +01:00
|
|
|
proc kos_init c uses ebx esi edi ebp
|
2020-02-07 03:26:27 +01:00
|
|
|
mov edi, endofcode
|
|
|
|
mov ecx, uglobals_size
|
|
|
|
xor eax, eax
|
|
|
|
rep stosb
|
|
|
|
|
2020-05-11 05:38:44 +02:00
|
|
|
mov [xsave_area_size], 0x1000
|
|
|
|
|
|
|
|
mov [pg_data.mem_amount], UMKA_MEMORY_BYTES
|
|
|
|
mov [pg_data.pages_count], UMKA_MEMORY_BYTES / PAGE_SIZE
|
|
|
|
mov [pg_data.pages_free], UMKA_MEMORY_BYTES / PAGE_SIZE
|
|
|
|
mov eax, UMKA_MEMORY_BYTES SHR 12
|
2020-02-08 16:10:45 +01:00
|
|
|
mov [pg_data.kernel_pages], eax
|
|
|
|
shr eax, 10
|
|
|
|
mov [pg_data.kernel_tables], eax
|
|
|
|
call init_kernel_heap
|
|
|
|
call init_malloc
|
2019-10-25 03:48:13 +02:00
|
|
|
|
2020-05-09 04:15:57 +02:00
|
|
|
mov eax, sys_proc
|
|
|
|
list_init eax
|
|
|
|
add eax, PROC.thr_list
|
|
|
|
list_init eax
|
|
|
|
|
2020-02-09 02:48:16 +01:00
|
|
|
mov [BOOT.bpp], 32
|
2020-05-11 05:38:44 +02:00
|
|
|
mov [BOOT.x_res], UMKA_DISPLAY_WIDTH
|
|
|
|
mov [BOOT.y_res], UMKA_DISPLAY_HEIGHT
|
|
|
|
mov [BOOT.pitch], UMKA_DISPLAY_WIDTH*4
|
2020-02-09 02:48:16 +01:00
|
|
|
mov [BOOT.lfb], LFB_BASE
|
|
|
|
call init_video
|
|
|
|
|
2020-02-08 19:27:29 +01:00
|
|
|
stdcall kernel_alloc, (unpack.LZMA_BASE_SIZE+(unpack.LZMA_LIT_SIZE shl \
|
|
|
|
(unpack.lc+unpack.lp)))*4
|
|
|
|
mov [unpack.p], eax
|
|
|
|
|
2020-02-09 02:48:16 +01:00
|
|
|
call init_events
|
|
|
|
mov eax, srv.fd-SRV.fd
|
|
|
|
mov [srv.fd], eax
|
|
|
|
mov [srv.bk], eax
|
|
|
|
|
|
|
|
stdcall kernel_alloc, [_display.win_map_size]
|
2020-02-04 22:53:24 +01:00
|
|
|
mov [_display.win_map], eax
|
|
|
|
|
2020-02-09 02:48:16 +01:00
|
|
|
; set background
|
|
|
|
movi eax, 1
|
2020-02-04 22:53:24 +01:00
|
|
|
mov [BgrDrawMode], eax
|
|
|
|
mov [BgrDataWidth], eax
|
|
|
|
mov [BgrDataHeight], eax
|
|
|
|
mov [mem_BACKGROUND], 4
|
|
|
|
mov [img_background], static_background_data
|
|
|
|
|
2020-02-09 02:48:16 +01:00
|
|
|
; set clipboard
|
|
|
|
xor eax, eax
|
|
|
|
mov [clipboard_slots], eax
|
|
|
|
mov [clipboard_write_lock], eax
|
|
|
|
stdcall kernel_alloc, 4096
|
|
|
|
test eax, eax
|
|
|
|
jnz @f
|
|
|
|
|
|
|
|
dec eax
|
|
|
|
@@:
|
|
|
|
mov [clipboard_main_list], eax
|
|
|
|
|
2020-05-11 05:38:44 +02:00
|
|
|
mov dword[sysdir_name], 'sys'
|
|
|
|
mov dword[sysdir_path], 'RD/1'
|
|
|
|
mov word[sysdir_path+4], 0
|
2020-02-09 02:48:16 +01:00
|
|
|
|
2020-05-11 05:38:44 +02:00
|
|
|
;call ramdisk_init
|
2020-05-09 04:15:57 +02:00
|
|
|
|
2020-05-11 05:38:44 +02:00
|
|
|
mov [X_UNDER], 500
|
|
|
|
mov [Y_UNDER], 500
|
|
|
|
mov word[MOUSE_X], 40
|
|
|
|
mov word[MOUSE_Y], 30
|
2020-05-09 04:15:57 +02:00
|
|
|
|
|
|
|
mov eax, -1
|
|
|
|
mov edi, thr_slot_map+4
|
|
|
|
mov [edi-4], dword 0xFFFFFFF8
|
|
|
|
stosd
|
|
|
|
stosd
|
|
|
|
stosd
|
|
|
|
stosd
|
|
|
|
stosd
|
|
|
|
stosd
|
|
|
|
stosd
|
|
|
|
|
|
|
|
mov [current_process], sys_proc
|
|
|
|
|
|
|
|
mov dword[CURRENT_TASK], 0
|
|
|
|
mov dword[TASK_COUNT], 0
|
|
|
|
|
2020-05-11 05:38:44 +02:00
|
|
|
mov eax, [xsave_area_size]
|
|
|
|
add eax, RING0_STACK_SIZE
|
|
|
|
stdcall kernel_alloc, eax
|
2020-05-09 04:15:57 +02:00
|
|
|
mov ebx, eax
|
|
|
|
mov edx, SLOT_BASE+256*1
|
|
|
|
call setup_os_slot
|
2020-05-11 05:38:44 +02:00
|
|
|
mov dword[edx], 'IDLE'
|
2020-05-09 04:15:57 +02:00
|
|
|
sub [edx+APPDATA.saved_esp], 4
|
|
|
|
mov eax, [edx+APPDATA.saved_esp]
|
2020-05-11 05:38:44 +02:00
|
|
|
mov dword[eax], idle
|
2020-05-09 04:15:57 +02:00
|
|
|
mov ecx, IDLE_PRIORITY
|
|
|
|
call sched_add_thread
|
|
|
|
|
2020-05-11 05:38:44 +02:00
|
|
|
mov eax, [xsave_area_size]
|
|
|
|
add eax, RING0_STACK_SIZE
|
|
|
|
stdcall kernel_alloc, eax
|
2020-05-09 04:15:57 +02:00
|
|
|
mov ebx, eax
|
|
|
|
mov edx, SLOT_BASE+256*2
|
|
|
|
call setup_os_slot
|
2020-05-11 05:38:44 +02:00
|
|
|
mov dword[edx], 'OS'
|
2020-05-09 04:15:57 +02:00
|
|
|
sub [edx+APPDATA.saved_esp], 4
|
|
|
|
mov eax, [edx+APPDATA.saved_esp]
|
|
|
|
mov dword[eax], 0
|
|
|
|
xor ecx, ecx
|
|
|
|
call sched_add_thread
|
|
|
|
|
|
|
|
mov dword[CURRENT_TASK], 2
|
2020-05-10 08:21:20 +02:00
|
|
|
mov dword[TASK_COUNT], 2
|
|
|
|
mov dword[TASK_BASE], CURRENT_TASK + 2*sizeof.TASKDATA
|
2020-05-09 04:15:57 +02:00
|
|
|
mov [current_slot], SLOT_BASE+256*2
|
2020-05-12 00:01:33 +02:00
|
|
|
mov [CURRENT_TASK + 2*sizeof.TASKDATA + TASKDATA.pid], 2
|
2020-05-09 04:15:57 +02:00
|
|
|
|
2020-05-11 05:38:44 +02:00
|
|
|
call set_window_defaults
|
|
|
|
call init_background
|
|
|
|
call calculatebackground
|
|
|
|
call init_display
|
|
|
|
mov eax, [def_cursor]
|
|
|
|
mov [SLOT_BASE+APPDATA.cursor+256], eax
|
|
|
|
mov [SLOT_BASE+APPDATA.cursor+256*2], eax
|
|
|
|
|
|
|
|
; from set_variables
|
|
|
|
xor eax, eax
|
|
|
|
mov [BTN_ADDR], dword BUTTON_INFO ; address of button list
|
|
|
|
mov byte [KEY_COUNT], al ; keyboard buffer
|
|
|
|
mov byte [BTN_COUNT], al ; button buffer
|
|
|
|
|
|
|
|
mov ebx, SLOT_BASE + 2*256
|
|
|
|
mov word[cur_dir.path], '/'
|
|
|
|
mov [ebx+APPDATA.cur_dir], cur_dir
|
|
|
|
|
|
|
|
;call stack_init
|
|
|
|
|
|
|
|
ret
|
|
|
|
endp
|
|
|
|
|
|
|
|
public skin_udata
|
|
|
|
proc idle uses ebx esi edi
|
|
|
|
.loop:
|
|
|
|
mov ecx, 10000000
|
|
|
|
@@:
|
|
|
|
loop @b
|
|
|
|
; DEBUGF 1, "1 idle\n"
|
|
|
|
jmp .loop
|
|
|
|
|
|
|
|
ret
|
|
|
|
endp
|
|
|
|
|
|
|
|
extrn raise
|
|
|
|
public umka_os
|
|
|
|
proc umka_os uses ebx esi edi
|
|
|
|
call kos_init
|
2020-05-09 04:15:57 +02:00
|
|
|
|
|
|
|
call stack_init
|
|
|
|
|
|
|
|
mov edx, SLOT_BASE+256*3
|
|
|
|
xor ecx, ecx
|
|
|
|
call sched_add_thread
|
|
|
|
|
|
|
|
mov edx, SLOT_BASE+256*4
|
|
|
|
xor ecx, ecx
|
|
|
|
call sched_add_thread
|
|
|
|
|
|
|
|
mov edx, SLOT_BASE+256*5
|
|
|
|
xor ecx, ecx
|
|
|
|
call sched_add_thread
|
|
|
|
|
2020-05-10 08:21:20 +02:00
|
|
|
mov dword[TASK_COUNT], 5
|
2020-05-09 06:34:28 +02:00
|
|
|
|
|
|
|
stdcall umka_install_thread, [monitor_thread]
|
|
|
|
|
2020-05-09 04:15:57 +02:00
|
|
|
ccall raise, SIGPROF
|
|
|
|
|
|
|
|
jmp osloop
|
|
|
|
|
|
|
|
ret
|
|
|
|
endp
|
|
|
|
|
2020-05-02 00:09:42 +02:00
|
|
|
extrn pci_read
|
|
|
|
proc pci_read_reg uses ebx esi edi
|
|
|
|
mov ecx, eax
|
|
|
|
and ecx, 3
|
|
|
|
movi edx, 1
|
|
|
|
shl edx, cl
|
|
|
|
push edx ; len
|
|
|
|
movzx edx, bl
|
|
|
|
push edx ; offset
|
|
|
|
movzx edx, bh
|
|
|
|
and edx, 7
|
|
|
|
push edx ; fun
|
|
|
|
movzx edx, bh
|
|
|
|
shr edx, 3
|
|
|
|
push edx ; dev
|
|
|
|
movzx edx, ah
|
|
|
|
push edx ; bus
|
|
|
|
call pci_read
|
|
|
|
ret
|
|
|
|
endp
|
|
|
|
|
2020-02-10 06:09:17 +01:00
|
|
|
proc sys_msg_board
|
2019-10-13 03:17:29 +02:00
|
|
|
cmp cl, 0x0d
|
|
|
|
jz @f
|
2017-10-18 22:19:53 +02:00
|
|
|
pushad
|
|
|
|
mov eax, SYS_WRITE
|
|
|
|
mov ebx, STDOUT
|
|
|
|
push ecx
|
|
|
|
mov ecx, esp
|
|
|
|
mov edx, 1
|
|
|
|
int 0x80
|
|
|
|
pop ecx
|
|
|
|
popad
|
2019-10-13 03:17:29 +02:00
|
|
|
@@:
|
|
|
|
ret
|
|
|
|
endp
|
|
|
|
|
2020-05-02 00:09:42 +02:00
|
|
|
proc map_io_mem _base, _size, _flags
|
|
|
|
mov eax, [_base]
|
|
|
|
ret
|
|
|
|
endp
|
|
|
|
|
2020-05-09 04:15:57 +02:00
|
|
|
extrn umka_sched_add_thread
|
|
|
|
sched_add_thread:
|
|
|
|
stdcall umka_sched_add_thread, edx
|
2020-05-06 23:33:32 +02:00
|
|
|
ret
|
|
|
|
|
2020-02-10 06:09:17 +01:00
|
|
|
change_task:
|
|
|
|
ret
|
2020-02-08 16:10:45 +01:00
|
|
|
|
2020-05-09 06:34:28 +02:00
|
|
|
public umka_install_thread
|
|
|
|
proc umka_install_thread _func
|
2020-05-11 05:38:44 +02:00
|
|
|
; fpu_state = sigsetjmp
|
|
|
|
mov eax, [xsave_area_size]
|
|
|
|
add eax, RING0_STACK_SIZE
|
|
|
|
stdcall kernel_alloc, eax
|
2020-05-09 06:34:28 +02:00
|
|
|
mov ebx, eax
|
|
|
|
mov edx, [TASK_COUNT]
|
2020-05-10 08:21:20 +02:00
|
|
|
inc edx
|
2020-05-09 06:34:28 +02:00
|
|
|
shl edx, 8
|
|
|
|
add edx, SLOT_BASE
|
|
|
|
call setup_os_slot
|
|
|
|
mov dword [edx], 'USER'
|
|
|
|
sub [edx+APPDATA.saved_esp], 4
|
|
|
|
mov eax, [edx+APPDATA.saved_esp]
|
|
|
|
mov ecx, [_func]
|
|
|
|
mov dword[eax], ecx
|
|
|
|
xor ecx, ecx
|
|
|
|
call sched_add_thread
|
|
|
|
inc dword[TASK_COUNT]
|
|
|
|
ret
|
|
|
|
endp
|
2020-02-27 22:22:44 +01:00
|
|
|
|
2020-02-10 06:09:17 +01:00
|
|
|
sysfn_saveramdisk:
|
|
|
|
sysfn_meminfo:
|
|
|
|
check_fdd_motor_status:
|
|
|
|
check_ATAPI_device_event:
|
|
|
|
check_fdd_motor_status_has_work?:
|
|
|
|
check_ATAPI_device_event_has_work?:
|
|
|
|
get_clock_ns:
|
|
|
|
request_terminate:
|
|
|
|
system_shutdown:
|
|
|
|
terminate:
|
|
|
|
LoadMedium:
|
|
|
|
clear_CD_cache:
|
|
|
|
allow_medium_removal:
|
|
|
|
EjectMedium:
|
|
|
|
save_image:
|
|
|
|
init_irqs:
|
|
|
|
PIC_init:
|
|
|
|
init_sys_v86:
|
|
|
|
PIT_init:
|
|
|
|
ramdisk_init:
|
|
|
|
APIC_init:
|
|
|
|
unmask_timer:
|
|
|
|
pci_enum:
|
|
|
|
load_pe_driver:
|
|
|
|
usb_init:
|
|
|
|
fdc_init:
|
|
|
|
attach_int_handler:
|
|
|
|
mtrr_validate:
|
2018-05-04 20:18:09 +02:00
|
|
|
protect_from_terminate:
|
|
|
|
unprotect_from_terminate:
|
|
|
|
ReadCDWRetr:
|
|
|
|
WaitUnitReady:
|
|
|
|
prevent_medium_removal:
|
|
|
|
Read_TOC:
|
|
|
|
commit_pages:
|
|
|
|
release_pages:
|
2018-05-09 23:08:52 +02:00
|
|
|
mutex_init:
|
|
|
|
mutex_lock:
|
|
|
|
mutex_unlock:
|
2020-02-08 16:10:45 +01:00
|
|
|
lock_application_table:
|
|
|
|
unlock_application_table:
|
|
|
|
get_pg_addr:
|
|
|
|
free_page:
|
2020-02-09 02:48:16 +01:00
|
|
|
scheduler_add_thread:
|
2020-02-10 06:09:17 +01:00
|
|
|
build_interrupt_table:
|
|
|
|
init_fpu:
|
|
|
|
init_mtrr:
|
|
|
|
create_trampoline_pgmap:
|
2020-02-27 22:22:44 +01:00
|
|
|
alloc_page:
|
|
|
|
|
2020-02-06 04:19:20 +01:00
|
|
|
sys_settime:
|
|
|
|
sys_pcibios:
|
|
|
|
sys_IPC:
|
|
|
|
pci_api:
|
|
|
|
sys_resize_app_memory:
|
|
|
|
f68:
|
|
|
|
sys_posix:
|
|
|
|
ret
|
2018-05-04 20:18:09 +02:00
|
|
|
|
2020-02-27 22:22:44 +01:00
|
|
|
alloc_pages:
|
|
|
|
enable_irq:
|
|
|
|
disable_irq:
|
|
|
|
ret 4
|
|
|
|
create_ring_buffer:
|
|
|
|
ret 8
|
|
|
|
map_page:
|
|
|
|
ret 12
|
|
|
|
map_memEx:
|
|
|
|
ret 20
|
2020-02-10 06:09:17 +01:00
|
|
|
|
|
|
|
|
2020-02-29 02:04:32 +01:00
|
|
|
HEAP_BASE equ
|
|
|
|
include 'init.inc'
|
|
|
|
sys_msg_board equ __pew
|
2020-02-10 06:09:17 +01:00
|
|
|
|
|
|
|
include fix pew
|
2020-02-27 22:22:44 +01:00
|
|
|
macro pew x {}
|
2020-02-29 02:04:32 +01:00
|
|
|
macro pew x {inclu#de `x}
|
2020-02-10 06:09:17 +01:00
|
|
|
macro org x {}
|
2020-02-27 22:22:44 +01:00
|
|
|
macro format [x] {}
|
2020-02-17 02:52:44 +01:00
|
|
|
|
|
|
|
macro lea r, v {
|
|
|
|
if v eq [(ecx-(CURRENT_TASK and 1FFFFFFFh)-TASKDATA.state)*8+SLOT_BASE]
|
|
|
|
int3
|
|
|
|
else if v eq [(edx-(CURRENT_TASK and 1FFFFFFFh))*8+SLOT_BASE]
|
|
|
|
int3
|
|
|
|
else
|
|
|
|
lea r, v
|
|
|
|
end if
|
|
|
|
}
|
2020-02-27 22:22:44 +01:00
|
|
|
|
2020-02-17 02:52:44 +01:00
|
|
|
macro add r, v {
|
|
|
|
if v eq CURRENT_TASK - (SLOT_BASE shr 3)
|
2020-05-09 04:15:57 +02:00
|
|
|
push r
|
|
|
|
mov r, SLOT_BASE
|
|
|
|
shr r, 3
|
|
|
|
neg r
|
|
|
|
add r, CURRENT_TASK
|
|
|
|
add r, [esp]
|
|
|
|
add esp, 4
|
2020-02-17 02:52:44 +01:00
|
|
|
else
|
|
|
|
add r, v
|
|
|
|
end if
|
|
|
|
}
|
2020-02-27 22:22:44 +01:00
|
|
|
|
2020-02-29 02:04:32 +01:00
|
|
|
include 'kernel.asm'
|
2020-02-27 22:22:44 +01:00
|
|
|
|
2020-02-29 02:04:32 +01:00
|
|
|
purge lea,add,org
|
|
|
|
restore lea,add,org
|
2020-02-27 22:22:44 +01:00
|
|
|
purge sys_msg_board,HEAP_BASE
|
2020-02-10 06:09:17 +01:00
|
|
|
|
2019-10-09 01:35:47 +02:00
|
|
|
coverage_end:
|
|
|
|
|
2017-10-18 22:19:53 +02:00
|
|
|
|
2020-02-04 22:53:24 +01:00
|
|
|
section '.data' writeable align 64
|
2020-05-11 05:38:44 +02:00
|
|
|
public umka_tool
|
|
|
|
umka_tool dd ?
|
2020-02-09 02:48:16 +01:00
|
|
|
timer_ticks dd 0
|
2020-02-08 16:10:45 +01:00
|
|
|
fpu_owner dd ?
|
2020-02-04 22:53:24 +01:00
|
|
|
|
2020-05-09 04:15:57 +02:00
|
|
|
task_base_addr dd TASK_BASE
|
|
|
|
task_data_addr dd TASK_DATA
|
|
|
|
slot_base_addr dd SLOT_BASE
|
|
|
|
|
2020-05-09 06:34:28 +02:00
|
|
|
monitor_thread dd ?
|
2020-05-09 04:15:57 +02:00
|
|
|
|
2020-02-09 02:48:16 +01:00
|
|
|
win_stack_addr dd WIN_STACK
|
|
|
|
win_pos_addr dd WIN_POS
|
|
|
|
lfb_base_addr dd lfb_base
|
|
|
|
|
2020-05-02 00:09:42 +02:00
|
|
|
kos_acpi_ssdt_base dd acpi_ssdt_base
|
|
|
|
kos_acpi_ssdt_size dd acpi_ssdt_size
|
|
|
|
|
2020-02-09 02:48:16 +01:00
|
|
|
uglobal
|
2020-02-10 06:09:17 +01:00
|
|
|
context_counter dd ?
|
|
|
|
LAPIC_BASE dd ?
|
|
|
|
irq_mode dd ?
|
2020-03-07 23:09:36 +01:00
|
|
|
ioapic_cnt dd ?
|
|
|
|
ioapic_gsi_base dd ?
|
|
|
|
MAX_IOAPICS = 2
|
2020-02-10 06:09:17 +01:00
|
|
|
cache_ide0 IDE_CACHE
|
|
|
|
cache_ide1 IDE_CACHE
|
2018-05-04 20:18:09 +02:00
|
|
|
DiskNumber db ?
|
|
|
|
ChannelNumber db ?
|
|
|
|
DevErrorCode dd ?
|
|
|
|
CDSectorAddress dd ?
|
|
|
|
CDDataBuf_pointer dd ?
|
2020-02-10 06:09:17 +01:00
|
|
|
allow_dma_access db ?
|
|
|
|
ide_mutex MUTEX
|
2018-05-18 09:09:05 +02:00
|
|
|
ide_channel1_mutex MUTEX
|
|
|
|
ide_channel2_mutex MUTEX
|
|
|
|
ide_channel3_mutex MUTEX
|
|
|
|
ide_channel4_mutex MUTEX
|
|
|
|
ide_channel5_mutex MUTEX
|
|
|
|
ide_channel6_mutex MUTEX
|
|
|
|
ide_channel7_mutex MUTEX
|
|
|
|
ide_channel8_mutex MUTEX
|
2020-05-19 17:20:46 +02:00
|
|
|
align 64
|
2020-02-10 06:09:17 +01:00
|
|
|
os_base: rb 0x1000
|
|
|
|
window_data: rb 0x2000
|
|
|
|
CURRENT_TASK: rb 4
|
|
|
|
TASK_COUNT: rb 12
|
|
|
|
rb 0x1000000
|
|
|
|
BOOT_LO boot_data
|
2020-02-09 02:48:16 +01:00
|
|
|
BOOT boot_data
|
2020-02-04 22:53:24 +01:00
|
|
|
lfb_base rd MAX_SCREEN_WIDTH*MAX_SCREEN_HEIGHT
|
2019-10-25 03:48:13 +02:00
|
|
|
cur_dir:
|
|
|
|
.encoding rb 1
|
|
|
|
.path rb maxPathLength
|
2020-02-04 22:53:24 +01:00
|
|
|
|
|
|
|
BgrAuxTable rb 32768
|
|
|
|
BgrAuxTable equ
|
|
|
|
SB16Buffer rb 65536
|
|
|
|
SB16Buffer equ
|
|
|
|
BUTTON_INFO rb 64*1024
|
|
|
|
BUTTON_INFO equ
|
2020-02-09 02:48:16 +01:00
|
|
|
endg
|
2020-02-04 22:53:24 +01:00
|
|
|
|
2020-02-29 02:04:32 +01:00
|
|
|
include 'data32.inc'
|