forked from KolibriOS/kolibrios
[KERNEL][UMKA] Make it compile and run on Windows
git-svn-id: svn://kolibrios.org@9342 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
3717b92b6d
commit
e92d2fb87b
@ -172,7 +172,7 @@ def run_tests_serially(tests, root_dir):
|
|||||||
return thread
|
return thread
|
||||||
|
|
||||||
def gcc(fin, fout):
|
def gcc(fin, fout):
|
||||||
flags = "-m32 -std=c11 -g -O0 -fno-pie -w" # -masm-intel
|
flags = "-m32 -std=c11 -g -O0 -fno-pie -w"
|
||||||
defines = "-D_FILE_OFFSET_BITS=64 -DNDEBUG -D_POSIX_C_SOURCE=200809L"
|
defines = "-D_FILE_OFFSET_BITS=64 -DNDEBUG -D_POSIX_C_SOURCE=200809L"
|
||||||
include = "-Iumka -Iumka/linux"
|
include = "-Iumka -Iumka/linux"
|
||||||
command = f"clang {flags} {defines} {include} -c {fin} -o {fout}"
|
command = f"clang {flags} {defines} {include} -c {fin} -o {fout}"
|
||||||
@ -185,8 +185,13 @@ def build_umka_asm():
|
|||||||
files = "umka/umka.asm umka/build/umka.o -s umka/build/umka.fas"
|
files = "umka/umka.asm umka/build/umka.o -s umka/build/umka.fas"
|
||||||
memory = "-m 2000000"
|
memory = "-m 2000000"
|
||||||
command = f"{include} fasm {flags} {files} {memory}"
|
command = f"{include} fasm {flags} {files} {memory}"
|
||||||
print(command)
|
if sys.platform != "win32":
|
||||||
os.system(command)
|
print(command)
|
||||||
|
os.system(command)
|
||||||
|
else:
|
||||||
|
my_env = os.environ.copy()
|
||||||
|
my_env["INCLUDE"] = "../../programs/develop/libraries/libcrash/hash"
|
||||||
|
print(subprocess.check_output(f"fasm {flags} {files} {memory} -dwin32=1", shell = True, env = my_env))
|
||||||
|
|
||||||
def build_umka():
|
def build_umka():
|
||||||
if not enable_umka:
|
if not enable_umka:
|
||||||
@ -194,12 +199,16 @@ def build_umka():
|
|||||||
if os.path.exists("umka_shell.exe"):
|
if os.path.exists("umka_shell.exe"):
|
||||||
return
|
return
|
||||||
os.makedirs("umka/build/linux", exist_ok = True)
|
os.makedirs("umka/build/linux", exist_ok = True)
|
||||||
|
os.makedirs("umka/build/win32", exist_ok = True)
|
||||||
sources = [ "umka_shell.c",
|
sources = [ "umka_shell.c",
|
||||||
"shell.c",
|
"shell.c",
|
||||||
"vdisk.c",
|
"vdisk.c",
|
||||||
"lodepng.c",
|
"lodepng.c",
|
||||||
"linux/pci.c",
|
"getopt.c" ]
|
||||||
"linux/thread.c" ]
|
if sys.platform == "win32":
|
||||||
|
sources += [ "win32/pci.c", "win32/thread.c" ]
|
||||||
|
else:
|
||||||
|
sources += [ "linux/pci.c", "linux/thread.c" ]
|
||||||
sources = [f"umka/{f}" for f in sources]
|
sources = [f"umka/{f}" for f in sources]
|
||||||
objects = []
|
objects = []
|
||||||
for source in sources:
|
for source in sources:
|
||||||
@ -210,9 +219,16 @@ def build_umka():
|
|||||||
build_umka_asm()
|
build_umka_asm()
|
||||||
objects.append("umka/build/umka.o")
|
objects.append("umka/build/umka.o")
|
||||||
objects = " ".join(objects)
|
objects = " ".join(objects)
|
||||||
command = f"gcc -m32 -no-pie -o umka_shell.exe -static -T umka/umka.ld {objects}"
|
if sys.platform != "win32":
|
||||||
|
ld_script = "-T umka/umka.ld"
|
||||||
|
else:
|
||||||
|
ld_script = ""
|
||||||
|
command = f"clang -m32 -fno-pie -o umka_shell.exe -static {ld_script} {objects}"
|
||||||
print(command)
|
print(command)
|
||||||
os.system(command)
|
os.system(command)
|
||||||
|
if not os.path.exists("umka_shell.exe"):
|
||||||
|
print("Could't compile umka_shell.exe")
|
||||||
|
exit()
|
||||||
|
|
||||||
def create_relocated(root_dir, fname):
|
def create_relocated(root_dir, fname):
|
||||||
with open(fname, "rb") as f:
|
with open(fname, "rb") as f:
|
||||||
@ -227,8 +243,18 @@ def create_relocated(root_dir, fname):
|
|||||||
def run_umka_test(root_dir, test_file_path):
|
def run_umka_test(root_dir, test_file_path):
|
||||||
test = create_relocated(root_dir, test_file_path)
|
test = create_relocated(root_dir, test_file_path)
|
||||||
ref_log = create_relocated(root_dir, f"{test_file_path[:-2]}.ref.log")
|
ref_log = create_relocated(root_dir, f"{test_file_path[:-2]}.ref.log")
|
||||||
out_log = f"{test_file_path[:-2]}.out.log.o"
|
out_log = f"{test_file_path[:-2]}.out.log"
|
||||||
os.system(f"./umka_shell.exe < {test} > {out_log}")
|
if sys.platform != "win32":
|
||||||
|
prefix = "./"
|
||||||
|
else:
|
||||||
|
prefix = ""
|
||||||
|
os.system(f"{prefix}umka_shell.exe < {test} > {out_log}")
|
||||||
|
if sys.platform == "win32":
|
||||||
|
with open(out_log, "rb") as f:
|
||||||
|
contents = f.read()
|
||||||
|
contents_no_crlf = contents.replace(b"\r\n", b"\n")
|
||||||
|
with open(out_log, "wb") as f:
|
||||||
|
f.write(contents_no_crlf)
|
||||||
if not filecmp.cmp(ref_log, out_log):
|
if not filecmp.cmp(ref_log, out_log):
|
||||||
print(f"FAILURE: {test_file_path}\n", end = "")
|
print(f"FAILURE: {test_file_path}\n", end = "")
|
||||||
else:
|
else:
|
||||||
|
@ -89,7 +89,8 @@ def get_file_directory(path):
|
|||||||
|
|
||||||
def run_qemu(root_dir, test_dir, debug_log):
|
def run_qemu(root_dir, test_dir, debug_log):
|
||||||
# Make local copy of IMG, so we will be able to run the test in parallel
|
# Make local copy of IMG, so we will be able to run the test in parallel
|
||||||
os.remove(f"{test_dir}/kolibri_test.img") # If previous test run interrupted the file may be busy
|
if os.path.exists(f"{test_dir}/kolibri_test.img"): # If previous test run interrupted the file may be busy
|
||||||
|
os.remove(f"{test_dir}/kolibri_test.img")
|
||||||
shutil.copyfile(f"{root_dir}/kolibri_test.img", f"{test_dir}/kolibri_test.img")
|
shutil.copyfile(f"{root_dir}/kolibri_test.img", f"{test_dir}/kolibri_test.img")
|
||||||
qemu_command = f"qemu-system-i386"
|
qemu_command = f"qemu-system-i386"
|
||||||
flags = ""
|
flags = ""
|
||||||
|
@ -307,7 +307,7 @@ shell_ramdisk_init(int argc, char **argv) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const char *fname = argv[1];
|
const char *fname = argv[1];
|
||||||
FILE *f = fopen(fname, "r");
|
FILE *f = fopen(fname, "rb");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
fprintf(fout, "[!] can't open file '%s': %s\n", fname, strerror(errno));
|
fprintf(fout, "[!] can't open file '%s': %s\n", fname, strerror(errno));
|
||||||
return;
|
return;
|
||||||
@ -1093,7 +1093,7 @@ shell_put_image(int argc, char **argv) {
|
|||||||
fputs(usage, fout);
|
fputs(usage, fout);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FILE *f = fopen(argv[1], "r");
|
FILE *f = fopen(argv[1], "rb");
|
||||||
fseek(f, 0, SEEK_END);
|
fseek(f, 0, SEEK_END);
|
||||||
size_t fsize = ftell(f);
|
size_t fsize = ftell(f);
|
||||||
rewind(f);
|
rewind(f);
|
||||||
@ -1126,7 +1126,7 @@ shell_put_image_palette(int argc, char **argv) {
|
|||||||
fputs(usage, fout);
|
fputs(usage, fout);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FILE *f = fopen(argv[1], "r");
|
FILE *f = fopen(argv[1], "rb");
|
||||||
fseek(f, 0, SEEK_END);
|
fseek(f, 0, SEEK_END);
|
||||||
size_t fsize = ftell(f);
|
size_t fsize = ftell(f);
|
||||||
rewind(f);
|
rewind(f);
|
||||||
@ -1332,7 +1332,7 @@ shell_blit_bitmap(int argc, char **argv) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const char *fname = argv[1];
|
const char *fname = argv[1];
|
||||||
FILE *f = fopen(fname, "r");
|
FILE *f = fopen(fname, "rb");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
fprintf(fout, "[!] can't open file '%s': %s\n", fname, strerror(errno));
|
fprintf(fout, "[!] can't open file '%s': %s\n", fname, strerror(errno));
|
||||||
return;
|
return;
|
||||||
@ -1763,7 +1763,7 @@ shell_acpi_preload_table(int argc, char **argv) {
|
|||||||
fputs(usage, fout);
|
fputs(usage, fout);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FILE *f = fopen(argv[1], "r");
|
FILE *f = fopen(argv[1], "rb");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
fprintf(fout, "[umka] can't open file: %s\n", argv[1]);
|
fprintf(fout, "[umka] can't open file: %s\n", argv[1]);
|
||||||
return;
|
return;
|
||||||
@ -1780,30 +1780,6 @@ shell_acpi_preload_table(int argc, char **argv) {
|
|||||||
kos_acpi_ssdt_cnt++;
|
kos_acpi_ssdt_cnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
shell_pci_set_path(int argc, char **argv) {
|
|
||||||
const char *usage = \
|
|
||||||
"usage: pci_set_path <path>\n"
|
|
||||||
" path where aaaa:bb:cc.d dirs are";
|
|
||||||
if (argc != 2) {
|
|
||||||
fputs(usage, fout);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
strcpy(pci_path, argv[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
shell_pci_get_path(int argc, char **argv) {
|
|
||||||
(void)argv;
|
|
||||||
const char *usage = \
|
|
||||||
"usage: pci_get_path";
|
|
||||||
if (argc != 1) {
|
|
||||||
fputs(usage, fout);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fprintf(fout, "pci path: %s\n", pci_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
shell_bg_set_size(int argc, char **argv) {
|
shell_bg_set_size(int argc, char **argv) {
|
||||||
const char *usage = \
|
const char *usage = \
|
||||||
@ -1869,7 +1845,7 @@ shell_bg_put_img(int argc, char **argv) {
|
|||||||
fputs(usage, fout);
|
fputs(usage, fout);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FILE *f = fopen(argv[1], "r");
|
FILE *f = fopen(argv[1], "rb");
|
||||||
fseek(f, 0, SEEK_END);
|
fseek(f, 0, SEEK_END);
|
||||||
size_t fsize = ftell(f);
|
size_t fsize = ftell(f);
|
||||||
rewind(f);
|
rewind(f);
|
||||||
@ -1949,8 +1925,6 @@ func_table_t shell_cmds[] = {
|
|||||||
{ "ls80", shell_ls80 },
|
{ "ls80", shell_ls80 },
|
||||||
{ "move_window", shell_move_window },
|
{ "move_window", shell_move_window },
|
||||||
{ "mouse_move", shell_mouse_move },
|
{ "mouse_move", shell_mouse_move },
|
||||||
{ "pci_get_path", shell_pci_get_path },
|
|
||||||
{ "pci_set_path", shell_pci_set_path },
|
|
||||||
{ "process_info", shell_process_info },
|
{ "process_info", shell_process_info },
|
||||||
{ "put_image", shell_put_image },
|
{ "put_image", shell_put_image },
|
||||||
{ "put_image_palette", shell_put_image_palette },
|
{ "put_image_palette", shell_put_image_palette },
|
||||||
|
@ -1,6 +1,36 @@
|
|||||||
; TODO: SPDX
|
; TODO: SPDX
|
||||||
|
|
||||||
format ELF
|
if ~ defined win32
|
||||||
|
format ELF
|
||||||
|
else
|
||||||
|
format MS COFF
|
||||||
|
|
||||||
|
macro c_public name, _alias, _argsize {
|
||||||
|
if ~ _argsize eq nomangle
|
||||||
|
if _alias eqtype 'string'
|
||||||
|
if _argsize eqtype 1
|
||||||
|
public name as '_' # _alias # '@' # `_argsize
|
||||||
|
else
|
||||||
|
public name as '_' # _alias
|
||||||
|
end if
|
||||||
|
else if _alias eqtype 1
|
||||||
|
public name as '_' # `name # '@' # `_alias
|
||||||
|
else
|
||||||
|
public name as '_' # `name
|
||||||
|
end if
|
||||||
|
else
|
||||||
|
public name as _alias
|
||||||
|
end if
|
||||||
|
}
|
||||||
|
|
||||||
|
macro extrn name, _argsize {
|
||||||
|
if _argsize eqtype 1
|
||||||
|
extrn '_' # `name # '@' # `_argsize as name
|
||||||
|
else
|
||||||
|
extrn '_' # `name as name
|
||||||
|
end if
|
||||||
|
}
|
||||||
|
end if
|
||||||
|
|
||||||
__DEBUG__ = 1
|
__DEBUG__ = 1
|
||||||
__DEBUG_LEVEL__ = 1
|
__DEBUG_LEVEL__ = 1
|
||||||
@ -11,73 +41,73 @@ UMKA_OS = 3
|
|||||||
|
|
||||||
UMKA_MEMORY_BYTES = 256 SHL 20
|
UMKA_MEMORY_BYTES = 256 SHL 20
|
||||||
|
|
||||||
public umka_sys_put_image_palette
|
c_public umka_sys_put_image_palette
|
||||||
public disk_add
|
c_public disk_add, 16
|
||||||
public disk_del
|
c_public disk_del, 4
|
||||||
public disk_list
|
c_public disk_list
|
||||||
public disk_media_changed
|
c_public disk_media_changed,8
|
||||||
|
|
||||||
public xfs._.user_functions as 'xfs_user_functions'
|
c_public xfs._.user_functions, 'xfs_user_functions'
|
||||||
public ext_user_functions
|
c_public ext_user_functions
|
||||||
public fat_user_functions
|
c_public fat_user_functions
|
||||||
public ntfs_user_functions
|
c_public ntfs_user_functions
|
||||||
|
|
||||||
public i40
|
c_public i40, 'i40', nomangle
|
||||||
|
|
||||||
public coverage_begin
|
c_public coverage_begin
|
||||||
public coverage_end
|
c_public coverage_end
|
||||||
|
|
||||||
public sha3_256_oneshot as 'hash_oneshot'
|
c_public sha3_256_oneshot, 'hash_oneshot'
|
||||||
public kos_time_to_epoch
|
c_public kos_time_to_epoch
|
||||||
public umka_init
|
c_public umka_init
|
||||||
|
|
||||||
public current_process as 'kos_current_process'
|
c_public current_process, 'kos_current_process'
|
||||||
public current_slot as 'kos_current_slot'
|
c_public current_slot, 'kos_current_slot'
|
||||||
public current_slot_idx as 'kos_current_slot_idx'
|
c_public current_slot_idx, 'kos_current_slot_idx'
|
||||||
|
|
||||||
public thread_count as 'kos_thread_count'
|
c_public thread_count, 'kos_thread_count'
|
||||||
public TASK_TABLE as 'kos_task_table'
|
c_public TASK_TABLE, 'kos_task_table'
|
||||||
public TASK_BASE as 'kos_task_base'
|
c_public TASK_BASE, 'kos_task_base'
|
||||||
public TASK_DATA as 'kos_task_data'
|
c_public TASK_DATA, 'kos_task_data'
|
||||||
public SLOT_BASE as 'kos_slot_base'
|
c_public SLOT_BASE, 'kos_slot_base'
|
||||||
public window_data as 'kos_window_data'
|
c_public window_data, 'kos_window_data'
|
||||||
|
|
||||||
public WIN_STACK as 'kos_win_stack'
|
c_public WIN_STACK, 'kos_win_stack'
|
||||||
public WIN_POS as 'kos_win_pos'
|
c_public WIN_POS, 'kos_win_pos'
|
||||||
public lfb_base as 'kos_lfb_base'
|
c_public lfb_base, 'kos_lfb_base'
|
||||||
|
|
||||||
public RAMDISK as 'kos_ramdisk'
|
c_public RAMDISK, 'kos_ramdisk'
|
||||||
public ramdisk_init as 'kos_ramdisk_init'
|
c_public ramdisk_init, 'kos_ramdisk_init'
|
||||||
|
|
||||||
public acpi_ssdt_cnt as 'kos_acpi_ssdt_cnt'
|
c_public acpi_ssdt_cnt, 'kos_acpi_ssdt_cnt'
|
||||||
public acpi_ssdt_base as 'kos_acpi_ssdt_base'
|
c_public acpi_ssdt_base, 'kos_acpi_ssdt_base'
|
||||||
public acpi_ssdt_size as 'kos_acpi_ssdt_size'
|
c_public acpi_ssdt_size, 'kos_acpi_ssdt_size'
|
||||||
|
|
||||||
public stack_init as 'kos_stack_init'
|
c_public stack_init, 'kos_stack_init'
|
||||||
public net_add_device
|
c_public net_add_device
|
||||||
|
|
||||||
public draw_data
|
c_public draw_data
|
||||||
public img_background
|
c_public img_background
|
||||||
public mem_BACKGROUND
|
c_public mem_BACKGROUND
|
||||||
public sys_background
|
c_public sys_background
|
||||||
public REDRAW_BACKGROUND as 'kos_redraw_background'
|
c_public REDRAW_BACKGROUND, 'kos_redraw_background'
|
||||||
public new_sys_threads as 'kos_new_sys_threads'
|
c_public new_sys_threads, 'kos_new_sys_threads', nomangle
|
||||||
public osloop as 'kos_osloop'
|
c_public osloop, 'kos_osloop'
|
||||||
public set_mouse_data as 'kos_set_mouse_data'
|
c_public set_mouse_data, 'kos_set_mouse_data', 20
|
||||||
public scheduler_current as 'kos_scheduler_current'
|
c_public scheduler_current, 'kos_scheduler_current'
|
||||||
public eth_input as 'kos_eth_input'
|
c_public eth_input, 'kos_eth_input'
|
||||||
public net_buff_alloc as 'kos_net_buff_alloc'
|
c_public net_buff_alloc, 'kos_net_buff_alloc'
|
||||||
|
|
||||||
public mem_block_list
|
c_public mem_block_list
|
||||||
|
|
||||||
public acpi_dev_data as "kos_acpi_dev_data"
|
c_public acpi_dev_data, "kos_acpi_dev_data"
|
||||||
public acpi_dev_size as "kos_acpi_dev_size"
|
c_public acpi_dev_size, "kos_acpi_dev_size"
|
||||||
public kernel_alloc as "kos_kernel_alloc"
|
c_public kernel_alloc, "kos_kernel_alloc"
|
||||||
|
|
||||||
public window._.set_screen as 'kos_window_set_screen'
|
c_public window._.set_screen, 'kos_window_set_screen'
|
||||||
public _display as 'kos_display'
|
c_public _display, 'kos_display'
|
||||||
|
|
||||||
public BOOT as 'kos_boot'
|
c_public BOOT, 'kos_boot'
|
||||||
|
|
||||||
macro cli {
|
macro cli {
|
||||||
pushfd
|
pushfd
|
||||||
@ -112,7 +142,7 @@ include 'macros.inc'
|
|||||||
macro diff16 msg,blah2,blah3 {
|
macro diff16 msg,blah2,blah3 {
|
||||||
if msg eq "end of .data segment"
|
if msg eq "end of .data segment"
|
||||||
; fasm doesn't align on 65536, but ld script does
|
; fasm doesn't align on 65536, but ld script does
|
||||||
section '.bss.aligned65k' writeable align 65536
|
section '.bss.65k' writeable align 512
|
||||||
bss_base:
|
bss_base:
|
||||||
end if
|
end if
|
||||||
}
|
}
|
||||||
@ -505,7 +535,7 @@ proc umka_init c uses ebx esi edi ebp
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
public skin_udata
|
c_public skin_udata
|
||||||
proc idle uses ebx esi edi
|
proc idle uses ebx esi edi
|
||||||
.loop:
|
.loop:
|
||||||
mov ecx, 10000000
|
mov ecx, 10000000
|
||||||
@ -517,7 +547,7 @@ proc idle uses ebx esi edi
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
extrn pci_read
|
extrn pci_read, 20
|
||||||
proc pci_read_reg uses ebx esi edi
|
proc pci_read_reg uses ebx esi edi
|
||||||
mov ecx, eax
|
mov ecx, eax
|
||||||
and ecx, 3
|
and ecx, 3
|
||||||
@ -541,6 +571,7 @@ endp
|
|||||||
proc sys_msg_board
|
proc sys_msg_board
|
||||||
cmp cl, 0x0d
|
cmp cl, 0x0d
|
||||||
jz @f
|
jz @f
|
||||||
|
if ~ defined win32
|
||||||
pushad
|
pushad
|
||||||
mov eax, SYS_WRITE
|
mov eax, SYS_WRITE
|
||||||
mov ebx, STDOUT
|
mov ebx, STDOUT
|
||||||
@ -550,6 +581,15 @@ proc sys_msg_board
|
|||||||
int 0x80
|
int 0x80
|
||||||
pop ecx
|
pop ecx
|
||||||
popad
|
popad
|
||||||
|
else
|
||||||
|
extrn putchar
|
||||||
|
|
||||||
|
pushad
|
||||||
|
push ecx
|
||||||
|
call putchar
|
||||||
|
add esp, 4
|
||||||
|
popad
|
||||||
|
end if
|
||||||
@@:
|
@@:
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@ -559,13 +599,13 @@ proc delay_ms
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
public umka_cli
|
c_public umka_cli
|
||||||
proc umka_cli
|
proc umka_cli
|
||||||
cli ; macro
|
cli ; macro
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
public umka_sti
|
c_public umka_sti
|
||||||
proc umka_sti
|
proc umka_sti
|
||||||
sti ; macro
|
sti ; macro
|
||||||
ret
|
ret
|
||||||
@ -593,7 +633,7 @@ endp
|
|||||||
|
|
||||||
extrn reset_procmask
|
extrn reset_procmask
|
||||||
extrn get_fake_if
|
extrn get_fake_if
|
||||||
public irq0
|
c_public irq0
|
||||||
proc irq0 c, _signo, _info, _context
|
proc irq0 c, _signo, _info, _context
|
||||||
DEBUGF 2, "### irq0\n"
|
DEBUGF 2, "### irq0\n"
|
||||||
pushfd
|
pushfd
|
||||||
@ -735,10 +775,10 @@ restore sys_msg_board,delay_ms
|
|||||||
coverage_end:
|
coverage_end:
|
||||||
|
|
||||||
; fasm doesn't align on 65536, but ld script does
|
; fasm doesn't align on 65536, but ld script does
|
||||||
section '.data.aligned65k' writeable align 65536
|
section '.data' readable writeable align 512
|
||||||
public umka_tool
|
c_public umka_tool
|
||||||
umka_tool dd ?
|
umka_tool dd ?
|
||||||
public umka_initialized
|
c_public umka_initialized
|
||||||
umka_initialized dd 0
|
umka_initialized dd 0
|
||||||
fpu_owner dd ?
|
fpu_owner dd ?
|
||||||
|
|
||||||
|
@ -9,6 +9,12 @@
|
|||||||
#define BDFE_LEN_CP866 304
|
#define BDFE_LEN_CP866 304
|
||||||
#define BDFE_LEN_UNICODE 560
|
#define BDFE_LEN_UNICODE 560
|
||||||
|
|
||||||
|
#if defined(WIN32) || defined(_WIN32)
|
||||||
|
typedef size_t off_t;
|
||||||
|
typedef long ssize_t;
|
||||||
|
# define PATH_MAX 256
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t left, top, right, bottom;
|
uint32_t left, top, right, bottom;
|
||||||
} rect_t;
|
} rect_t;
|
||||||
|
@ -21,9 +21,9 @@ void *vdisk_init(const char *fname, int adjust_cache_size, size_t cache_size) {
|
|||||||
printf("vdisk: can't open file '%s': %s\n", fname, strerror(errno));
|
printf("vdisk: can't open file '%s': %s\n", fname, strerror(errno));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
fseeko(f, 0, SEEK_END);
|
fseek(f, 0, SEEK_END);
|
||||||
off_t fsize = ftello(f);
|
off_t fsize = ftell(f);
|
||||||
fseeko(f, 0, SEEK_SET);
|
fseek(f, 0, SEEK_SET);
|
||||||
size_t sect_size = 512;
|
size_t sect_size = 512;
|
||||||
if (strstr(fname, "s4096") != NULL || strstr(fname, "s4k") != NULL) {
|
if (strstr(fname, "s4096") != NULL || strstr(fname, "s4k") != NULL) {
|
||||||
sect_size = 4096;
|
sect_size = 4096;
|
||||||
@ -51,7 +51,7 @@ vdisk_read(void *userdata, void *buffer, off_t startsector,
|
|||||||
size_t *numsectors) {
|
size_t *numsectors) {
|
||||||
COVERAGE_OFF();
|
COVERAGE_OFF();
|
||||||
vdisk_t *vdisk = userdata;
|
vdisk_t *vdisk = userdata;
|
||||||
fseeko(vdisk->file, startsector * vdisk->sect_size, SEEK_SET);
|
fseek(vdisk->file, startsector * vdisk->sect_size, SEEK_SET);
|
||||||
fread(buffer, *numsectors * vdisk->sect_size, 1, vdisk->file);
|
fread(buffer, *numsectors * vdisk->sect_size, 1, vdisk->file);
|
||||||
COVERAGE_ON();
|
COVERAGE_ON();
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
@ -62,7 +62,7 @@ vdisk_write(void *userdata, void *buffer, off_t startsector,
|
|||||||
size_t *numsectors) {
|
size_t *numsectors) {
|
||||||
COVERAGE_OFF();
|
COVERAGE_OFF();
|
||||||
vdisk_t *vdisk = userdata;
|
vdisk_t *vdisk = userdata;
|
||||||
fseeko(vdisk->file, startsector * vdisk->sect_size, SEEK_SET);
|
fseek(vdisk->file, startsector * vdisk->sect_size, SEEK_SET);
|
||||||
fwrite(buffer, *numsectors * vdisk->sect_size, 1, vdisk->file);
|
fwrite(buffer, *numsectors * vdisk->sect_size, 1, vdisk->file);
|
||||||
COVERAGE_ON();
|
COVERAGE_ON();
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
|
8
kernel/trunk/umka/win32/pci.c
Normal file
8
kernel/trunk/umka/win32/pci.c
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#include "pci.h"
|
||||||
|
|
||||||
|
__attribute__((stdcall)) uint32_t pci_read(uint32_t bus, uint32_t dev,
|
||||||
|
uint32_t fun, uint32_t offset,
|
||||||
|
size_t len) {
|
||||||
|
printf("STUB: %s() -> 0", __func__);
|
||||||
|
return 0;
|
||||||
|
}
|
8
kernel/trunk/umka/win32/pci.h
Normal file
8
kernel/trunk/umka/win32/pci.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef PCI_H_INCLUDED
|
||||||
|
#define PCI_H_INCLUDED
|
||||||
|
|
||||||
|
#include "umka.h"
|
||||||
|
|
||||||
|
extern char pci_path[PATH_MAX];
|
||||||
|
|
||||||
|
#endif // PCI_H_INCLUDED
|
8
kernel/trunk/umka/win32/thread.c
Normal file
8
kernel/trunk/umka/win32/thread.c
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
void reset_procmask(void) {
|
||||||
|
printf("STUB: %s()", __func__);
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_fake_if(void *ctx) {
|
||||||
|
printf("STUB: %s() -> 0", __func__);
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user