From 76c7819882b9f43d34264df6a8def42796fb72b3 Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Wed, 18 Jan 2023 08:29:08 +0000 Subject: [PATCH] Split I/O code to generic io* and platform specific io_async* --- apps/readdir.asm | 10 +- io.c | 52 +++++ linux/io.h => io.h | 16 +- linux/io.c | 51 ----- linux/io_async.c | 212 ++++++++++++++++++ linux/io_async.h | 27 +++ makefile | 17 +- shell.c | 36 +-- shell.h | 5 +- ...#xfs_#s05k_ls_all_dir_types_ftype1.ref.log | 2 +- ...f70s1_#xfs_#s05k_ls_all_dir_types_ftype1.t | 2 +- ...#xfs_#s05k_ls_all_dir_types_ftype0.ref.log | 2 +- ...f70s1_#xfs_#s05k_ls_all_dir_types_ftype0.t | 2 +- ...70s0_#xfs_#s05k_read_without_holes.ref.log | 2 +- ...f70_#f70s0_#xfs_#s05k_read_without_holes.t | 2 +- test/004_#f70_#f70s5_#xfs_stat.ref.log | 2 +- test/004_#f70_#f70s5_#xfs_stat.t | 2 +- test/005_#f30_#xfs_cur_dir.ref.log | 2 +- test/005_#f30_#xfs_cur_dir.t | 2 +- ..._#f70s0_#xfs_#s05k_read_with_holes.ref.log | 2 +- ...6_#f70_#f70s0_#xfs_#s05k_read_with_holes.t | 2 +- test/007_#f70_#xfs_#lookup_all.ref.log | 2 +- test/007_#f70_#xfs_#lookup_all.t | 2 +- ..._#xfs_#s4k_ls_all_dir_types_ftype0.ref.log | 2 +- ...#f70s1_#xfs_#s4k_ls_all_dir_types_ftype0.t | 2 +- ...70_#f70s0_#f70s1_#xfs_#s05k_#xattr.ref.log | 2 +- ...009_#f70_#f70s0_#f70s1_#xfs_#s05k_#xattr.t | 2 +- test/010_#f70_#xfs_#lookup_#xattr_all.ref.log | 2 +- test/010_#f70_#xfs_#lookup_#xattr_all.t | 2 +- ...0_#f70s1_#xfs_#lookup_#unicode_all.ref.log | 2 +- ...11_#f70_#f70s1_#xfs_#lookup_#unicode_all.t | 2 +- ..._#v5_#s05k_ls_all_dir_types_ftype1.ref.log | 2 +- ...1_#xfs_#v5_#s05k_ls_all_dir_types_ftype1.t | 2 +- test/013_#f70_#xfs_#v5_#lookup_all.ref.log | 2 +- test/013_#f70_#xfs_#v5_#lookup_all.t | 2 +- ...0s0_#xfs_#v5_#s05k_read_with_holes.ref.log | 2 +- ...70_#f70s0_#xfs_#v5_#s05k_read_with_holes.t | 2 +- ..._#xfs_#v5_#s05k_read_without_holes.ref.log | 2 +- ...#f70s0_#xfs_#v5_#s05k_read_without_holes.t | 2 +- test/016_#f01_#draw_all.ref.log | 2 +- test/016_#f01_#draw_all.t | 2 +- ..._#f70s0_#xfs_#s05k_read_above_4GiB.ref.log | 2 +- ...7_#f70_#f70s0_#xfs_#s05k_read_above_4GiB.t | 2 +- test/018_#xfs_#coverage_all.ref.log | 2 +- test/018_#xfs_#coverage_all.t | 2 +- test/019_#xfs_deep_btree.ref.log | 2 +- test/019_#xfs_deep_btree.t | 2 +- test/021_#i40_all.ref.log | 2 +- test/021_#i40_all.t | 2 +- test/044_#f01_#draw_winmap.ref.log | 2 +- test/044_#f01_#draw_winmap.t | 2 +- test/045_#f70_#fat32_test0.ref.log | 2 +- test/045_#f70_#fat32_test0.t | 2 +- ...6_#f70_#f70s1_#fat_#exfat_#s05k_ls.ref.log | 2 +- test/046_#f70_#f70s1_#fat_#exfat_#s05k_ls.t | 2 +- ...#f70_#f70s1_#fat_#exfat_#s05k_stat.ref.log | 2 +- test/047_#f70_#f70s1_#fat_#exfat_#s05k_stat.t | 2 +- test/049_#keyboard_#input_all.ref.log | 2 +- test/049_#keyboard_#input_all.t | 2 +- test/050_#mouse_#input_all.ref.log | 2 +- test/050_#mouse_#input_all.t | 2 +- test/051_#draw_#cursor_all.ref.log | 2 +- test/051_#draw_#cursor_all.t | 2 +- test/053_#userevent_all.t | 2 +- test/054_#draw_#cursor_#osloop_resize.ref.log | 2 +- test/054_#draw_#cursor_#osloop_resize.t | 2 +- test/055_#xfs_#bigtime_all.ref.log | 2 +- test/055_#xfs_#bigtime_all.t | 2 +- test/056_#xfs_#nrext64_all.ref.log | 2 +- test/056_#xfs_#nrext64_all.t | 2 +- test/057_#xfs_#lookup_#v5_all.ref.log | 2 +- test/057_#xfs_#lookup_#v5_all.t | 2 +- test/058_#xfs_#lookup_#v4_all.ref.log | 2 +- test/058_#xfs_#lookup_#v4_all.t | 2 +- test/059_#gpt_all.ref.log | 2 +- test/059_#gpt_all.t | 2 +- ..._#ext_#ext2_#s05k_ls_all_dir_types.ref.log | 2 +- ...#f70s1_#ext_#ext2_#s05k_ls_all_dir_types.t | 2 +- ..._#ext_#ext4_#s05k_ls_all_dir_types.ref.log | 2 +- ...#f70s1_#ext_#ext4_#s05k_ls_all_dir_types.t | 2 +- ...#fat_#fat12_#s05k_ls_all_dir_types.ref.log | 2 +- ...f70s1_#fat_#fat12_#s05k_ls_all_dir_types.t | 2 +- ...#fat_#fat16_#s05k_ls_all_dir_types.ref.log | 2 +- ...f70s1_#fat_#fat16_#s05k_ls_all_dir_types.t | 2 +- ...5_#s05k_#samehash_ls_all_dir_types.ref.log | 2 +- ..._#xfsv5_#s05k_#samehash_ls_all_dir_types.t | 2 +- umka.asm | 25 +-- umka.h | 7 +- umka_fuse.c | 4 +- umka_os.c | 7 +- umka_os.us | 2 +- umka_shell.c | 6 +- vdisk.c | 4 +- vdisk/qcow2.c | 14 +- vdisk/qcow2.h | 5 +- vdisk/raw.c | 5 +- vdisk/raw.h | 5 +- windows/io.c | 27 --- windows/io.h | 21 -- 99 files changed, 453 insertions(+), 259 deletions(-) create mode 100644 io.c rename linux/io.h => io.h (52%) delete mode 100644 linux/io.c create mode 100644 linux/io_async.c create mode 100644 linux/io_async.h delete mode 100644 windows/io.c delete mode 100644 windows/io.h diff --git a/apps/readdir.asm b/apps/readdir.asm index 2e903a4..af4c98f 100644 --- a/apps/readdir.asm +++ b/apps/readdir.asm @@ -20,19 +20,21 @@ start: mcall 12, 1 mcall 0, <100,200>, <100,100>, 0x34888888, , window_title mcall 12, 2 + + DEBUGF 1, "abcde\n" + mcall 70, fs70 + DEBUGF 1, "files in dir: %d\n", ebx + mcall 18, 19, 4, 0 .next: mcall 37, 0 - add eax, 0x00030003 + add eax, 0x00020002 mov edx, eax mcall 18, 19, 4 mcall 5, 1 ; mov ecx, 0x1000000 ; loopnz $ jmp .next - DEBUGF 1, "abcde\n" - mcall 70, fs70 - DEBUGF 1, "files in dir: %d\n", ebx mcall -1 exit: ; mcall 18, 9, 2 diff --git a/io.c b/io.c new file mode 100644 index 0000000..4fac7e5 --- /dev/null +++ b/io.c @@ -0,0 +1,52 @@ +/* + SPDX-License-Identifier: GPL-2.0-or-later + + UMKa - User-Mode KolibriOS developer tools + io - input/output platform specific code + + Copyright (C) 2023 Ivan Baravy +*/ + +#include +#include +#include +#include +#include +#include "io.h" +#include "io_async.h" + +struct umka_io * +io_init(int *running) { + struct umka_io *io = malloc(sizeof(struct umka_io)); + io->running = running; + io->async = io_async_init(); + return io; +} + +void +io_close(struct umka_io *io) { + io_async_close(io->async); + free(io); +} + +ssize_t +io_read(int fd, void *buf, size_t count, struct umka_io *io) { + ssize_t res; + if (!*io->running) { + res = read(fd, buf, count); + } else { + res = io_async_read(fd, buf, count, io->async); + } + return res; +} + +ssize_t +io_write(int fd, const void *buf, size_t count, struct umka_io *io) { + ssize_t res; + if (!*io->running) { + res = write(fd, buf, count); + } else { + res = io_async_write(fd, buf, count, io->async); + } + return res; +} diff --git a/linux/io.h b/io.h similarity index 52% rename from linux/io.h rename to io.h index ddac37d..ba6879e 100644 --- a/linux/io.h +++ b/io.h @@ -12,19 +12,21 @@ #include -#define IO_DONT_CHANGE_TASK 0 -#define IO_CHANGE_TASK 1 +struct umka_io { + const int *running; + void *async; // platform specific +}; -void * -io_init(int change_task); +struct umka_io * +io_init(int *running); void -io_close(void *arg); +io_close(struct umka_io *io); ssize_t -io_read(int fd, void *buf, size_t count, void *arg); +io_read(int fd, void *buf, size_t count, struct umka_io *io); ssize_t -io_write(int fd, const void *buf, size_t count, void *arg); +io_write(int fd, const void *buf, size_t count, struct umka_io *io); #endif // IO_H_INCLUDED diff --git a/linux/io.c b/linux/io.c deleted file mode 100644 index 0fa67a9..0000000 --- a/linux/io.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - SPDX-License-Identifier: GPL-2.0-or-later - - UMKa - User-Mode KolibriOS developer tools - io - input/output platform specific code - - Copyright (C) 2023 Ivan Baravy -*/ - -#include -#include -#include "io.h" - -struct umka_io { - int change_task; - int uring_fd; -}; - -void * -io_init(int change_task) { - struct umka_io *io = malloc(sizeof(struct umka_io)); - io->change_task = change_task; - if (change_task) { - io->uring_fd = 1; - } - return io; -} - -void -io_close(void *arg) { - struct umka_io *io = arg; - free(io); -} - -ssize_t -io_read(int fd, void *buf, size_t count, void *arg) { - struct umka_io *io = arg; - (void)io; - ssize_t res; - res = read(fd, buf, count); - return res; -} - -ssize_t -io_write(int fd, const void *buf, size_t count, void *arg) { - struct umka_io *io = arg; - (void)io; - ssize_t res; - res = write(fd, buf, count); - return res; -} diff --git a/linux/io_async.c b/linux/io_async.c new file mode 100644 index 0000000..1b0246f --- /dev/null +++ b/linux/io_async.c @@ -0,0 +1,212 @@ +/* + SPDX-License-Identifier: GPL-2.0-or-later + + UMKa - User-Mode KolibriOS developer tools + io_async - input/output platform specific code + + Copyright (C) 2023 Ivan Baravy +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "../umka.h" + +#define QUEUE_DEPTH 1 + +#define read_barrier() __asm__ __volatile__("":::"memory") +#define write_barrier() __asm__ __volatile__("":::"memory") + +#define MAX(x, y) ((x) >= (y) ? (x) : (y)) + +struct io_uring_queue { + int fd; + void *base; + size_t base_mmap_len; + struct io_uring_params p; + uint32_t *array; + struct io_uring_sqe *sqes; + size_t sqes_mmap_len; + uint32_t *sq_head, *sq_tail; + uint32_t sq_mask; + struct io_uring_cqe *cqes; + uint32_t *cq_head, *cq_tail; + uint32_t cq_mask; +}; + +static int +io_uring_setup(unsigned entries, struct io_uring_params *p) { + return (int) syscall(__NR_io_uring_setup, entries, p); +} + +static int +io_uring_enter(int ring_fd, unsigned int to_submit, unsigned int min_complete, + unsigned int flags) { + return (int) syscall(__NR_io_uring_enter, ring_fd, to_submit, min_complete, + flags, NULL, 0); +} + +/* +static void +dump_scht(char *prefix, struct io_uring_queue *q) { +fprintf(stderr, "# async %s: %p %p\n", prefix, (void*)q, q->base); + size_t head, tail, mask; + read_barrier(); + mask = q->sq_mask; + mask = *(uint32_t*)(((uintptr_t)q->base) + q->p.sq_off.ring_mask); + head = *q->sq_head & mask; + tail = *q->sq_tail & mask; +fprintf(stderr, "######### %s ######### sq %u:%u 0x%x\n", prefix, head, tail, mask); + mask = q->cq_mask; + mask = *(uint32_t*)(((uintptr_t)q->base) + q->p.cq_off.ring_mask); + head = *q->cq_head & mask; + tail = *q->cq_tail & mask; +fprintf(stderr, "######### %s ######### cq %u:%u 0x%x\n", prefix, head, tail, mask); +} +*/ + +int +cq_has_data(struct io_uring_queue *q) { + size_t head, tail; + read_barrier(); + head = *q->cq_head & q->cq_mask; + tail = *q->cq_tail & q->cq_mask; + return head != tail; +} + +static void +build_op_read(struct io_uring_sqe *sqe, int fd, void *data, size_t size, + off_t offset) { + sqe->fd = fd; + sqe->flags = 0; + sqe->opcode = IORING_OP_READ; + sqe->addr = (uintptr_t)data; + sqe->len = size; + sqe->off = offset; + sqe->user_data = 0; +} + +static int +read_from_cq(struct io_uring_queue *q) { + size_t head, tail; + struct io_uring_cqe *cqe; + do { + read_barrier(); + head = *q->cq_head & q->cq_mask; + tail = *q->cq_tail & q->cq_mask; + if (head == tail) + break; + + /* Get the entry */ + cqe = q->cqes + head; + if (cqe->res < 0) { + fprintf(stderr, "Read error: %s\n", strerror(abs(cqe->res))); + } + (*q->cq_head)++; + } while (head == tail); + write_barrier(); + return cqe->res; +} + +struct io_uring_queue * +io_async_init() { + struct io_uring_queue *q = calloc(1, sizeof(struct io_uring_queue)); + q->fd = io_uring_setup(QUEUE_DEPTH, &q->p); + if (q->fd < 0) { + perror("io_uring_setup"); + return NULL; + } + + size_t sring_size = q->p.sq_off.array + q->p.sq_entries * sizeof(unsigned); + size_t cring_size = q->p.cq_off.cqes + + q->p.cq_entries * sizeof(struct io_uring_cqe); + size_t rings_size = MAX(sring_size, cring_size); + q->base_mmap_len = rings_size; + + if (!(q->p.features & IORING_FEAT_SINGLE_MMAP)) { + fprintf(stderr, "[io.uring] Your kernel doesn't support" + " IORING_FEAT_SINGLE_MMAP, upgrade to Linux 5.4\n"); + return NULL; + } + + q->base = mmap(0, rings_size, PROT_READ | PROT_WRITE, MAP_SHARED + | MAP_POPULATE, q->fd, IORING_OFF_SQ_RING); + if (q->base == MAP_FAILED) { + perror("[io.uring] Can't mmap io_uring rings"); + return NULL; + } + + q->sqes_mmap_len = q->p.sq_entries * sizeof(struct io_uring_sqe); + q->sqes = mmap(0, q->sqes_mmap_len, PROT_READ | PROT_WRITE, MAP_SHARED + | MAP_POPULATE, q->fd, IORING_OFF_SQES); + if (q->sqes == MAP_FAILED) { + perror("[io.uring] Can't mmap io_uring SQEs"); + return NULL; + } + + q->cqes = (struct io_uring_cqe*)((uintptr_t)q->base + q->p.cq_off.cqes); + q->array = (uint32_t*)((uintptr_t)q->base + q->p.sq_off.array); + q->sq_head = (uint32_t*)((uintptr_t)q->base + q->p.sq_off.head); + q->sq_tail = (uint32_t*)((uintptr_t)q->base + q->p.sq_off.tail); + q->sq_mask = *(uint32_t*)((uintptr_t)q->base + q->p.sq_off.ring_mask); + q->cq_head = (uint32_t*)((uintptr_t)q->base + q->p.cq_off.head); + q->cq_tail = (uint32_t*)((uintptr_t)q->base + q->p.cq_off.tail); + q->cq_mask = *(uint32_t*)((uintptr_t)q->base + q->p.cq_off.ring_mask); + + return q; +} + +void +io_async_close(void *arg) { + struct io_uring_queue *q = arg; + munmap(q->base, q->base_mmap_len); + munmap(q->sqes, q->sqes_mmap_len); + close(q->fd); + free(q); +} + +static uint32_t +io_uring_wait_test() { + appdata_t *app; + __asm__ __volatile__ ("":"=b"(app)::); + struct io_uring_queue *q = app->wait_param; + int done = cq_has_data(q); + return done; +} + +ssize_t +io_async_read(int fd, void *buf, size_t count, void *arg) { + struct io_uring_queue *q = arg; + read_barrier(); + size_t tail = *q->sq_tail & q->sq_mask; + struct io_uring_sqe *sqe = q->sqes + tail; + build_op_read(sqe, fd, buf, count, -1); + q->array[tail] = tail; + (*q->sq_tail)++; + + int ret = io_uring_enter(q->fd, 1, 0, IORING_ENTER_GETEVENTS); + if(ret < 0) { + perror("io_uring_enter"); + return 1; + } + + kos_wait_events(io_uring_wait_test, q); + + ssize_t res = read_from_cq(q); + + return res; +} + +ssize_t +io_async_write(int fd, const void *buf, size_t count, void *arg) { + (void)fd; + (void)buf; + (void)count; + (void)arg; + return -1; +} diff --git a/linux/io_async.h b/linux/io_async.h new file mode 100644 index 0000000..76dfb8b --- /dev/null +++ b/linux/io_async.h @@ -0,0 +1,27 @@ +/* + SPDX-License-Identifier: GPL-2.0-or-later + + UMKa - User-Mode KolibriOS developer tools + io_async - input/output platform specific code + + Copyright (C) 2023 Ivan Baravy +*/ + +#ifndef IO_ASYNC_H_INCLUDED +#define IO_ASYNC_H_INCLUDED + +#include + +void * +io_async_init(); + +void +io_async_close(void *arg); + +ssize_t +io_async_read(int fd, void *buf, size_t count, void *arg); + +ssize_t +io_async_write(int fd, const void *buf, size_t count, void *arg); + +#endif // IO_ASYNC_H_INCLUDED diff --git a/makefile b/makefile index a1c0d88..e09e516 100644 --- a/makefile +++ b/makefile @@ -25,7 +25,7 @@ else endif CFLAGS=$(WARNINGS) $(NOWARNINGS) -std=c11 -g -O0 -DNDEBUG -masm=intel \ - -D_POSIX_C_SOURCE=200809L -I$(HOST) -fno-pie + -D_POSIX_C_SOURCE=200809L -I$(HOST) -I. -fno-pie CFLAGS_32=$(CFLAGS) -m32 -D_FILE_OFFSET_BITS=64 -D__USE_TIME_BITS64 LDFLAGS=-no-pie LDFLAGS_32=$(LDFLAGS) -m32 @@ -57,18 +57,18 @@ test: umka_shell umka_shell: umka_shell.o umka.o shell.o trace.o trace_lbr.o vdisk.o \ vdisk/raw.o vdisk/qcow2.o vdisk/miniz/miniz.a vnet.o lodepng.o \ - $(HOST)/pci.o $(HOST)/thread.o $(HOST)/io.o util.o optparse.o \ - bestline.o + $(HOST)/pci.o $(HOST)/thread.o io.o $(HOST)/io_async.o util.o \ + optparse.o bestline.o $(CC) $(LDFLAGS_32) $^ -o $@ -T umka.ld umka_fuse: umka_fuse.o umka.o trace.o trace_lbr.o vdisk.o vdisk/raw.o \ vdisk/qcow2.o vdisk/miniz/miniz.a $(HOST)/pci.o $(HOST)/thread.o \ - $(HOST)/io.o + io.o $(HOST)/io_async.o $(CC) $(LDFLAGS_32) $^ -o $@ `pkg-config fuse3 --libs` -T umka.ld umka_os: umka_os.o umka.o shell.o lodepng.o vdisk.o vdisk/raw.o vdisk/qcow2.o \ vdisk/miniz/miniz.a vnet.o trace.o trace_lbr.o $(HOST)/pci.o \ - $(HOST)/thread.o $(HOST)/io.o util.o bestline.o optparse.o + $(HOST)/thread.o io.o $(HOST)/io_async.o util.o bestline.o optparse.o $(CC) $(LDFLAGS_32) $^ -o $@ -T umka.ld umka_gen_devices_dat: umka_gen_devices_dat.o umka.o $(HOST)/pci.o \ @@ -81,8 +81,11 @@ umka.o umka.fas: umka.asm shell.o: shell.c lodepng.h $(CC) $(CFLAGS_32) -c $< -$(HOST)/io.o: $(HOST)/io.c $(HOST)/io.h - $(CC) $(CFLAGS_32) -c $< -o $@ +io.o: io.c io.h + $(CC) $(CFLAGS_32) -D_DEFAULT_SOURCE -c $< -o $@ + +$(HOST)/io_async.o: $(HOST)/io_async.c $(HOST)/io_async.h + $(CC) $(CFLAGS_32) -D_DEFAULT_SOURCE -c $< -o $@ $(HOST)/thread.o: $(HOST)/thread.c $(CC) $(CFLAGS_32) -c $< -o $@ diff --git a/shell.c b/shell.c index cccc792..66d20d9 100644 --- a/shell.c +++ b/shell.c @@ -323,7 +323,7 @@ get_last_dir(const char *path) { static void prompt(struct shell_ctx *ctx) { if (cur_dir_changed) { - if (ctx->umka && ctx->umka->initialized) { + if (ctx->umka->booted) { COVERAGE_ON(); umka_sys_get_cwd(cur_dir, PATH_MAX); COVERAGE_OFF(); @@ -405,34 +405,19 @@ cmd_send_scancode(struct shell_ctx *ctx, int argc, char **argv) { } static void -cmd_umka_init(struct shell_ctx *ctx, int argc, char **argv) { +cmd_umka_boot(struct shell_ctx *ctx, int argc, char **argv) { + (void)ctx; + (void)argv; const char *usage = \ - "usage: umka_init \n" - " number or string: 1=shell, 2=fuse, 3=os"; - if (argc != 2) { + "usage: umka_boot"; + if (argc != 1) { puts(usage); return; } - const char *tool_str = argv[1]; - unsigned tool; - if (!strcmp(tool_str, "1") || !strcmp(tool_str, "shell")) { - tool = UMKA_SHELL; - } else if (!strcmp(tool_str, "2") || !strcmp(tool_str, "fuse")) { - tool = UMKA_FUSE; - } else if (!strcmp(tool_str, "3") || !strcmp(tool_str, "os")) { - tool = UMKA_OS; - } else { - printf("[!] bad tool value: '%s'\n", tool_str); - return; - } COVERAGE_ON(); - ctx->umka = umka_init(tool); + umka_boot(); COVERAGE_OFF(); - - if (!ctx->umka) { - printf("![shell] can't init umka\n"); - } } static void @@ -3706,7 +3691,7 @@ static void cmd_help(struct shell_ctx *ctx, int argc, char **argv); func_table_t cmd_cmds[] = { { "send_scancode", cmd_send_scancode }, - { "umka_init", cmd_umka_init }, + { "umka_boot", cmd_umka_boot }, { "umka_set_boot_params", cmd_umka_set_boot_params }, { "acpi_call", cmd_acpi_call }, { "acpi_enable", cmd_acpi_enable }, @@ -3912,9 +3897,10 @@ run_test(struct shell_ctx *ctx) { } struct shell_ctx * -shell_init(int reproducible, const char *hist_file, struct umka_io *io) { +shell_init(int reproducible, const char *hist_file, struct umka_ctx *umka, + struct umka_io *io) { struct shell_ctx *ctx = malloc(sizeof(struct shell_ctx)); - ctx->umka = NULL; + ctx->umka = umka; ctx->io = io; ctx->reproducible = reproducible; ctx->hist_file = hist_file; diff --git a/shell.h b/shell.h index b2304a0..61f38ae 100644 --- a/shell.h +++ b/shell.h @@ -33,7 +33,7 @@ struct shell_var { }; struct shell_ctx { - struct umka_ctx *umka; + const struct umka_ctx *umka; struct umka_io *io; int reproducible; const char *hist_file; @@ -41,7 +41,8 @@ struct shell_ctx { }; struct shell_ctx * -shell_init(int reproducible, const char *hist_file, struct umka_io *io); +shell_init(int reproducible, const char *hist_file, struct umka_ctx *umka, + struct umka_io *io); void shell_close(struct shell_ctx *shell); diff --git a/test/001_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype1.ref.log b/test/001_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype1.ref.log index c62b6a7..997767c 100644 --- a/test/001_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype1.ref.log +++ b/test/001_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype1.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.qcow2 hd0 -c 0 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/001_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype1.t b/test/001_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype1.t index a8b3c30..8c9ad92 100644 --- a/test/001_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype1.t +++ b/test/001_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype1.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.qcow2 hd0 -c 0 disk_add ../img/xfs_short_dir_i8.qcow2 hd1 -c 0 diff --git a/test/002_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype0.ref.log b/test/002_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype0.ref.log index 7837864..12bdc77 100644 --- a/test/002_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype0.ref.log +++ b/test/002_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype0.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/002_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype0.t b/test/002_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype0.t index 27057a1..1b79905 100644 --- a/test/002_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype0.t +++ b/test/002_#f70_#f70s1_#xfs_#s05k_ls_all_dir_types_ftype0.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k.qcow2 hd0 -c 524288 ls70 /hd0/1/sf_empty ls70 /hd0/1/sf diff --git a/test/003_#f70_#f70s0_#xfs_#s05k_read_without_holes.ref.log b/test/003_#f70_#f70s0_#xfs_#s05k_read_without_holes.ref.log index 68e1922..d04e45a 100644 --- a/test/003_#f70_#f70s0_#xfs_#s05k_read_without_holes.ref.log +++ b/test/003_#f70_#f70s0_#xfs_#s05k_read_without_holes.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/003_#f70_#f70s0_#xfs_#s05k_read_without_holes.t b/test/003_#f70_#f70s0_#xfs_#s05k_read_without_holes.t index edec23b..ca1e644 100644 --- a/test/003_#f70_#f70s0_#xfs_#s05k_read_without_holes.t +++ b/test/003_#f70_#f70s0_#xfs_#s05k_read_without_holes.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_v4_files_s05k_b4k_n8k.qcow2 hd0 -c 524288 # zero length read70 /hd0/1/no_hole 0 0 -b diff --git a/test/004_#f70_#f70s5_#xfs_stat.ref.log b/test/004_#f70_#f70s5_#xfs_stat.ref.log index 82d592d..5df7b53 100644 --- a/test/004_#f70_#f70s5_#xfs_stat.ref.log +++ b/test/004_#f70_#f70s5_#xfs_stat.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/004_#f70_#f70s5_#xfs_stat.t b/test/004_#f70_#f70s5_#xfs_stat.t index 20a9048..1446fd6 100644 --- a/test/004_#f70_#f70s5_#xfs_stat.t +++ b/test/004_#f70_#f70s5_#xfs_stat.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_v4_files_s05k_b4k_n8k.qcow2 hd0 -c 524288 stat70 /hd0/1/ stat70 /hd0/1/hole_begin diff --git a/test/005_#f30_#xfs_cur_dir.ref.log b/test/005_#f30_#xfs_cur_dir.ref.log index 3596891..76a1608 100644 --- a/test/005_#f30_#xfs_cur_dir.ref.log +++ b/test/005_#f30_#xfs_cur_dir.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/005_#f30_#xfs_cur_dir.t b/test/005_#f30_#xfs_cur_dir.t index 882b4ca..d726e0d 100644 --- a/test/005_#f30_#xfs_cur_dir.t +++ b/test/005_#f30_#xfs_cur_dir.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_v4_files_s05k_b4k_n8k.qcow2 hd0 -c 524288 pwd cd /hd0 diff --git a/test/006_#f70_#f70s0_#xfs_#s05k_read_with_holes.ref.log b/test/006_#f70_#f70s0_#xfs_#s05k_read_with_holes.ref.log index 2692088..6afc0eb 100644 --- a/test/006_#f70_#f70s0_#xfs_#s05k_read_with_holes.ref.log +++ b/test/006_#f70_#f70s0_#xfs_#s05k_read_with_holes.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/006_#f70_#f70s0_#xfs_#s05k_read_with_holes.t b/test/006_#f70_#f70s0_#xfs_#s05k_read_with_holes.t index de3495f..fbd1c08 100644 --- a/test/006_#f70_#f70s0_#xfs_#s05k_read_with_holes.t +++ b/test/006_#f70_#f70s0_#xfs_#s05k_read_with_holes.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_v4_files_s05k_b4k_n8k.qcow2 hd0 -c 524288 # hole begin # zero length diff --git a/test/007_#f70_#xfs_#lookup_all.ref.log b/test/007_#f70_#xfs_#lookup_all.ref.log index 78758ae..bc77807 100644 --- a/test/007_#f70_#xfs_#lookup_all.ref.log +++ b/test/007_#f70_#xfs_#lookup_all.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/007_#f70_#xfs_#lookup_all.t b/test/007_#f70_#xfs_#lookup_all.t index 0bb5f82..7826251 100644 --- a/test/007_#f70_#xfs_#lookup_all.t +++ b/test/007_#f70_#xfs_#lookup_all.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.qcow2 hd0 -c 524288 stat70 /hd0/1/sf_empty stat70 /hd0/1/sf_empty/. diff --git a/test/008_#f70_#f70s1_#xfs_#s4k_ls_all_dir_types_ftype0.ref.log b/test/008_#f70_#f70s1_#xfs_#s4k_ls_all_dir_types_ftype0.ref.log index 26d42b2..ef27e44 100644 --- a/test/008_#f70_#f70s1_#xfs_#s4k_ls_all_dir_types_ftype0.ref.log +++ b/test/008_#f70_#f70s1_#xfs_#s4k_ls_all_dir_types_ftype0.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_v4_ftype0_s4k_b4k_n8k.qcow2 hd0 -c 524288 /hd0: sector_size=4096, capacity=77312 (302 MiB), num_partitions=1 /hd0/1: fs=xfs, start=256 (1 MiB), length=76800 (300 MiB) diff --git a/test/008_#f70_#f70s1_#xfs_#s4k_ls_all_dir_types_ftype0.t b/test/008_#f70_#f70s1_#xfs_#s4k_ls_all_dir_types_ftype0.t index 3287c6b..da7c6ec 100644 --- a/test/008_#f70_#f70s1_#xfs_#s4k_ls_all_dir_types_ftype0.t +++ b/test/008_#f70_#f70s1_#xfs_#s4k_ls_all_dir_types_ftype0.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_v4_ftype0_s4k_b4k_n8k.qcow2 hd0 -c 524288 ls70 /hd0/1/sf ls70 /hd0/1/block diff --git a/test/009_#f70_#f70s0_#f70s1_#xfs_#s05k_#xattr.ref.log b/test/009_#f70_#f70s0_#f70s1_#xfs_#s05k_#xattr.ref.log index b595df6..2ed0f8e 100644 --- a/test/009_#f70_#f70s0_#f70s1_#xfs_#s05k_#xattr.ref.log +++ b/test/009_#f70_#f70s0_#f70s1_#xfs_#s05k_#xattr.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/009_#f70_#f70s0_#f70s1_#xfs_#s05k_#xattr.t b/test/009_#f70_#f70s0_#f70s1_#xfs_#s05k_#xattr.t index 13d9d06..38a011c 100644 --- a/test/009_#f70_#f70s0_#f70s1_#xfs_#s05k_#xattr.t +++ b/test/009_#f70_#f70s0_#f70s1_#xfs_#s05k_#xattr.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.qcow2 hd0 -c 524288 ls70 /hd0/1/sf_empty ls70 /hd0/1/sf diff --git a/test/010_#f70_#xfs_#lookup_#xattr_all.ref.log b/test/010_#f70_#xfs_#lookup_#xattr_all.ref.log index 163401c..9989adf 100644 --- a/test/010_#f70_#xfs_#lookup_#xattr_all.ref.log +++ b/test/010_#f70_#xfs_#lookup_#xattr_all.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/010_#f70_#xfs_#lookup_#xattr_all.t b/test/010_#f70_#xfs_#lookup_#xattr_all.t index dd5e09b..2fc2c3c 100644 --- a/test/010_#f70_#xfs_#lookup_#xattr_all.t +++ b/test/010_#f70_#xfs_#lookup_#xattr_all.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.qcow2 hd0 -c 524288 stat70 /hd0/1/sf_empty stat70 /hd0/1/sf_empty/. diff --git a/test/011_#f70_#f70s1_#xfs_#lookup_#unicode_all.ref.log b/test/011_#f70_#f70s1_#xfs_#lookup_#unicode_all.ref.log index e4b2eae..a440f72 100644 --- a/test/011_#f70_#f70s1_#xfs_#lookup_#unicode_all.ref.log +++ b/test/011_#f70_#f70s1_#xfs_#lookup_#unicode_all.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_v4_unicode.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/011_#f70_#f70s1_#xfs_#lookup_#unicode_all.t b/test/011_#f70_#f70s1_#xfs_#lookup_#unicode_all.t index 63fab1b..02a8668 100644 --- a/test/011_#f70_#f70s1_#xfs_#lookup_#unicode_all.t +++ b/test/011_#f70_#f70s1_#xfs_#lookup_#unicode_all.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_v4_unicode.qcow2 hd0 -c 524288 stat80 /hd0/1/dir0 diff --git a/test/012_#f70_#f70s1_#xfs_#v5_#s05k_ls_all_dir_types_ftype1.ref.log b/test/012_#f70_#f70s1_#xfs_#v5_#s05k_ls_all_dir_types_ftype1.ref.log index 54d8026..0c20994 100644 --- a/test/012_#f70_#f70s1_#xfs_#v5_#s05k_ls_all_dir_types_ftype1.ref.log +++ b/test/012_#f70_#f70s1_#xfs_#v5_#s05k_ls_all_dir_types_ftype1.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/012_#f70_#f70s1_#xfs_#v5_#s05k_ls_all_dir_types_ftype1.t b/test/012_#f70_#f70s1_#xfs_#v5_#s05k_ls_all_dir_types_ftype1.t index 228fbc9..8ab5fe5 100644 --- a/test/012_#f70_#f70s1_#xfs_#v5_#s05k_ls_all_dir_types_ftype1.t +++ b/test/012_#f70_#f70s1_#xfs_#v5_#s05k_ls_all_dir_types_ftype1.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.qcow2 hd0 -c 524288 ls70 /hd0/1/sf_empty ls70 /hd0/1/sf diff --git a/test/013_#f70_#xfs_#v5_#lookup_all.ref.log b/test/013_#f70_#xfs_#v5_#lookup_all.ref.log index fb4cf5a..f146087 100644 --- a/test/013_#f70_#xfs_#v5_#lookup_all.ref.log +++ b/test/013_#f70_#xfs_#v5_#lookup_all.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/013_#f70_#xfs_#v5_#lookup_all.t b/test/013_#f70_#xfs_#v5_#lookup_all.t index edf0595..06e5154 100644 --- a/test/013_#f70_#xfs_#v5_#lookup_all.t +++ b/test/013_#f70_#xfs_#v5_#lookup_all.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.qcow2 hd0 -c 524288 stat70 /hd0/1/sf_empty stat70 /hd0/1/sf_empty/. diff --git a/test/014_#f70_#f70s0_#xfs_#v5_#s05k_read_with_holes.ref.log b/test/014_#f70_#f70s0_#xfs_#v5_#s05k_read_with_holes.ref.log index 729c574..9eaf887 100644 --- a/test/014_#f70_#f70s0_#xfs_#v5_#s05k_read_with_holes.ref.log +++ b/test/014_#f70_#f70s0_#xfs_#v5_#s05k_read_with_holes.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_v5_files_s05k_b4k_n8k.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/014_#f70_#f70s0_#xfs_#v5_#s05k_read_with_holes.t b/test/014_#f70_#f70s0_#xfs_#v5_#s05k_read_with_holes.t index 53e3291..619914e 100644 --- a/test/014_#f70_#f70s0_#xfs_#v5_#s05k_read_with_holes.t +++ b/test/014_#f70_#f70s0_#xfs_#v5_#s05k_read_with_holes.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_v5_files_s05k_b4k_n8k.qcow2 hd0 -c 524288 # hole begin # zero length diff --git a/test/015_#f70_#f70s0_#xfs_#v5_#s05k_read_without_holes.ref.log b/test/015_#f70_#f70s0_#xfs_#v5_#s05k_read_without_holes.ref.log index 0e01031..36c9e5c 100644 --- a/test/015_#f70_#f70s0_#xfs_#v5_#s05k_read_without_holes.ref.log +++ b/test/015_#f70_#f70s0_#xfs_#v5_#s05k_read_without_holes.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_v5_files_s05k_b4k_n8k.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/015_#f70_#f70s0_#xfs_#v5_#s05k_read_without_holes.t b/test/015_#f70_#f70s0_#xfs_#v5_#s05k_read_without_holes.t index 7b1e315..881c2eb 100644 --- a/test/015_#f70_#f70s0_#xfs_#v5_#s05k_read_without_holes.t +++ b/test/015_#f70_#f70s0_#xfs_#v5_#s05k_read_without_holes.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_v5_files_s05k_b4k_n8k.qcow2 hd0 -c 524288 # zero length read70 /hd0/1/no_hole 0 0 -b diff --git a/test/016_#f01_#draw_all.ref.log b/test/016_#f01_#draw_all.ref.log index 3446522..e040b4e 100644 --- a/test/016_#f01_#draw_all.ref.log +++ b/test/016_#f01_#draw_all.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> set_mouse_pos_screen 40 30 /> #disk_add ../img/kolibri.raw rd -c 0 /> ramdisk_init ../img/kolibri.raw diff --git a/test/016_#f01_#draw_all.t b/test/016_#f01_#draw_all.t index 2067325..5221e9a 100644 --- a/test/016_#f01_#draw_all.t +++ b/test/016_#f01_#draw_all.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot set_mouse_pos_screen 40 30 #disk_add ../img/kolibri.raw rd -c 0 ramdisk_init ../img/kolibri.raw diff --git a/test/017_#f70_#f70s0_#xfs_#s05k_read_above_4GiB.ref.log b/test/017_#f70_#f70s0_#xfs_#s05k_read_above_4GiB.ref.log index f4c7400..684fa1b 100644 --- a/test/017_#f70_#f70s0_#xfs_#s05k_read_above_4GiB.ref.log +++ b/test/017_#f70_#f70s0_#xfs_#s05k_read_above_4GiB.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/017_#f70_#f70s0_#xfs_#s05k_read_above_4GiB.t b/test/017_#f70_#f70s0_#xfs_#s05k_read_above_4GiB.t index dafdc70..8cd08d0 100644 --- a/test/017_#f70_#f70s0_#xfs_#s05k_read_above_4GiB.t +++ b/test/017_#f70_#f70s0_#xfs_#s05k_read_above_4GiB.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_v4_files_s05k_b4k_n8k.qcow2 hd0 -c 524288 read70 /hd0/1/4GiB_plus 0x3ff4 11 -b diff --git a/test/018_#xfs_#coverage_all.ref.log b/test/018_#xfs_#coverage_all.ref.log index b05b12d..8021868 100644 --- a/test/018_#xfs_#coverage_all.ref.log +++ b/test/018_#xfs_#coverage_all.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/jfs.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=32768 (16 MiB), num_partitions=1 /hd0/1: fs=???, start=2048 (1 MiB), length=28672 (14 MiB) diff --git a/test/018_#xfs_#coverage_all.t b/test/018_#xfs_#coverage_all.t index 4f8f465..142678c 100644 --- a/test/018_#xfs_#coverage_all.t +++ b/test/018_#xfs_#coverage_all.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/jfs.qcow2 hd0 -c 524288 disk_del hd0 disk_add ../img/xfs_borg_bit.qcow2 hd0 -c 524288 diff --git a/test/019_#xfs_deep_btree.ref.log b/test/019_#xfs_deep_btree.ref.log index 764cfee..f5f4cf9 100644 --- a/test/019_#xfs_deep_btree.ref.log +++ b/test/019_#xfs_deep_btree.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_v4_btrees_l2.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/019_#xfs_deep_btree.t b/test/019_#xfs_deep_btree.t index 9a02953..4d9ba54 100644 --- a/test/019_#xfs_deep_btree.t +++ b/test/019_#xfs_deep_btree.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_v4_btrees_l2.qcow2 hd0 -c 524288 ls80 /hd0/1/dir_btree_l2 -f 0 -c 1 diff --git a/test/021_#i40_all.ref.log b/test/021_#i40_all.ref.log index 97c27c3..fedf2d0 100644 --- a/test/021_#i40_all.ref.log +++ b/test/021_#i40_all.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> i40 18 16 eax = 00040000 262144 262144 ebx = 00000010 16 16 diff --git a/test/021_#i40_all.t b/test/021_#i40_all.t index 266b2eb..6312841 100644 --- a/test/021_#i40_all.t +++ b/test/021_#i40_all.t @@ -1,2 +1,2 @@ -umka_init shell +umka_boot i40 18 16 diff --git a/test/044_#f01_#draw_winmap.ref.log b/test/044_#f01_#draw_winmap.ref.log index 44f09c4..3f12182 100644 --- a/test/044_#f01_#draw_winmap.ref.log +++ b/test/044_#f01_#draw_winmap.ref.log @@ -1,5 +1,5 @@ /> umka_set_boot_params --x_res 44 --y_res 44 -/> umka_init shell +/> umka_boot /> ramdisk_init ../img/kolibri.raw /rd: sector_size=512, capacity=2880 (1440 kiB), num_partitions=1 /rd/1: fs=fat, start=0 (0 B), length=2880 (1440 kiB) diff --git a/test/044_#f01_#draw_winmap.t b/test/044_#f01_#draw_winmap.t index 04b8eb9..dcbd5ed 100644 --- a/test/044_#f01_#draw_winmap.t +++ b/test/044_#f01_#draw_winmap.t @@ -1,5 +1,5 @@ umka_set_boot_params --x_res 44 --y_res 44 -umka_init shell +umka_boot ramdisk_init ../img/kolibri.raw set_skin /sys/DEFAULT.SKN diff --git a/test/045_#f70_#fat32_test0.ref.log b/test/045_#f70_#fat32_test0.ref.log index 9054f64..d088033 100644 --- a/test/045_#f70_#fat32_test0.ref.log +++ b/test/045_#f70_#fat32_test0.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/fat32_test0.raw hd0 -c 0 /hd0: sector_size=512, capacity=131072 (64 MiB), num_partitions=1 /hd0/1: fs=fat, start=2048 (1 MiB), length=126976 (62 MiB) diff --git a/test/045_#f70_#fat32_test0.t b/test/045_#f70_#fat32_test0.t index f5a630e..e198466 100644 --- a/test/045_#f70_#fat32_test0.t +++ b/test/045_#f70_#fat32_test0.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/fat32_test0.raw hd0 -c 0 ls80 /hd0/1/ read70 /hd0/1/A 0 16388096 -h diff --git a/test/046_#f70_#f70s1_#fat_#exfat_#s05k_ls.ref.log b/test/046_#f70_#f70s1_#fat_#exfat_#s05k_ls.ref.log index b9dad9e..94bf7b5 100644 --- a/test/046_#f70_#f70s1_#fat_#exfat_#s05k_ls.ref.log +++ b/test/046_#f70_#f70s1_#fat_#exfat_#s05k_ls.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/exfat_s05k_c16k_b16k.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=exfat, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/046_#f70_#f70s1_#fat_#exfat_#s05k_ls.t b/test/046_#f70_#f70s1_#fat_#exfat_#s05k_ls.t index 0cc5f6a..e7e9485 100644 --- a/test/046_#f70_#f70s1_#fat_#exfat_#s05k_ls.t +++ b/test/046_#f70_#f70s1_#fat_#exfat_#s05k_ls.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/exfat_s05k_c16k_b16k.qcow2 hd0 -c 524288 ls70 /hd0/1/dir_0 -f 0 -c 0 diff --git a/test/047_#f70_#f70s1_#fat_#exfat_#s05k_stat.ref.log b/test/047_#f70_#f70s1_#fat_#exfat_#s05k_stat.ref.log index f1b8547..11552c7 100644 --- a/test/047_#f70_#f70s1_#fat_#exfat_#s05k_stat.ref.log +++ b/test/047_#f70_#f70s1_#fat_#exfat_#s05k_stat.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/exfat_s05k_c8k_b8k.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=exfat, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/047_#f70_#f70s1_#fat_#exfat_#s05k_stat.t b/test/047_#f70_#f70s1_#fat_#exfat_#s05k_stat.t index e29dc04..c866e0e 100644 --- a/test/047_#f70_#f70s1_#fat_#exfat_#s05k_stat.t +++ b/test/047_#f70_#f70s1_#fat_#exfat_#s05k_stat.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/exfat_s05k_c8k_b8k.qcow2 hd0 -c 524288 stat70 /hd0/1/dir_000 diff --git a/test/049_#keyboard_#input_all.ref.log b/test/049_#keyboard_#input_all.ref.log index f8787d0..b2e9a0a 100644 --- a/test/049_#keyboard_#input_all.ref.log +++ b/test/049_#keyboard_#input_all.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> /> get_keyboard_mode keyboard_mode: 0 - ASCII diff --git a/test/049_#keyboard_#input_all.t b/test/049_#keyboard_#input_all.t index e02868d..ecf7905 100644 --- a/test/049_#keyboard_#input_all.t +++ b/test/049_#keyboard_#input_all.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot get_keyboard_mode get_keyboard_lang diff --git a/test/050_#mouse_#input_all.ref.log b/test/050_#mouse_#input_all.ref.log index 364fdc8..5b75d68 100644 --- a/test/050_#mouse_#input_all.ref.log +++ b/test/050_#mouse_#input_all.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> /> get_mouse_pos_screen x y: 200 150 diff --git a/test/050_#mouse_#input_all.t b/test/050_#mouse_#input_all.t index 2dafb99..fd7e31a 100644 --- a/test/050_#mouse_#input_all.t +++ b/test/050_#mouse_#input_all.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot get_mouse_pos_screen get_mouse_pos_window diff --git a/test/051_#draw_#cursor_all.ref.log b/test/051_#draw_#cursor_all.ref.log index 3f062bb..9124b28 100644 --- a/test/051_#draw_#cursor_all.ref.log +++ b/test/051_#draw_#cursor_all.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> #set_mouse_pos_screen 40 30 /> ramdisk_init ../img/kolibri.raw /rd: sector_size=512, capacity=2880 (1440 kiB), num_partitions=1 diff --git a/test/051_#draw_#cursor_all.t b/test/051_#draw_#cursor_all.t index 9892ab6..b7415fe 100644 --- a/test/051_#draw_#cursor_all.t +++ b/test/051_#draw_#cursor_all.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot #set_mouse_pos_screen 40 30 ramdisk_init ../img/kolibri.raw set_skin /sys/DEFAULT.SKN diff --git a/test/053_#userevent_all.t b/test/053_#userevent_all.t index b567a23..6f617c6 100644 --- a/test/053_#userevent_all.t +++ b/test/053_#userevent_all.t @@ -1,3 +1,3 @@ -umka_init shell +umka_boot check_for_event check_for_event diff --git a/test/054_#draw_#cursor_#osloop_resize.ref.log b/test/054_#draw_#cursor_#osloop_resize.ref.log index c972502..88b9f88 100644 --- a/test/054_#draw_#cursor_#osloop_resize.ref.log +++ b/test/054_#draw_#cursor_#osloop_resize.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> /> ramdisk_init ../img/kolibri.raw /rd: sector_size=512, capacity=2880 (1440 kiB), num_partitions=1 diff --git a/test/054_#draw_#cursor_#osloop_resize.t b/test/054_#draw_#cursor_#osloop_resize.t index 53fcf9b..20ce777 100644 --- a/test/054_#draw_#cursor_#osloop_resize.t +++ b/test/054_#draw_#cursor_#osloop_resize.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot ramdisk_init ../img/kolibri.raw set_skin /sys/DEFAULT.SKN diff --git a/test/055_#xfs_#bigtime_all.ref.log b/test/055_#xfs_#bigtime_all.ref.log index f64f597..2cda3d7 100644 --- a/test/055_#xfs_#bigtime_all.ref.log +++ b/test/055_#xfs_#bigtime_all.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_bigtime.qcow2 hd0 -c 0 /hd0: sector_size=512, capacity=618496 (302 MiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=614400 (300 MiB) diff --git a/test/055_#xfs_#bigtime_all.t b/test/055_#xfs_#bigtime_all.t index de6b06c..23d082b 100644 --- a/test/055_#xfs_#bigtime_all.t +++ b/test/055_#xfs_#bigtime_all.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_bigtime.qcow2 hd0 -c 0 ls70 /hd0/1/ ls70 /hd0/1/dira diff --git a/test/056_#xfs_#nrext64_all.ref.log b/test/056_#xfs_#nrext64_all.ref.log index 3f67884..ed2b114 100644 --- a/test/056_#xfs_#nrext64_all.ref.log +++ b/test/056_#xfs_#nrext64_all.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_nrext64.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=6291456 (3 GiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=6287360 (3070 MiB) diff --git a/test/056_#xfs_#nrext64_all.t b/test/056_#xfs_#nrext64_all.t index 641c21a..6744ff3 100644 --- a/test/056_#xfs_#nrext64_all.t +++ b/test/056_#xfs_#nrext64_all.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_nrext64.qcow2 hd0 -c 524288 stat70 /hd0/1/dir_sf stat70 /hd0/1/dir_block diff --git a/test/057_#xfs_#lookup_#v5_all.ref.log b/test/057_#xfs_#lookup_#v5_all.ref.log index f363ce2..747aece 100644 --- a/test/057_#xfs_#lookup_#v5_all.ref.log +++ b/test/057_#xfs_#lookup_#v5_all.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_lookup_v5.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=10485760 (5 GiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=10481664 (5118 MiB) diff --git a/test/057_#xfs_#lookup_#v5_all.t b/test/057_#xfs_#lookup_#v5_all.t index fa8263b..b55d571 100644 --- a/test/057_#xfs_#lookup_#v5_all.t +++ b/test/057_#xfs_#lookup_#v5_all.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_lookup_v5.qcow2 hd0 -c 524288 cd /hd0/1/dir_sf stat70 d0000000000/d0000000000 diff --git a/test/058_#xfs_#lookup_#v4_all.ref.log b/test/058_#xfs_#lookup_#v4_all.ref.log index c39bc26..448a7ab 100644 --- a/test/058_#xfs_#lookup_#v4_all.ref.log +++ b/test/058_#xfs_#lookup_#v4_all.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_lookup_v4.qcow2 hd0 -c 1048576 /hd0: sector_size=512, capacity=6291456 (3 GiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=6287360 (3070 MiB) diff --git a/test/058_#xfs_#lookup_#v4_all.t b/test/058_#xfs_#lookup_#v4_all.t index 028b455..ce4ed40 100644 --- a/test/058_#xfs_#lookup_#v4_all.t +++ b/test/058_#xfs_#lookup_#v4_all.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_lookup_v4.qcow2 hd0 -c 1048576 cd /hd0/1/dir_sf stat70 d0000000000/d0000000000 diff --git a/test/059_#gpt_all.ref.log b/test/059_#gpt_all.ref.log index c32e86b..7bce926 100644 --- a/test/059_#gpt_all.ref.log +++ b/test/059_#gpt_all.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/gpt_partitions_s05k.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=2097152 (1 GiB), num_partitions=24 /hd0/1: fs=???, start=2048 (1 MiB), length=2048 (1 MiB) diff --git a/test/059_#gpt_all.t b/test/059_#gpt_all.t index dc5a82a..82c4644 100644 --- a/test/059_#gpt_all.t +++ b/test/059_#gpt_all.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/gpt_partitions_s05k.qcow2 hd0 -c 524288 disk_del hd0 disk_add ../img/gpt_partitions_s4k.qcow2 hd0 -c 524288 diff --git a/test/060_#f70_#f70s1_#ext_#ext2_#s05k_ls_all_dir_types.ref.log b/test/060_#f70_#f70s1_#ext_#ext2_#s05k_ls_all_dir_types.ref.log index e5abf63..dba4b19 100644 --- a/test/060_#f70_#f70s1_#ext_#ext2_#s05k_ls_all_dir_types.ref.log +++ b/test/060_#f70_#f70s1_#ext_#ext2_#s05k_ls_all_dir_types.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/ext2_s05k.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=10485760 (5 GiB), num_partitions=1 /hd0/1: fs=ext, start=2048 (1 MiB), length=10481664 (5118 MiB) diff --git a/test/060_#f70_#f70s1_#ext_#ext2_#s05k_ls_all_dir_types.t b/test/060_#f70_#f70s1_#ext_#ext2_#s05k_ls_all_dir_types.t index ece9d0c..ffd3b3a 100644 --- a/test/060_#f70_#f70s1_#ext_#ext2_#s05k_ls_all_dir_types.t +++ b/test/060_#f70_#f70s1_#ext_#ext2_#s05k_ls_all_dir_types.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/ext2_s05k.qcow2 hd0 -c 524288 ls70 /hd0/1/dir_a ls70 /hd0/1/dir_b diff --git a/test/061_#f70_#f70s1_#ext_#ext4_#s05k_ls_all_dir_types.ref.log b/test/061_#f70_#f70s1_#ext_#ext4_#s05k_ls_all_dir_types.ref.log index 91c75ae..664fda7 100644 --- a/test/061_#f70_#f70s1_#ext_#ext4_#s05k_ls_all_dir_types.ref.log +++ b/test/061_#f70_#f70s1_#ext_#ext4_#s05k_ls_all_dir_types.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/ext4_s05k.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=10485760 (5 GiB), num_partitions=1 /hd0/1: fs=???, start=2048 (1 MiB), length=10481664 (5118 MiB) diff --git a/test/061_#f70_#f70s1_#ext_#ext4_#s05k_ls_all_dir_types.t b/test/061_#f70_#f70s1_#ext_#ext4_#s05k_ls_all_dir_types.t index e4ba9c9..77fb97c 100644 --- a/test/061_#f70_#f70s1_#ext_#ext4_#s05k_ls_all_dir_types.t +++ b/test/061_#f70_#f70s1_#ext_#ext4_#s05k_ls_all_dir_types.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/ext4_s05k.qcow2 hd0 -c 524288 ls70 /hd0/1/dir_a ls70 /hd0/1/dir_b diff --git a/test/062_#f70_#f70s1_#fat_#fat12_#s05k_ls_all_dir_types.ref.log b/test/062_#f70_#f70s1_#fat_#fat12_#s05k_ls_all_dir_types.ref.log index 44e96e8..bdbba83 100644 --- a/test/062_#f70_#f70s1_#fat_#fat12_#s05k_ls_all_dir_types.ref.log +++ b/test/062_#f70_#f70s1_#fat_#fat12_#s05k_ls_all_dir_types.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/fat12_s05k.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=524288 (256 MiB), num_partitions=1 /hd0/1: fs=fat, start=2048 (1 MiB), length=520192 (254 MiB) diff --git a/test/062_#f70_#f70s1_#fat_#fat12_#s05k_ls_all_dir_types.t b/test/062_#f70_#f70s1_#fat_#fat12_#s05k_ls_all_dir_types.t index e9e740f..5252f68 100644 --- a/test/062_#f70_#f70s1_#fat_#fat12_#s05k_ls_all_dir_types.t +++ b/test/062_#f70_#f70s1_#fat_#fat12_#s05k_ls_all_dir_types.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/fat12_s05k.qcow2 hd0 -c 524288 ls70 /hd0/1/dir_a ls70 /hd0/1/dir_b diff --git a/test/063_#f70_#f70s1_#fat_#fat16_#s05k_ls_all_dir_types.ref.log b/test/063_#f70_#f70s1_#fat_#fat16_#s05k_ls_all_dir_types.ref.log index 4f2ea1e..de66a75 100644 --- a/test/063_#f70_#f70s1_#fat_#fat16_#s05k_ls_all_dir_types.ref.log +++ b/test/063_#f70_#f70s1_#fat_#fat16_#s05k_ls_all_dir_types.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/fat16_s05k.qcow2 hd0 -c 524288 /hd0: sector_size=512, capacity=8388608 (4 GiB), num_partitions=1 /hd0/1: fs=fat, start=2048 (1 MiB), length=8384481 (4292854272 B) diff --git a/test/063_#f70_#f70s1_#fat_#fat16_#s05k_ls_all_dir_types.t b/test/063_#f70_#f70s1_#fat_#fat16_#s05k_ls_all_dir_types.t index d4590f3..26d4598 100644 --- a/test/063_#f70_#f70s1_#fat_#fat16_#s05k_ls_all_dir_types.t +++ b/test/063_#f70_#f70s1_#fat_#fat16_#s05k_ls_all_dir_types.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/fat16_s05k.qcow2 hd0 -c 524288 ls70 /hd0/1/dir_a ls70 /hd0/1/dir_b diff --git a/test/064_#f70_#f70s1_#xfs_#xfsv5_#s05k_#samehash_ls_all_dir_types.ref.log b/test/064_#f70_#f70s1_#xfs_#xfsv5_#s05k_#samehash_ls_all_dir_types.ref.log index 573cb81..d414d26 100644 --- a/test/064_#f70_#f70s1_#xfs_#xfsv5_#s05k_#samehash_ls_all_dir_types.ref.log +++ b/test/064_#f70_#f70s1_#xfs_#xfsv5_#s05k_#samehash_ls_all_dir_types.ref.log @@ -1,4 +1,4 @@ -/> umka_init shell +/> umka_boot /> disk_add ../img/xfs_samehash_s05k.raw hd0 -c 0 /hd0: sector_size=512, capacity=2097152 (1 GiB), num_partitions=1 /hd0/1: fs=xfs, start=2048 (1 MiB), length=2093056 (1022 MiB) diff --git a/test/064_#f70_#f70s1_#xfs_#xfsv5_#s05k_#samehash_ls_all_dir_types.t b/test/064_#f70_#f70s1_#xfs_#xfsv5_#s05k_#samehash_ls_all_dir_types.t index 028ac4f..770fc15 100644 --- a/test/064_#f70_#f70s1_#xfs_#xfsv5_#s05k_#samehash_ls_all_dir_types.t +++ b/test/064_#f70_#f70s1_#xfs_#xfsv5_#s05k_#samehash_ls_all_dir_types.t @@ -1,4 +1,4 @@ -umka_init shell +umka_boot disk_add ../img/xfs_samehash_s05k.raw hd0 -c 0 ls70 /hd0/1/dir_sf ls70 /hd0/1/dir_block diff --git a/umka.asm b/umka.asm index 199a0b2..50f098d 100644 --- a/umka.asm +++ b/umka.asm @@ -116,6 +116,7 @@ pubsym sha3_256_oneshot, 'hash_oneshot' pubsym kos_time_to_epoch pubsym umka_init, 4 pubsym umka_close, 4 +pubsym umka_boot pubsym current_process, 'kos_current_process' pubsym current_slot, 'kos_current_slot' @@ -570,18 +571,15 @@ proc kos_eth_input c uses ebx esi edi ebp, buffer_ptr endp struct umka_ctx - tool dd ? - initialized dd ? + booted dd ? + running dd ? ends -proc umka_init c uses ebx esi edi ebp, _tool +proc umka_init c uses ebx esi edi ebp call umka._.check_alignment - stdcall kos_init - stdcall kernel_alloc, sizeof.umka_ctx - mov ecx, [_tool] - mov [umka_tool], ecx - mov [eax+umka_ctx.tool], ecx - mov [eax+umka_ctx.initialized], 1 + mov eax, umka + mov [eax+umka_ctx.booted], 0 + mov [eax+umka_ctx.running], 0 ret endp @@ -590,7 +588,8 @@ proc umka_close c, _ctx ret endp -proc kos_init uses ebx esi edi ebp +proc umka_boot uses ebx esi edi ebp + mov [umka.booted], 1 mov edi, endofcode mov ecx, uglobals_size xor eax, eax @@ -1035,8 +1034,8 @@ bios32_entry equ bios32_entry_pew tmp_page_tabs equ tmp_page_tabs_pew macro jmp target { if target eq osloop - cmp [umka_tool], UMKA_SHELL - jnz osloop + cmp [umka.running], 1 + jz osloop ret else jmp target @@ -1079,7 +1078,7 @@ else error "Your OS is not supported" end if -umka_tool dd ? +umka umka_ctx fpu_owner dd ? uglobal diff --git a/umka.h b/umka.h index 69d6db6..1c5459d 100644 --- a/umka.h +++ b/umka.h @@ -29,8 +29,8 @@ typedef void siginfo_t; #define STDCALL __attribute__((__stdcall__)) struct umka_ctx { - uint32_t tool; - uint32_t initialized; + int booted; + int running; }; #define UMKA_DEFAULT_DISPLAY_BPP 32 @@ -547,6 +547,9 @@ umka_init(int tool); void umka_close(struct umka_ctx *ctx); +void +umka_boot(void); + void i40(void); diff --git a/umka_fuse.c b/umka_fuse.c index 5005a95..92bf5c5 100644 --- a/umka_fuse.c +++ b/umka_fuse.c @@ -36,8 +36,8 @@ struct umka_fuse_ctx { static struct umka_fuse_ctx * umka_fuse_init() { struct umka_fuse_ctx *ctx = malloc(sizeof(struct umka_fuse_ctx)); - ctx->umka = NULL; - ctx->io = io_init(IO_DONT_CHANGE_TASK); + ctx->umka = umka_init(UMKA_FUSE); + ctx->io = io_init(&ctx->umka->running); return ctx; } diff --git a/umka_os.c b/umka_os.c index 37dbdd3..5583be8 100644 --- a/umka_os.c +++ b/umka_os.c @@ -52,10 +52,10 @@ hw_int_mouse(void *arg) { struct umka_os_ctx * umka_os_init() { struct umka_os_ctx *ctx = malloc(sizeof(struct umka_os_ctx)); - ctx->umka = NULL; - ctx->io = io_init(IO_DONT_CHANGE_TASK); + ctx->umka = umka_init(UMKA_OS); + ctx->io = io_init(&ctx->umka->running); ctx->shell = shell_init(SHELL_LOG_NONREPRODUCIBLE, history_filename, - ctx->io); + ctx->umka, ctx->io); return ctx; } @@ -315,6 +315,7 @@ main(int argc, char *argv[]) { setitimer(ITIMER_PROF, &timeout, NULL); + ctx->umka->running = 1; umka_osloop(); // doesn't return if (coverage) diff --git a/umka_os.us b/umka_os.us index 4fbb5d0..8a7a59f 100644 --- a/umka_os.us +++ b/umka_os.us @@ -1,4 +1,4 @@ -umka_init os +umka_boot ramdisk_init ../img/kolibri.raw set_skin /sys/DEFAULT.SKN disk_add ../img/xfs_samehash_s05k.raw hd0 -c 0 diff --git a/umka_shell.c b/umka_shell.c index 33a595f..2ae1af2 100644 --- a/umka_shell.c +++ b/umka_shell.c @@ -33,9 +33,9 @@ char history_filename[PATH_MAX]; struct umka_shell_ctx * umka_shell_init(int reproducible) { struct umka_shell_ctx *ctx = malloc(sizeof(struct umka_shell_ctx)); - ctx->umka = NULL; - ctx->io = io_init(IO_DONT_CHANGE_TASK); - ctx->shell = shell_init(reproducible, history_filename, ctx->io); + ctx->umka = umka_init(UMKA_SHELL); + ctx->io = io_init(&ctx->umka->running); + ctx->shell = shell_init(reproducible, history_filename, ctx->umka, ctx->io); return ctx; } diff --git a/vdisk.c b/vdisk.c index 3084e63..769500e 100644 --- a/vdisk.c +++ b/vdisk.c @@ -49,10 +49,10 @@ vdisk_init(const char *fname, int adjust_cache_size, size_t cache_size, struct vdisk *disk; if (fname_len > dot_raw_len && !strcmp(fname + fname_len - dot_raw_len, RAW_SUFFIX)) { - disk = (struct vdisk*)vdisk_init_raw(fname); + disk = (struct vdisk*)vdisk_init_raw(fname, io); } else if (fname_len > dot_qcow2_len && !strcmp(fname + fname_len - dot_qcow2_len, QCOW2_SUFFIX)) { - disk = (struct vdisk*)vdisk_init_qcow2(fname); + disk = (struct vdisk*)vdisk_init_qcow2(fname, io); } else { fprintf(stderr, "[vdisk] file has unknown format: %s\n", fname); return NULL; diff --git a/vdisk/qcow2.c b/vdisk/qcow2.c index f45f796..0387822 100644 --- a/vdisk/qcow2.c +++ b/vdisk/qcow2.c @@ -14,6 +14,7 @@ #include "../trace.h" #include "qcow2.h" #include "miniz/miniz.h" +#include "io.h" struct vdisk_qcow2 { struct vdisk vdisk; @@ -96,7 +97,7 @@ qcow2_read_guest_sector(struct vdisk_qcow2 *d, uint64_t sector, uint8_t *buf) { uint64_t l2_entry; uint64_t l1_entry_offset = d->l1_table_offset + l1_index*sizeof(l1_entry); lseek(d->fd, l1_entry_offset, SEEK_SET); - if (!read(d->fd, &l1_entry, sizeof(l1_entry))) { + if (!io_read(d->fd, &l1_entry, sizeof(l1_entry), d->vdisk.io)) { fprintf(stderr, "[vdisk.qcow2] can't read from image file: %s\n", strerror(errno)); return; @@ -109,7 +110,7 @@ qcow2_read_guest_sector(struct vdisk_qcow2 *d, uint64_t sector, uint8_t *buf) { return; } lseek(d->fd, l2_table_offset + l2_index*sizeof(l2_entry), SEEK_SET); - if (!read(d->fd, &l2_entry, sizeof(l2_entry))) { + if (!io_read(d->fd, &l2_entry, sizeof(l2_entry), d->vdisk.io)) { fprintf(stderr, "[vdisk.qcow2] can't read from image file: %s\n", strerror(errno)); return; @@ -124,7 +125,7 @@ qcow2_read_guest_sector(struct vdisk_qcow2 *d, uint64_t sector, uint8_t *buf) { } cluster_offset = l2_entry & L2_ENTRY_STD_OFFSET; lseek(d->fd, cluster_offset, SEEK_SET); - if (!read(d->fd, d->cluster, d->cluster_size)) { + if (!io_read(d->fd, d->cluster, d->cluster_size, d->vdisk.io)) { fprintf(stderr, "[vdisk.qcow2] can't read from image file: %s\n", strerror(errno)); return; @@ -139,7 +140,7 @@ qcow2_read_guest_sector(struct vdisk_qcow2 *d, uint64_t sector, uint8_t *buf) { size_t additional_sectors = (l2_entry & d->l2_entry_cmp_sect_cnt_mask) >> d->l2_entry_cmp_x; size_t cmp_size = 512 - (cmp_offset & 511) + additional_sectors*512; - if (!read(d->fd, d->cmp_cluster, d->cluster_size)) { + if (!io_read(d->fd, d->cmp_cluster, d->cluster_size, d->vdisk.io)) { fprintf(stderr, "[vdisk.qcow2] can't read from image file: %s\n", strerror(errno)); return; @@ -193,7 +194,7 @@ vdisk_qcow2_write(void *userdata, void *buffer, off_t startsector, } struct vdisk* -vdisk_init_qcow2(const char *fname) { +vdisk_init_qcow2(const char *fname, struct umka_io *io) { struct vdisk_qcow2 *d = (struct vdisk_qcow2*)calloc(1, sizeof(struct vdisk_qcow2)); d->vdisk.diskfunc = (diskfunc_t) {.strucsize = sizeof(diskfunc_t), @@ -201,6 +202,7 @@ vdisk_init_qcow2(const char *fname) { .read = vdisk_qcow2_read, .write = vdisk_qcow2_write, }; + d->vdisk.io = io; if (!d) { fprintf(stderr, "[vdisk.qcow2] can't allocate memory: %s\n", strerror(errno)); @@ -219,7 +221,7 @@ vdisk_init_qcow2(const char *fname) { } struct qcow2_header header; - if (!read(d->fd, &header, sizeof(struct qcow2_header))) { + if (!io_read(d->fd, &header, sizeof(struct qcow2_header), d->vdisk.io)) { fprintf(stderr, "[vdisk.qcow2] can't read from image file: %s\n", strerror(errno)); vdisk_qcow2_close(d); diff --git a/vdisk/qcow2.h b/vdisk/qcow2.h index 63cb221..2c1a259 100644 --- a/vdisk/qcow2.h +++ b/vdisk/qcow2.h @@ -11,11 +11,12 @@ #define VDISK_QCOW2_H_INCLUDED #include -#include "../vdisk.h" +#include "vdisk.h" +#include "io.h" #define QCOW2_SUFFIX ".qcow2" struct vdisk* -vdisk_init_qcow2(const char *fname); +vdisk_init_qcow2(const char *fname, struct umka_io *io); #endif // VDISK_QCOW2_H_INCLUDED diff --git a/vdisk/raw.c b/vdisk/raw.c index 368f667..50bea37 100644 --- a/vdisk/raw.c +++ b/vdisk/raw.c @@ -54,8 +54,8 @@ vdisk_raw_write(void *userdata, void *buffer, off_t startsector, } struct vdisk* -vdisk_init_raw(const char *fname) { - int fd = open(fname, O_RDWR); +vdisk_init_raw(const char *fname, struct umka_io *io) { + int fd = open(fname, O_RDONLY); if (!fd) { printf("[vdisk.raw]: can't open file '%s': %s\n", fname, strerror(errno)); return NULL; @@ -75,6 +75,7 @@ vdisk_init_raw(const char *fname) { }, .sect_size = sect_size, .sect_cnt = (uint64_t)fsize / sect_size, + .io = io, }, .fd = fd, }; diff --git a/vdisk/raw.h b/vdisk/raw.h index f5e9b88..5063384 100644 --- a/vdisk/raw.h +++ b/vdisk/raw.h @@ -11,11 +11,12 @@ #define VDISK_RAW_H_INCLUDED #include -#include "../vdisk.h" +#include "vdisk.h" +#include "io.h" #define RAW_SUFFIX ".raw" struct vdisk* -vdisk_init_raw(const char *fname); +vdisk_init_raw(const char *fname, struct umka_io *io); #endif // VDISK_RAW_H_INCLUDED diff --git a/windows/io.c b/windows/io.c deleted file mode 100644 index 4f4db58..0000000 --- a/windows/io.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - SPDX-License-Identifier: GPL-2.0-or-later - - UMKa - User-Mode KolibriOS developer tools - io - input/output platform specific code - - Copyright (C) 2023 Ivan Baravy -*/ - -#include -#include "io.h" - -ssize_t -io_read(int fd, void *buf, size_t count, int change_task) { - (void)change_task; - ssize_t res; - res = read(fd, buf, count); - return res; -} - -ssize_t -io_write(int fd, const void *buf, size_t count, int change_task) { - (void)change_task; - ssize_t res; - res = write(fd, buf, count); - return res; -} diff --git a/windows/io.h b/windows/io.h deleted file mode 100644 index f773bd2..0000000 --- a/windows/io.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - SPDX-License-Identifier: GPL-2.0-or-later - - UMKa - User-Mode KolibriOS developer tools - io - input/output platform specific code - - Copyright (C) 2023 Ivan Baravy -*/ - -#ifndef IO_H_INCLUDED -#define IO_H_INCLUDED - -#include - -ssize_t -io_read(int fd, void *buf, size_t count, int change_task); - -ssize_t -io_write(int fd, const void *buf, size_t count, int change_task); - -#endif // IO_H_INCLUDED