From 2f58d4453d7f244dd122511ee03efb9ced318899 Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Mon, 20 Feb 2023 03:07:54 +0000 Subject: [PATCH] Use a CreateProcessA argument instead of chdir on Windows Plus minor build fixes --- makefile | 16 ++++++++++------ test/runtests.c | 4 ++-- umka.asm | 12 +++++++----- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/makefile b/makefile index 311eaeb..92beb5c 100644 --- a/makefile +++ b/makefile @@ -32,10 +32,14 @@ CFLAGS=$(WARNINGS) $(NOWARNINGS) -std=c11 -g -O0 -DNDEBUG -masm=intel \ CFLAGS_32=$(CFLAGS) -m32 -D_FILE_OFFSET_BITS=64 -D__USE_TIME_BITS64 LDFLAGS=-no-pie LDFLAGS_32=$(LDFLAGS) -m32 -LIBS=-lpthread +LIBS_COMMON=-lpthread -ifeq ($(HOST),windows) - LIBS=$(LIBS) -lws2_32 +ifeq ($(HOST),linux) + LIBS=$(LIBS_COMMON) +else ifeq ($(HOST),windows) + LIBS=$(LIBS_COMMON) -lws2_32 +else + $(error your HOST is not supported) endif ifeq ($(HOST),linux) @@ -45,7 +49,7 @@ else ifeq ($(HOST),windows) FASM_INCLUDE=$(KOLIBRIOS)\kernel\trunk;$(KOLIBRIOS)\programs\develop\libraries\libcrash\hash FASM=set "INCLUDE=$(FASM_INCLUDE)" && $(FASM_EXE) $(FASM_FLAGS) else - $(error your OS is not supported) + $(error your HOST is not supported) endif ifeq ($(HOST),linux) @@ -54,7 +58,7 @@ all: umka_shell umka_fuse umka_os umka_gen_devices_dat umka.sym umka.prp \ else ifeq ($(HOST),windows) all: umka_shell umka.sym umka.prp umka.lst default.skn skin.skn test/runtests else - $(error your OS is not supported) + $(error your HOST is not supported) endif .PHONY: test @@ -180,7 +184,7 @@ umka_gen_devices_dat.o: umka_gen_devices_dat.c umka.h $(CC) $(CFLAGS_32) -c $< test/runtests: test/runtests.o deps/optparse/optparse.o - $(CC) $(LDFLAGS_32) -o $@ $^ + $(CC) $(LDFLAGS_32) -o $@ $^ $(LIBS) test/runtests.o: test/runtests.c $(CC) $(CFLAGS_32) -c $< -o $@ -Wno-deprecated-declarations diff --git a/test/runtests.c b/test/runtests.c index f3e2a88..df73c9b 100644 --- a/test/runtests.c +++ b/test/runtests.c @@ -212,8 +212,8 @@ run_test(const void *arg) { memset(&pi, 0, sizeof(pi)); unsigned tout = get_test_timeout(test_name); - if(!CreateProcess(NULL, "../../umka_shell -ri run.us -o out.log", NULL, - NULL, FALSE, 0, NULL, NULL, &si, &pi)) { + if(!CreateProcessA(NULL, "../umka_shell -ri run.us -o out.log", NULL, + NULL, FALSE, 0, NULL, test_name, &si, &pi)) { fprintf(stderr, "CreateProcess failed: %lu\n", GetLastError()); return (void *)-1; } diff --git a/umka.asm b/umka.asm index 9b029cb..8497569 100644 --- a/umka.asm +++ b/umka.asm @@ -100,8 +100,8 @@ UMKA_BOOT_DEFAULT_DISPLAY_BPP = 32 UMKA_BOOT_DEFAULT_DISPLAY_WIDTH = 400 UMKA_BOOT_DEFAULT_DISPLAY_HEIGHT = 300 -public idle_scheduled -public os_scheduled +pubsym idle_scheduled, 'idle_scheduled' +pubsym os_scheduled, 'os_scheduled' pubsym irq_serv.irq_10, 'kos_irq_serv_irq10' pubsym idts, 'kos_idts' pubsym attach_int_handler, 'kos_attach_int_handler', 12 @@ -132,8 +132,8 @@ pubsym coverage_end pubsym sha3_256_oneshot, 'hash_oneshot' pubsym kos_time_to_epoch -pubsym umka_init, 4 -pubsym umka_close, 4 +pubsym umka_init, 'umka_init' +pubsym umka_close, 'umka_close' pubsym umka_boot pubsym current_process, 'kos_current_process' @@ -884,12 +884,14 @@ endp pubsym skin_udata proc idle uses ebx esi edi -extrn "pause", 0, libc_pause sti @@: mov [idle_scheduled], 1 sfence +if ~ HOST eq windows +extrn "pause", 0, libc_pause call libc_pause +end if jmp @b ret