diff --git a/.gitignore b/.gitignore index 8893771..7655caf 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ ignore.* t.d *~ *.exe +colors.dtp diff --git a/makefile b/makefile index 6677132..9fd57f1 100644 --- a/makefile +++ b/makefile @@ -96,8 +96,11 @@ getopt.o: getopt.c getopt.h util.o: util.c util.h umka.h $(CC) $(CFLAGS_32) -c $< -default.skn: $(KOLIBRIOS)/skins/Leency/Shkvorka/default.asm - $(FASM) "$<" $@ +default.skn: $(KOLIBRIOS)/skins/Leency/Shkvorka/default.asm colors.dtp + $(FASM) $< $@ + +colors.dtp: $(KOLIBRIOS)/skins/Leency/Shkvorka/colors.dtp.asm + $(FASM) $< $@ skin.skn: $(KOLIBRIOS)/skins/Leency/Octo_flat/default.asm $(FASM) "$<" $@ diff --git a/shell.c b/shell.c index c54f771..0de6566 100644 --- a/shell.c +++ b/shell.c @@ -603,6 +603,9 @@ shell_dump_appdata(int argc, char **argv) { fprintf(fout, "draw_bgr_x: %u\n", a->draw_bgr_x); fprintf(fout, "draw_bgr_y: %u\n", a->draw_bgr_y); fprintf(fout, "event_mask: %" PRIx32 "\n", a->event_mask); + fprintf(fout, "tid: %" PRId32 "\n", a->tid); + fprintf(fout, "state: 0x%" PRIx8 "\n", a->state); + fprintf(fout, "wnd_number: %" PRIu8 "\n", a->wnd_number); fprintf(fout, "terminate_protection: %u\n", a->terminate_protection); fprintf(fout, "keyboard_mode: %u\n", a->keyboard_mode); fprintf(fout, "captionEncoding: %u\n", a->captionEncoding); @@ -626,26 +629,6 @@ shell_dump_appdata(int argc, char **argv) { (appdata_t*)a->in_schedule.next - kos_slot_base); } -static void -shell_dump_taskdata(int argc, char **argv) { - const char *usage = \ - "usage: dump_taskdata \n" - " index index into taskdata array to dump"; - if (argc < 2) { - fputs(usage, fout); - return; - } - int idx = strtol(argv[1], NULL, 0); - taskdata_t *t = kos_task_table + idx; - fprintf(fout, "event_mask: %" PRIx32 "\n", t->event_mask); - fprintf(fout, "pid: %" PRId32 "\n", t->pid); - fprintf(fout, "state: 0x%" PRIx8 "\n", t->state); - fprintf(fout, "wnd_number: %" PRIu8 "\n", t->wnd_number); - fprintf(fout, "counter_sum: %" PRIu32 "\n", t->counter_sum); - fprintf(fout, "counter_add: %" PRIu32 "\n", t->counter_add); - fprintf(fout, "cpu_usage: %" PRIu32 "\n", t->cpu_usage); -} - static void shell_switch_to_thread(int argc, char **argv) { const char *usage = \ @@ -657,7 +640,6 @@ shell_switch_to_thread(int argc, char **argv) { } 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; } @@ -2744,7 +2726,6 @@ func_table_t shell_cmds[] = { { "draw_rect", shell_draw_rect }, { "draw_window", shell_draw_window }, { "dump_appdata", shell_dump_appdata }, - { "dump_taskdata", shell_dump_taskdata }, { "dump_win_pos", shell_dump_win_pos }, { "dump_win_stack", shell_dump_win_stack }, { "dump_win_map", shell_dump_win_map }, diff --git a/test/016_#f01_#draw_all.ref.log b/test/016_#f01_#draw_all.ref.log index 0415afe..a021a8a 100644 --- a/test/016_#f01_#draw_all.ref.log +++ b/test/016_#f01_#draw_all.ref.log @@ -49,14 +49,6 @@ font smoothing: 0 - off /> dump_win_pos 2 0: 0 1: 1 -/> dump_taskdata 2 -event_mask: 0 -pid: 2 -state: 0x0 -wnd_number: 2 -counter_sum: 0 -counter_add: 0 -cpu_usage: 0 /> dump_appdata 2 app_name: OS except_mask: 0 @@ -65,6 +57,9 @@ cur_dir: draw_bgr_x: 0 draw_bgr_y: 0 event_mask: 0 +tid: 2 +state: 0x0 +wnd_number: 2 terminate_protection: 1 keyboard_mode: 0 captionEncoding: 0 diff --git a/test/016_#f01_#draw_all.t b/test/016_#f01_#draw_all.t index 1b8c72b..7f67c9e 100644 --- a/test/016_#f01_#draw_all.t +++ b/test/016_#f01_#draw_all.t @@ -31,7 +31,6 @@ set_window_colors 0 0 0 0 0 0 0 0 0 0 dump_win_stack 2 dump_win_pos 2 -dump_taskdata 2 dump_appdata 2 process_info -1 diff --git a/test/makefile b/test/makefile index d6b3dde..572f701 100644 --- a/test/makefile +++ b/test/makefile @@ -1,3 +1,7 @@ +ifndef HOST + $(error "Set HOST variable to linux/windows") +endif + ifndef COVERAGE UMKA_SHELL ?= ../umka_shell else diff --git a/umka.asm b/umka.asm index 1184627..3b871f9 100644 --- a/umka.asm +++ b/umka.asm @@ -103,9 +103,6 @@ pubsym current_slot, 'kos_current_slot' pubsym current_slot_idx, 'kos_current_slot_idx' pubsym thread_count, 'kos_thread_count' -pubsym TASK_TABLE, 'kos_task_table' -pubsym TASK_BASE, 'kos_task_base' -pubsym TASK_DATA, 'kos_task_data' pubsym SLOT_BASE, 'kos_slot_base' pubsym window_data, 'kos_window_data' @@ -214,9 +211,6 @@ include 'struct.inc' macro BOOT_LO a {} macro BOOT a {} window_data equ __pew01 -TASK_TABLE equ __pew02 -TASK_BASE equ __pew03 -TASK_DATA equ __pew04 CDDataBuf equ __pew06 idts equ __pew07 WIN_STACK equ __pew08 @@ -239,8 +233,7 @@ HEAP_BASE equ __pew23 ;} include 'const.inc' restore window_data -restore TASK_TABLE -restore TASK_BASE,TASK_DATA,CDDataBuf,idts,WIN_STACK,WIN_POS +restore CDDataBuf,idts,WIN_STACK,WIN_POS restore FDD_BUFF,WIN_TEMP_XY,KEY_COUNT,KEY_BUFF,BTN_COUNT,BTN_BUFF,BTN_ADDR restore MEM_AMOUNT,SYS_SHUTDOWN,SLOT_BASE,sys_proc,VGABasePtr restore HEAP_BASE @@ -256,20 +249,6 @@ macro restore_ring3_context { popad } -macro add r, v { - if v eq TASK_TABLE - (SLOT_BASE shr 3) - push r - mov r, SLOT_BASE - shr r, 3 - neg r - add r, TASK_TABLE - add esp, 4 - add r, [esp-4] - else - add r, v - end if -} - macro stdcall target, [args] { common if target eq is_region_userspace @@ -291,22 +270,10 @@ macro call target { call target end if } -;macro mov r, v { -; if r eq byte [current_slot_idx] & v eq bh -; push eax -; mov eax, ebx -; sub eax, SLOT_BASE -; shr eax, BSF sizeof.APPDATA -; mov [current_slot_idx], eax -; pop eax -; else -; mov r, v -; end if -;} do_change_task equ hjk irq0 equ jhg include 'core/sched.inc' -purge call, mov +purge call restore irq0 include 'core/syscall.inc' ;include 'core/fpu.inc' @@ -316,6 +283,15 @@ include 'core/heap.inc' include 'core/malloc.inc' include 'core/taskman.inc' include 'core/dll.inc' +macro call target { + if target eq pci_read_reg + call _pci_read_reg + else + call target + end if +} +include 'bus/pci/pci32.inc' +purge call ;include 'core/peload.inc' ;include 'core/exports.inc' include 'core/string.inc' @@ -343,10 +319,11 @@ include 'gui/font.inc' include 'gui/button.inc' include 'gui/mouse.inc' include 'gui/skincode.inc' +include 'gui/background.inc' include 'hid/keyboard.inc' include 'hid/mousedrv.inc' -;include 'hid/set_dtc.inc' ; setting date,time,clock and alarm-clock +include 'hid/set_dtc.inc' ; setting date,time,clock and alarm-clock include 'sound/playnote.inc' @@ -619,7 +596,7 @@ proc umka_init c uses ebx esi edi ebp add eax, RING0_STACK_SIZE stdcall kernel_alloc, eax mov ebx, eax - mov edx, SLOT_BASE+256*2 + mov edx, SLOT_BASE+sizeof.APPDATA*2 call setup_os_slot mov dword[edx], 'OS' sub [edx+APPDATA.saved_esp], 4 @@ -630,9 +607,8 @@ proc umka_init c uses ebx esi edi ebp mov [current_slot_idx], 2 mov [thread_count], 2 - mov dword[TASK_BASE], TASK_TABLE + 2*sizeof.TASKDATA mov [current_slot], SLOT_BASE+2*sizeof.APPDATA - mov [TASK_TABLE + 2*sizeof.TASKDATA + TASKDATA.pid], 2 + mov [SLOT_BASE + 2*sizeof.APPDATA + APPDATA.tid], 2 call set_window_defaults call init_background @@ -668,7 +644,7 @@ proc idle uses ebx esi edi endp extrn pci_read, 20 -proc pci_read_reg uses ebx esi edi +proc _pci_read_reg uses ebx esi edi mov ecx, eax and ecx, 3 movi edx, 1 @@ -798,7 +774,6 @@ allow_medium_removal: EjectMedium: save_image: init_sys_v86: -pci_enum: load_pe_driver: usb_init: fdc_init: @@ -820,12 +795,8 @@ init_fpu: init_mtrr: create_trampoline_pgmap: alloc_page: -pci_write_reg: -sys_settime: -sys_pcibios: sys_IPC: -pci_api: sys_resize_app_memory: f68: v86_irq: @@ -879,20 +850,10 @@ macro pew x {inclu#de `x} macro org x {} macro format [x] {} -macro lea r, v { - if v eq [(ecx-(TASK_TABLE and 1FFFFFFFh)-TASKDATA.state)*8+SLOT_BASE] - int3 - else if v eq [(edx-(TASK_TABLE and 1FFFFFFFh))*8+SLOT_BASE] - int3 - else - lea r, v - end if -} - include 'kernel.asm' -purge lea,add,org,mov -restore lea,add,org,mov +purge org,mov +restore add,org,mov purge sys_msg_board,delay_ms restore sys_msg_board,delay_ms @@ -921,9 +882,6 @@ uglobal align 64 os_base: rb PAGE_SIZE window_data: rb sizeof.WDATA * 256 -TASK_TABLE: rb 16 -TASK_BASE: rd 4 -TASK_DATA: rd sizeof.TASKDATA * 255 / 4 CDDataBuf: rb 0x1000 idts rb IRQ_RESERVED * 8 ; IDT descriptor is 8 bytes long WIN_STACK rw 0x200 ; why not 0x100? diff --git a/umka.h b/umka.h index ca4cbda..e13d703 100644 --- a/umka.h +++ b/umka.h @@ -787,7 +787,8 @@ typedef struct { uint32_t draw_bgr_x; // +116 uint32_t draw_bgr_y; // +120 uint8_t state; // +124 - uint8_t pad2[3]; // +125 + uint8_t wnd_number; // +125 + uint8_t pad2[2]; // +126 uint8_t *wnd_shape; // +128 uint32_t wnd_shape_scale; // +132 uint32_t mem_start; // +136 @@ -815,23 +816,6 @@ typedef struct { _Static_assert(sizeof(appdata_t) == 256, "must be 0x100 bytes long"); -typedef struct { - uint32_t event_mask; - uint32_t pid; - uint16_t pad1; - uint8_t state; - uint8_t pad2; - uint16_t pad3; - uint8_t wnd_number; - uint8_t pad4; - uint32_t mem_start; - uint32_t counter_sum; - uint32_t counter_add; - uint32_t cpu_usage; -} taskdata_t; - -_Static_assert(sizeof(taskdata_t) == 32, "must be 0x20 bytes long"); - #define UMKA_SHELL 1u #define UMKA_FUSE 2u #define UMKA_OS 3u @@ -847,9 +831,7 @@ extern uint32_t umka_tool; extern uint32_t umka_initialized; extern uint8_t kos_redraw_background; extern size_t kos_task_count; -extern taskdata_t *kos_task_base; extern wdata_t kos_window_data[]; -extern taskdata_t kos_task_table[]; extern appdata_t kos_slot_base[]; extern uint32_t kos_current_process; extern appdata_t *kos_current_slot; @@ -891,7 +873,7 @@ umka_scheduler_add_thread(appdata_t *thread, int32_t priority) { typedef struct { appdata_t *appdata; - taskdata_t *taskdata; + void *taskdata; int same; } find_next_task_t;