Add new shell commands: dump_win_map and set (variable).

This commit is contained in:
Ivan Baravy 2021-11-02 12:46:36 +03:00
parent 72570a7bc3
commit 18c6f4922c
77 changed files with 900 additions and 72 deletions

View File

@ -29,7 +29,7 @@ umka_os: umka_os.o umka.o shell.o lodepng.o vdisk.o vnet.o trace.o trace_lbr.o \
$(CC) $(LDFLAGS_32) $^ -o $@ -static -T umka.ld $(CC) $(LDFLAGS_32) $^ -o $@ -static -T umka.ld
umka.o umka.fas: umka.asm umka.o umka.fas: umka.asm
INCLUDE="$(KOLIBRIOS)/kernel/trunk;$(KOLIBRIOS)/programs/develop/libraries/libcrash/trunk" \ INCLUDE="$(KOLIBRIOS)/kernel/trunk;$(KOLIBRIOS)/programs/develop/libraries/libcrash/hash" \
$(FASM) $< umka.o -s umka.fas -m 1234567 $(FASM) $< umka.o -s umka.fas -m 1234567
shell.o: shell.c shell.o: shell.c

125
shell.c
View File

@ -193,9 +193,11 @@ get_last_dir(const char *path) {
static void static void
prompt() { prompt() {
if (cur_dir_changed) { if (cur_dir_changed) {
COVERAGE_ON(); if (umka_initialized) {
umka_sys_get_cwd(cur_dir, PATH_MAX); COVERAGE_ON();
COVERAGE_OFF(); umka_sys_get_cwd(cur_dir, PATH_MAX);
COVERAGE_OFF();
}
last_dir = get_last_dir(cur_dir); last_dir = get_last_dir(cur_dir);
cur_dir_changed = false; cur_dir_changed = false;
} }
@ -236,6 +238,51 @@ split_args(char *s, char **argv) {
return argc; return argc;
} }
static void
shell_umka_init(int argc, char **argv) {
const char *usage = \
"usage: umka_init";
(void)argv;
if (argc < 0) {
fputs(usage, fout);
return;
}
COVERAGE_ON();
umka_init();
COVERAGE_OFF();
}
static void
shell_umka_set_boot_params(int argc, char **argv) {
const char *usage = \
"usage: umka_set_boot_params [--x_res <num>] [--y_res <num>]\n"
" --x_res <num> screen width\n"
" --y_res <num> screen height";
argc -= 1;
argv += 1;
while (argc) {
if (!strcmp(argv[0], "--x_res") && argc > 1) {
kos_boot.x_res = strtoul(argv[1], NULL, 0);
kos_boot.pitch = kos_boot.x_res * 4; // assume 32bpp
argc -= 2;
argv += 2;
continue;
} else if (!strcmp(argv[0], "--y_res") && argc > 1) {
kos_boot.y_res = strtoul(argv[1], NULL, 0);
argc -= 2;
argv += 2;
continue;
} else {
printf("bad option: %s\n", argv[0]);
puts(usage);
exit(1);
}
}
}
static void static void
shell_i40(int argc, char **argv) { shell_i40(int argc, char **argv) {
const char *usage = \ const char *usage = \
@ -497,6 +544,23 @@ shell_dump_win_pos(int argc, char **argv) {
} }
} }
static void
shell_dump_win_map(int argc, char **argv) {
const char *usage = \
"usage: dump_win_map";
(void)argv;
if (argc < 0) {
fputs(usage, fout);
return;
}
for (size_t y = 0; y < kos_display.height; y++) {
for (size_t x = 0; x < kos_display.width; x++) {
fputc(kos_display.win_map[y * kos_display.width + x] + '0', fout);
}
fputc('\n', fout);
}
}
static void static void
shell_dump_appdata(int argc, char **argv) { shell_dump_appdata(int argc, char **argv) {
const char *usage = \ const char *usage = \
@ -577,6 +641,55 @@ shell_dump_taskdata(int argc, char **argv) {
fprintf(fout, "cpu_usage: %" PRIu32 "\n", t->cpu_usage); fprintf(fout, "cpu_usage: %" PRIu32 "\n", t->cpu_usage);
} }
static void
shell_switch_to_thread(int argc, char **argv) {
const char *usage = \
"usage: switch_to_thread <tid>\n"
" <tid> thread id to switch to";
if (argc != 2) {
fputs(usage, fout);
return;
}
uint8_t tid = strtoul(argv[1], NULL, 0);
kos_current_slot_idx = tid;
kos_task_base = kos_task_table + tid;
kos_current_slot = kos_slot_base + tid;
}
static void
shell_set(int argc, char **argv) {
const char *usage = \
"usage: set <var> <value>\n"
" <var> variable to set\n"
" <value> decimal or hex value";
if (argc != 3) {
fputs(usage, fout);
return;
}
const char *var = argv[1];
size_t value = strtoul(argv[2], NULL, 0);
if (!strcmp(var, "redraw_background")) {
kos_redraw_background = value;
} else {
printf("bad option: %s\n", argv[0]);
puts(usage);
exit(1);
}
}
static void
shell_new_sys_thread(int argc, char **argv) {
const char *usage = \
"usage: new_sys_thread";
if (!argc) {
fputs(usage, fout);
return;
}
(void)argv;
size_t tid = umka_new_sys_threads(0, NULL, NULL);
fprintf(fout, "tid: %u\n", tid);
}
static void static void
shell_mouse_move(int argc, char **argv) { shell_mouse_move(int argc, char **argv) {
const char *usage = \ const char *usage = \
@ -2580,6 +2693,8 @@ shell_bg_unmap(int argc, char **argv) {
static void shell_help(int argc, char **argv); static void shell_help(int argc, char **argv);
func_table_t shell_cmds[] = { func_table_t shell_cmds[] = {
{ "umka_init", shell_umka_init },
{ "umka_set_boot_params", shell_umka_set_boot_params },
{ "acpi_call", shell_acpi_call }, { "acpi_call", shell_acpi_call },
{ "acpi_enable", shell_acpi_enable }, { "acpi_enable", shell_acpi_enable },
{ "acpi_get_usage", shell_acpi_get_usage }, { "acpi_get_usage", shell_acpi_get_usage },
@ -2598,6 +2713,7 @@ func_table_t shell_cmds[] = {
{ "blit_bitmap", shell_blit_bitmap }, { "blit_bitmap", shell_blit_bitmap },
{ "button", shell_button }, { "button", shell_button },
{ "cd", shell_cd }, { "cd", shell_cd },
{ "set", shell_set },
{ "disk_add", shell_disk_add }, { "disk_add", shell_disk_add },
{ "disk_del", shell_disk_del }, { "disk_del", shell_disk_del },
{ "display_number", shell_display_number }, { "display_number", shell_display_number },
@ -2608,6 +2724,7 @@ func_table_t shell_cmds[] = {
{ "dump_taskdata", shell_dump_taskdata }, { "dump_taskdata", shell_dump_taskdata },
{ "dump_win_pos", shell_dump_win_pos }, { "dump_win_pos", shell_dump_win_pos },
{ "dump_win_stack", shell_dump_win_stack }, { "dump_win_stack", shell_dump_win_stack },
{ "dump_win_map", shell_dump_win_map },
{ "exec", shell_exec }, { "exec", shell_exec },
{ "get_font_size", shell_get_font_size }, { "get_font_size", shell_get_font_size },
{ "get_font_smoothing", shell_get_font_smoothing }, { "get_font_smoothing", shell_get_font_smoothing },
@ -2677,6 +2794,8 @@ func_table_t shell_cmds[] = {
{ "stat80", shell_stat80 }, { "stat80", shell_stat80 },
{ "window_redraw", shell_window_redraw }, { "window_redraw", shell_window_redraw },
{ "write_text", shell_write_text }, { "write_text", shell_write_text },
{ "switch_to_thread", shell_switch_to_thread },
{ "new_sys_thread", shell_new_sys_thread },
}; };
static void static void

View File

@ -1,3 +1,4 @@
/> umka_init
/> disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.img hd0 -c 0 /> disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.img hd0 -c 0
/hd0/1: xfs /hd0/1: xfs
/> disk_add ../img/xfs_short_dir_i8.img hd1 -c 0 /> disk_add ../img/xfs_short_dir_i8.img hd1 -c 0

View File

@ -1,3 +1,4 @@
umka_init
disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.img hd0 -c 0 disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.img hd0 -c 0
disk_add ../img/xfs_short_dir_i8.img hd1 -c 0 disk_add ../img/xfs_short_dir_i8.img hd1 -c 0

View File

@ -1,3 +1,4 @@
/> umka_init
/> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k.img hd0 -c 0 /> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k.img hd0 -c 0
/hd0/1: xfs /hd0/1: xfs
/> ls70 /hd0/1/sf_empty /> ls70 /hd0/1/sf_empty

View File

@ -1,3 +1,4 @@
umka_init
disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k.img hd0 -c 0 disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k.img hd0 -c 0
ls70 /hd0/1/sf_empty ls70 /hd0/1/sf_empty
ls70 /hd0/1/sf ls70 /hd0/1/sf

View File

@ -1,3 +1,4 @@
/> umka_init
/> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0 /> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0
/hd0/1: xfs /hd0/1: xfs
# zero length # zero length

View File

@ -1,3 +1,4 @@
umka_init
disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0 disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0
# zero length # zero length
read70 /hd0/1/no_hole 0 0 -b read70 /hd0/1/no_hole 0 0 -b

View File

@ -1,3 +1,4 @@
/> umka_init
/> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0 /> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0
/hd0/1: xfs /hd0/1: xfs
/> stat70 /hd0/1/ /> stat70 /hd0/1/

View File

@ -1,3 +1,4 @@
umka_init
disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0 disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0
stat70 /hd0/1/ stat70 /hd0/1/
stat70 /hd0/1/hole_begin stat70 /hd0/1/hole_begin

View File

@ -1,3 +1,4 @@
/> umka_init
/> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0 /> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0
/hd0/1: xfs /hd0/1: xfs
/> pwd /> pwd

View File

@ -1,3 +1,4 @@
umka_init
disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0 disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0
pwd pwd
cd /hd0 cd /hd0

View File

@ -1,3 +1,4 @@
/> umka_init
/> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0 /> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0
/hd0/1: xfs /hd0/1: xfs
# hole begin # hole begin

View File

@ -1,3 +1,4 @@
umka_init
disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0 disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0
# hole begin # hole begin
# zero length # zero length

View File

@ -1,3 +1,4 @@
/> umka_init
/> disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.img hd0 -c 0 /> disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.img hd0 -c 0
/hd0/1: xfs /hd0/1: xfs
/> stat70 /hd0/1/sf_empty /> stat70 /hd0/1/sf_empty

View File

@ -1,3 +1,4 @@
umka_init
disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.img hd0 -c 0 disk_add ../img/xfs_v4_ftype1_s05k_b2k_n8k.img hd0 -c 0
stat70 /hd0/1/sf_empty stat70 /hd0/1/sf_empty
stat70 /hd0/1/sf_empty/. stat70 /hd0/1/sf_empty/.

View File

@ -1,3 +1,4 @@
/> umka_init
/> disk_add ../img/xfs_v4_ftype0_s4k_b4k_n8k.img hd0 -c 0 /> disk_add ../img/xfs_v4_ftype0_s4k_b4k_n8k.img hd0 -c 0
/hd0/1: xfs /hd0/1: xfs
/> ls70 /hd0/1/sf /> ls70 /hd0/1/sf

View File

@ -1,3 +1,4 @@
umka_init
disk_add ../img/xfs_v4_ftype0_s4k_b4k_n8k.img hd0 -c 0 disk_add ../img/xfs_v4_ftype0_s4k_b4k_n8k.img hd0 -c 0
ls70 /hd0/1/sf ls70 /hd0/1/sf
ls70 /hd0/1/block ls70 /hd0/1/block

View File

@ -1,3 +1,4 @@
/> umka_init
/> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.img hd0 -c 0 /> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.img hd0 -c 0
/hd0/1: xfs /hd0/1: xfs
/> ls70 /hd0/1/sf_empty /> ls70 /hd0/1/sf_empty

View File

@ -1,3 +1,4 @@
umka_init
disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.img hd0 -c 0 disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.img hd0 -c 0
ls70 /hd0/1/sf_empty ls70 /hd0/1/sf_empty
ls70 /hd0/1/sf ls70 /hd0/1/sf

View File

@ -1,3 +1,4 @@
/> umka_init
/> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.img hd0 -c 0 /> disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.img hd0 -c 0
/hd0/1: xfs /hd0/1: xfs
/> stat70 /hd0/1/sf_empty /> stat70 /hd0/1/sf_empty

View File

@ -1,3 +1,4 @@
umka_init
disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.img hd0 -c 0 disk_add ../img/xfs_v4_ftype0_s05k_b2k_n8k_xattr.img hd0 -c 0
stat70 /hd0/1/sf_empty stat70 /hd0/1/sf_empty
stat70 /hd0/1/sf_empty/. stat70 /hd0/1/sf_empty/.

View File

@ -1,3 +1,4 @@
/> umka_init
/> disk_add ../img/xfs_v4_unicode.img hd0 -c 0 /> disk_add ../img/xfs_v4_unicode.img hd0 -c 0
/hd0/1: xfs /hd0/1: xfs

View File

@ -1,3 +1,4 @@
umka_init
disk_add ../img/xfs_v4_unicode.img hd0 -c 0 disk_add ../img/xfs_v4_unicode.img hd0 -c 0
stat80 /hd0/1/dir0 stat80 /hd0/1/dir0

View File

@ -1,3 +1,4 @@
/> umka_init
/> disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.img hd0 -c 0 /> disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.img hd0 -c 0
/hd0/1: xfs /hd0/1: xfs
/> ls70 /hd0/1/sf_empty /> ls70 /hd0/1/sf_empty

View File

@ -1,3 +1,4 @@
umka_init
disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.img hd0 -c 0 disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.img hd0 -c 0
ls70 /hd0/1/sf_empty ls70 /hd0/1/sf_empty
ls70 /hd0/1/sf ls70 /hd0/1/sf

View File

@ -1,3 +1,4 @@
/> umka_init
/> disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.img hd0 -c 0 /> disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.img hd0 -c 0
/hd0/1: xfs /hd0/1: xfs
/> stat70 /hd0/1/sf_empty /> stat70 /hd0/1/sf_empty

View File

@ -1,3 +1,4 @@
umka_init
disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.img hd0 -c 0 disk_add ../img/xfs_v5_ftype1_s05k_b2k_n8k.img hd0 -c 0
stat70 /hd0/1/sf_empty stat70 /hd0/1/sf_empty
stat70 /hd0/1/sf_empty/. stat70 /hd0/1/sf_empty/.

View File

@ -1,3 +1,4 @@
/> umka_init
/> disk_add ../img/xfs_v5_files_s05k_b4k_n8k.img hd0 -c 0 /> disk_add ../img/xfs_v5_files_s05k_b4k_n8k.img hd0 -c 0
/hd0/1: xfs /hd0/1: xfs
# hole begin # hole begin

View File

@ -1,3 +1,4 @@
umka_init
disk_add ../img/xfs_v5_files_s05k_b4k_n8k.img hd0 -c 0 disk_add ../img/xfs_v5_files_s05k_b4k_n8k.img hd0 -c 0
# hole begin # hole begin
# zero length # zero length

View File

@ -1,3 +1,4 @@
/> umka_init
/> disk_add ../img/xfs_v5_files_s05k_b4k_n8k.img hd0 -c 0 /> disk_add ../img/xfs_v5_files_s05k_b4k_n8k.img hd0 -c 0
/hd0/1: xfs /hd0/1: xfs
# zero length # zero length

View File

@ -1,3 +1,4 @@
umka_init
disk_add ../img/xfs_v5_files_s05k_b4k_n8k.img hd0 -c 0 disk_add ../img/xfs_v5_files_s05k_b4k_n8k.img hd0 -c 0
# zero length # zero length
read70 /hd0/1/no_hole 0 0 -b read70 /hd0/1/no_hole 0 0 -b

View File

@ -1,3 +1,4 @@
/> umka_init
#disk_add ../img/kolibri.img rd -c 0 #disk_add ../img/kolibri.img rd -c 0
/> ramdisk_init ../img/kolibri.img /> ramdisk_init ../img/kolibri.img
/rd/1: fat /rd/1: fat

View File

@ -1,3 +1,4 @@
umka_init
#disk_add ../img/kolibri.img rd -c 0 #disk_add ../img/kolibri.img rd -c 0
ramdisk_init ../img/kolibri.img ramdisk_init ../img/kolibri.img
set_skin /sys/DEFAULT.SKN set_skin /sys/DEFAULT.SKN

View File

@ -1,3 +1,4 @@
/> umka_init
/> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0 /> disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0
/hd0/1: xfs /hd0/1: xfs

View File

@ -1,3 +1,4 @@
umka_init
disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0 disk_add ../img/xfs_v4_files_s05k_b4k_n8k.img hd0 -c 0
read70 /hd0/1/4GiB_plus 0x3ff4 11 -b read70 /hd0/1/4GiB_plus 0x3ff4 11 -b

View File

@ -1,3 +1,4 @@
/> umka_init
/> disk_add ../img/jfs.img hd0 -c 0 /> disk_add ../img/jfs.img hd0 -c 0
/hd0/1: ??? /hd0/1: ???
/> disk_del hd0 /> disk_del hd0

View File

@ -1,3 +1,4 @@
umka_init
disk_add ../img/jfs.img hd0 -c 0 disk_add ../img/jfs.img hd0 -c 0
disk_del hd0 disk_del hd0
disk_add ../img/xfs_borg_bit.img hd0 -c 0 disk_add ../img/xfs_borg_bit.img hd0 -c 0

View File

@ -1,3 +1,4 @@
/> umka_init
/> disk_add ../img/xfs_v4_btrees_l2.img hd0 -c 0 /> disk_add ../img/xfs_v4_btrees_l2.img hd0 -c 0
/hd0/1: xfs /hd0/1: xfs

View File

@ -1,3 +1,4 @@
umka_init
disk_add ../img/xfs_v4_btrees_l2.img hd0 -c 0 disk_add ../img/xfs_v4_btrees_l2.img hd0 -c 0
ls80 /hd0/1/dir_btree_l2 -f 0 -c 1 ls80 /hd0/1/dir_btree_l2 -f 0 -c 1

View File

@ -1,3 +1,4 @@
/> umka_init
/> i40 18 16 /> i40 18 16
eax = 00040000 262144 262144 eax = 00040000 262144 262144
ebx = 00000010 16 16 ebx = 00000010 16 16

View File

@ -1 +1,2 @@
umka_init
i40 18 16 i40 18 16

View File

@ -1,3 +1,4 @@
/> umka_init
/> pci_set_path machines/000/pci /> pci_set_path machines/000/pci
/> acpi_set_usage 2 /> acpi_set_usage 2

View File

@ -1,3 +1,4 @@
umka_init
pci_set_path machines/000/pci pci_set_path machines/000/pci
acpi_set_usage 2 acpi_set_usage 2

View File

@ -1,3 +1,4 @@
/> umka_init
/> pci_set_path machines/001/pci /> pci_set_path machines/001/pci
/> acpi_set_usage 2 /> acpi_set_usage 2

View File

@ -1,3 +1,4 @@
umka_init
pci_set_path machines/001/pci pci_set_path machines/001/pci
acpi_set_usage 2 acpi_set_usage 2

View File

@ -1,3 +1,4 @@
/> umka_init
/> pci_set_path machines/002/pci /> pci_set_path machines/002/pci
# some _ADR's are methods with memory access # some _ADR's are methods with memory access

View File

@ -1,3 +1,4 @@
umka_init
pci_set_path machines/002/pci pci_set_path machines/002/pci
# some _ADR's are methods with memory access # some _ADR's are methods with memory access

View File

@ -1,3 +1,4 @@
/> umka_init
/> pci_set_path machines/003/pci /> pci_set_path machines/003/pci
/> acpi_set_usage 2 /> acpi_set_usage 2

View File

@ -1,3 +1,4 @@
umka_init
pci_set_path machines/003/pci pci_set_path machines/003/pci
acpi_set_usage 2 acpi_set_usage 2

View File

@ -1,3 +1,4 @@
/> umka_init
/> acpi_set_usage 1 /> acpi_set_usage 1
/> acpi_preload_table machines/004/acpi/DSDT /> acpi_preload_table machines/004/acpi/DSDT

View File

@ -1,3 +1,4 @@
umka_init
acpi_set_usage 1 acpi_set_usage 1
acpi_preload_table machines/004/acpi/DSDT acpi_preload_table machines/004/acpi/DSDT

View File

@ -1,3 +1,4 @@
/> umka_init
/> acpi_set_usage 1 /> acpi_set_usage 1
/> acpi_preload_table machines/unit/acpi/scope_empty.aml /> acpi_preload_table machines/unit/acpi/scope_empty.aml

View File

@ -1,3 +1,4 @@
umka_init
acpi_set_usage 1 acpi_set_usage 1
acpi_preload_table machines/unit/acpi/scope_empty.aml acpi_preload_table machines/unit/acpi/scope_empty.aml

View File

@ -1,3 +1,4 @@
/> umka_init
/> pci_set_path machines/005/pci /> pci_set_path machines/005/pci
/> acpi_set_usage 2 /> acpi_set_usage 2

View File

@ -1,3 +1,4 @@
umka_init
pci_set_path machines/005/pci pci_set_path machines/005/pci
acpi_set_usage 2 acpi_set_usage 2

View File

@ -1,3 +1,4 @@
/> umka_init
/> acpi_set_usage 1 /> acpi_set_usage 1
/> acpi_preload_table machines/unit/acpi/debug_object.aml /> acpi_preload_table machines/unit/acpi/debug_object.aml

View File

@ -1,3 +1,4 @@
umka_init
acpi_set_usage 1 acpi_set_usage 1
acpi_preload_table machines/unit/acpi/debug_object.aml acpi_preload_table machines/unit/acpi/debug_object.aml

View File

@ -1,3 +1,4 @@
/> umka_init
/> acpi_set_usage 1 /> acpi_set_usage 1
/> acpi_preload_table machines/unit/acpi/field.aml /> acpi_preload_table machines/unit/acpi/field.aml

View File

@ -1,3 +1,4 @@
umka_init
acpi_set_usage 1 acpi_set_usage 1
acpi_preload_table machines/unit/acpi/field.aml acpi_preload_table machines/unit/acpi/field.aml

View File

@ -1,3 +1,4 @@
/> umka_init
/> pci_set_path machines/006/pci /> pci_set_path machines/006/pci
/> acpi_set_usage 2 /> acpi_set_usage 2

View File

@ -1,3 +1,4 @@
umka_init
pci_set_path machines/006/pci pci_set_path machines/006/pci
acpi_set_usage 2 acpi_set_usage 2

View File

@ -1,3 +1,4 @@
/> umka_init
/> pci_set_path machines/007/pci /> pci_set_path machines/007/pci
/> acpi_set_usage 2 /> acpi_set_usage 2

View File

@ -1,3 +1,4 @@
umka_init
pci_set_path machines/007/pci pci_set_path machines/007/pci
acpi_set_usage 2 acpi_set_usage 2

View File

@ -1,3 +1,4 @@
/> umka_init
/> acpi_set_usage 1 /> acpi_set_usage 1
/> acpi_preload_table machines/008/acpi/dsdt.dat /> acpi_preload_table machines/008/acpi/dsdt.dat

View File

@ -1,3 +1,4 @@
umka_init
acpi_set_usage 1 acpi_set_usage 1
acpi_preload_table machines/008/acpi/dsdt.dat acpi_preload_table machines/008/acpi/dsdt.dat

View File

@ -1,3 +1,4 @@
/> umka_init
/> acpi_set_usage 1 /> acpi_set_usage 1
/> acpi_preload_table machines/010/acpi/dsdt.dat /> acpi_preload_table machines/010/acpi/dsdt.dat

View File

@ -1,3 +1,4 @@
umka_init
acpi_set_usage 1 acpi_set_usage 1
acpi_preload_table machines/010/acpi/dsdt.dat acpi_preload_table machines/010/acpi/dsdt.dat

View File

@ -5,9 +5,9 @@ table #0
/> acpi_enable /> acpi_enable
acpi.aml.process_table begin acpi.aml.process_table begin
table length 0x00000032 table length 0x0000012C
Table signature: 'DSDT' Table signature: 'DSDT'
Table length (with header): 0x00000032 Table length (with header): 0x0000012C
Revision: 0x01 Revision: 0x01
OEM ID: 'UMKA ' OEM ID: 'UMKA '
OEM Table ID: 'UMKADSDT' OEM Table ID: 'UMKADSDT'
@ -44,13 +44,64 @@ table/position: [0x0000002B]
aml._.term_obj begin aml._.term_obj begin
aml._.object begin aml._.object begin
aml._.namespace_modifier_obj begin aml._.namespace_modifier_obj begin
aml._.name begin
aml._.name_string begin
aml._.name_string begin again
offset: 0x0000002C
aml._.name_path begin
aml._.name_path end
name_string: REF5
aml._.name_string end
aml._.get_node_by_name begin
name: ''
aml._.get_node_by_name end
aml._.data_ref_object begin
aml._.data_object begin
aml._.computational_data begin
aml._.byte_const begin
aml._.byte_const end
aml._.computational_data end
aml._.data_object end
aml._.data_ref_object end
aml._.name end
aml._.namespace_modifier_obj end
aml._.object end
aml._.term_obj end
table/position: [0x00000032]
aml._.term_obj begin
aml._.object begin
aml._.namespace_modifier_obj begin
aml._.namespace_modifier_obj end aml._.namespace_modifier_obj end
aml._.named_obj begin aml._.named_obj begin
aml._.method begin aml._.method begin
pkg_length: 0x00000006 pkg_length: 0x000000EA
aml._.name_string begin aml._.name_string begin
aml._.name_string begin again aml._.name_string begin again
offset: 0x0000002D offset: 0x00000035
aml._.name_path begin
aml._.name_path end
name_string: AREF
aml._.name_string end
aml._.attach_node begin
aml._.get_node_by_name begin
name: ''
aml._.get_node_by_name end
aml._.attach_node end
aml._.method end
aml._.named_obj end
aml._.object end
aml._.term_obj end
table/position: [0x0000011D]
aml._.term_obj begin
aml._.object begin
aml._.namespace_modifier_obj begin
aml._.namespace_modifier_obj end
aml._.named_obj begin
aml._.method begin
pkg_length: 0x0000000E
aml._.name_string begin
aml._.name_string begin again
offset: 0x0000011F
aml._.name_path begin aml._.name_path begin
aml._.name_path end aml._.name_path end
name_string: MAIN name_string: MAIN
@ -65,7 +116,9 @@ aml._.named_obj end
aml._.object end aml._.object end
aml._.term_obj end aml._.term_obj end
==========ACPI_TREE========== ==========ACPI_TREE==========
\MAIN Method length:0x00000000 Args:0 serialize:0 sync_level:0 \MAIN Method length:0x00000008 Args:0 serialize:0 sync_level:0
\AREF Method length:0x000000E3 Args:1 serialize:0 sync_level:0
\REF5 Integer = 0x0000000000000002
\INT5 Integer = 0x0000000000000005 \INT5 Integer = 0x0000000000000005
\_TZ_ Scope \_TZ_ Scope
\_SI_ Scope \_SI_ Scope
@ -75,7 +128,9 @@ aml._.term_obj end
----------------------------- -----------------------------
acpi.aml.process_table end acpi.aml.process_table end
==========ACPI_TREE========== ==========ACPI_TREE==========
\MAIN Method length:0x00000000 Args:0 serialize:0 sync_level:0 \MAIN Method length:0x00000008 Args:0 serialize:0 sync_level:0
\AREF Method length:0x000000E3 Args:1 serialize:0 sync_level:0
\REF5 Integer = 0x0000000000000002
\INT5 Integer = 0x0000000000000005 \INT5 Integer = 0x0000000000000005
\_TZ_ Scope \_TZ_ Scope
\_SI_ Scope \_SI_ Scope
@ -85,11 +140,11 @@ acpi.aml.process_table end
----------------------------- -----------------------------
/> acpi_get_node_alloc_cnt /> acpi_get_node_alloc_cnt
nodes allocated: 9 nodes allocated: 11
/> acpi_get_node_free_cnt /> acpi_get_node_free_cnt
nodes freed: 0 nodes freed: 0
/> acpi_get_node_cnt /> acpi_get_node_cnt
nodes in namespace: 9 nodes in namespace: 11
/> acpi_call \MAIN /> acpi_call \MAIN
acpi.call_name begin acpi.call_name begin
@ -98,17 +153,270 @@ name: '\MAIN'
aml._.get_node_by_name end aml._.get_node_by_name end
acpi.call_node begin acpi.call_node begin
# func name MAIN # func name MAIN
# bytes 0x00000000 # bytes 0x46455241
# bytes 0x00000000 # bytes 0x35544E49
# bytes 0xDF590000 # bytes 0x0001DE69
acpi.call_node end table/position: [0x00000124]
acpi.call_name end aml._.term_obj begin
calling acpi method: '\MAIN' aml._.object begin
acpi method returned aml._.namespace_modifier_obj begin
aml._.namespace_modifier_obj end
aml._.named_obj begin
aml._.named_obj end
aml._.object end
aml._.type1opcode begin
aml._.type1opcode end
aml._.name_string begin
aml._.name_string begin again
offset: 0x00000124
aml._.name_path begin
aml._.name_path end
name_string: AREF
aml._.name_string end
aml._.get_node_by_name begin
name: 'AREF'
aml._.get_node_by_name end
aml._.method_invocation begin
arg_count: 1
aml._.term_arg begin
aml._.name_string begin
aml._.name_string begin again
offset: 0x00000128
aml._.name_path begin
aml._.name_path end
name_string: INT5
aml._.name_string end
aml._.get_node_by_name begin
name: 'INT5'
aml._.get_node_by_name end
aml._.data_object begin
aml._.computational_data begin
aml._.computational_data end
aml._.data_object end
aml._.name_string begin
aml._.name_string begin again
offset: 0x00000128
aml._.name_path begin
aml._.name_path end
name_string: INT5
aml._.name_string end
aml._.get_node_by_name begin
name: 'INT5'
aml._.get_node_by_name end
aml._.term_arg end
table/position: [0x0000003A]
aml._.term_obj begin
aml._.object begin
aml._.namespace_modifier_obj begin
aml._.namespace_modifier_obj end
aml._.named_obj begin
aml._.named_obj end
aml._.object end
aml._.type1opcode begin
aml._.type1opcode end
aml._.store begin
aml._.term_arg begin
aml._.name_string begin
aml._.name_string begin again
offset: 0x0000003B
aml._.name_path begin
aml._.name_path end
name_string: INT5
aml._.name_string end
aml._.get_node_by_name begin
name: 'INT5'
aml._.get_node_by_name end
aml._.data_object begin
aml._.computational_data begin
aml._.computational_data end
aml._.data_object end
aml._.name_string begin
aml._.name_string begin again
offset: 0x0000003B
aml._.name_path begin
aml._.name_path end
name_string: INT5
aml._.name_string end
aml._.get_node_by_name begin
name: 'INT5'
aml._.get_node_by_name end
aml._.term_arg end
aml._.super_name begin
aml._.simple_name begin
aml._.name_string begin
aml._.name_string end
aml._.simple_name end
aml._.debug_obj begin
aml._.debug_obj end
aml._.super_name end
aml._.store_table begin
types 2 to 19
aml._.store_table.integer_to_debug_object begin
AML_DBG: 0x0000000000000005
aml._.store_table.integer_to_debug_object end
aml._.store_table end
aml._.store end
aml._.term_obj end
table/position: [0x00000041]
aml._.term_obj begin
aml._.object begin
aml._.namespace_modifier_obj begin
aml._.namespace_modifier_obj end
aml._.named_obj begin
aml._.named_obj end
aml._.object end
aml._.type1opcode begin
aml._.type1opcode end
aml._.store begin
aml._.term_arg begin
aml._.name_string begin
aml._.name_string end
aml._.data_object begin
aml._.computational_data begin
aml._.computational_data end
aml._.data_object end
aml._.arg_obj begin
aml._.arg_obj end
aml._.term_arg end
aml._.super_name begin
aml._.simple_name begin
aml._.name_string begin
aml._.name_string end
aml._.simple_name end
aml._.debug_obj begin
aml._.debug_obj end
aml._.super_name end
aml._.store_table begin
types 2 to 19
aml._.store_table.integer_to_debug_object begin
AML_DBG: 0x0000000000000005
aml._.store_table.integer_to_debug_object end
aml._.store_table end
aml._.store end
aml._.term_obj end
table/position: [0x00000045]
aml._.term_obj begin
aml._.object begin
aml._.namespace_modifier_obj begin
aml._.namespace_modifier_obj end
aml._.named_obj begin
aml._.named_obj end
aml._.object end
aml._.type1opcode begin
aml._.type1opcode end
aml._.store begin
aml._.term_arg begin
aml._.name_string begin
aml._.name_string begin again
offset: 0x00000046
aml._.name_path begin
aml._.name_path end
name_string: REF5
aml._.name_string end
aml._.get_node_by_name begin
name: 'REF5'
aml._.get_node_by_name end
aml._.data_object begin
aml._.computational_data begin
aml._.computational_data end
aml._.data_object end
aml._.name_string begin
aml._.name_string begin again
offset: 0x00000046
aml._.name_path begin
aml._.name_path end
name_string: REF5
aml._.name_string end
aml._.get_node_by_name begin
name: 'REF5'
aml._.get_node_by_name end
aml._.term_arg end
aml._.super_name begin
aml._.simple_name begin
aml._.name_string begin
aml._.name_string end
aml._.simple_name end
aml._.debug_obj begin
aml._.debug_obj end
aml._.super_name end
aml._.store_table begin
types 2 to 19
aml._.store_table.integer_to_debug_object begin
AML_DBG: 0x0000000000000002
aml._.store_table.integer_to_debug_object end
aml._.store_table end
aml._.store end
aml._.term_obj end
table/position: [0x0000004C]
aml._.term_obj begin
aml._.object begin
aml._.namespace_modifier_obj begin
aml._.namespace_modifier_obj end
aml._.named_obj begin
aml._.named_obj end
aml._.object end
aml._.type1opcode begin
aml._.type1opcode end
aml._.store begin
aml._.term_arg begin
aml._.name_string begin
aml._.name_string end
aml._.data_object begin
aml._.computational_data begin
aml._.string begin
aml._.string end
aml._.computational_data end
aml._.data_object end
aml._.term_arg end
aml._.super_name begin
aml._.simple_name begin
aml._.name_string begin
aml._.name_string end
aml._.simple_name end
aml._.debug_obj begin
aml._.debug_obj end
aml._.super_name end
aml._.store_table begin
types 3 to 19
aml._.store_table.string_to_debug_object begin
AML_DBG:
/> acpi_get_node_alloc_cnt aml._.store_table.string_to_debug_object end
nodes allocated: 9 aml._.store_table end
/> acpi_get_node_free_cnt aml._.store end
nodes freed: 0 aml._.term_obj end
/> acpi_get_node_cnt table/position: [0x00000052]
nodes in namespace: 9 aml._.term_obj begin
aml._.object begin
aml._.namespace_modifier_obj begin
aml._.namespace_modifier_obj end
aml._.named_obj begin
aml._.named_obj end
aml._.object end
aml._.type1opcode begin
aml._.type1opcode end
aml._.store begin
aml._.term_arg begin
aml._.name_string begin
aml._.name_string end
aml._.data_object begin
aml._.computational_data begin
aml._.computational_data end
aml._.data_object end
aml._.name_string begin
aml._.name_string end
error: unknown term_arg: 0x71
aml._.term_arg end
aml._.super_name begin
aml._.simple_name begin
aml._.name_string begin
aml._.name_string end
aml._.simple_name end
aml._.name_string begin
aml._.name_string end
aml._.super_name end
aml._.store end
aml._.name_string begin
aml._.name_string end
aml._.term_obj end
error: unknown bytes: 0x7168

View File

@ -1,3 +1,4 @@
/> umka_init
#pci_set_path machines/011/pci #pci_set_path machines/011/pci
/> acpi_set_usage 1 /> acpi_set_usage 1

View File

@ -1,3 +1,4 @@
umka_init
#pci_set_path machines/011/pci #pci_set_path machines/011/pci
acpi_set_usage 1 acpi_set_usage 1

View File

@ -0,0 +1,166 @@
/> umka_set_boot_params --x_res 44 --y_res 44
/> umka_init
/> ramdisk_init ../img/kolibri.img
/rd/1: fat
/> set_skin /sys/DEFAULT.SKN
status: 0
/> window_redraw 1
/> draw_window 2 10 4 10 0x000088 1 1 1 0 1 4 hello
/> window_redraw 2
/> set_window_caption hi_there 0
/> new_sys_thread
tid: 3
/> switch_to_thread 3
/> window_redraw 1
/> draw_window 4 5 8 5 0x000088 1 1 1 0 1 4 hello
/> window_redraw 2
/> dump_win_map
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11223333332221111111111111111111111111111111
11223333332221111111111111111111111111111111
11223333332221111111111111111111111111111111
11223333332221111111111111111111111111111111
11223333332221111111111111111111111111111111
11223333332221111111111111111111111111111111
11222222222221111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
/> set redraw_background 0
/> move_window 6 8 5 5
/> dump_win_map
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222233333321111111111111111111111111111111
11222233333321111111111111111111111111111111
11222233333321111111111111111111111111111111
11222233333321111111111111111111111111111111
11222233333321111111111111111111111111111111
11222233333321111111111111111111111111111111
11222222222221111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
/> set redraw_background 0
/> move_window 6 10 5 5
/> dump_win_map
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222222222221111111111111111111111111111111
11222233333321111111111111111111111111111111
11222233333321111111111111111111111111111111
11222233333321111111111111111111111111111111
11222233333321111111111111111111111111111111
11222233333321111111111111111111111111111111
11111133333311111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111
/> scrot 044_#f01_#draw_winmap.out.png
/> disk_del rd

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

View File

@ -0,0 +1,31 @@
umka_set_boot_params --x_res 44 --y_res 44
umka_init
ramdisk_init ../img/kolibri.img
set_skin /sys/DEFAULT.SKN
window_redraw 1
draw_window 2 10 4 10 0x000088 1 1 1 0 1 4 hello
window_redraw 2
set_window_caption hi_there 0
new_sys_thread
switch_to_thread 3
window_redraw 1
draw_window 4 5 8 5 0x000088 1 1 1 0 1 4 hello
window_redraw 2
dump_win_map
set redraw_background 0
move_window 6 8 5 5
dump_win_map
set redraw_background 0
move_window 6 10 5 5
dump_win_map
scrot 044_#f01_#draw_winmap.out.png
disk_del rd

View File

@ -10,8 +10,6 @@ UMKA_FUSE = 2
UMKA_OS = 3 UMKA_OS = 3
UMKA_MEMORY_BYTES = 256 SHL 20 UMKA_MEMORY_BYTES = 256 SHL 20
UMKA_DISPLAY_WIDTH = 400
UMKA_DISPLAY_HEIGHT = 300
public disk_add public disk_add
public disk_del public disk_del
@ -41,6 +39,7 @@ public TASK_TABLE as 'kos_task_table'
public TASK_BASE as 'kos_task_base' public TASK_BASE as 'kos_task_base'
public TASK_DATA as 'kos_task_data' public TASK_DATA as 'kos_task_data'
public SLOT_BASE as 'kos_slot_base' public SLOT_BASE as 'kos_slot_base'
public window_data as 'kos_window_data'
public WIN_STACK as 'kos_win_stack' public WIN_STACK as 'kos_win_stack'
public WIN_POS as 'kos_win_pos' public WIN_POS as 'kos_win_pos'
@ -67,7 +66,7 @@ public draw_data
public img_background public img_background
public mem_BACKGROUND public mem_BACKGROUND
public sys_background public sys_background
public REDRAW_BACKGROUND public REDRAW_BACKGROUND as 'kos_redraw_background'
public new_sys_threads as 'kos_new_sys_threads' public new_sys_threads as 'kos_new_sys_threads'
public osloop as 'kos_osloop' public osloop as 'kos_osloop'
public set_mouse_data as 'kos_set_mouse_data' public set_mouse_data as 'kos_set_mouse_data'
@ -78,6 +77,11 @@ public net_buff_alloc as 'kos_net_buff_alloc'
public mem_block_list public mem_block_list
public pci_root public pci_root
public window._.set_screen as 'kos_window_set_screen'
public _display as 'kos_display'
public BOOT as 'kos_boot'
macro cli { macro cli {
pushfd pushfd
bts dword[esp], 21 bts dword[esp], 21
@ -279,6 +283,7 @@ include 'acpi/acpi.inc'
include 'unpacker.inc' include 'unpacker.inc'
LIBCRASH_CTX_LEN = 0x500 ; FIXME
include 'sha3.asm' include 'sha3.asm'
; TODO: stdcall attribute in umka.h ; TODO: stdcall attribute in umka.h
@ -308,6 +313,7 @@ proc umka._.check_alignment
endp endp
proc umka_init c uses ebx esi edi ebp proc umka_init c uses ebx esi edi ebp
mov [umka_initialized], 1
call umka._.check_alignment call umka._.check_alignment
mov edi, endofcode mov edi, endofcode
@ -362,10 +368,6 @@ proc umka_init c uses ebx esi edi ebp
add eax, PROC.thr_list add eax, PROC.thr_list
list_init eax list_init eax
mov [BOOT.bpp], 32
mov [BOOT.x_res], UMKA_DISPLAY_WIDTH
mov [BOOT.y_res], UMKA_DISPLAY_HEIGHT
mov [BOOT.pitch], UMKA_DISPLAY_WIDTH*4
mov [BOOT.lfb], LFB_BASE mov [BOOT.lfb], LFB_BASE
call init_video call init_video
@ -719,8 +721,15 @@ coverage_end:
section '.data.aligned65k' writeable align 65536 section '.data.aligned65k' writeable align 65536
public umka_tool public umka_tool
umka_tool dd ? umka_tool dd ?
public umka_initialized
umka_initialized dd 0
fpu_owner dd ? fpu_owner dd ?
BOOT boot_data
virtual at BOOT
BOOT_LO boot_data
end virtual
uglobal uglobal
align 64 align 64
os_base: rb PAGE_SIZE os_base: rb PAGE_SIZE
@ -772,10 +781,6 @@ ide_channel8_mutex MUTEX
lfb_base rd MAX_SCREEN_WIDTH*MAX_SCREEN_HEIGHT lfb_base rd MAX_SCREEN_WIDTH*MAX_SCREEN_HEIGHT
BOOT boot_data
virtual at BOOT
BOOT_LO boot_data
end virtual
align 4096 align 4096
cur_dir: cur_dir:
.encoding rb 1 .encoding rb 1

131
umka.h
View File

@ -43,6 +43,20 @@ typedef struct {
_Static_assert(sizeof(process_information_t) == 0x400, _Static_assert(sizeof(process_information_t) == 0x400,
"must be 0x400 bytes long"); "must be 0x400 bytes long");
typedef struct {
box_t box;
uint32_t cl_workarea;
uint32_t cl_titlebar;
uint32_t cl_frames;
uint8_t z_modif;
uint8_t fl_wstate;
uint8_t fl_wdrawn;
uint8_t fl_redraw;
} __attribute__((packed)) wdata_t;
_Static_assert(sizeof(wdata_t) == 0x20,
"must be 0x20 bytes long");
typedef struct { typedef struct {
uint32_t frame; uint32_t frame;
uint32_t grab; uint32_t grab;
@ -97,6 +111,8 @@ typedef struct {
uint32_t count; uint32_t count;
} mutex_t; } mutex_t;
typedef mutex_t rwsem_t;
typedef struct { typedef struct {
uint32_t flags; uint32_t flags;
uint32_t sector_size; uint32_t sector_size;
@ -412,17 +428,23 @@ umka_mouse_move(int lbheld, int mbheld, int rbheld, int xabs, int32_t xmoving,
__attribute__((__stdcall__)) net_buff_t * __attribute__((__stdcall__)) net_buff_t *
kos_net_buff_alloc(size_t size); kos_net_buff_alloc(size_t size);
static inline void static inline size_t
umka_new_sys_threads(uint32_t flags, void (*entry)(), void *stack) { umka_new_sys_threads(uint32_t flags, void (*entry)(), void *stack) {
size_t tid;
__asm__ __inline__ __volatile__ ( __asm__ __inline__ __volatile__ (
"pushad;" "push ebx;"
"push esi;"
"push edi;"
"call kos_new_sys_threads;" "call kos_new_sys_threads;"
"popad" "pop edi;"
: "pop esi;"
"pop ebx"
: "=a"(tid)
: "b"(flags), : "b"(flags),
"c"(entry), "c"(entry),
"d"(stack) "d"(stack)
: "memory", "cc"); : "memory", "cc");
return tid;
} }
static inline void static inline void
@ -482,6 +504,101 @@ kos_net_add_device(net_device_t *dev) {
return dev_num; return dev_num;
} }
__attribute__((__stdcall__)) void
kos_window_set_screen(ssize_t left, ssize_t top, ssize_t right, ssize_t bottom,
ssize_t proc);
typedef struct {
int32_t x;
int32_t y;
size_t width;
size_t height;
size_t bits_per_pixel;
size_t vrefresh;
void *current_lfb;
size_t lfb_pitch;
rwsem_t win_map_lock;
uint8_t *win_map;
size_t win_map_pitch;
size_t win_map_size;
void *modes;
void *ddev;
void *connector;
void *crtc;
void *cr_list_next;
void *cr_list_prev;
void *cursor;
void *init_cursor;
void *select_cursor;
void *show_cursor;
void *move_cursor;
void *restore_cursor;
void *disable_mouse;
size_t mask_seqno;
void *check_mouse;
void *check_m_pixel;
size_t bytes_per_pixel;
} __attribute__((packed)) display_t;
extern display_t kos_display;
typedef struct {
uint64_t addr;
uint64_t size;
uint32_t type;
} e820entry_t;
#define MAX_MEMMAP_BLOCKS 32
typedef struct {
uint8_t bpp; // bits per pixel
uint16_t pitch; // scanline length
uint8_t pad1[5];
uint16_t vesa_mode;
uint16_t x_res;
uint16_t y_res;
uint8_t pad2[6];
uint32_t bank_switch; // Vesa 1.2 pm bank switch
void *lfb; // Vesa 2.0 LFB address
uint8_t mtrr; // 0 or 1: enable MTRR graphics acceleration
uint8_t launcher_start; // 0 or 1: start the first app (right now it's
// LAUNCHER) after kernel is loaded
uint8_t debug_print; // if nonzero, duplicates debug output to the screen
uint8_t dma; // DMA write: 1=yes, 2=no
uint8_t pci_data[8];
uint8_t pad3[8];
uint8_t shutdown_type; // see sysfn 18.9
uint8_t pad4[15];
uint32_t apm_entry; // entry point of APM BIOS
uint16_t apm_version; // BCD
uint16_t apm_flags;
uint8_t pad5[8];
uint16_t apm_code_32;
uint16_t apm_code_16;
uint16_t apm_data_16;
uint8_t rd_load_from; // Device to load ramdisk from, RD_LOAD_FROM_*
uint8_t pad6[1];
uint16_t kernel_restart;
uint16_t sys_disk; // Device to mount on /sys/, see loader_doc.txt for details
void *acpi_rsdp;
char syspath[0x17];
void *devicesdat_data;
size_t devicesdat_size;
uint8_t bios_hd_cnt; // number of BIOS hard disks
uint8_t bios_hd[0x80]; // BIOS hard disks
size_t memmap_block_cnt; // available physical memory map: number of blocks
e820entry_t memmap_blocks[MAX_MEMMAP_BLOCKS];
uint8_t acpi_usage;
} __attribute__((packed)) boot_data_t;
extern boot_data_t kos_boot;
void void
umka_cli(void); umka_cli(void);
@ -622,10 +739,16 @@ _Static_assert(sizeof(taskdata_t) == 32, "must be 0x20 bytes long");
extern appdata_t *kos_scheduler_current[NR_SCHED_QUEUES]; extern appdata_t *kos_scheduler_current[NR_SCHED_QUEUES];
extern uint32_t umka_tool; extern uint32_t umka_tool;
extern uint32_t umka_initialized;
extern uint8_t kos_redraw_background;
extern size_t kos_task_count; extern size_t kos_task_count;
extern taskdata_t *kos_task_base; extern taskdata_t *kos_task_base;
extern wdata_t kos_window_data[];
extern taskdata_t kos_task_table[]; extern taskdata_t kos_task_table[];
extern appdata_t kos_slot_base[]; extern appdata_t kos_slot_base[];
extern uint32_t kos_current_process;
extern appdata_t *kos_current_slot;
extern uint32_t kos_current_slot_idx;
extern void umka_do_change_task(appdata_t *new); extern void umka_do_change_task(appdata_t *new);
extern void scheduler_add_thread(void); extern void scheduler_add_thread(void);
extern void find_next_task(void); extern void find_next_task(void);

View File

@ -29,6 +29,9 @@
#include "umka.h" #include "umka.h"
#include "trace.h" #include "trace.h"
#define UMKA_DEFAULT_DISPLAY_WIDTH 400
#define UMKA_DEFAULT_DISPLAY_HEIGHT 300
int int
main(int argc, char **argv) { main(int argc, char **argv) {
umka_tool = UMKA_SHELL; umka_tool = UMKA_SHELL;
@ -39,48 +42,53 @@ main(int argc, char **argv) {
char outfile[PATH_MAX] = {0}; char outfile[PATH_MAX] = {0};
FILE *fin = stdin, *fout = stdout; FILE *fin = stdin, *fout = stdout;
int opt; kos_boot.bpp = 32;
optind = 1; kos_boot.x_res = UMKA_DEFAULT_DISPLAY_WIDTH;
if (argc > 1 && *argv[optind] != '-') { kos_boot.y_res = UMKA_DEFAULT_DISPLAY_HEIGHT;
infile = argv[optind++]; kos_boot.pitch = UMKA_DEFAULT_DISPLAY_WIDTH*4; // 32bpp
strncpy(outfile, infile, PATH_MAX-2); // ".t" is shorter than ".out"
char *last_dot = strrchr(outfile, '.');
if (!last_dot) {
printf("test file must have '.t' suffix\n");
return 1;
}
strcpy(last_dot, ".out.log");
}
if (infile) { // skip 'umka_shell'
fin = fopen(infile, "r"); argc -= 1;
} argv += 1;
if (*outfile) {
fout = fopen(outfile, "w");
}
if (!fin || !fout) {
printf("can't open in/out files\n");
return 1;
}
while ((opt = getopt(argc, argv, "c")) != -1) { while (argc) {
switch (opt) { if (!strcmp(argv[0], "-c")) {
case 'c':
coverage = 1; coverage = 1;
break; argc -= 1;
default: argv += 1;
continue;
} else if (!strcmp(argv[0], "-i") && argc > 1) {
infile = argv[1];
strncpy(outfile, infile, PATH_MAX-2); // ".t" is shorter than ".out"
char *last_dot = strrchr(outfile, '.');
if (!last_dot) {
printf("[!] test file must have '.t' suffix\n");
exit(1);
}
strcpy(last_dot, ".out.log");
fin = fopen(infile, "r");
if (!fin) {
perror("[!] can't open file");
exit(1);
}
fout = fopen(outfile, "w");
if (!fout) {
perror("[!] can't open file");
exit(1);
}
argc -= 2;
argv += 2;
continue;
} else {
printf("bad option: %s\n", argv[0]);
puts(usage); puts(usage);
return 1; exit(1);
} }
} }
if (coverage) if (coverage)
trace_begin(); trace_begin();
COVERAGE_ON();
umka_init();
COVERAGE_OFF();
run_test(fin, fout, 1); run_test(fin, fout, 1);
if (coverage) if (coverage)