diff --git a/kernel/trunk/bootloader/uefi4kos/uefi32kos.asm b/kernel/trunk/bootloader/uefi4kos/uefi32kos.asm index 4efa359364..a4be7bf012 100644 --- a/kernel/trunk/bootloader/uefi4kos/uefi32kos.asm +++ b/kernel/trunk/bootloader/uefi4kos/uefi32kos.asm @@ -24,6 +24,7 @@ FILE_BUFFER_SIZE = 0x1000 KERNEL_BASE = 0x10000 RAMDISK_BASE = 0x100000 +MAX_FILE_SIZE = 0x10000000 CODE_32_SELECTOR = 8 DATA_32_SELECTOR = 16 @@ -410,12 +411,12 @@ main: mov eax, [esi+EFI_SYSTEM_TABLE.ConOut] ccall [eax+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString], eax, \ msg_load_kernel - stdcall load_file, [esp_root], kernel_name, KERNEL_BASE, -1, 1 + stdcall load_file, [esp_root], kernel_name, KERNEL_BASE, MAX_FILE_SIZE, 1 mov eax, [esi+EFI_SYSTEM_TABLE.ConOut] ccall [eax+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString], eax, \ msg_load_ramdisk - stdcall load_file, [esp_root], ramdisk_name, RAMDISK_BASE, -1, 1 + stdcall load_file, [esp_root], ramdisk_name, RAMDISK_BASE, MAX_FILE_SIZE, 1 mov eax, [esi+EFI_SYSTEM_TABLE.ConOut] ccall [eax+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString], eax, \ @@ -845,43 +846,25 @@ proc clearbuf ret endp -section '.data' data readable writeable -efi_handle dd 0 -efi_table dd 0 - +section '.rodata' data readable +align 16 GDTR: dw 3*8-1 dq GDT +align 16 GDT: dw 0, 0, 0, 0 dw 0FFFFh,0,9A00h,0CFh ; 32-bit code dw 0FFFFh,0,9200h,0CFh ; flat data - -fb_base dd 0 - gopuuid db EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID -gop_buffer_size dd GOP_BUFFER_SIZE -gop_handle dd 0 -gop_interface dd 0 -gop_info_size dd 0 -gop_info dd 0 - lipuuid db EFI_LOADED_IMAGE_PROTOCOL_GUID -lip_buffer_size dd LIP_BUFFER_SIZE -lip_handle dd 0 -lip_interface dd 0 - sfspguid db EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID -sfsp_interface dd 0 -esp_root dd ? -file_handle dd ? file_name du "\EFI\KOLIBRIOS\KOLIBRI.INI",0 kernel_name du "\EFI\KOLIBRIOS\KOLIBRI.KRN",0 ramdisk_name du "\EFI\KOLIBRIOS\KOLIBRI.IMG",0 devicesdat_name du "\EFI\KOLIBRIOS\DEVICES.DAT",0 -file_buffer_size dd FILE_BUFFER_SIZE-1 ; leave the last byte for \0 config_options dd cfg_opt_name_resolution, cfg_opt_func_resolution, \ cfg_opt_cmnt_resolution, \ @@ -922,30 +905,6 @@ cfg_opt_cmnt_ask_params db "# Interrupt booting to ask the user for boot", \ cfg_opt_cmnt_imgfrom db "# Where to load ramdisk image from",0 cfg_opt_cmnt_syspath db "# Path to /sys directory",0 -cfg_opt_used_resolution db 0 -cfg_opt_used_acpi db 0 -cfg_opt_used_debug_print db 0 -cfg_opt_used_launcher_start db 0 -cfg_opt_used_mtrr db 0 -cfg_opt_used_ask_params db 0 -cfg_opt_used_imgfrom db 0 -cfg_opt_used_syspath db 0 - -cfg_opt_value_vmode db 0 -cfg_opt_value_acpi db 0 -cfg_opt_value_debug_print db 0 -cfg_opt_value_launcher_start db 1 -cfg_opt_value_mtrr db 0 -cfg_opt_value_ask_params db 0 -cfg_opt_value_imgfrom db RD_LOAD_FROM_MEMORY -cfg_opt_value_syspath db "/RD/1",0 - rb 20 - -memory_map_key dd 0 -descriptor_size dd 0 -descriptor_ver dd 0 -memory_map_size dd MEMORY_MAP_SIZE - msg_u4k_loaded du "uefi32kos loaded",13,10,0 msg_read_options du "Read options from config file",13,10,0 msg_load_kernel du "Load kernel",13,10,0 @@ -971,6 +930,53 @@ msg_error_out_of_handlers du "Out of handlers",13,10,0 msg_error_open_file du "Error: can't open file ",0 msg du 79 dup " ",13,10,0 + +section '.data' data readable writeable +efi_handle dd 0 +efi_table dd 0 + +fb_base dd 0 + +gop_buffer_size dd GOP_BUFFER_SIZE +gop_handle dd 0 +gop_interface dd 0 +gop_info_size dd 0 +gop_info dd 0 + +lip_buffer_size dd LIP_BUFFER_SIZE +lip_handle dd 0 +lip_interface dd 0 + +sfsp_interface dd 0 + +esp_root dd ? +file_handle dd ? +file_buffer_size dd FILE_BUFFER_SIZE-1 ; leave the last byte for \0 + +cfg_opt_used_resolution db 0 +cfg_opt_used_acpi db 0 +cfg_opt_used_debug_print db 0 +cfg_opt_used_launcher_start db 0 +cfg_opt_used_mtrr db 0 +cfg_opt_used_ask_params db 0 +cfg_opt_used_imgfrom db 0 +cfg_opt_used_syspath db 0 + +cfg_opt_value_vmode db 0 +cfg_opt_value_acpi db 0 +cfg_opt_value_debug_print db 0 +cfg_opt_value_launcher_start db 1 +cfg_opt_value_mtrr db 0 +cfg_opt_value_ask_params db 0 +cfg_opt_value_imgfrom db RD_LOAD_FROM_MEMORY +cfg_opt_value_syspath db "/RD/1",0 + rb 20 + +memory_map_key dd 0 +descriptor_size dd 0 +descriptor_ver dd 0 +memory_map_size dd MEMORY_MAP_SIZE + efi_fs_info_id db EFI_FILE_SYSTEM_INFO_ID efi_fs_info_size dq sizeof.EFI_FILE_SYSTEM_INFO efi_fs_info EFI_FILE_SYSTEM_INFO diff --git a/kernel/trunk/bootloader/uefi4kos/uefi64kos.asm b/kernel/trunk/bootloader/uefi4kos/uefi64kos.asm index 98b120eb65..bd4f1d9e87 100644 --- a/kernel/trunk/bootloader/uefi4kos/uefi64kos.asm +++ b/kernel/trunk/bootloader/uefi4kos/uefi64kos.asm @@ -25,6 +25,7 @@ FILE_BUFFER_SIZE = 0x1000 KERNEL_BASE = 0x10000 RAMDISK_BASE = 0x100000 +MAX_FILE_SIZE = 0x10000000 CODE_32_SELECTOR = 8 DATA_32_SELECTOR = 16 @@ -400,7 +401,7 @@ find_vmode_index_by_resolution: movzx eax, [cfg_opt_value_vmode] mov rcx, [gop_interface] mov rdx, [rcx+EFI_GRAPHICS_OUTPUT_PROTOCOL.Mode] - cmp eax, 8;[rdx+EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE.MaxMode] + cmp eax, [rdx+EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE.MaxMode] jnz .next_mode mov [cfg_opt_used_resolution], 0 mov [cfg_opt_value_ask_params], 1 @@ -526,8 +527,8 @@ main: mov rbx, [rbx+EFI_SYSTEM_TABLE.ConOut] eficall rbx, EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString, rbx, \ msg_load_kernel - push 1 - push -1 + push 1 ; fatal + push MAX_FILE_SIZE push KERNEL_BASE ; push kernel_name mov rax, kernel_name @@ -540,8 +541,8 @@ main: mov rbx, [rbx+EFI_SYSTEM_TABLE.ConOut] eficall rbx, EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString, rbx, \ msg_load_ramdisk - push 1 - push -1 + push 1 ; fatal + push MAX_FILE_SIZE push RAMDISK_BASE ; push ramdisk_name mov rax, ramdisk_name @@ -1085,45 +1086,26 @@ clearbuf: pop rdi rsi rdx rcx rbx rax ret -section '.data' data readable writeable -efi_handle dq 0 -efi_table dq 0 -uefi_rsptmp dq 0 - +section '.rodata' data readable +align 16 GDTR: dw 4*8-1 dq GDT +align 16 GDT: dw 0, 0, 0, 0 dw 0FFFFh,0,9A00h,0CFh ; 32-bit code dw 0FFFFh,0,9200h,0CFh ; flat data dw 0FFFFh,0,9A00h,0AFh ; 64-bit code - -fb_base dq 0 - gopuuid db EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID -gop_buffer_size dq GOP_BUFFER_SIZE -gop_handle dq 0 -gop_interface dq 0 -gop_info_size dq 0 -gop_info dq 0 - lipuuid db EFI_LOADED_IMAGE_PROTOCOL_GUID -lip_buffer_size dq LIP_BUFFER_SIZE -lip_handle dq 0 -lip_interface dq 0 - sfspguid db EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID -sfsp_interface dq 0 -esp_root dq ? -file_handle dq ? file_name du '\EFI\KOLIBRIOS\KOLIBRI.INI',0 kernel_name du '\EFI\KOLIBRIOS\KOLIBRI.KRN',0 ramdisk_name du '\EFI\KOLIBRIOS\KOLIBRI.IMG',0 devicesdat_name du '\EFI\KOLIBRIOS\DEVICES.DAT',0 -file_buffer_size dq FILE_BUFFER_SIZE-1 ; leave the last byte for \0 config_options dq cfg_opt_name_resolution, cfg_opt_func_resolution, \ cfg_opt_cmnt_resolution, \ @@ -1164,30 +1146,6 @@ cfg_opt_cmnt_ask_params db "# Interrupt booting to ask the user for boot", \ cfg_opt_cmnt_imgfrom db "# Where to load ramdisk image from",0 cfg_opt_cmnt_syspath db "# Path to /sys directory",0 -cfg_opt_used_resolution db 0 -cfg_opt_used_acpi db 0 -cfg_opt_used_debug_print db 0 -cfg_opt_used_launcher_start db 0 -cfg_opt_used_mtrr db 0 -cfg_opt_used_ask_params db 0 -cfg_opt_used_imgfrom db 0 -cfg_opt_used_syspath db 0 - -cfg_opt_value_vmode db 0 -cfg_opt_value_acpi db 0 -cfg_opt_value_debug_print db 0 -cfg_opt_value_launcher_start db 1 -cfg_opt_value_mtrr db 0 -cfg_opt_value_ask_params db 0 -cfg_opt_value_imgfrom db RD_LOAD_FROM_MEMORY -cfg_opt_value_syspath db "/RD/1",0 - rb 20 - -memory_map_key dq 0 -descriptor_size dq 0 -descriptor_ver dq 0 -memory_map_size dq MEMORY_MAP_SIZE - msg_u4k_loaded du "uefi64kos loaded",13,10,0 msg_read_options du "Read options from config file",13,10,0 msg_file_size du "File size:",13,10,0 @@ -1220,6 +1178,54 @@ msg_error_open_file du "Error: can't open file ",0 msg_error_exit_boot_services du "Error: Exit boot services",13,10,0 msg du 79 dup " ",13,10,0 + +section '.data' data readable writeable +efi_handle dq 0 +efi_table dq 0 +uefi_rsptmp dq 0 + +fb_base dq 0 + +gop_buffer_size dq GOP_BUFFER_SIZE +gop_handle dq 0 +gop_interface dq 0 +gop_info_size dq 0 +gop_info dq 0 + +lip_buffer_size dq LIP_BUFFER_SIZE +lip_handle dq 0 +lip_interface dq 0 + +sfsp_interface dq 0 + +esp_root dq ? +file_handle dq ? +file_buffer_size dq FILE_BUFFER_SIZE-1 ; leave the last byte for \0 + +cfg_opt_used_resolution db 0 +cfg_opt_used_acpi db 0 +cfg_opt_used_debug_print db 0 +cfg_opt_used_launcher_start db 0 +cfg_opt_used_mtrr db 0 +cfg_opt_used_ask_params db 0 +cfg_opt_used_imgfrom db 0 +cfg_opt_used_syspath db 0 + +cfg_opt_value_vmode db 0 +cfg_opt_value_acpi db 0 +cfg_opt_value_debug_print db 0 +cfg_opt_value_launcher_start db 1 +cfg_opt_value_mtrr db 0 +cfg_opt_value_ask_params db 0 +cfg_opt_value_imgfrom db RD_LOAD_FROM_MEMORY +cfg_opt_value_syspath db "/RD/1",0 + rb 20 + +memory_map_key dq 0 +descriptor_size dq 0 +descriptor_ver dq 0 +memory_map_size dq MEMORY_MAP_SIZE + efi_fs_info_id db EFI_FILE_SYSTEM_INFO_ID efi_fs_info_size dq sizeof.EFI_FILE_SYSTEM_INFO efi_fs_info EFI_FILE_SYSTEM_INFO diff --git a/kernel/trunk/init.inc b/kernel/trunk/init.inc index 8f25304652..af72b258a9 100644 --- a/kernel/trunk/init.inc +++ b/kernel/trunk/init.inc @@ -70,7 +70,7 @@ proc init_mem ; ignore memory after 4 GiB cmp [edi+e820entry.addr.hi], 0 jnz .unusable - mov eax, [edi] + mov eax, [edi+e820entry.addr.lo] cmp [edi+e820entry.size.hi], 0 jnz .overflow add eax, [edi+e820entry.size.lo] diff --git a/kernel/trunk/video/cursors.inc b/kernel/trunk/video/cursors.inc index 7b9dc48e99..1b089836b4 100644 --- a/kernel/trunk/video/cursors.inc +++ b/kernel/trunk/video/cursors.inc @@ -1165,12 +1165,13 @@ init_display: mov [edi+display_t.cr_list.next], ecx mov [edi+display_t.cr_list.prev], ecx +if ~defined UEFI cmp [SCR_MODE], word 0x13 jbe .fail test word [SCR_MODE], 0x4000 jz .fail - +end if mov ebx, restore_32 mov ecx, move_cursor_32 mov edx, Vesa20_putpixel32_new