diff --git a/img/makefile b/img/makefile index 13696bb..dfd63de 100644 --- a/img/makefile +++ b/img/makefile @@ -24,6 +24,9 @@ kolibri.img: ../default.skn ../fill.cur mkfs.vfat -n KOLIBRIOS -F 12 $@ mcopy -vmoi $@ ../default.skn ::DEFAULT.SKN mcopy -vmoi $@ ../fill.cur ::FILL.CUR + mcopy -vmoi $@ ../spray.cur ::SPRAY.CUR + mmd -i $@ ::LIB + mcopy -vmoi $@ ../network.obj ::LIB/NETWORK.OBJ jfs.img: fallocate -l 16MiB $@ diff --git a/network.obj b/network.obj new file mode 100644 index 0000000..e31a174 Binary files /dev/null and b/network.obj differ diff --git a/shell.c b/shell.c index 69facc2..734d973 100644 --- a/shell.c +++ b/shell.c @@ -2439,6 +2439,23 @@ shell_pci_get_path(struct shell_ctx *ctx, int argc, char **argv) { fprintf(ctx->fout, "pci path: %s\n", pci_path); } +static void +shell_load_dll(struct shell_ctx *ctx, int argc, char **argv) { + const char *usage = \ + "usage: load_dll \n" + " path /path/to/library.obj in KolibriOS fs\n"; + if (argc != 2) { + fputs(usage, ctx->fout); + return; + } + COVERAGE_ON(); + void *export = umka_sys_load_dll(argv[1]); + COVERAGE_OFF(); +// if (ctx->reproducible) + fprintf(ctx->fout, "### export: %p\n", export); +} + + #ifndef _WIN32 static void @@ -3337,6 +3354,7 @@ func_table_t shell_cmds[] = { { "i40", shell_i40 }, { "load_cursor_from_file", shell_load_cursor_from_file }, { "load_cursor_from_mem", shell_load_cursor_from_mem }, + { "load_dll", shell_load_dll }, { "ls70", shell_ls70 }, { "ls80", shell_ls80 }, { "move_window", shell_move_window }, diff --git a/umka.asm b/umka.asm index 50dd7d2..5278596 100644 --- a/umka.asm +++ b/umka.asm @@ -174,6 +174,9 @@ pubsym BOOT, 'kos_boot' EFLAGS.ID = 1 SHL 21 +macro invlpg addr { +} + macro cli { pushfd bts dword[esp], BSF EFLAGS.ID @@ -242,6 +245,7 @@ SLOT_BASE equ __pew20 sys_proc equ __pew21 VGABasePtr equ __pew22 HEAP_BASE equ __pew23 +page_tabs equ page_tabs_pew ;macro OS_BASE [x] { ; OS_BASE equ os_base ;} @@ -251,6 +255,7 @@ restore CDDataBuf,idts,WIN_STACK,WIN_POS restore FDD_BUFF,WIN_TEMP_XY,KEY_COUNT,KEY_BUFF,BTN_COUNT,BTN_BUFF,BTN_ADDR restore MEM_AMOUNT,SYS_SHUTDOWN,SLOT_BASE,sys_proc,VGABasePtr restore HEAP_BASE +restore page_tabs purge BOOT_LO,BOOT LFB_BASE = lfb_base @@ -267,6 +272,8 @@ macro stdcall target, [args] { common if target eq is_region_userspace cmp esp, esp ; ZF + else if target eq is_string_userspace + cmp esp, esp ; ZF else stdcall target, args end if @@ -275,6 +282,48 @@ common include 'system.inc' include 'fdo.inc' +OS_BASE equ 0 +macro mov target, source { + if source eq (HEAP_BASE - 0 + HEAP_MIN_SIZE)/4096 + push eax eax + mov eax, HEAP_BASE + add eax, HEAP_MIN_SIZE + shr eax, 12 + mov [esp+4], eax + pop eax + pop target + else if target eq dword [sys_proc-0+PROC.pdt_0+(page_tabs shr 20)] + push eax ecx + mov eax, page_tabs + shr eax, 20 + add eax, PROC.pdt_0 + add eax, sys_proc + mov ecx, sys_proc+PROC.pdt_0+PG_SWR + mov [eax], ecx + pop ecx eax + else + mov target, source + end if +} +macro cmp target, source { + if source eq (HEAP_BASE - 0 + HEAP_MIN_SIZE)/4096 + push eax eax + mov eax, HEAP_BASE + add eax, HEAP_MIN_SIZE + shr eax, 12 + mov [esp], eax + mov eax, [esp+4] + cmp target, [esp] + pop eax eax + else + mov target, source + end if +} + +include 'init.inc' +purge cmp +purge mov +restore OS_BASE include 'core/sync.inc' ;include 'core/sys32.inc' macro call target { @@ -291,11 +340,32 @@ purge call restore irq0 include 'core/syscall.inc' ;include 'core/fpu.inc' -;include 'core/memory.inc' +map_io_mem equ map_io_mem_pew +create_trampoline_pgmap equ create_trampoline_pgmap_pew +alloc_page equ alloc_page_pew +alloc_pages equ alloc_pages_pew +free_page equ free_page_pew +include 'core/memory.inc' +restore map_io_mem, free_page, create_trampoline_pgmap, alloc_page, alloc_pages ;include 'core/mtrr.inc' include 'core/heap.inc' include 'core/malloc.inc' +macro mov target, source { + if target eq [edi - 4096 + (page_tabs shr 20)] + push eax ebx + mov ebx, eax + mov eax, page_tabs + shr eax, 20 + sub eax, 4096 + add eax, edi + mov [eax], ebx + pop ebx eax + else + mov target, source + end if +} include 'core/taskman.inc' +purge mov include 'core/dll.inc' macro call target { if target eq pci_read_reg @@ -459,6 +529,8 @@ proc umka_init c uses ebx esi edi ebp xor eax, eax rep stosb +; call init_page_map + mov [xsave_area_size], 0x1000 mov ecx, pg_data.mutex @@ -782,7 +854,7 @@ endp extrn system_shutdown sysfn_saveramdisk: -sysfn_meminfo: +;sysfn_meminfo: check_fdd_motor_status: check_ATAPI_device_event: check_fdd_motor_status_has_work?: @@ -795,7 +867,7 @@ allow_medium_removal: EjectMedium: save_image: init_sys_v86: -load_pe_driver: +;load_pe_driver: usb_init: fdc_init: mtrr_validate: @@ -805,11 +877,8 @@ ReadCDWRetr: WaitUnitReady: prevent_medium_removal: Read_TOC: -commit_pages: -release_pages: lock_application_table: unlock_application_table: -get_pg_addr: free_page: build_interrupt_table: init_fpu: @@ -817,16 +886,16 @@ init_mtrr: create_trampoline_pgmap: alloc_page: -sys_IPC: +;sys_IPC: sys_resize_app_memory: -f68: +;f68: v86_irq: -test_cpu: -acpi_locate: -init_BIOS32: -mem_test: -init_mem: -init_page_map: +;test_cpu: +;acpi_locate: +;init_BIOS32: +;mem_test: +;init_mem: +;init_page_map: ahci_init: enable_acpi: acpi.call_name: @@ -843,13 +912,14 @@ acpi._.lookup_node: acpi._.print_tree: ret +load_PE: alloc_pages: ret 4 -create_ring_buffer: +;create_ring_buffer: ret 8 -map_page: +;map_page: ret 12 -map_memEx: +;map_memEx: ret 20 uglobal @@ -924,6 +994,8 @@ HEAP_BASE rb UMKA_MEMORY_BYTES - (HEAP_BASE - os_base + \ endg uglobal +page_tabs: +rb 256*1024*1024 v86_irqhooks rd IRQ_RESERVED*2 cache_ide0 IDE_CACHE cache_ide1 IDE_CACHE diff --git a/umka.h b/umka.h index 19ed571..c048be5 100644 --- a/umka.h +++ b/umka.h @@ -394,6 +394,26 @@ typedef struct { // Protocol family #define AF_INET4 AF_INET +/* +struct sockaddr_in { + uint16_t sin_family; // sa_family_t + uint16_t sin_port; // in_port_t + uint32_t sin_addr; // struct in_addr + uint8_t sin_zero[8]; // zero +}; + +struct addrinfo { + uint32_t ai_flags; // bitmask of AI_* + uint32_t ai_family; // PF_* + uint32_t ai_socktype; // SOCK_* + uint32_t ai_protocol; // 0 or IPPROTO_* + uint32_t ai_addrlen; // length of ai_addr + uint32_t ai_canonname; // char* + uint32_t ai_addr; // struct sockaddr* + uint32_t ai_next; // struct addrinfo* +}; +*/ + typedef struct net_device_t net_device_t; typedef struct { @@ -708,7 +728,7 @@ typedef struct { extern display_t kos_display; typedef struct { - uint64_t addr; + void *addr; uint64_t size; uint32_t type; } e820entry_t; @@ -1633,6 +1653,19 @@ umka_sys_move_window(size_t x, size_t y, ssize_t xsize, ssize_t ysize) { : "memory"); } +static inline void* +umka_sys_load_dll(const char *fname) { + void *table; + __asm__ __inline__ __volatile__ ( + "call i40" + : "=a"(table) + : "a"(68), + "b"(19), + "c"(fname) + : "memory"); + return table; +} + static inline void umka_sys_lfn(void *f7080sXarg, f7080ret_t *r, f70or80_t f70or80) { __asm__ __inline__ __volatile__ ( diff --git a/umka_shell.c b/umka_shell.c index babeec4..40bce57 100644 --- a/umka_shell.c +++ b/umka_shell.c @@ -40,6 +40,10 @@ void build_history_filename() { sprintf(history_filename, "%s/%s", dir_name, HIST_FILE_BASENAME); } +uint8_t mem0[64*1024*1024]; +uint8_t mem1[128*1024*1024]; +uint8_t mem2[256*1024*1024]; + int main(int argc, char **argv) { (void)argc; @@ -55,6 +59,11 @@ main(int argc, char **argv) { .hist_file = history_filename}; build_history_filename(); + kos_boot.memmap_block_cnt = 3; + kos_boot.memmap_blocks[0] = (e820entry_t){mem0, 64*1024*1024, 1}; + kos_boot.memmap_blocks[1] = (e820entry_t){mem1, 128*1024*1024, 1}; + kos_boot.memmap_blocks[2] = (e820entry_t){mem2, 256*1024*1024, 1}; + kos_boot.bpp = 32; kos_boot.x_res = UMKA_DEFAULT_DISPLAY_WIDTH; kos_boot.y_res = UMKA_DEFAULT_DISPLAY_HEIGHT;