Support different framebuffer formats, add tests
This commit is contained in:
parent
d8ce095598
commit
e03ae18548
10
README
10
README
@ -103,12 +103,6 @@ Testing
|
|||||||
Troubleshooting
|
Troubleshooting
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
# umka_monitor
|
|
||||||
|
|
||||||
Allow reading process_vm_readv syscall.
|
|
||||||
|
|
||||||
# sysctl -w kernel.yama.ptrace_scope=0
|
|
||||||
|
|
||||||
# umka_os
|
# umka_os
|
||||||
|
|
||||||
To create tap devices.
|
To create tap devices.
|
||||||
@ -119,6 +113,10 @@ To load apps at 0 address.
|
|||||||
|
|
||||||
# sysctl -w vm.mmap_min_addr=0
|
# sysctl -w vm.mmap_min_addr=0
|
||||||
|
|
||||||
|
Allow reading process_vm_readv syscall.
|
||||||
|
|
||||||
|
# sysctl -w kernel.yama.ptrace_scope=0
|
||||||
|
|
||||||
|
|
||||||
Links & Acknowledgements
|
Links & Acknowledgements
|
||||||
------------------------
|
------------------------
|
||||||
|
@ -16,7 +16,7 @@ sigset_t mask;
|
|||||||
|
|
||||||
void reset_procmask(void) {
|
void reset_procmask(void) {
|
||||||
sigemptyset (&mask);
|
sigemptyset (&mask);
|
||||||
sigaddset (&mask, SIGPROF);
|
sigaddset (&mask, SIGALRM);
|
||||||
sigprocmask(SIG_UNBLOCK, &mask, NULL);
|
sigprocmask(SIG_UNBLOCK, &mask, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
makefile
12
makefile
@ -69,10 +69,7 @@ umka_fuse: umka_fuse.o umka.o trace.o trace_lbr.o vdisk.o vdisk/raw.o \
|
|||||||
umka_os: umka_os.o umka.o shell.o lodepng.o vdisk.o vdisk/raw.o vdisk/qcow2.o \
|
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 \
|
vdisk/miniz/miniz.a vnet.o trace.o trace_lbr.o $(HOST)/pci.o \
|
||||||
$(HOST)/thread.o io.o $(HOST)/io_async.o util.o bestline32.o optparse32.o
|
$(HOST)/thread.o io.o $(HOST)/io_async.o util.o bestline32.o optparse32.o
|
||||||
$(CC) $(LDFLAGS_32) `sdl2-config --libs` -lpthread $^ -o $@ -T umka.ld
|
$(CC) $(LDFLAGS_32) `sdl2-config --libs` $^ -o $@ -T umka.ld
|
||||||
|
|
||||||
#umka_monitor: umka_monitor.o optparse.o bestline.o
|
|
||||||
# $(CC) $(LDFLAGS) `sdl2-config --libs` $^ -o $@
|
|
||||||
|
|
||||||
umka_gen_devices_dat: umka_gen_devices_dat.o umka.o $(HOST)/pci.o \
|
umka_gen_devices_dat: umka_gen_devices_dat.o umka.o $(HOST)/pci.o \
|
||||||
$(HOST)/thread.o util.o
|
$(HOST)/thread.o util.o
|
||||||
@ -100,10 +97,10 @@ lodepng.o: lodepng.c lodepng.h
|
|||||||
$(CC) $(CFLAGS_32) -c $<
|
$(CC) $(CFLAGS_32) -c $<
|
||||||
|
|
||||||
bestline32.o: bestline.c bestline.h
|
bestline32.o: bestline.c bestline.h
|
||||||
$(CC) $(CFLAGS_32) -U_POSIX_C_SOURCE -Wno-logical-op -Wno-switch-enum -c $< -o $@
|
$(CC) $(CFLAGS_32) -Wno-logical-op -Wno-switch-enum -c $< -o $@
|
||||||
|
|
||||||
bestline.o: bestline.c bestline.h
|
bestline.o: bestline.c bestline.h
|
||||||
$(CC) $(CFLAGS) -U_POSIX_C_SOURCE -Wno-logical-op -Wno-switch-enum -c $< -o $@
|
$(CC) $(CFLAGS) -Wno-logical-op -Wno-switch-enum -c $< -o $@
|
||||||
|
|
||||||
optparse32.o: optparse.c optparse.h
|
optparse32.o: optparse.c optparse.h
|
||||||
$(CC) $(CFLAGS_32) -c $< -o $@
|
$(CC) $(CFLAGS_32) -c $< -o $@
|
||||||
@ -174,9 +171,6 @@ umka_fuse.o: umka_fuse.c umka.h
|
|||||||
umka_os.o: umka_os.c umka.h umka_os.h
|
umka_os.o: umka_os.c umka.h umka_os.h
|
||||||
$(CC) $(CFLAGS_32) `sdl2-config --cflags` -c $<
|
$(CC) $(CFLAGS_32) `sdl2-config --cflags` -c $<
|
||||||
|
|
||||||
#umka_monitor.o: umka_monitor.c umka_os.h
|
|
||||||
# $(CC) $(CFLAGS) `sdl2-config --cflags` -c $< -D_GNU_SOURCE
|
|
||||||
|
|
||||||
umka_gen_devices_dat.o: umka_gen_devices_dat.c umka.h
|
umka_gen_devices_dat.o: umka_gen_devices_dat.c umka.h
|
||||||
$(CC) $(CFLAGS_32) -c $<
|
$(CC) $(CFLAGS_32) -c $<
|
||||||
|
|
||||||
|
4
shell.h
4
shell.h
@ -38,11 +38,13 @@ struct shell_ctx {
|
|||||||
int reproducible;
|
int reproducible;
|
||||||
const char *hist_file;
|
const char *hist_file;
|
||||||
struct shell_var *var;
|
struct shell_var *var;
|
||||||
|
FILE *fin;
|
||||||
|
FILE *fout;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct shell_ctx *
|
struct shell_ctx *
|
||||||
shell_init(int reproducible, const char *hist_file, struct umka_ctx *umka,
|
shell_init(int reproducible, const char *hist_file, struct umka_ctx *umka,
|
||||||
struct umka_io *io);
|
struct umka_io *io, FILE *fin, FILE *fout);
|
||||||
|
|
||||||
void
|
void
|
||||||
shell_close(struct shell_ctx *shell);
|
shell_close(struct shell_ctx *shell);
|
||||||
|
15
test/065_#board_all.ref.log
Normal file
15
test/065_#board_all.ref.log
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/> umka_boot
|
||||||
|
/> board_get
|
||||||
|
(empty)
|
||||||
|
/> board_put d
|
||||||
|
/> board_get
|
||||||
|
d
|
||||||
|
/> board_get
|
||||||
|
(empty)
|
||||||
|
/>
|
||||||
|
/> board_put h
|
||||||
|
/> board_put i
|
||||||
|
/> board_get -ln
|
||||||
|
hi
|
||||||
|
/>
|
||||||
|
/> board_get -l
|
11
test/065_#board_all.t
Normal file
11
test/065_#board_all.t
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
umka_boot
|
||||||
|
board_get
|
||||||
|
board_put d
|
||||||
|
board_get
|
||||||
|
board_get
|
||||||
|
|
||||||
|
board_put h
|
||||||
|
board_put i
|
||||||
|
board_get -ln
|
||||||
|
|
||||||
|
board_get -l
|
117
test/066_#f01_#draw_#draw16bit_all.ref.log
Normal file
117
test/066_#f01_#draw_#draw16bit_all.ref.log
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
/> umka_set_boot_params --bpp 16
|
||||||
|
/> umka_boot
|
||||||
|
/> set_mouse_pos_screen 40 30
|
||||||
|
/> #disk_add ../img/kolibri.raw rd -c 0
|
||||||
|
/> 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)
|
||||||
|
/> set_skin /sys/DEFAULT.SKN
|
||||||
|
status: 0
|
||||||
|
/> window_redraw 1
|
||||||
|
/> draw_window 10 300 5 200 0x000088 1 1 1 0 1 4 hello
|
||||||
|
/> set_pixel 0 0 0x0000ff
|
||||||
|
/> set_pixel 1 1 0xff0000
|
||||||
|
/> set_pixel 2 2 0x00ff00
|
||||||
|
/> draw_line 10 510 10 510 0xff0000
|
||||||
|
/> draw_rect 60 20 30 20 0x00ff00
|
||||||
|
/> put_image chess_image.rgb 8 8 5 15
|
||||||
|
/> put_image_palette chess_image.rgb 12 12 5 30 9 0
|
||||||
|
/> write_text 10 70 0xffff00 hello 0 0 0 0 0 5 0
|
||||||
|
/> set_button_style 0
|
||||||
|
/> button 55 40 5 20 0xc0ffee 0xffffff 1 0
|
||||||
|
/> set_button_style 1
|
||||||
|
/> button 100 40 5 20 0xc1ffee 0xffffff 1 0
|
||||||
|
/> display_number 0 10 4 0 0 1234 5 45 0xffff00 1 1 0 0 0x0000ff
|
||||||
|
/> blit_bitmap chess_image.rgba 20 35 8 8 0 0 8 8 0 0 0 1 32
|
||||||
|
/> window_redraw 2
|
||||||
|
/>
|
||||||
|
/> set_window_caption hi_there 0
|
||||||
|
/>
|
||||||
|
/> get_font_smoothing
|
||||||
|
font smoothing: 2 - subpixel
|
||||||
|
/> set_font_smoothing 0
|
||||||
|
/> get_font_smoothing
|
||||||
|
font smoothing: 0 - off
|
||||||
|
/>
|
||||||
|
/> get_window_colors
|
||||||
|
0x00586786 frame
|
||||||
|
0x00fefefe grab
|
||||||
|
0x00c5bdb9 work_3d_dark
|
||||||
|
0x00f2efec work_3d_light
|
||||||
|
0x00333333 grab_text
|
||||||
|
0x00ddd7cf work
|
||||||
|
0x007887a6 work_button
|
||||||
|
0x00fefefe work_button_text
|
||||||
|
0x00000000 work_text
|
||||||
|
0x007e7e7e work_graph
|
||||||
|
/> set_window_colors 0 0 0 0 0 0 0 0 0 0
|
||||||
|
/>
|
||||||
|
/> dump_win_stack 2
|
||||||
|
0: 0
|
||||||
|
1: 1
|
||||||
|
/> dump_win_pos 2
|
||||||
|
0: 0
|
||||||
|
1: 1
|
||||||
|
/> dump_appdata 2
|
||||||
|
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
|
||||||
|
wnd_number: 2
|
||||||
|
terminate_protection: 1
|
||||||
|
keyboard_mode: 0
|
||||||
|
captionEncoding: 0
|
||||||
|
exec_params: (null)
|
||||||
|
wnd_caption:
|
||||||
|
wnd_clientbox (ltwh): 5 24 291 172
|
||||||
|
priority: 0
|
||||||
|
in_schedule: prev (2), next (2)
|
||||||
|
/>
|
||||||
|
/> process_info -1
|
||||||
|
cpu_usage: 0
|
||||||
|
window_stack_position: 2
|
||||||
|
window_stack_value: 2
|
||||||
|
process_name: OS
|
||||||
|
memory_start: 0x00000000
|
||||||
|
used_memory: 4294967295 (0xffffffff)
|
||||||
|
pid: 2
|
||||||
|
box: 10 5 300 200
|
||||||
|
slot_state: 0
|
||||||
|
client_box: 5 24 291 172
|
||||||
|
wnd_state: 0x00
|
||||||
|
/> get_skin_height
|
||||||
|
24
|
||||||
|
/> get_screen_area
|
||||||
|
0 left
|
||||||
|
0 top
|
||||||
|
399 right
|
||||||
|
299 bottom
|
||||||
|
/> set_screen_area 0 20 350 250
|
||||||
|
/> get_screen_area
|
||||||
|
0 left
|
||||||
|
20 top
|
||||||
|
350 right
|
||||||
|
250 bottom
|
||||||
|
/> get_skin_margins
|
||||||
|
6 left
|
||||||
|
5 top
|
||||||
|
65 right
|
||||||
|
3 bottom
|
||||||
|
/>
|
||||||
|
/> get_font_size
|
||||||
|
0px
|
||||||
|
/> set_font_size 16
|
||||||
|
/> get_font_size
|
||||||
|
16px
|
||||||
|
/>
|
||||||
|
/> get_screen_size
|
||||||
|
400x300
|
||||||
|
/>
|
||||||
|
/> scrot 066_#f01_#draw_#draw16bit_all.out.png
|
||||||
|
/>
|
||||||
|
/> disk_del rd
|
BIN
test/066_#f01_#draw_#draw16bit_all.ref.png
Normal file
BIN
test/066_#f01_#draw_#draw16bit_all.ref.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
53
test/066_#f01_#draw_#draw16bit_all.t
Normal file
53
test/066_#f01_#draw_#draw16bit_all.t
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
umka_set_boot_params --bpp 16
|
||||||
|
umka_boot
|
||||||
|
set_mouse_pos_screen 40 30
|
||||||
|
#disk_add ../img/kolibri.raw rd -c 0
|
||||||
|
ramdisk_init ../img/kolibri.raw
|
||||||
|
set_skin /sys/DEFAULT.SKN
|
||||||
|
window_redraw 1
|
||||||
|
draw_window 10 300 5 200 0x000088 1 1 1 0 1 4 hello
|
||||||
|
set_pixel 0 0 0x0000ff
|
||||||
|
set_pixel 1 1 0xff0000
|
||||||
|
set_pixel 2 2 0x00ff00
|
||||||
|
draw_line 10 510 10 510 0xff0000
|
||||||
|
draw_rect 60 20 30 20 0x00ff00
|
||||||
|
put_image chess_image.rgb 8 8 5 15
|
||||||
|
put_image_palette chess_image.rgb 12 12 5 30 9 0
|
||||||
|
write_text 10 70 0xffff00 hello 0 0 0 0 0 5 0
|
||||||
|
set_button_style 0
|
||||||
|
button 55 40 5 20 0xc0ffee 0xffffff 1 0
|
||||||
|
set_button_style 1
|
||||||
|
button 100 40 5 20 0xc1ffee 0xffffff 1 0
|
||||||
|
display_number 0 10 4 0 0 1234 5 45 0xffff00 1 1 0 0 0x0000ff
|
||||||
|
blit_bitmap chess_image.rgba 20 35 8 8 0 0 8 8 0 0 0 1 32
|
||||||
|
window_redraw 2
|
||||||
|
|
||||||
|
set_window_caption hi_there 0
|
||||||
|
|
||||||
|
get_font_smoothing
|
||||||
|
set_font_smoothing 0
|
||||||
|
get_font_smoothing
|
||||||
|
|
||||||
|
get_window_colors
|
||||||
|
set_window_colors 0 0 0 0 0 0 0 0 0 0
|
||||||
|
|
||||||
|
dump_win_stack 2
|
||||||
|
dump_win_pos 2
|
||||||
|
dump_appdata 2
|
||||||
|
|
||||||
|
process_info -1
|
||||||
|
get_skin_height
|
||||||
|
get_screen_area
|
||||||
|
set_screen_area 0 20 350 250
|
||||||
|
get_screen_area
|
||||||
|
get_skin_margins
|
||||||
|
|
||||||
|
get_font_size
|
||||||
|
set_font_size 16
|
||||||
|
get_font_size
|
||||||
|
|
||||||
|
get_screen_size
|
||||||
|
|
||||||
|
scrot 066_#f01_#draw_#draw16bit_all.out.png
|
||||||
|
|
||||||
|
disk_del rd
|
117
test/067_#f01_#draw_#draw24bit_all.ref.log
Normal file
117
test/067_#f01_#draw_#draw24bit_all.ref.log
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
/> umka_set_boot_params --bpp 24
|
||||||
|
/> umka_boot
|
||||||
|
/> set_mouse_pos_screen 40 30
|
||||||
|
/> #disk_add ../img/kolibri.raw rd -c 0
|
||||||
|
/> 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)
|
||||||
|
/> set_skin /sys/DEFAULT.SKN
|
||||||
|
status: 0
|
||||||
|
/> window_redraw 1
|
||||||
|
/> draw_window 10 300 5 200 0x000088 1 1 1 0 1 4 hello
|
||||||
|
/> set_pixel 0 0 0x0000ff
|
||||||
|
/> set_pixel 1 1 0xff0000
|
||||||
|
/> set_pixel 2 2 0x00ff00
|
||||||
|
/> draw_line 10 510 10 510 0xff0000
|
||||||
|
/> draw_rect 60 20 30 20 0x00ff00
|
||||||
|
/> put_image chess_image.rgb 8 8 5 15
|
||||||
|
/> put_image_palette chess_image.rgb 12 12 5 30 9 0
|
||||||
|
/> write_text 10 70 0xffff00 hello 0 0 0 0 0 5 0
|
||||||
|
/> set_button_style 0
|
||||||
|
/> button 55 40 5 20 0xc0ffee 0xffffff 1 0
|
||||||
|
/> set_button_style 1
|
||||||
|
/> button 100 40 5 20 0xc1ffee 0xffffff 1 0
|
||||||
|
/> display_number 0 10 4 0 0 1234 5 45 0xffff00 1 1 0 0 0x0000ff
|
||||||
|
/> blit_bitmap chess_image.rgba 20 35 8 8 0 0 8 8 0 0 0 1 32
|
||||||
|
/> window_redraw 2
|
||||||
|
/>
|
||||||
|
/> set_window_caption hi_there 0
|
||||||
|
/>
|
||||||
|
/> get_font_smoothing
|
||||||
|
font smoothing: 2 - subpixel
|
||||||
|
/> set_font_smoothing 0
|
||||||
|
/> get_font_smoothing
|
||||||
|
font smoothing: 0 - off
|
||||||
|
/>
|
||||||
|
/> get_window_colors
|
||||||
|
0x00586786 frame
|
||||||
|
0x00fefefe grab
|
||||||
|
0x00c5bdb9 work_3d_dark
|
||||||
|
0x00f2efec work_3d_light
|
||||||
|
0x00333333 grab_text
|
||||||
|
0x00ddd7cf work
|
||||||
|
0x007887a6 work_button
|
||||||
|
0x00fefefe work_button_text
|
||||||
|
0x00000000 work_text
|
||||||
|
0x007e7e7e work_graph
|
||||||
|
/> set_window_colors 0 0 0 0 0 0 0 0 0 0
|
||||||
|
/>
|
||||||
|
/> dump_win_stack 2
|
||||||
|
0: 0
|
||||||
|
1: 1
|
||||||
|
/> dump_win_pos 2
|
||||||
|
0: 0
|
||||||
|
1: 1
|
||||||
|
/> dump_appdata 2
|
||||||
|
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
|
||||||
|
wnd_number: 2
|
||||||
|
terminate_protection: 1
|
||||||
|
keyboard_mode: 0
|
||||||
|
captionEncoding: 0
|
||||||
|
exec_params: (null)
|
||||||
|
wnd_caption:
|
||||||
|
wnd_clientbox (ltwh): 5 24 291 172
|
||||||
|
priority: 0
|
||||||
|
in_schedule: prev (2), next (2)
|
||||||
|
/>
|
||||||
|
/> process_info -1
|
||||||
|
cpu_usage: 0
|
||||||
|
window_stack_position: 2
|
||||||
|
window_stack_value: 2
|
||||||
|
process_name: OS
|
||||||
|
memory_start: 0x00000000
|
||||||
|
used_memory: 4294967295 (0xffffffff)
|
||||||
|
pid: 2
|
||||||
|
box: 10 5 300 200
|
||||||
|
slot_state: 0
|
||||||
|
client_box: 5 24 291 172
|
||||||
|
wnd_state: 0x00
|
||||||
|
/> get_skin_height
|
||||||
|
24
|
||||||
|
/> get_screen_area
|
||||||
|
0 left
|
||||||
|
0 top
|
||||||
|
399 right
|
||||||
|
299 bottom
|
||||||
|
/> set_screen_area 0 20 350 250
|
||||||
|
/> get_screen_area
|
||||||
|
0 left
|
||||||
|
20 top
|
||||||
|
350 right
|
||||||
|
250 bottom
|
||||||
|
/> get_skin_margins
|
||||||
|
6 left
|
||||||
|
5 top
|
||||||
|
65 right
|
||||||
|
3 bottom
|
||||||
|
/>
|
||||||
|
/> get_font_size
|
||||||
|
0px
|
||||||
|
/> set_font_size 16
|
||||||
|
/> get_font_size
|
||||||
|
16px
|
||||||
|
/>
|
||||||
|
/> get_screen_size
|
||||||
|
400x300
|
||||||
|
/>
|
||||||
|
/> scrot 067_#f01_#draw_#draw24bit_all.out.png
|
||||||
|
/>
|
||||||
|
/> disk_del rd
|
BIN
test/067_#f01_#draw_#draw24bit_all.ref.png
Normal file
BIN
test/067_#f01_#draw_#draw24bit_all.ref.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
53
test/067_#f01_#draw_#draw24bit_all.t
Normal file
53
test/067_#f01_#draw_#draw24bit_all.t
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
umka_set_boot_params --bpp 24
|
||||||
|
umka_boot
|
||||||
|
set_mouse_pos_screen 40 30
|
||||||
|
#disk_add ../img/kolibri.raw rd -c 0
|
||||||
|
ramdisk_init ../img/kolibri.raw
|
||||||
|
set_skin /sys/DEFAULT.SKN
|
||||||
|
window_redraw 1
|
||||||
|
draw_window 10 300 5 200 0x000088 1 1 1 0 1 4 hello
|
||||||
|
set_pixel 0 0 0x0000ff
|
||||||
|
set_pixel 1 1 0xff0000
|
||||||
|
set_pixel 2 2 0x00ff00
|
||||||
|
draw_line 10 510 10 510 0xff0000
|
||||||
|
draw_rect 60 20 30 20 0x00ff00
|
||||||
|
put_image chess_image.rgb 8 8 5 15
|
||||||
|
put_image_palette chess_image.rgb 12 12 5 30 9 0
|
||||||
|
write_text 10 70 0xffff00 hello 0 0 0 0 0 5 0
|
||||||
|
set_button_style 0
|
||||||
|
button 55 40 5 20 0xc0ffee 0xffffff 1 0
|
||||||
|
set_button_style 1
|
||||||
|
button 100 40 5 20 0xc1ffee 0xffffff 1 0
|
||||||
|
display_number 0 10 4 0 0 1234 5 45 0xffff00 1 1 0 0 0x0000ff
|
||||||
|
blit_bitmap chess_image.rgba 20 35 8 8 0 0 8 8 0 0 0 1 32
|
||||||
|
window_redraw 2
|
||||||
|
|
||||||
|
set_window_caption hi_there 0
|
||||||
|
|
||||||
|
get_font_smoothing
|
||||||
|
set_font_smoothing 0
|
||||||
|
get_font_smoothing
|
||||||
|
|
||||||
|
get_window_colors
|
||||||
|
set_window_colors 0 0 0 0 0 0 0 0 0 0
|
||||||
|
|
||||||
|
dump_win_stack 2
|
||||||
|
dump_win_pos 2
|
||||||
|
dump_appdata 2
|
||||||
|
|
||||||
|
process_info -1
|
||||||
|
get_skin_height
|
||||||
|
get_screen_area
|
||||||
|
set_screen_area 0 20 350 250
|
||||||
|
get_screen_area
|
||||||
|
get_skin_margins
|
||||||
|
|
||||||
|
get_font_size
|
||||||
|
set_font_size 16
|
||||||
|
get_font_size
|
||||||
|
|
||||||
|
get_screen_size
|
||||||
|
|
||||||
|
scrot 067_#f01_#draw_#draw24bit_all.out.png
|
||||||
|
|
||||||
|
disk_del rd
|
19
umka.asm
19
umka.asm
@ -186,6 +186,9 @@ pubsym Wait_events, "_kos_wait_events"
|
|||||||
pubsym window._.set_screen, 'kos_window_set_screen'
|
pubsym window._.set_screen, 'kos_window_set_screen'
|
||||||
pubsym _display, 'kos_display'
|
pubsym _display, 'kos_display'
|
||||||
|
|
||||||
|
pubsym msg_board_data, "kos_msg_board_data"
|
||||||
|
pubsym msg_board_count, "kos_msg_board_count"
|
||||||
|
|
||||||
pubsym BOOT, 'kos_boot'
|
pubsym BOOT, 'kos_boot'
|
||||||
|
|
||||||
EFLAGS.ID = 1 SHL 21
|
EFLAGS.ID = 1 SHL 21
|
||||||
@ -837,7 +840,7 @@ proc _page_fault_handler
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
proc sys_msg_board
|
proc s2ys_msg_board
|
||||||
cmp cl, 0x0d
|
cmp cl, 0x0d
|
||||||
jz @f
|
jz @f
|
||||||
if HOST eq windows
|
if HOST eq windows
|
||||||
@ -885,7 +888,7 @@ extrn reset_procmask
|
|||||||
extrn get_fake_if
|
extrn get_fake_if
|
||||||
pubsym irq0
|
pubsym irq0
|
||||||
proc irq0 c, _signo, _info, _context
|
proc irq0 c, _signo, _info, _context
|
||||||
DEBUGF 2, "### irq0\n"
|
DEBUGF 1, "### irq0\n"
|
||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
pushad
|
pushad
|
||||||
@ -896,7 +899,7 @@ proc irq0 c, _signo, _info, _context
|
|||||||
ccall get_fake_if, [_context]
|
ccall get_fake_if, [_context]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz @f
|
jnz @f
|
||||||
DEBUGF 2, "### cli\n"
|
DEBUGF 1, "### cli\n"
|
||||||
jmp .done
|
jmp .done
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
@ -917,7 +920,7 @@ proc _do_change_task
|
|||||||
mov ecx, ebx
|
mov ecx, ebx
|
||||||
sub ecx, SLOT_BASE
|
sub ecx, SLOT_BASE
|
||||||
shr ecx, 8
|
shr ecx, 8
|
||||||
DEBUGF 2, "### switching task from %d to %d\n",eax,ecx
|
DEBUGF 1, "### switching task from %d to %d\n",eax,ecx
|
||||||
|
|
||||||
mov esi, ebx
|
mov esi, ebx
|
||||||
xchg esi, [current_slot]
|
xchg esi, [current_slot]
|
||||||
@ -1020,7 +1023,7 @@ acpi_root dd ?
|
|||||||
acpi_dev_next dd ?
|
acpi_dev_next dd ?
|
||||||
endg
|
endg
|
||||||
|
|
||||||
sys_msg_board equ __pex0
|
;sys_msg_board equ __pex0
|
||||||
delay_ms equ __pex1
|
delay_ms equ __pex1
|
||||||
|
|
||||||
include fix pew
|
include fix pew
|
||||||
@ -1043,8 +1046,10 @@ macro jmp target {
|
|||||||
include 'kernel.asm'
|
include 'kernel.asm'
|
||||||
purge jmp
|
purge jmp
|
||||||
restore bios32_entry, tmp_page_tabs
|
restore bios32_entry, tmp_page_tabs
|
||||||
purge org,sys_msg_board,delay_ms
|
purge org,delay_ms
|
||||||
restore org,sys_msg_board,delay_ms
|
;purge sys_msg_board
|
||||||
|
restore org,delay_ms
|
||||||
|
;restore sys_msg_board
|
||||||
|
|
||||||
coverage_end:
|
coverage_end:
|
||||||
|
|
||||||
|
34
umka.h
34
umka.h
@ -222,6 +222,11 @@ typedef struct {
|
|||||||
uint32_t count;
|
uint32_t count;
|
||||||
} mutex_t;
|
} mutex_t;
|
||||||
|
|
||||||
|
struct board_get_ret {
|
||||||
|
uint32_t value;
|
||||||
|
uint32_t status;
|
||||||
|
};
|
||||||
|
|
||||||
typedef mutex_t rwsem_t;
|
typedef mutex_t rwsem_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -542,7 +547,7 @@ void
|
|||||||
irq0(int signo, siginfo_t *info, void *context);
|
irq0(int signo, siginfo_t *info, void *context);
|
||||||
|
|
||||||
struct umka_ctx *
|
struct umka_ctx *
|
||||||
umka_init(int tool);
|
umka_init(void);
|
||||||
|
|
||||||
void
|
void
|
||||||
umka_close(struct umka_ctx *ctx);
|
umka_close(struct umka_ctx *ctx);
|
||||||
@ -958,6 +963,9 @@ typedef struct {
|
|||||||
uint8_t acpi_usage;
|
uint8_t acpi_usage;
|
||||||
} __attribute__((packed)) boot_data_t;
|
} __attribute__((packed)) boot_data_t;
|
||||||
|
|
||||||
|
extern uint8_t kos_msg_board_data[];
|
||||||
|
extern uint32_t kos_msg_board_count;
|
||||||
|
|
||||||
extern boot_data_t kos_boot;
|
extern boot_data_t kos_boot;
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1822,6 +1830,30 @@ umka_sys_set_font_size(uint32_t size) {
|
|||||||
: "memory");
|
: "memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
umka_sys_board_put(char c) {
|
||||||
|
__asm__ __inline__ __volatile__ (
|
||||||
|
"call i40"
|
||||||
|
:
|
||||||
|
: "a"(63),
|
||||||
|
"b"(1),
|
||||||
|
"c"(c)
|
||||||
|
: "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct board_get_ret
|
||||||
|
umka_sys_board_get() {
|
||||||
|
struct board_get_ret ret;
|
||||||
|
__asm__ __inline__ __volatile__ (
|
||||||
|
"call i40"
|
||||||
|
: "=a"(ret.value),
|
||||||
|
"=b"(ret.status)
|
||||||
|
: "a"(63),
|
||||||
|
"b"(2)
|
||||||
|
: "memory");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
umka_sys_put_image_palette(void *image, size_t xsize, size_t ysize,
|
umka_sys_put_image_palette(void *image, size_t xsize, size_t ysize,
|
||||||
size_t x, size_t y, size_t bpp, void *palette,
|
size_t x, size_t y, size_t bpp, void *palette,
|
||||||
|
@ -36,7 +36,7 @@ struct umka_fuse_ctx {
|
|||||||
static struct umka_fuse_ctx *
|
static struct umka_fuse_ctx *
|
||||||
umka_fuse_init() {
|
umka_fuse_init() {
|
||||||
struct umka_fuse_ctx *ctx = malloc(sizeof(struct umka_fuse_ctx));
|
struct umka_fuse_ctx *ctx = malloc(sizeof(struct umka_fuse_ctx));
|
||||||
ctx->umka = umka_init(UMKA_FUSE);
|
ctx->umka = umka_init();
|
||||||
ctx->io = io_init(&ctx->umka->running);
|
ctx->io = io_init(&ctx->umka->running);
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ main () {
|
|||||||
|
|
||||||
strcpy(pci_path, PCI_BASE_DIR);
|
strcpy(pci_path, PCI_BASE_DIR);
|
||||||
|
|
||||||
umka_init(UMKA_GEN_DEVICES_DAT);
|
umka_init();
|
||||||
kos_acpi_aml_init();
|
kos_acpi_aml_init();
|
||||||
ctx = kos_acpi_aml_new_thread();
|
ctx = kos_acpi_aml_new_thread();
|
||||||
kos_acpi_dev_size = MAX_PCI_DEVICES*16;
|
kos_acpi_dev_size = MAX_PCI_DEVICES*16;
|
||||||
|
156
umka_monitor.c
156
umka_monitor.c
@ -1,156 +0,0 @@
|
|||||||
/*
|
|
||||||
SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
UMKa - User-Mode KolibriOS developer tools
|
|
||||||
umka_monitor - a program to monitor and control umka_os
|
|
||||||
|
|
||||||
Copyright (C) 2023 Ivan Baravy <dunkaist@gmail.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <threads.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/uio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <SDL2/SDL.h>
|
|
||||||
#include "umka_os.h"
|
|
||||||
#include "bestline.h"
|
|
||||||
#include "optparse.h"
|
|
||||||
|
|
||||||
struct shared_info sinfo;
|
|
||||||
|
|
||||||
int
|
|
||||||
sdlthr(void *arg) {
|
|
||||||
(void)arg;
|
|
||||||
if(SDL_Init(SDL_INIT_VIDEO) < 0)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Failed to initialize the SDL2 library\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Window *window = SDL_CreateWindow("LFB Viewer SDL2",
|
|
||||||
SDL_WINDOWPOS_CENTERED,
|
|
||||||
SDL_WINDOWPOS_CENTERED,
|
|
||||||
sinfo.lfb_width, sinfo.lfb_height,
|
|
||||||
0);
|
|
||||||
|
|
||||||
if(!window)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Failed to create window\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Surface *window_surface = SDL_GetWindowSurface(window);
|
|
||||||
|
|
||||||
if(!window_surface)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Failed to get the surface from the window\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t *lfb = (uint32_t*)malloc(sinfo.lfb_width*sinfo.lfb_height*sizeof(uint32_t));
|
|
||||||
|
|
||||||
struct iovec remote = {.iov_base = (void*)(uintptr_t)sinfo.lfb_base,
|
|
||||||
.iov_len = sinfo.lfb_width*sinfo.lfb_height*4};
|
|
||||||
struct iovec local = {.iov_base = lfb,
|
|
||||||
.iov_len = sinfo.lfb_width*sinfo.lfb_height*4};
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t *p = window_surface->pixels;
|
|
||||||
while (1) {
|
|
||||||
process_vm_readv(sinfo.pid, &local, 1, &remote, 1, 0);
|
|
||||||
memcpy(window_surface->pixels, lfb, 400*300*4);
|
|
||||||
SDL_LockSurface(window_surface);
|
|
||||||
for (ssize_t y = 0; y < window_surface->h; y++) {
|
|
||||||
for (ssize_t x = 0; x < window_surface->w; x++) {
|
|
||||||
p[y*window_surface->pitch/4+x] = lfb[y*400+x];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SDL_UnlockSurface(window_surface);
|
|
||||||
SDL_UpdateWindowSurface(window);
|
|
||||||
sleep(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char *argv[]) {
|
|
||||||
(void)argc;
|
|
||||||
const char *usage = "umka_monitor [-i <infile>] [-o <outfile>] [-s <shname>]\n";
|
|
||||||
const char *shname = "/umka";
|
|
||||||
int shfd = 0;
|
|
||||||
const char *infile = NULL, *outfile = NULL;
|
|
||||||
|
|
||||||
struct optparse options;
|
|
||||||
int opt;
|
|
||||||
optparse_init(&options, argv);
|
|
||||||
|
|
||||||
while ((opt = optparse(&options, "i:o:s:")) != -1) {
|
|
||||||
switch (opt) {
|
|
||||||
case 'i':
|
|
||||||
infile = options.optarg;
|
|
||||||
break;
|
|
||||||
case 'o':
|
|
||||||
outfile = options.optarg;
|
|
||||||
break;
|
|
||||||
case 's':
|
|
||||||
shname = options.optarg;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fprintf(stderr, "bad option: %c\n", opt);
|
|
||||||
fputs(usage, stderr);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (infile && !freopen(infile, "r", stdin)) {
|
|
||||||
fprintf(stderr, "[!] can't open file for reading: %s\n", infile);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (outfile && !freopen(outfile, "w", stdout)) {
|
|
||||||
fprintf(stderr, "[!] can't open file for writing: %s\n", outfile);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shname) {
|
|
||||||
shfd = shm_open(shname, O_RDONLY, S_IRUSR | S_IWUSR);
|
|
||||||
if (!shfd) {
|
|
||||||
perror("[!] can't open shared memory");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ssize_t nread = read(shfd, &sinfo, sizeof(sinfo));
|
|
||||||
if (nread != sizeof(sinfo)) {
|
|
||||||
perror("can't read from shared memory");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
printf("read umka_os configuration:\n"
|
|
||||||
" pid: %d\n"
|
|
||||||
" lfb_base: %p\n"
|
|
||||||
" lfb_bpp: %u"
|
|
||||||
" lfb_width: %u"
|
|
||||||
" lfb_height: %u"
|
|
||||||
" cmd: %p\n",
|
|
||||||
(pid_t)sinfo.pid, (void*)(uintptr_t)sinfo.lfb_base, sinfo.lfb_bpp,
|
|
||||||
sinfo.lfb_width, sinfo.lfb_height, (void*)(uintptr_t)sinfo.cmd_buf);
|
|
||||||
shm_unlink(shname);
|
|
||||||
|
|
||||||
union sigval sval = (union sigval){.sival_int = 14};
|
|
||||||
|
|
||||||
thrd_t st;
|
|
||||||
thrd_create(&st, sdlthr, NULL);
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
getchar();
|
|
||||||
sigqueue(sinfo.pid, SIGUSR2, sval);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
171
umka_os.c
171
umka_os.c
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
@ -29,6 +30,7 @@
|
|||||||
#include <threads.h>
|
#include <threads.h>
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include "umka.h"
|
#include "umka.h"
|
||||||
|
#include "util.h"
|
||||||
#include "umka_os.h"
|
#include "umka_os.h"
|
||||||
#include "bestline.h"
|
#include "bestline.h"
|
||||||
#include "optparse.h"
|
#include "optparse.h"
|
||||||
@ -40,16 +42,39 @@
|
|||||||
|
|
||||||
#define THREAD_STACK_SIZE 0x100000
|
#define THREAD_STACK_SIZE 0x100000
|
||||||
|
|
||||||
|
#define CMD_BUF_LEN 0x10000
|
||||||
|
|
||||||
struct umka_os_ctx {
|
struct umka_os_ctx {
|
||||||
struct umka_ctx *umka;
|
struct umka_ctx *umka;
|
||||||
struct umka_io *io;
|
struct umka_io *io;
|
||||||
struct shell_ctx *shell;
|
struct shell_ctx *shell;
|
||||||
|
FILE *fboardlog;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct shared_info sinfo;
|
struct umka_os_ctx *os;
|
||||||
|
|
||||||
|
uint8_t cmd_buf[CMD_BUF_LEN];
|
||||||
|
|
||||||
char history_filename[PATH_MAX];
|
char history_filename[PATH_MAX];
|
||||||
|
|
||||||
|
static void
|
||||||
|
completion(const char *buf, bestlineCompletions *lc) {
|
||||||
|
if (buf[0] == 'h') {
|
||||||
|
bestlineAddCompletion(lc,"hello");
|
||||||
|
bestlineAddCompletion(lc,"hello there");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
hints(const char *buf, const char **ansi1, const char **ansi2) {
|
||||||
|
if (!strcmp(buf,"hello")) {
|
||||||
|
*ansi1 = "\033[35m"; /* magenta foreground */
|
||||||
|
*ansi2 = "\033[39m"; /* reset foreground */
|
||||||
|
return " World";
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
hw_int_mouse(void *arg) {
|
hw_int_mouse(void *arg) {
|
||||||
(void)arg;
|
(void)arg;
|
||||||
@ -58,12 +83,13 @@ hw_int_mouse(void *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct umka_os_ctx *
|
struct umka_os_ctx *
|
||||||
umka_os_init() {
|
umka_os_init(FILE *fin, FILE *fout, FILE *fboardlog) {
|
||||||
struct umka_os_ctx *ctx = malloc(sizeof(struct umka_os_ctx));
|
struct umka_os_ctx *ctx = malloc(sizeof(struct umka_os_ctx));
|
||||||
ctx->umka = umka_init(UMKA_OS);
|
ctx->fboardlog = fboardlog;
|
||||||
|
ctx->umka = umka_init();
|
||||||
ctx->io = io_init(&ctx->umka->running);
|
ctx->io = io_init(&ctx->umka->running);
|
||||||
ctx->shell = shell_init(SHELL_LOG_NONREPRODUCIBLE, history_filename,
|
ctx->shell = shell_init(SHELL_LOG_NONREPRODUCIBLE, history_filename,
|
||||||
ctx->umka, ctx->io);
|
ctx->umka, ctx->io, fin, fout);
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +176,7 @@ handle_i40(int signo, siginfo_t *info, void *context) {
|
|||||||
if (*(uint16_t*)ip == 0x40cd) {
|
if (*(uint16_t*)ip == 0x40cd) {
|
||||||
ctx->uc_mcontext.__gregs[REG_EIP] += 2; // skip int 0x40
|
ctx->uc_mcontext.__gregs[REG_EIP] += 2; // skip int 0x40
|
||||||
}
|
}
|
||||||
printf("i40: %i %p\n", eax, ip);
|
fprintf(os->fboardlog, "i40: %i %p\n", eax, ip);
|
||||||
umka_i40((pushad_t*)(ctx->uc_mcontext.__gregs + REG_EDI));
|
umka_i40((pushad_t*)(ctx->uc_mcontext.__gregs + REG_EDI));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,9 +202,6 @@ hw_int(int signo, siginfo_t *info, void *context) {
|
|||||||
int
|
int
|
||||||
sdlthr(void *arg) {
|
sdlthr(void *arg) {
|
||||||
(void)arg;
|
(void)arg;
|
||||||
sigset_t set;
|
|
||||||
pthread_sigmask(SIG_BLOCK, NULL, &set);
|
|
||||||
pthread_sigmask(SIG_BLOCK, &set, NULL);
|
|
||||||
if(SDL_Init(SDL_INIT_VIDEO) < 0)
|
if(SDL_Init(SDL_INIT_VIDEO) < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to initialize the SDL2 library\n");
|
fprintf(stderr, "Failed to initialize the SDL2 library\n");
|
||||||
@ -186,9 +209,10 @@ sdlthr(void *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDL_Window *window = SDL_CreateWindow("LFB Viewer SDL2",
|
SDL_Window *window = SDL_CreateWindow("LFB Viewer SDL2",
|
||||||
SDL_WINDOWPOS_CENTERED,
|
SDL_WINDOWPOS_UNDEFINED,
|
||||||
SDL_WINDOWPOS_CENTERED,
|
SDL_WINDOWPOS_UNDEFINED,
|
||||||
sinfo.lfb_width, sinfo.lfb_height,
|
kos_display.width,
|
||||||
|
kos_display.height,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
if(!window)
|
if(!window)
|
||||||
@ -205,79 +229,86 @@ sdlthr(void *arg) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t *lfb = (uint32_t*)malloc(sinfo.lfb_width*sinfo.lfb_height*sizeof(uint32_t));
|
void (*copy_display)(void *);
|
||||||
|
|
||||||
struct iovec remote = {.iov_base = (void*)(uintptr_t)sinfo.lfb_base,
|
switch (window_surface->format->format) {
|
||||||
.iov_len = sinfo.lfb_width*sinfo.lfb_height*4};
|
case SDL_PIXELFORMAT_RGB888:
|
||||||
struct iovec local = {.iov_base = lfb,
|
copy_display = copy_display_to_rgb888;
|
||||||
.iov_len = sinfo.lfb_width*sinfo.lfb_height*4};
|
break;
|
||||||
|
default:
|
||||||
|
printf("unknown SDL_PIXELFORMAT_* value: 0x%8.8x\n",
|
||||||
|
window_surface->format->format);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t *p = window_surface->pixels;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
process_vm_readv(sinfo.pid, &local, 1, &remote, 1, 0);
|
|
||||||
memcpy(window_surface->pixels, lfb, 400*300*4);
|
|
||||||
SDL_LockSurface(window_surface);
|
SDL_LockSurface(window_surface);
|
||||||
for (ssize_t y = 0; y < window_surface->h; y++) {
|
copy_display(window_surface->pixels);
|
||||||
for (ssize_t x = 0; x < window_surface->w; x++) {
|
|
||||||
p[y*window_surface->pitch/4+x] = lfb[y*400+x];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SDL_UnlockSurface(window_surface);
|
SDL_UnlockSurface(window_surface);
|
||||||
SDL_UpdateWindowSurface(window);
|
SDL_UpdateWindowSurface(window);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
umka_monitor(void *arg) {
|
umka_monitor(void *arg) {
|
||||||
(void)arg;
|
(void)arg;
|
||||||
sigset_t set;
|
|
||||||
pthread_sigmask(SIG_BLOCK, NULL, &set);
|
|
||||||
pthread_sigmask(SIG_BLOCK, &set, NULL);
|
|
||||||
/*
|
|
||||||
printf("read umka_os configuration:\n"
|
|
||||||
" pid: %d\n"
|
|
||||||
" lfb_base: %p\n"
|
|
||||||
" lfb_bpp: %u"
|
|
||||||
" lfb_width: %u"
|
|
||||||
" lfb_height: %u"
|
|
||||||
" cmd: %p\n",
|
|
||||||
(pid_t)sinfo.pid, (void*)(uintptr_t)sinfo.lfb_base, sinfo.lfb_bpp,
|
|
||||||
sinfo.lfb_width, sinfo.lfb_height, (void*)(uintptr_t)sinfo.cmd_buf);
|
|
||||||
*/
|
|
||||||
union sigval sval = (union sigval){.sival_int = 14};
|
union sigval sval = (union sigval){.sival_int = 14};
|
||||||
|
|
||||||
while (1) {
|
pid_t mypid = getpid();
|
||||||
// getchar();
|
char *line;
|
||||||
// sigqueue(sinfo.pid, SIGUSR2, sval);
|
while((line = bestline(">"))) {
|
||||||
pause();
|
sigqueue(mypid, SIGUSR2, sval);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
umka_thread_board() {
|
||||||
|
struct board_get_ret c;
|
||||||
|
while (1) {
|
||||||
|
c = umka_sys_board_get();
|
||||||
|
if (c.status) {
|
||||||
|
fprintf(os->fboardlog, "%c", c.value);
|
||||||
|
} else {
|
||||||
|
umka_sys_delay(50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[]) {
|
main(int argc, char *argv[]) {
|
||||||
(void)argc;
|
(void)argc;
|
||||||
const char *usage = "umka_os [-i <infile>] [-o <outfile>]\n";
|
const char *usage = "umka_os [-i <infile>] [-o <outfile>]"
|
||||||
|
" [-b <boardlog>]\n";
|
||||||
if (coverage) {
|
if (coverage) {
|
||||||
trace_begin();
|
trace_begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
umka_sti();
|
umka_sti();
|
||||||
|
|
||||||
const char *infile = NULL, *outfile = NULL;
|
|
||||||
build_history_filename();
|
build_history_filename();
|
||||||
|
bestlineSetCompletionCallback(completion);
|
||||||
|
bestlineSetHintsCallback(hints);
|
||||||
|
bestlineHistoryLoad(history_filename);
|
||||||
|
|
||||||
|
const char *infile = NULL;
|
||||||
|
const char *outfile = NULL;
|
||||||
|
const char *boardlogfile = NULL;
|
||||||
|
FILE *fin = stdin;
|
||||||
|
FILE *fout = stdout;
|
||||||
|
FILE *fboardlog;
|
||||||
|
|
||||||
struct optparse options;
|
struct optparse options;
|
||||||
int opt;
|
int opt;
|
||||||
optparse_init(&options, argv);
|
optparse_init(&options, argv);
|
||||||
|
|
||||||
while ((opt = optparse(&options, "i:o:s:")) != -1) {
|
while ((opt = optparse(&options, "b:i:o:s:")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
|
case 'b':
|
||||||
|
boardlogfile = options.optarg;
|
||||||
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
infile = options.optarg;
|
infile = options.optarg;
|
||||||
break;
|
break;
|
||||||
@ -291,16 +322,31 @@ main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (infile && !freopen(infile, "r", stdin)) {
|
if (infile) {
|
||||||
fprintf(stderr, "[!] can't open file for reading: %s\n", infile);
|
fin = fopen(infile, "r");
|
||||||
exit(1);
|
if (!fin) {
|
||||||
|
fprintf(stderr, "[!] can't open file for reading: %s\n", infile);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (outfile && !freopen(outfile, "w", stdout)) {
|
if (outfile) {
|
||||||
fprintf(stderr, "[!] can't open file for writing: %s\n", outfile);
|
fout = fopen(outfile, "w");
|
||||||
exit(1);
|
if (!fout) {
|
||||||
|
fprintf(stderr, "[!] can't open file for writing: %s\n", outfile);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (boardlogfile) {
|
||||||
|
fboardlog = fopen(boardlogfile, "w");
|
||||||
|
if (!fboardlog) {
|
||||||
|
fprintf(stderr, "[!] can't open file for writing: %s\n", outfile);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fboardlog = fout;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct umka_os_ctx *ctx = umka_os_init();
|
os = umka_os_init(fin, fout, fboardlog);
|
||||||
|
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
sa.sa_sigaction = irq0;
|
sa.sa_sigaction = irq0;
|
||||||
@ -351,17 +397,7 @@ main(int argc, char *argv[]) {
|
|||||||
kos_boot.y_res = UMKA_DEFAULT_DISPLAY_HEIGHT;
|
kos_boot.y_res = UMKA_DEFAULT_DISPLAY_HEIGHT;
|
||||||
kos_boot.pitch = UMKA_DEFAULT_DISPLAY_WIDTH * UMKA_DEFAULT_DISPLAY_BPP / 8;
|
kos_boot.pitch = UMKA_DEFAULT_DISPLAY_WIDTH * UMKA_DEFAULT_DISPLAY_BPP / 8;
|
||||||
|
|
||||||
sinfo = (struct shared_info) {
|
run_test(os->shell);
|
||||||
.pid = getpid(),
|
|
||||||
.lfb_base = (uintptr_t)kos_lfb_base,
|
|
||||||
.lfb_bpp = kos_boot.bpp,
|
|
||||||
.lfb_width = kos_boot.x_res,
|
|
||||||
.lfb_height = kos_boot.y_res,
|
|
||||||
.cmd_buf = (uintptr_t)cmd_buf,
|
|
||||||
};
|
|
||||||
// printf("pid=%d, kos_lfb_base=%p\n", getpid(), (void*)kos_lfb_base);
|
|
||||||
|
|
||||||
run_test(ctx->shell);
|
|
||||||
// umka_stack_init();
|
// umka_stack_init();
|
||||||
|
|
||||||
// load_app_host("../apps/board_cycle", app);
|
// load_app_host("../apps/board_cycle", app);
|
||||||
@ -410,6 +446,7 @@ main(int argc, char *argv[]) {
|
|||||||
kos_attach_int_handler(14, hw_int_mouse, NULL);
|
kos_attach_int_handler(14, hw_int_mouse, NULL);
|
||||||
|
|
||||||
// thread_start(0, monitor, THREAD_STACK_SIZE);
|
// thread_start(0, monitor, THREAD_STACK_SIZE);
|
||||||
|
thread_start(1, umka_thread_board, THREAD_STACK_SIZE);
|
||||||
kos_thread_t start = (kos_thread_t)(KOS_APP_BASE + app->menuet.start);
|
kos_thread_t start = (kos_thread_t)(KOS_APP_BASE + app->menuet.start);
|
||||||
thread_start(0, start, THREAD_STACK_SIZE);
|
thread_start(0, start, THREAD_STACK_SIZE);
|
||||||
|
|
||||||
@ -426,7 +463,7 @@ main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
setitimer(ITIMER_REAL, &timeout, NULL);
|
setitimer(ITIMER_REAL, &timeout, NULL);
|
||||||
|
|
||||||
ctx->umka->running = 1;
|
os->umka->running = 1;
|
||||||
umka_osloop(); // doesn't return
|
umka_osloop(); // doesn't return
|
||||||
|
|
||||||
if (coverage)
|
if (coverage)
|
||||||
|
14
umka_os.h
14
umka_os.h
@ -9,20 +9,6 @@
|
|||||||
|
|
||||||
#include "umka.h"
|
#include "umka.h"
|
||||||
|
|
||||||
struct shared_info {
|
|
||||||
uint64_t pid;
|
|
||||||
uint32_t lfb_base;
|
|
||||||
uint32_t lfb_bpp;
|
|
||||||
uint32_t lfb_width;
|
|
||||||
uint32_t lfb_height;
|
|
||||||
uint32_t cmd_buf;
|
|
||||||
uint32_t pad;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define CMD_BUF_LEN 0x10000
|
|
||||||
|
|
||||||
uint8_t cmd_buf[CMD_BUF_LEN];
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
UMKA_CMD_NONE,
|
UMKA_CMD_NONE,
|
||||||
UMKA_CMD_SET_MOUSE_DATA,
|
UMKA_CMD_SET_MOUSE_DATA,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
umka_set_boot_params --bpp 16
|
||||||
umka_boot
|
umka_boot
|
||||||
ramdisk_init ../img/kolibri.raw
|
ramdisk_init ../img/kolibri.raw
|
||||||
set_skin /sys/DEFAULT.SKN
|
set_skin /sys/DEFAULT.SKN
|
||||||
|
33
umka_shell.c
33
umka_shell.c
@ -8,6 +8,8 @@
|
|||||||
Copyright (C) 2021 Magomed Kostoev <mkostoevr@yandex.ru>
|
Copyright (C) 2021 Magomed Kostoev <mkostoevr@yandex.ru>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -31,11 +33,12 @@ struct umka_shell_ctx {
|
|||||||
char history_filename[PATH_MAX];
|
char history_filename[PATH_MAX];
|
||||||
|
|
||||||
struct umka_shell_ctx *
|
struct umka_shell_ctx *
|
||||||
umka_shell_init(int reproducible) {
|
umka_shell_init(int reproducible, FILE *fin, FILE *fout) {
|
||||||
struct umka_shell_ctx *ctx = malloc(sizeof(struct umka_shell_ctx));
|
struct umka_shell_ctx *ctx = malloc(sizeof(struct umka_shell_ctx));
|
||||||
ctx->umka = umka_init(UMKA_SHELL);
|
ctx->umka = umka_init();
|
||||||
ctx->io = io_init(&ctx->umka->running);
|
ctx->io = io_init(&ctx->umka->running);
|
||||||
ctx->shell = shell_init(reproducible, history_filename, ctx->umka, ctx->io);
|
ctx->shell = shell_init(reproducible, history_filename, ctx->umka, ctx->io,
|
||||||
|
fin, fout);
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +65,10 @@ main(int argc, char **argv) {
|
|||||||
" -o outfile file for logs\n"
|
" -o outfile file for logs\n"
|
||||||
" -r reproducible logs (without pointers and datetime)\n"
|
" -r reproducible logs (without pointers and datetime)\n"
|
||||||
" -c collect coverage\n";
|
" -c collect coverage\n";
|
||||||
|
|
||||||
const char *infile = NULL, *outfile = NULL;
|
const char *infile = NULL, *outfile = NULL;
|
||||||
|
FILE *fin = stdin;
|
||||||
|
FILE *fout = stdout;
|
||||||
build_history_filename();
|
build_history_filename();
|
||||||
/*
|
/*
|
||||||
kos_boot.memmap_block_cnt = 3;
|
kos_boot.memmap_block_cnt = 3;
|
||||||
@ -104,16 +110,23 @@ main(int argc, char **argv) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (infile && !freopen(infile, "r", stdin)) {
|
|
||||||
fprintf(stderr, "[!] can't open file for reading: %s\n", infile);
|
if (infile) {
|
||||||
exit(1);
|
fin = fopen(infile, "r");
|
||||||
|
if (!fin) {
|
||||||
|
fprintf(stderr, "[!] can't open file for reading: %s\n", infile);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (outfile && !freopen(outfile, "w", stdout)) {
|
if (outfile) {
|
||||||
fprintf(stderr, "[!] can't open file for writing: %s\n", outfile);
|
fout = fopen(outfile, "w");
|
||||||
exit(1);
|
if (!fout) {
|
||||||
|
fprintf(stderr, "[!] can't open file for writing: %s\n", outfile);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct umka_shell_ctx *ctx = umka_shell_init(reproducible);
|
struct umka_shell_ctx *ctx = umka_shell_init(reproducible, fin, fout);
|
||||||
|
|
||||||
if (coverage)
|
if (coverage)
|
||||||
trace_begin();
|
trace_begin();
|
||||||
|
54
util.c
54
util.c
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
UMKa - User-Mode KolibriOS developer tools
|
UMKa - User-Mode KolibriOS developer tools
|
||||||
|
|
||||||
Copyright (C) 2021 Ivan Baravy <dunkaist@gmail.com>
|
Copyright (C) 2021, 2023 Ivan Baravy <dunkaist@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -35,7 +35,8 @@ dump_devices_dat_iter(struct pci_dev *node, void *arg) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_devices_dat(const char *filename) {
|
void
|
||||||
|
dump_devices_dat(const char *filename) {
|
||||||
FILE *f = fopen(filename, "w");
|
FILE *f = fopen(filename, "w");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
perror("Can't open file devices.dat");
|
perror("Can't open file devices.dat");
|
||||||
@ -46,3 +47,52 @@ void dump_devices_dat(const char *filename) {
|
|||||||
fwrite(&(uint32_t){0xffffffffu}, 1, 4, f);
|
fwrite(&(uint32_t){0xffffffffu}, 1, 4, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
copy_display_bpp16_to_rgb888(void *to) {
|
||||||
|
for (size_t y = 0; y < kos_display.height; y++) {
|
||||||
|
for (size_t x = 0; x < kos_display.width; x++) {
|
||||||
|
uint32_t p = ((uint16_t*)kos_lfb_base)[y*kos_display.width+x];
|
||||||
|
p = ((p & 0xf800u) << 8) + ((p & 0x7e0u) << 5) + ((p & 0x1fu) << 3);
|
||||||
|
((uint32_t*)to)[y*kos_display.lfb_pitch/2+x] = p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
copy_display_bpp24_to_rgb888(void *to) {
|
||||||
|
uint8_t *from = kos_lfb_base;
|
||||||
|
for (size_t y = 0; y < kos_display.height; y++) {
|
||||||
|
for (size_t x = 0; x < kos_display.width; x++) {
|
||||||
|
uint32_t p = 0;
|
||||||
|
p += (uint32_t)from[y*kos_display.width*3+x*3 + 0] << 0;
|
||||||
|
p += (uint32_t)from[y*kos_display.width*3+x*3 + 1] << 8;
|
||||||
|
p += (uint32_t)from[y*kos_display.width*3+x*3 + 2] << 16;
|
||||||
|
((uint32_t*)to)[y*kos_display.width+x] = p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
copy_display_bpp32_to_rgb888(void *to) {
|
||||||
|
memcpy(to, kos_lfb_base, kos_display.width*kos_display.height*4);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
copy_display_to_rgb888(void *to) {
|
||||||
|
switch (kos_display.bits_per_pixel) {
|
||||||
|
case 16:
|
||||||
|
copy_display_bpp16_to_rgb888(to);
|
||||||
|
break;
|
||||||
|
case 24:
|
||||||
|
copy_display_bpp24_to_rgb888(to);
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
copy_display_bpp32_to_rgb888(to);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "[!] unsupported bit depth: %d\n",
|
||||||
|
kos_display.bits_per_pixel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
8
util.h
8
util.h
@ -3,12 +3,16 @@
|
|||||||
|
|
||||||
UMKa - User-Mode KolibriOS developer tools
|
UMKa - User-Mode KolibriOS developer tools
|
||||||
|
|
||||||
Copyright (C) 2021 Ivan Baravy <dunkaist@gmail.com>
|
Copyright (C) 2021, 2023 Ivan Baravy <dunkaist@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef UTIL_H_INCLUDED
|
#ifndef UTIL_H_INCLUDED
|
||||||
#define UTIL_H_INCLUDED
|
#define UTIL_H_INCLUDED
|
||||||
|
|
||||||
void dump_devices_dat(const char *filename);
|
void
|
||||||
|
dump_devices_dat(const char *filename);
|
||||||
|
|
||||||
|
void
|
||||||
|
copy_display_to_rgb888(void *to);
|
||||||
|
|
||||||
#endif // UTIL_H_INCLUDED
|
#endif // UTIL_H_INCLUDED
|
||||||
|
Loading…
Reference in New Issue
Block a user