Sync kernel structures with upstream, update tests

This commit is contained in:
2023-09-01 22:57:11 +01:00
parent 085a7bdd4b
commit 1e46f84cf9
19 changed files with 170 additions and 101 deletions
+1 -1
View File
@@ -50,4 +50,4 @@ apps/readdir
apps/loader
apps/asciivju
apps/justawindow
test/runtests
runtests
+5 -5
View File
@@ -54,9 +54,9 @@ endif
ifeq ($(HOST),linux)
all: umka_shell umka_fuse umka_os umka_gen_devices_dat umka.sym umka.prp \
umka.lst tags default.skn skin.skn test/runtests
umka.lst tags default.skn skin.skn runtests
else ifeq ($(HOST),windows)
all: umka_shell umka.sym umka.prp umka.lst default.skn skin.skn test/runtests
all: umka_shell umka.sym umka.prp umka.lst default.skn skin.skn runtests
else
$(error your HOST is not supported)
endif
@@ -183,10 +183,10 @@ umka_os.o: umka_os.c umka.h
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
runtests: runtests.o deps/optparse/optparse.o
$(CC) $(LDFLAGS_32) -o $@ $^ $(LIBS)
test/runtests.o: test/runtests.c
runtests.o: runtests.c
$(CC) $(CFLAGS_32) -c $< -o $@ -Wno-deprecated-declarations
@@ -195,6 +195,6 @@ test/runtests.o: test/runtests.c
clean:
rm -f umka_shell umka_fuse umka_os umka_gen_devices_dat umka.fas \
umka.sym umka.lst umka.prp umka.cov coverage *.skn colors.dtp \
test/runtests
runtests
find . -name "*.o" -delete
find . -name "*.a" -delete
+1
View File
@@ -36,6 +36,7 @@ _Thread_local char timeoutfname[PATH_MAX];
_Thread_local char reffname[PATH_MAX];
_Thread_local char outfname[PATH_MAX];
int coverage = 0;
int silent_success = 1;
static int
+13 -4
View File
@@ -1127,18 +1127,30 @@ cmd_dump_wdata(struct shell_ctx *ctx, int argc, char **argv) {
(void)ctx;
const char *usage = \
"usage: dump_wdata <index>\n"
" index index into wdata array to dump\n";
" index index into wdata array to dump\n"
" -p print fields that are pointers\n";
if (argc < 2) {
fputs(usage, ctx->fout);
return;
}
int show_pointers = 0;
int idx = strtol(argv[1], NULL, 0);
if (argc > 2 && !strcmp(argv[2], "-p")) {
show_pointers = 1;
}
wdata_t *w = kos_window_data + idx;
fprintf(ctx->fout, "captionEncoding: %u\n", w->caption_encoding);
fprintf(ctx->fout, "caption: %s\n", w->caption);
fprintf(ctx->fout, "clientbox (ltwh): %u %u %u %u\n", w->clientbox.left,
w->clientbox.top, w->clientbox.width, w->clientbox.height);
fprintf(ctx->fout, "draw_bgr_x: %u\n", w->draw_bgr_x);
fprintf(ctx->fout, "draw_bgr_y: %u\n", w->draw_bgr_y);
fprintf(ctx->fout, "thread: %u\n", (uintptr_t)(w->thread - kos_slot_base));
if (show_pointers) {
fprintf(ctx->fout, "thread: %p\n", (void*)w->thread);
fprintf(ctx->fout, "cursor: %p\n", (void*)w->cursor);
}
}
static void
@@ -1167,7 +1179,6 @@ cmd_dump_appdata(struct shell_ctx *ctx, int argc, char **argv) {
fprintf(ctx->fout, "except_mask: %" PRIx32 "\n", a->except_mask);
if (show_pointers) {
fprintf(ctx->fout, "pl0_stack: %p\n", (void*)a->pl0_stack);
fprintf(ctx->fout, "cursor: %p\n", (void*)a->cursor);
fprintf(ctx->fout, "fd_ev: %p\n", (void*)a->fd_ev);
fprintf(ctx->fout, "bk_ev: %p\n", (void*)a->bk_ev);
fprintf(ctx->fout, "fd_obj: %p\n", (void*)a->fd_obj);
@@ -1176,8 +1187,6 @@ cmd_dump_appdata(struct shell_ctx *ctx, int argc, char **argv) {
}
fprintf(ctx->fout, "dbg_state: %u\n", a->dbg_state);
fprintf(ctx->fout, "cur_dir: %s\n", a->cur_dir);
fprintf(ctx->fout, "draw_bgr_x: %u\n", a->draw_bgr_x);
fprintf(ctx->fout, "draw_bgr_y: %u\n", a->draw_bgr_y);
fprintf(ctx->fout, "event_mask: %" PRIx32 "\n", a->event_mask);
fprintf(ctx->fout, "tid: %" PRId32 "\n", a->tid);
fprintf(ctx->fout, "state: 0x%" PRIx8 "\n", a->state);
+3 -3
View File
@@ -8,9 +8,9 @@ else
UMKA_SHELL ?= sudo taskset 1 ../umka_shell -c
endif
xfs_tests := $(addsuffix .out.log, $(basename $(wildcard *\#xfs_*.t)))
xfsv5_tests := $(addsuffix .out.log, $(basename $(wildcard *\#xfsv5_*.t)))
exfat_tests := $(addsuffix .out.log, $(basename $(wildcard *\#exfat_*.t)))
test_dirs := $(wildcard t???*)
test_logs := $(addsuffix .out.log, $(basename $(wildcard *\#xfsv5_*.t)))
test_run_ := $(addsuffix .out.log, $(basename $(wildcard *\#exfat_*.t)))
fat_tests := $(addsuffix .out.log, $(basename $(wildcard *\#fat_*.t)))
ext_tests := $(addsuffix .out.log, $(basename $(wildcard *\#ext_*.t)))
s05k_tests := $(addsuffix .out.log, $(basename $(wildcard *\#s05k_*.t)))
+14 -8
View File
@@ -6,6 +6,11 @@
/rd/1: fs=fat, start=0 (0 B), length=2880 (1440 kiB)
/> set_skin /sys/DEFAULT.SKN
status: 0
/>
/> new_sys_thread
tid: 3
/> switch_to_thread 3
/>
/> window_redraw 1
/> draw_window 10 300 5 200 0x000088 1 1 1 0 1 4 hello
/> set_pixel 0 0 0x0000ff
@@ -56,8 +61,6 @@ app_name: OS
except_mask: 0
dbg_state: 0
cur_dir:
draw_bgr_x: 0
draw_bgr_y: 0
event_mask: 0
tid: 2
state: 0x0
@@ -67,23 +70,26 @@ keyboard_mode: 0
exec_params: (null)
priority: 0
in_schedule: prev (2), next (2)
/> dump_wdata 2
/> dump_wdata 3
captionEncoding: 0
caption:
caption: hi_there
clientbox (ltwh): 5 24 291 172
draw_bgr_x: 0
draw_bgr_y: 0
thread: 3
/>
/> process_info -1
cpu_usage: 0
window_stack_position: 2
window_stack_value: 2
window_stack_position: 3
window_stack_value: 3
process_name: OS
memory_start: 0x00000000
used_memory: 4294967295 (0xffffffff)
pid: 2
pid: 3
box: 10 5 300 200
slot_state: 0
client_box: 5 24 291 172
wnd_state: 0x00
wnd_state: 0x80
/> get_skin_height
24
/> get_screen_area
+5 -1
View File
@@ -3,6 +3,10 @@ set_mouse_pos_screen 40 30
#disk_add ../img/kolibri.raw rd -c 0
ramdisk_init ../../img/kolibri.raw
set_skin /sys/DEFAULT.SKN
new_sys_thread
switch_to_thread 3
window_redraw 1
draw_window 10 300 5 200 0x000088 1 1 1 0 1 4 hello
set_pixel 0 0 0x0000ff
@@ -33,7 +37,7 @@ set_window_colors 0 0 0 0 0 0 0 0 0 0
dump_win_stack 2
dump_win_pos 2
dump_appdata 2
dump_wdata 2
dump_wdata 3
process_info -1
get_skin_height
+40 -36
View File
@@ -6,6 +6,10 @@
/> set_skin /sys/DEFAULT.SKN
status: 0
/>
/> new_sys_thread
tid: 3
/> switch_to_thread 3
/>
/> window_redraw 1
/> draw_window 2 10 4 10 0x000088 1 1 1 0 1 4 hello
/> window_redraw 2
@@ -13,8 +17,8 @@ status: 0
/> set_window_caption hi_there 0
/>
/> new_sys_thread
tid: 3
/> switch_to_thread 3
tid: 4
/> switch_to_thread 4
/>
/> window_redraw 1
/> draw_window 4 5 8 5 0x000088 1 1 1 0 1 4 hello
@@ -25,17 +29,17 @@ tid: 3
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11223333332221111111111111111111111111111111
11223333332221111111111111111111111111111111
11223333332221111111111111111111111111111111
11223333332221111111111111111111111111111111
11223333332221111111111111111111111111111111
11223333332221111111111111111111111111111111
11222222222221111111111111111111111111111111
11333333333331111111111111111111111111111111
11333333333331111111111111111111111111111111
11333333333331111111111111111111111111111111
11333333333331111111111111111111111111111111
11334444443331111111111111111111111111111111
11334444443331111111111111111111111111111111
11334444443331111111111111111111111111111111
11334444443331111111111111111111111111111111
11334444443331111111111111111111111111111111
11334444443331111111111111111111111111111111
11333333333331111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
@@ -73,17 +77,17 @@ tid: 3
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222233333321111111111111111111111111111111
11222233333321111111111111111111111111111111
11222233333321111111111111111111111111111111
11222233333321111111111111111111111111111111
11222233333321111111111111111111111111111111
11222233333321111111111111111111111111111111
11222222222221111111111111111111111111111111
11333333333331111111111111111111111111111111
11333333333331111111111111111111111111111111
11333333333331111111111111111111111111111111
11333333333331111111111111111111111111111111
11333344444431111111111111111111111111111111
11333344444431111111111111111111111111111111
11333344444431111111111111111111111111111111
11333344444431111111111111111111111111111111
11333344444431111111111111111111111111111111
11333344444431111111111111111111111111111111
11333333333331111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
@@ -121,18 +125,18 @@ tid: 3
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222233333321111111111111111111111111111111
11222233333321111111111111111111111111111111
11222233333321111111111111111111111111111111
11222233333321111111111111111111111111111111
11222233333321111111111111111111111111111111
11111133333311111111111111111111111111111111
11333333333331111111111111111111111111111111
11333333333331111111111111111111111111111111
11333333333331111111111111111111111111111111
11333333333331111111111111111111111111111111
11333333333331111111111111111111111111111111
11333333333331111111111111111111111111111111
11333344444431111111111111111111111111111111
11333344444431111111111111111111111111111111
11333344444431111111111111111111111111111111
11333344444431111111111111111111111111111111
11333344444431111111111111111111111111111111
11111144444411111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
+4 -1
View File
@@ -3,6 +3,9 @@ umka_boot
ramdisk_init ../../img/kolibri.raw
set_skin /sys/DEFAULT.SKN
new_sys_thread
switch_to_thread 3
window_redraw 1
draw_window 2 10 4 10 0x000088 1 1 1 0 1 4 hello
window_redraw 2
@@ -10,7 +13,7 @@ window_redraw 2
set_window_caption hi_there 0
new_sys_thread
switch_to_thread 3
switch_to_thread 4
window_redraw 1
draw_window 4 5 8 5 0x000088 1 1 1 0 1 4 hello
+4
View File
@@ -6,6 +6,10 @@
/> set_skin /sys/DEFAULT.SKN
status: 0
/>
/> new_sys_thread
tid: 3
/> switch_to_thread 3
/>
/> load_cursor_from_file /sys/fill.cur
handle = non-zero
/> var $cur_fill
+3
View File
@@ -3,6 +3,9 @@ umka_boot
ramdisk_init ../../img/kolibri.raw
set_skin /sys/DEFAULT.SKN
new_sys_thread
switch_to_thread 3
load_cursor_from_file /sys/fill.cur
var $cur_fill
load_cursor_from_mem ./spray.cur
+4
View File
@@ -6,6 +6,10 @@
/> set_skin /sys/DEFAULT.SKN
status: 0
/>
/> new_sys_thread
tid: 3
/> switch_to_thread 3
/>
/> window_redraw 1
/> draw_window 10 300 5 200 0x000088 1 1 1 0 1 3 hello
/> window_redraw 2
+3
View File
@@ -3,6 +3,9 @@ umka_boot
ramdisk_init ../../img/kolibri.raw
set_skin /sys/DEFAULT.SKN
new_sys_thread
switch_to_thread 3
window_redraw 1
draw_window 10 300 5 200 0x000088 1 1 1 0 1 3 hello
window_redraw 2
+14 -8
View File
@@ -7,6 +7,11 @@
/rd/1: fs=fat, start=0 (0 B), length=2880 (1440 kiB)
/> set_skin /sys/DEFAULT.SKN
status: 0
/>
/> new_sys_thread
tid: 3
/> switch_to_thread 3
/>
/> window_redraw 1
/> draw_window 10 300 5 200 0x000088 1 1 1 0 1 4 hello
/> set_pixel 0 0 0x0000ff
@@ -57,8 +62,6 @@ app_name: OS
except_mask: 0
dbg_state: 0
cur_dir:
draw_bgr_x: 0
draw_bgr_y: 0
event_mask: 0
tid: 2
state: 0x0
@@ -68,23 +71,26 @@ keyboard_mode: 0
exec_params: (null)
priority: 0
in_schedule: prev (2), next (2)
/> dump_wdata 2
/> dump_wdata 3
captionEncoding: 0
caption:
caption: hi_there
clientbox (ltwh): 5 24 291 172
draw_bgr_x: 0
draw_bgr_y: 0
thread: 3
/>
/> process_info -1
cpu_usage: 0
window_stack_position: 2
window_stack_value: 2
window_stack_position: 3
window_stack_value: 3
process_name: OS
memory_start: 0x00000000
used_memory: 4294967295 (0xffffffff)
pid: 2
pid: 3
box: 10 5 300 200
slot_state: 0
client_box: 5 24 291 172
wnd_state: 0x00
wnd_state: 0x80
/> get_skin_height
24
/> get_screen_area
+5 -1
View File
@@ -4,6 +4,10 @@ set_mouse_pos_screen 40 30
#disk_add ../img/kolibri.raw rd -c 0
ramdisk_init ../../img/kolibri.raw
set_skin /sys/DEFAULT.SKN
new_sys_thread
switch_to_thread 3
window_redraw 1
draw_window 10 300 5 200 0x000088 1 1 1 0 1 4 hello
set_pixel 0 0 0x0000ff
@@ -34,7 +38,7 @@ set_window_colors 0 0 0 0 0 0 0 0 0 0
dump_win_stack 2
dump_win_pos 2
dump_appdata 2
dump_wdata 2
dump_wdata 3
process_info -1
get_skin_height
+14 -8
View File
@@ -7,6 +7,11 @@
/rd/1: fs=fat, start=0 (0 B), length=2880 (1440 kiB)
/> set_skin /sys/DEFAULT.SKN
status: 0
/>
/> new_sys_thread
tid: 3
/> switch_to_thread 3
/>
/> window_redraw 1
/> draw_window 10 300 5 200 0x000088 1 1 1 0 1 4 hello
/> set_pixel 0 0 0x0000ff
@@ -57,8 +62,6 @@ app_name: OS
except_mask: 0
dbg_state: 0
cur_dir:
draw_bgr_x: 0
draw_bgr_y: 0
event_mask: 0
tid: 2
state: 0x0
@@ -68,23 +71,26 @@ keyboard_mode: 0
exec_params: (null)
priority: 0
in_schedule: prev (2), next (2)
/> dump_wdata 2
/> dump_wdata 3
captionEncoding: 0
caption:
caption: hi_there
clientbox (ltwh): 5 24 291 172
draw_bgr_x: 0
draw_bgr_y: 0
thread: 3
/>
/> process_info -1
cpu_usage: 0
window_stack_position: 2
window_stack_value: 2
window_stack_position: 3
window_stack_value: 3
process_name: OS
memory_start: 0x00000000
used_memory: 4294967295 (0xffffffff)
pid: 2
pid: 3
box: 10 5 300 200
slot_state: 0
client_box: 5 24 291 172
wnd_state: 0x00
wnd_state: 0x80
/> get_skin_height
24
/> get_screen_area
+5 -1
View File
@@ -4,6 +4,10 @@ set_mouse_pos_screen 40 30
#disk_add ../img/kolibri.raw rd -c 0
ramdisk_init ../../img/kolibri.raw
set_skin /sys/DEFAULT.SKN
new_sys_thread
switch_to_thread 3
window_redraw 1
draw_window 10 300 5 200 0x000088 1 1 1 0 1 4 hello
set_pixel 0 0 0x0000ff
@@ -34,7 +38,7 @@ set_window_colors 0 0 0 0 0 0 0 0 0 0
dump_win_stack 2
dump_win_pos 2
dump_appdata 2
dump_wdata 2
dump_wdata 3
process_info -1
get_skin_height
+7 -7
View File
@@ -165,7 +165,6 @@ pubsym acpi.count_nodes, 'kos_acpi_count_nodes', 4
pubsym stack_init, 'kos_stack_init', no_mangle
pubsym net_add_device, no_mangle
pubsym draw_data
pubsym img_background
pubsym mem_BACKGROUND
pubsym sys_background
@@ -262,8 +261,8 @@ include 'proc32.inc'
include 'struct.inc'
macro BOOT_LO a {}
macro BOOT a {}
window_data equ __pew01
CDDataBuf equ __pew06
window_data equ __pew_window_data
background_window equ __pew_background_window
idts equ __pew07
WIN_STACK equ __pew08
WIN_POS equ __pew09
@@ -297,7 +296,8 @@ macro tss pew {}
include 'const.inc'
purge tss
restore window_data
restore CDDataBuf,idts,WIN_STACK,WIN_POS
restore background_window
restore 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
@@ -855,8 +855,8 @@ proc umka_boot uses ebx esi edi ebp
call calculatebackground
call init_display
mov eax, [def_cursor]
mov [SLOT_BASE+APPDATA.cursor+sizeof.APPDATA], eax
mov [SLOT_BASE+APPDATA.cursor+sizeof.APPDATA*2], eax
mov [window_data + sizeof.WDATA + WDATA.cursor], eax
mov [window_data + sizeof.WDATA*2 + WDATA.cursor], eax
; from set_variables
mov ax, [BOOT.y_res]
@@ -1141,7 +1141,7 @@ align 64
rb 0x100000 - (($-bss_base) AND (0x100000-1)) ; align on 1MiB
os_base: rb PAGE_SIZE
window_data: rb sizeof.WDATA * 256
CDDataBuf: rb 0x1000
background_window = window_data + sizeof.WDATA
idts rb (NUM_EXCEPTIONS + IRQ_RESERVED) * sizeof.idt_entry
WIN_STACK rw 0x200 ; why not 0x100?
WIN_POS rw 0x200
+25 -17
View File
@@ -173,7 +173,7 @@ typedef struct {
static_assert(sizeof(process_information_t) == 0x400,
"must be 0x400 bytes long");
typedef struct {
typedef struct wdata {
box_t box;
uint32_t cl_workarea;
uint32_t cl_titlebar;
@@ -187,10 +187,18 @@ typedef struct {
uint32_t shape_scale;
char *caption;
uint8_t caption_encoding;
uint8_t pad[3];
uint8_t pad0[3];
box_t saved_box;
void *cursor;
void *temp_cursor;
uint32_t draw_bgr_x;
uint32_t draw_bgr_y;
rect_t draw_data;
struct appdata *thread;
uint8_t pad1[12];
} __attribute__((packed)) wdata_t;
static_assert(sizeof(wdata_t) == 0x40, "must be 0x40 bytes long");
static_assert(sizeof(struct wdata) == 0x80, "must be 0x80 bytes long");
typedef struct {
uint32_t frame;
@@ -900,7 +908,7 @@ typedef struct {
static_assert(sizeof(proc_t) == 0x1400, "must be 0x1400 bytes long");
typedef struct {
typedef struct appdata {
char app_name[11];
uint8_t pad1[5];
@@ -910,7 +918,7 @@ typedef struct {
void *exc_handler; // +32
uint32_t except_mask; // +36
void *pl0_stack; // +40
void *cursor; // +44
uint32_t pad2; // +44
event_t *fd_ev; // +48
event_t *bk_ev; // +52
appobj_t *fd_obj; // +56
@@ -927,36 +935,36 @@ typedef struct {
void *tls_base; // +104
uint32_t event_mask; // +108
uint32_t tid; // +112
uint32_t draw_bgr_x; // +116
uint32_t draw_bgr_y; // +120
uint32_t pad3; // +116
uint32_t pad4; // +120
uint8_t state; // +124
uint8_t wnd_number; // +125
uint8_t pad2[2]; // +126
uint32_t pad3; // +128
uint32_t pad4; // +132
uint32_t mem_start; // +136
uint16_t pad5; // +126
struct wdata *window; // +128
uint32_t pad6; // +132
uint32_t pad7; // +136
uint32_t counter_sum; // +140
box_t saved_box; // +144
uint32_t pad8[4]; // +144
uint32_t *ipc_start; // +160
size_t ipc_size; // +164
uint32_t occurred_events; // +168
uint32_t debugger_slot; // +172
uint32_t terminate_protection; // +176
uint8_t keyboard_mode; // +180
uint8_t pad5[3]; // +181
uint8_t pad9[3]; // +181
char *exec_params; // +184
void *dbg_event_mem; // +188
dbg_regs_t dbg_regs; // +192
uint32_t pad6; // +212
uint32_t pad7[4]; // +216
uint32_t pad10; // +212
uint32_t pad11[4]; // +216
uint32_t priority; // +232
lhead_t in_schedule; // +236
uint32_t counter_add; // +244
uint32_t cpu_usage; // +248
uint32_t pad8; // +252
uint32_t pad12; // +252
} appdata_t;
static_assert(sizeof(appdata_t) == 256, "must be 0x100 bytes long");
static_assert(sizeof(struct appdata) == 256, "must be 0x100 bytes long");
extern uint8_t kos_redraw_background;
extern size_t kos_task_count;