Fixed a "blue screen" hang when trying to write a configuration to a read-only device

git-svn-id: svn://kolibrios.org@9942 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat 2023-09-22 19:17:33 +00:00
parent 69f5ec5ac7
commit e4362a1edc
7 changed files with 63 additions and 42 deletions

View File

@ -93,6 +93,14 @@ macro _ask_question question,range,variable_to_set
mov [variable_to_set], al
}
clear_status_field:
mov si, space_msg
mov byte [si+80], 0
_setcursor 16,0
call printplain
_setcursor 16,0
ret
boot_read_floppy:
push si
xor si, si
@ -276,7 +284,6 @@ else
cld
push 0
pop es
; \begin{diamond}[02.12.2005]
; if bootloader sets ax = 'KL', then ds:si points to loader block
cmp ax, 'KL'
jnz @f
@ -284,8 +291,6 @@ else
mov word [cs:cfgmanager.loader_block+2], ds
mov word [es:BOOT_LO.kernel_restart], kernel_restart_bootblock
@@:
; \end{diamond}[02.12.2005]
; if bootloader sets cx = 'HA' and dx = 'RD', then bx contains identifier of source disk
; (see comment to BOOT_LO.sys_disk and loader_doc.txt)
mov word [es:BOOT_LO.sys_disk], 'r1' ; default value: /rd/1
@ -420,7 +425,6 @@ sayerr:
loopz @b
in al, 0x60
;;;/diamond today 5.02.2008
; set keyboard typematic rate & delay
mov al, 0xf3
out 0x60, al
@ -494,7 +498,6 @@ noloaderblock:
call calc_vmodes_table
call check_first_parm ;check and enable cursor_pos
; \begin{diamond}[30.11.2005]
cfgmanager:
; settings:
; a) preboot_graph = graphical mode
@ -931,20 +934,30 @@ if ~ defined extended_primary_loader
push cs
push .cont
push eax
retf ;call back
retf ;call back
.loadc:
pop eax
.cont:
push cs
pop ds
mov si, space_msg
mov byte [si+80], 0
_setcursor 16,0
call printplain
_setcursor 16,0
push es
les bx, [.loader_block]
cmp byte [es:bx+7], 0 ; get write error flag
pop es
jz .load
call clear_status_field
mov si, write_err_msg
call print
.wait_any_key:
xor ax, ax
int 16h
test ax, ax
jz .wait_any_key
.load:
call clear_status_field
end if
; \end{diamond}[02.12.2005]
; ASK GRAPHICS MODE
@ -998,37 +1011,38 @@ include '../detect/biosmem.inc'
jne no_sys_on_floppy
mov si, diskload
call print
xor ax, ax ; reset drive
xor dx, dx
xor ax, ax ; reset drive
xor dx, dx ; 1st floppy disk (0)
int 0x13
; do we boot from CD-ROM?
mov ah, 41h
mov bx, 55AAh
xor dx, dx
mov ah, 41h ; check extended mode
mov bx, 55AAh ; test 2 bytes to check that this function is supported
xor dx, dx ; 1st floppy disk (0)
int 0x13
jc .nocd
jc .nocd ; extended mode not supported
cmp bx, 0AA55h
jnz .nocd
mov ah, 48h
jnz .nocd ; extended mode not supported
mov ah, 48h ; extended read drive parameters
push ds
push es
pop ds
mov si, 0xa000
mov word [si], 30
mov word [si], 30 ; size of result buffer
int 0x13
pop ds
jc .nocd
jc .nocd ; error getting parameters
push ds
lds si, [es:si+26]
test byte [ds:si+10], 40h
lds si, [es:si+26] ; pointer to Enhanced Disk Drive (EDD) configuration parameters
test byte [ds:si+10], 40h ; check ATAPI device
pop ds
jz .nocd
; yes - read all floppy by 18 sectors
; TODO: !!!! read only first sector and set variables !!!!!
; ...
; TODO: !!! then read flippy image track by track
mov cx, 0x0001 ; startcyl,startsector
.a1:
push cx dx

View File

@ -94,6 +94,7 @@ save_quest db "New settings have been applied.",13,10,13,10,186
db " Do you want to record them for the future boots?",13,10,186
db " Answer 'yes' only if your booting device is writable. [y/n]: ",0
loader_block_error db "Bootloader data invalid, I cannot continue. Stopped.",0
write_err_msg db "Recording the configuration has failed. Press any key to resume booting...",0
end if
_st latin1 '║ ┌───────────────────────────────┬─┐',13,10,0

View File

@ -89,8 +89,9 @@ end if
loading_msg latin1 "Laadin KolibriOS...",0
if ~ defined extended_primary_loader
save_quest latin1 "Jäta meelde praegused seaded? [y/n]: ",0
save_quest latin1 "Jäta meelde praegused seaded? [y/n]: ",0
loader_block_error latin1 "Alglaaduri andmed vigased, ei saa jätkata. Peatatud.",0
write_err_msg latin1 "Salvestamine ebaõnnestus. Käivitamise jätkamiseks vajutage suvalist klahvi...",0
end if
_st latin1 '║ ┌───────────────────────────────┬─┐',13,10,0
@ -103,4 +104,4 @@ remark1 latin1 "Vaikimisi väärtused on kasutatavad enamikes arvutites, kuid m
remark2 latin1 "Kui süsteem ei käivitu, proovige lülitada kirje [b] välja. Kui see läheb",0
remark3 latin1 "kinni pärast käivitamist, võimaldama valik [c], keelake [d] ja teha foto.",0
remarks dw remark1, remark2, remark3
num_remarks = 3
num_remarks = 3

View File

@ -89,8 +89,9 @@ end if
loading_msg db "Lade KolibriOS...",0
if ~ defined extended_primary_loader
save_quest db "Aktuelle Einstellungen speichern? [y/n]: ",0
save_quest db "Aktuelle Einstellungen speichern? [y/n]: ",0
loader_block_error db "Bootloader Daten ungueltig, Kann nicht fortfahren. Angehalten.",0
write_err_msg db "Schreiben fehlgeschlagen. Zum Booten eine beliebige Taste drucken...",0
end if
_st latin1 '║ ┌───────────────────────────────┬─┐',13,10,0
@ -104,4 +105,4 @@ remark2 db "Wenn das System nicht bootet, das Option [b] deaktivieren versu
remark3 db "nach dem Booten hangen bleibt, aktivieren Sie Option [c], deaktivieren [d]",0
remark4 db "und machen Fotos.",0
remarks dw remark1, remark2, remark3, remark4
num_remarks = 4
num_remarks = 4

View File

@ -92,6 +92,7 @@ save_quest cp866 "Новые настройки были применены.
cp866 "║ Хотите записать их для будущих загрузок? Отвечайте да, только",13,10
cp866 "║ если ваше загрузочное устройство доступно для записи. [y/n]: ",0
loader_block_error cp866 "Ошибка в данных начального загрузчика, продолжение невозможно.",0
write_err_msg cp866 "Неудалось записать. Нажмите любую клавишу, для продолжения загрузки...",0
end if
_st cp866 '║ ┌───────────────────────────────┬─┐ ',13,10,0

View File

@ -91,8 +91,9 @@ end if
loading_msg cp850 "Cargando KolibriOS...",0
if ~ defined extended_primary_loader
save_quest cp850 "¿Recordar configuración actual? [s/n]: ",0
loader_block_error cp850 "Bootloader inválido, no puedo continuar. Detenido.",0
save_quest cp850 "¿Recordar configuración actual? [s/n]: ",0
loader_block_error cp850 "Bootloader inválido, no puedo continuar. Detenido.",0
write_err_msg cp850 "La grabación ha fallado. Presione cualquier tecla para continuar...",0
end if
_st cp850 '║ ┌───────────────────────────────┬─┐',13,10,0

View File

@ -129,9 +129,7 @@ freeze_pc:
found_kernel_file:
mov bp, [si+01ah] ; first cluster of kernel file
; <diamond>
mov [cluster1st+boot_program], bp ; starting cluster of kernel file
; <\diamond>
; reading first FAT table
mov ax, word [BPB_RsvdSecCnt+boot_program] ; begin first FAT abs sector number
@ -184,12 +182,10 @@ verify_end_sector:
jmp loop_obtains_kernel_data
execute_kernel:
; <diamond>
mov ax, 'KL'
push 0
pop ds
mov si, loader_block+boot_program
; </diamond>
push word seg_read_kernel
push word 0
retf ; jmp far 1000:0000
@ -230,16 +226,23 @@ patchhere:
; read sector from disk
read_sector:
push bp
mov bp, 20 ; try 20 times
mov bp, 20 ; try 20 times
newread:
dec bp
jnz .next
cmp ah, 02h ; if read sectors
jz file_error_message
mov byte[write_err+boot_program], 1 ; if write sectors
jmp .ret
.next:
push ax bx cx dx
int 13h
pop dx cx bx ax
jc newread
.ret:
pop bp
retn
;------------------------------------------
; convert abs. sector number (AX) to BIOS T:H:S
; sector number = (abs.sector%BPB_SecPerTrk)+1
@ -279,7 +282,6 @@ FirstRootDirSecNum dw ?
RootDirSecs dw ?
data_start dw ?
; <diamond>
write1st:
push cs
pop ds
@ -293,11 +295,11 @@ write1st:
retf
cluster1st dw ?
loader_block:
db 1
dw 0
dw write1st+boot_program
dw 0
; <\diamond>
db 1 ; +0
dw 0 ; +1
dw write1st+boot_program ; +3
dw 0 ; +5
write_err: db 0 ; +7
times 0x1fe-$ db 00h