From 102dad1dafd36eaf771bcff7027f9a8efbf68510 Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Thu, 12 Jan 2023 21:24:06 +0000 Subject: [PATCH] Compile in core/sys32.inc --- apps/board_cycle.asm | 13 ++++++++++--- umka.asm | 34 ++++++++++++++++++++++++---------- umka.h | 10 ++++++++++ umka_os.c | 15 +++++++++------ 4 files changed, 53 insertions(+), 19 deletions(-) diff --git a/apps/board_cycle.asm b/apps/board_cycle.asm index 8a5e0d4..8ba4ebb 100644 --- a/apps/board_cycle.asm +++ b/apps/board_cycle.asm @@ -16,10 +16,17 @@ start: pushfd btr dword[esp], BSF EFLAGS.ID popfd + mov ecx, '0' +next_char: + cmp ecx, '9' + jbe @f + mov ecx, '0' @@: -jmp $ - mcall 63, 1, '*' - jmp @b + mcall 63, 1 +;jmp $ + mcall 5, 10 + inc ecx + jmp next_char exit: mcall 18, 9, 2 mcall -1 diff --git a/umka.asm b/umka.asm index 5e713a2..6555c24 100644 --- a/umka.asm +++ b/umka.asm @@ -336,14 +336,16 @@ purge cmp purge mov restore OS_BASE include 'core/sync.inc' -;include 'core/sys32.inc' macro call target { if target eq do_change_task call _do_change_task + else if target eq page_fault_handler + call _page_fault_handler else call target end if } +include 'core/sys32.inc' do_change_task equ hjk irq0 equ irq0_pew tss._io_map_0 equ 0 @@ -762,11 +764,12 @@ endp pubsym skin_udata proc idle uses ebx esi edi + sti .loop: mov ecx, 10000000 @@: loop @b - DEBUGF 1, "1 idle\n" +; DEBUGF 1, "1 idle\n" jmp .loop ret @@ -793,6 +796,10 @@ proc _pci_read_reg uses ebx esi edi ret endp +proc _page_fault_handler + ret +endp + proc sys_msg_board cmp cl, 0x0d jz @f @@ -901,8 +908,6 @@ check_fdd_motor_status: check_ATAPI_device_event: check_fdd_motor_status_has_work?: check_ATAPI_device_event_has_work?: -request_terminate: -terminate: LoadMedium: clear_CD_cache: allow_medium_removal: @@ -913,23 +918,28 @@ init_sys_v86: usb_init: fdc_init: mtrr_validate: -protect_from_terminate: -unprotect_from_terminate: +; sys32.inc +;terminate: +;protect_from_terminate: +;unprotect_from_terminate: +;lock_application_table: +;unlock_application_table: +;build_interrupt_table: +;sys_resize_app_memory: +;request_terminate: +v86_exc_c: +except_7: ReadCDWRetr: WaitUnitReady: prevent_medium_removal: Read_TOC: -lock_application_table: -unlock_application_table: free_page: -build_interrupt_table: init_fpu: init_mtrr: create_trampoline_pgmap: alloc_page: ;sys_IPC: -sys_resize_app_memory: ;f68: v86_irq: ;test_cpu: @@ -1129,6 +1139,10 @@ forward dw 0 else if x eq (tss shr 16) and 0xFF00 dw 0 + else if x eq i40 and 0xFFFF + dw 0 + else if x eq i40 shr 16 + dw 0 else dw x end if diff --git a/umka.h b/umka.h index be7557e..7239e7f 100644 --- a/umka.h +++ b/umka.h @@ -1120,6 +1120,16 @@ umka_sys_write_text(size_t x, size_t y, uint32_t color, int asciiz, : "memory"); } +static inline void +umka_sys_delay(size_t cs) { + __asm__ __inline__ __volatile__ ( + "call i40" + : + : "a"(5), + "b"(cs) + : "memory"); +} + static inline void umka_sys_put_image(void *image, size_t xsize, size_t ysize, size_t x, size_t y) { diff --git a/umka_os.c b/umka_os.c index de8118b..de1b5f3 100644 --- a/umka_os.c +++ b/umka_os.c @@ -164,17 +164,18 @@ main() { kos_boot.pitch = UMKA_DEFAULT_DISPLAY_WIDTH*4; // 32bpp umka_init(); - umka_stack_init(); +// umka_stack_init(); - FILE *f = fopen("../img/kolibri.img", "r"); + FILE *f = fopen("../img/kolibri.raw", "r"); fread(kos_ramdisk, 2880*512, 1, f); fclose(f); kos_ramdisk_init(); // load_app_host("../apps/board_cycle", app_base); + load_app_host("../apps/lsdir", app_base); // load_app("/rd/1/loader"); - net_device_t *vnet = vnet_init(); - kos_net_add_device(vnet); +// net_device_t *vnet = vnet_init(); +// kos_net_add_device(vnet); char devname[64]; for (size_t i = 0; i < umka_sys_net_get_dev_count(); i++) { @@ -184,6 +185,7 @@ main() { fprintf(stderr, "[net_drv] device %i: %s %u\n", i, devname, devtype); } +/* // network setup should be done from the userspace app, e.g. via zeroconf f76ret_t r76; r76 = umka_sys_net_ipv4_set_subnet(1, inet_addr("255.255.255.0")); @@ -209,9 +211,10 @@ main() { fprintf(stderr, "[net_drv] set ip addr error\n"); return -1; } +*/ - - thread_start(0, monitor, THREAD_STACK_SIZE); +// thread_start(0, monitor, THREAD_STACK_SIZE); + thread_start(0, app_base, THREAD_STACK_SIZE); dump_procs();