From 63c570c54d63c0f9afb8acffb1a6ccd19e7c8823 Mon Sep 17 00:00:00 2001 From: Yogev Ezra Date: Sun, 7 Jul 2013 23:12:01 +0000 Subject: [PATCH] Added 2 more options to blue screen: c) BOOT_DEBUG_PRINT and d) BOOT_LAUNCHER_START. Existing option "Boot device" is now e). BOOT_DEBUG_PRINT = If set to "yes"/"on", will duplicate debug output to the screen. Default is "no"/"off". BOOT_LAUNCHER_START = If set to "no"/"off", LAUNCHER application won't be run after kernel has loaded. Default is "yes"/"on". git-svn-id: svn://kolibrios.org@3777 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/boot/bootcode.inc | 77 +++++++++++++++++++++++++--------- kernel/trunk/boot/booten.inc | 10 ++++- kernel/trunk/boot/bootet.inc | 10 ++++- kernel/trunk/boot/bootge.inc | 10 ++++- kernel/trunk/boot/bootru.inc | 10 ++++- kernel/trunk/boot/bootsp.inc | 10 ++++- kernel/trunk/boot/preboot.inc | 2 + kernel/trunk/const.inc | 4 +- kernel/trunk/kernel.asm | 29 +++++++++---- 9 files changed, 124 insertions(+), 38 deletions(-) diff --git a/kernel/trunk/boot/bootcode.inc b/kernel/trunk/boot/bootcode.inc index 1340ace721..0aaceda0e4 100644 --- a/kernel/trunk/boot/bootcode.inc +++ b/kernel/trunk/boot/bootcode.inc @@ -596,9 +596,11 @@ cfgmanager: ; settings: ; a) preboot_graph = graphical mode ; preboot_gprobe = probe this mode? -; b) preboot_dma = use DMA access? -; c) preboot_vrrm = use VRR? -; d) preboot_device = from what boot? +; b) preboot_biosdisk = use BIOS disks through V86 emulation? // (earlier was: preboot_dma = use DMA access?) +; c) preboot_debug = duplicates kernel debug output to the screen // (earlier was: preboot_vrrm = use VRR?) +; // VRR is an obsolete functionality, used only with CRT monitors: increase display frequency by reducing screen resolution +; d) preboot_launcher = start the first app (right now it's LAUNCHER) after kernel is loaded? +; e) preboot_device = from where to boot? ; determine default settings if ~ defined extended_primary_loader @@ -632,6 +634,8 @@ end if ; following 4 lines set variables to 1 if its current value is 0 cmp byte [di+preboot_dma-preboot_device], 1 adc byte [di+preboot_dma-preboot_device], 0 + cmp byte [di+preboot_launcher-preboot_device], 1 ; Start LAUNCHER by default + adc byte [di+preboot_launcher-preboot_device], 0 ; cmp byte [di+preboot_biosdisk-preboot_device], 1 ; adc byte [di+preboot_biosdisk-preboot_device], 0 ;; default value for VRR is OFF @@ -669,6 +673,12 @@ end if ; mov si, vrrm_msg ; cmp [preboot_vrrm], 1 ; call .say_on_off + mov si, debug_mode_msg + cmp [preboot_debug], 1 + call .say_on_off + mov si, launcher_msg + cmp [preboot_launcher], 1 + call .say_on_off mov si, preboot_device_msg call print mov al, [preboot_device] @@ -752,17 +762,20 @@ end if cmp al, 13 jz .continue or al, 20h - cmp al, 'a' + cmp al, 'a' ; select graphical mode jz .change_a cmp al, 'q' ; Trick to make 'A' key on azerty keyboard work je .change_a - cmp al, 'b' + cmp al, 'b' ; use BIOS disks? // (selecting YES will make BIOS disks visible as /bd) jz .change_b -; cmp al, 'c' -; jz .change_c - cmp al, 'c' ; 'd' + cmp al, 'c' ; load kernel in debug mode? // (earlier was: use VRR?) + jz .change_c + cmp al, 'd' ; start launcher after kernel is loaded? + jz .change_d + cmp al, 'e' ; select boot origin jnz .show_remarks - _setcursor 15,0 +; e) preboot_device = from where to boot? + _setcursor 16,0 mov si, bdev call print if defined extended_primary_loader @@ -772,7 +785,7 @@ else end if call getkey mov [preboot_device], al - _setcursor 13,0 + _setcursor 14,0 .d: if ~ defined extended_primary_loader mov [.bSettingsChanged], 1 @@ -858,9 +871,9 @@ end if jmp .d -.change_b: - _setcursor 15,0 -; mov si, ask_dma +.change_b: ; b) preboot_biosdisk = use BIOS disks through V86 emulation? + _setcursor 16,0 +; mov si, ask_dma // (earlier was: preboot_dma = use DMA access?) ; call print ; mov bx, '13' ; call getkey @@ -872,8 +885,8 @@ end if mov [preboot_biosdisk], al _setcursor 11,0 jmp .d -;.change_c: -; _setcursor 15,0 +;.change_c: ; // VRR is an obsolete functionality, used only with CRT monitors +; _setcursor 16,0 ; mov si, vrrmprint ; call print ; mov bx, '12' @@ -881,6 +894,24 @@ end if ; mov [preboot_vrrm], al ; _setcursor 12,0 ; jmp .d +.change_c: ; c) preboot_debug = duplicates kernel debug output to the screen + _setcursor 16,0 + mov si, ask_debug + call print + mov bx, '12' + call getkey + mov [preboot_debug], al + _setcursor 12,0 + jmp .d +.change_d: ; d) preboot_launcher = start the first app (right now it's LAUNCHER) after kernel is loaded? + _setcursor 16,0 + mov si, ask_launcher + call print + mov bx, '12' + call getkey + mov [preboot_launcher], al + _setcursor 13,0 + jmp .d ;;;;;;;;;;;;;;;;;;;;;;;;;;;; .say_on_off: pushf @@ -988,7 +1019,7 @@ end if _setcursor 6,0 mov si, loading_msg call print - _setcursor 15,0 + _setcursor 16,0 if ~ defined extended_primary_loader cmp [.bSettingsChanged], 0 jz .load @@ -1030,9 +1061,9 @@ if ~ defined extended_primary_loader pop ds mov si, space_msg mov byte [si+80], 0 - _setcursor 15,0 + _setcursor 16,0 call printplain - _setcursor 15,0 + _setcursor 16,0 .load: end if ; \end{diamond}[02.12.2005] @@ -1053,7 +1084,15 @@ end if ;; VRR_M USE ; ; mov al,[preboot_vrrm] -; mov [es:0x9030], al +; mov [es:BOOT_VRR], al ;// 0x9030 + +; Set kernel DEBUG mode - if nonzero, duplicates debug output to the screen. + mov al, [preboot_debug] + mov [es:BOOT_DEBUG_PRINT], al ;// 0x901E + +; Start the first app (right now it's LAUNCHER) after kernel is loaded? + mov al, [preboot_launcher] + mov [es:BOOT_LAUNCHER_START], al ;// 0x901D ; BOOT DEVICE diff --git a/kernel/trunk/boot/booten.inc b/kernel/trunk/boot/booten.inc index c8e769910a..52caa046db 100644 --- a/kernel/trunk/boot/booten.inc +++ b/kernel/trunk/boot/booten.inc @@ -52,7 +52,7 @@ diskload db "Loading diskette: 00 %",8,8,8,8,0 pros db "00" backspace2 db 8,8,0 boot_dev db 0 ; 0=floppy, 1=hd -start_msg db "Press [abc] to change settings, press [Enter] to continue booting",13,10,0 +start_msg db "Press [abcde] to change settings, press [Enter] to continue booting",13,10,0 time_msg db " or wait " time_str db " 5 seconds" db " before automatical continuation",13,10,0 @@ -66,7 +66,13 @@ usebd_msg db " [b] Add disks visible by BIOS:",0 on_msg db " on",13,10,0 off_msg db " off",13,10,0 -preboot_device_msg db " [c] Floppy image: ",0 +debug_mode_msg db " [c] Duplicate debug output to the screen:",0 +ask_debug db "Duplicate debug output to the screen? [1-yes, 2-no]: ",0 + +launcher_msg db " [d] Start LAUNCHER after kernel is loaded:",0 +ask_launcher db "Start first app (LAUNCHER) after kernel is loaded? [1-yes, 2-no]: ",0 + +preboot_device_msg db " [e] Floppy image: ",0 if defined extended_primary_loader preboot_device_msgs dw 0,pdm1,pdm2,0 diff --git a/kernel/trunk/boot/bootet.inc b/kernel/trunk/boot/bootet.inc index 7efe46c1ad..87deccafe7 100644 --- a/kernel/trunk/boot/bootet.inc +++ b/kernel/trunk/boot/bootet.inc @@ -52,7 +52,7 @@ diskload: latin1 "Loen disketti: 00 %",8,8,8,8,0 pros: latin1 "00" backspace2:latin1 8,8,0 boot_dev db 0 ; 0=floppy, 1=hd -start_msg:latin1 "Vajuta [abc] seadete muutmiseks, vajuta [Enter] laadimise jätkamiseks",13,10,0 +start_msg:latin1 "Vajuta [abcde] seadete muutmiseks, vajuta [Enter] laadimise jätkamiseks",13,10,0 time_msg: latin1 " või oota " time_str: latin1 " 5 sekundit" latin1 " automaatseks jätkamiseks",13,10,0 @@ -66,7 +66,13 @@ usebd_msg:latin1 " [b] Lisa kettad nahtavaks BIOS:",0 on_msg: latin1 " sees",13,10,0 off_msg: latin1 " väljas",13,10,0 -preboot_device_msg:latin1 " [c] Disketi kujutis: ",0 +debug_mode_msg: latin1 " [c] Duplicate siluda väljund ekraani:",0 +ask_debug: latin1 "Duplicate siluda väljund ekraani? [1-jah, 2-no]: ",0 + +launcher_msg: latin1 " [d] Alusta LAUNCHER pärast kernel on koormatud:",0 +ask_launcher: latin1 "Alusta esimese taotluse (LAUNCHER) pärast kernel laetakse? [1-jah, 2-no]: ",0 + +preboot_device_msg:latin1 " [e] Disketi kujutis: ",0 if defined extended_primary_loader preboot_device_msgs dw 0,pdm1,pdm2,0 diff --git a/kernel/trunk/boot/bootge.inc b/kernel/trunk/boot/bootge.inc index 79dc6c889d..0aeebec46c 100644 --- a/kernel/trunk/boot/bootge.inc +++ b/kernel/trunk/boot/bootge.inc @@ -54,7 +54,7 @@ diskload db "Lade Diskette: 00 %",8,8,8,8,0 pros db "00" backspace2 db 8,8,0 boot_dev db 0 ; 0=floppy, 1=hd -start_msg db "Druecke [abc], um die Einstellungen zu aendern, druecke [Enter] zum starten",13,10,0 +start_msg db "Druecke [abcde], um die Einstellungen zu aendern, druecke [Enter] zum starten",13,10,0 time_msg db " oder warte " time_str db " 5 Sekunden" db " bis zum automatischen Start",13,10,0 @@ -68,7 +68,13 @@ usebd_msg db " [b] Add-Festplatten sichtbar durch das BIOS:",0 on_msg db " an",13,10,0 off_msg db " aus",13,10,0 -preboot_device_msg db " [c] Diskettenimage: ",0 +debug_mode_msg db " [c] Duplizieren debuggen Ausgabe auf dem Bildschirm:",0 +ask_debug db "Duplizieren debuggen Ausgabe auf dem Bildschirm? [1-ja, 2 nein]: ",0 + +launcher_msg db " [d] Start LAUNCHER nach Kernel geladen wird:",0 +ask_launcher db "Starten sie die erste App (LAUNCHER) nach Kernel geladen wird? [1-ja, 2 nein]: ",0 + +preboot_device_msg db " [e] Diskettenimage: ",0 if defined extended_primary_loader preboot_device_msgs dw 0,pdm1,pdm2,0 diff --git a/kernel/trunk/boot/bootru.inc b/kernel/trunk/boot/bootru.inc index 34b27e063b..abd1c7dc44 100644 --- a/kernel/trunk/boot/bootru.inc +++ b/kernel/trunk/boot/bootru.inc @@ -50,7 +50,7 @@ diskload: cp866 "Загрузка дискеты: 00 %",8,8,8,8,0 pros: cp866 "00" backspace2:cp866 8,8,0 boot_dev db 0 -start_msg:cp866 "Нажмите [abc] для изменения настроек, [Enter] для продолжения загрузки",13,10,0 +start_msg:cp866 "Нажмите [abcde] для изменения настроек, [Enter] для продолжения загрузки",13,10,0 time_msg: cp866 " или подождите " time_str: cp866 " 5 секунд " cp866 " до автоматического продолжения",13,10,0 @@ -64,7 +64,13 @@ usebd_msg:cp866 " [b] Добавить диски, видимые чере on_msg: cp866 " вкл",13,10,0 off_msg: cp866 " выкл",13,10,0 -preboot_device_msg:cp866 " [c] Образ дискеты: ",0 +debug_mode_msg: cp866 " [c] Дублировать дебаг-вывод на экран монитора:",0 +ask_debug: cp866 "Дублировать дебаг-вывод на экран монитора? [1-да, 2-нет]: ",0 + +launcher_msg: cp866 " [d] Запустить программу LAUNCHER после загрузки ядра:",0 +ask_launcher: cp866 "Запустить первую программу (LAUNCHER) после загрузки ядра? [1-да, 2-нет]: ",0 + +preboot_device_msg:cp866 " [e] Образ дискеты: ",0 if defined extended_primary_loader preboot_device_msgs dw 0,pdm1,pdm2,0 diff --git a/kernel/trunk/boot/bootsp.inc b/kernel/trunk/boot/bootsp.inc index 3206cb7682..1f6e6345aa 100644 --- a/kernel/trunk/boot/bootsp.inc +++ b/kernel/trunk/boot/bootsp.inc @@ -56,7 +56,7 @@ diskload: cp850 "Cargando disquete: 00 %",8,8,8,8,0 pros: cp850 "00" backspace2:cp850 8,8,0 boot_dev db 0 ; 0=floppy, 1=hd -start_msg:cp850 "Presiona [abc] para cambiar la configuración, [Enter] para continuar",13,10,0 +start_msg:cp850 "Presiona [abcde] para cambiar la configuración, [Enter] para continuar",13,10,0 time_msg: cp850 " o espera " time_str: cp850 " 5 segundos" cp850 " para que inicie automáticamente",13,10,0 @@ -70,7 +70,13 @@ usebd_msg:cp850 " [b] Agregar discos visibles por el BIOS:",0 on_msg: cp850 " activado",13,10,0 off_msg: cp850 " desactivado",13,10,0 -preboot_device_msg:cp850 " [c] Imagen de disquete: ",0 +debug_mode_msg: cp850 " [c] Duplicar depurar salida a la pantalla:",0 +ask_debug: cp850 "¿Duplicar depurar la salida a la pantalla? [1-si, 2-no]: ",0 + +launcher_msg: cp850 " [d] Iniciar LAUNCHER después de cargar kernel:",0 +ask_launcher: cp850 "¿Inicie la primera aplicación (LAUNCHER) después de cargar el kernel? [1-si, 2-no]: ",0 + +preboot_device_msg:cp850 " [e] Imagen de disquete: ",0 if defined extended_primary_loader preboot_device_msgs dw 0,pdm1,pdm2,0 diff --git a/kernel/trunk/boot/preboot.inc b/kernel/trunk/boot/preboot.inc index 19923f550f..72404b7ba5 100644 --- a/kernel/trunk/boot/preboot.inc +++ b/kernel/trunk/boot/preboot.inc @@ -24,6 +24,8 @@ number_vm dw 0 ; ;pixel_save dw 0 ; per to pixel preboot_gprobe db 0 ; probe vesa3 videomodes (1-no, 2-yes) ;preboot_vrrm db 0 ; use VRR_M (1-yes, 2- no) +preboot_debug db 0 ; load kernel in debug mode? (1-yes, 2-no) +preboot_launcher db 0 ; start launcher after kernel is loaded? (1-yes, 2-no) preboot_dma db 0 ; use DMA for access to HDD (1-always, 2-only for read, 3-never) preboot_device db 0 ; boot device ; (1-floppy 2-harddisk 3-kernel restart 4-format ram disk) diff --git a/kernel/trunk/const.inc b/kernel/trunk/const.inc index e4a610dbcb..62bbf9abbc 100644 --- a/kernel/trunk/const.inc +++ b/kernel/trunk/const.inc @@ -295,8 +295,10 @@ BOOT_Y_RES equ 0x900C ;word Y res BOOT_BANK_SW equ 0x9014 ;dword Vesa 1.2 pm bank switch BOOT_LFB equ 0x9018 ;dword Vesa 2.0 LFB address BOOT_MTRR equ 0x901C ;byte 0 or 1 : enable MTRR graphics acceleration -BOOT_LOG equ 0x901D ;byte not used anymore (0 or 1 : enable system log display) +;BOOT_LOG equ 0x901D ;byte not used anymore (0 or 1 : enable system log display) +BOOT_LAUNCHER_START equ 0x901D ;byte (0 or 1) start the first app (right now it's LAUNCHER) after kernel is loaded? ;BOOT_DIRECT_LFB equ 0x901E ;byte 0 or 1 : enable direct lfb write, paging disabled +BOOT_DEBUG_PRINT equ 0x901E ;byte If nonzero, duplicates debug output to the screen. BOOT_DMA equ 0x901F ; BOOT_PCI_DATA equ 0x9020 ;8bytes pci data BOOT_VRR equ 0x9030 ;byte VRR start enabled 1, 2-no diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 17886f44cc..2b9853ca41 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -79,8 +79,6 @@ VESA_1_2_VIDEO equ 0 ; enable vesa 1.2 bank switch functions ; Enabling the next line will enable serial output console ;debug_com_base equ 0x3f8 ; 0x3f8 is com1, 0x2f8 is com2, 0x3e8 is com3, 0x2e8 is com4, no irq's are used -; The following constant, if nonzero, duplicates debug output to the screen. -debug_direct_print equ 0 include "proc32.inc" include "kglobals.inc" @@ -88,10 +86,17 @@ include "lang.inc" include "encoding.inc" include "const.inc" + +iglobal +; The following variable, if equal to 1, duplicates debug output to the screen. +debug_direct_print db 0 +; Start the first app (LAUNCHER) after kernel is loaded? (1=yes, 2 or 0=no) +launcher_start db 1 +endg + max_processes equ 255 tss_step equ (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4 - os_stack equ (os_data_l-gdts) ; GDTs os_code equ (os_code_l-gdts) graph_data equ (3+graph_data_l-gdts) @@ -471,7 +476,10 @@ save_variables_IDE_controller: movzx eax, byte [BOOT_VARS+BOOT_BPP] ; bpp mov [_display.bpp], eax mov [_display.vrefresh], 60 - + mov al, [BOOT_VARS+BOOT_DEBUG_PRINT] ; If nonzero, duplicates debug output to the screen + mov [debug_direct_print], al + mov al, [BOOT_VARS+BOOT_LAUNCHER_START] ; Start the first app (LAUNCHER) after kernel is loaded? + mov [launcher_start], al movzx eax, word [BOOT_VARS+BOOT_X_RES]; X max mov [_display.width], eax mov [display_width_standard], eax @@ -961,8 +969,10 @@ end if [SLOT_BASE+256+APPDATA.io_map+4], PG_MAP ; LOAD FIRST APPLICATION - cli + cmp byte [launcher_start], 1 ; Check if starting LAUNCHER is selected on blue screen (1 = yes) + jnz @f + cli mov ebp, firstapp call fs_execute_from_sysdir test eax, eax @@ -4863,10 +4873,12 @@ if defined debug_com_base end if mov [msg_board_data+ecx], bl -if debug_direct_print +; // if debug_direct_print == 1 + cmp byte [debug_direct_print], 1 + jnz @f pusha iglobal -msg_board_pos dd 234*65536+10 +msg_board_pos dd 234*65536+10 ; for printing debug output on the screen endg lea edx, [msg_board_data+ecx] mov ecx, 0x40FFFFFF @@ -4885,7 +4897,8 @@ endg jbe @f mov word [msg_board_pos], 10 @@: -end if +; // end if + if 0 pusha mov al, bl