From 875ba74b275f4d0a2f4c8c8bad98d1cb33253bbb Mon Sep 17 00:00:00 2001 From: "Evgeny Grechnikov (Diamond)" Date: Mon, 21 May 2007 13:25:02 +0000 Subject: [PATCH] * unknown/unsupported videomode at boot leads to return in config manager * boot config manager now allows to totally disable DMA access to HD git-svn-id: svn://kolibrios.org@514 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/blkdev/hd_drv.inc | 10 +- kernel/trunk/boot/bootcode.inc | 1101 ++++++++++++++++---------------- kernel/trunk/boot/booteng.inc | 5 +- kernel/trunk/boot/bootet.inc | 5 +- kernel/trunk/boot/bootge.inc | 3 +- kernel/trunk/boot/bootru.inc | 5 +- kernel/trunk/boot/preboot.inc | 2 +- kernel/trunk/kernel.asm | 4 +- kernel/trunk/unpacker.inc | 0 9 files changed, 573 insertions(+), 562 deletions(-) mode change 100755 => 100644 kernel/trunk/blkdev/hd_drv.inc mode change 100755 => 100644 kernel/trunk/unpacker.inc diff --git a/kernel/trunk/blkdev/hd_drv.inc b/kernel/trunk/blkdev/hd_drv.inc old mode 100755 new mode 100644 index 99cdd94eaf..79b37e049c --- a/kernel/trunk/blkdev/hd_drv.inc +++ b/kernel/trunk/blkdev/hd_drv.inc @@ -54,6 +54,9 @@ hd_read: call find_empty_slot ; ret in edi cmp [hd_error],0 jne return_01 +; DMA read is permitted if [allow_dma_access]=1 or 2 + cmp [allow_dma_access], 2 + ja .nodma cmp [dma_hdd], 1 jnz .nodma call hd_read_dma @@ -229,8 +232,9 @@ write_cache: cmp eax,[PARTITION_END] ja danger - cmp [allow_dma_write], 1 - jnz .nodma +; DMA write is permitted only if [allow_dma_access]=1 + cmp [allow_dma_access], 2 + jae .nodma cmp [dma_hdd], 1 jnz .nodma ; Объединяем запись цепочки последовательных секторов в одно обращение к диску @@ -601,7 +605,7 @@ cache_chain_size db 0 cache_chain_started db 0 dma_task_switched db 0 dma_hdd db 0 -allow_dma_write db 0 +allow_dma_access db 0 endg align 4 diff --git a/kernel/trunk/boot/bootcode.inc b/kernel/trunk/boot/bootcode.inc index 8a92e3cb1c..0456d03d56 100644 --- a/kernel/trunk/boot/bootcode.inc +++ b/kernel/trunk/boot/bootcode.inc @@ -23,60 +23,60 @@ $Revision$ putchar: ; in: al=character - mov ah, 0Eh - mov bh, 0 - int 10h - ret + mov ah, 0Eh + mov bh, 0 + int 10h + ret print: ; in: si->string - mov al, 186 - call putchar - mov al, ' ' - call putchar + mov al, 186 + call putchar + mov al, ' ' + call putchar printplain: ; in: si->string - pusha - lodsb + pusha + lodsb @@: - call putchar - lodsb - cmp al, 0 - jnz @b - popa - ret + call putchar + lodsb + cmp al, 0 + jnz @b + popa + ret getkey: ; get number in range [bl,bh] (bl,bh in ['0'..'9']) ; in: bx=range ; out: ax=digit (1..9, 10 for 0) - mov ah, 0 - int 16h - cmp al, bl - jb getkey - cmp al, bh - ja getkey - push ax - call putchar - pop ax - and ax, 0Fh - jnz @f - mov al, 10 + mov ah, 0 + int 16h + cmp al, bl + jb getkey + cmp al, bh + ja getkey + push ax + call putchar + pop ax + and ax, 0Fh + jnz @f + mov al, 10 @@: - ret + ret setcursor: ; in: dl=column, dh=row - mov ah, 2 - mov bh, 0 - int 10h - ret + mov ah, 2 + mov bh, 0 + int 10h + ret macro _setcursor row,column { - mov dx, row*256 + column - call setcursor + mov dx, row*256 + column + call setcursor } boot_read_floppy: @@ -107,128 +107,130 @@ sayerr_plain: start_of_code: - cld + cld ; \begin{diamond}[02.12.2005] - cmp ax, 'KL' - jnz @f - mov word [cs:cfgmanager.loader_block], si - mov word [cs:cfgmanager.loader_block+2], ds +; if bootloader sets ax = 'KL', then ds:si points to loader block + cmp ax, 'KL' + jnz @f + mov word [cs:cfgmanager.loader_block], si + mov word [cs:cfgmanager.loader_block+2], ds @@: ; \end{diamond}[02.12.2005] - cmp cx,'HA' ; яю ЁхушёЄЁрь юяЁхфхы хЄё  чруЁєчър ё тшэЄр - jnz no_hd_load - cmp dx,'RD' - jnz no_hd_load - mov word [cs:bx_from_load], bx ; {SPraid}[13.03.2007] +; if bootloader sets cx = 'HA' and dx = 'RD', then bx contains identifier of source hard disk +; (see comment to bx_from_load) + cmp cx, 'HA' + jnz no_hd_load + cmp dx,'RD' + jnz no_hd_load + mov word [cs:bx_from_load], bx ; {SPraid}[13.03.2007] no_hd_load: ; set up stack - mov ax, 3000h - mov ss, ax - mov sp, 0EC00h + mov ax, 3000h + mov ss, ax + mov sp, 0EC00h ; set up segment registers - push cs - pop ds - push cs - pop es + push cs + pop ds + push cs + pop es ; set videomode - mov ax, 3 - int 0x10 + mov ax, 3 + int 0x10 if lang eq ru ; Load & set russian VGA font (RU.INC) - mov bp, RU_FNT1 ; RU_FNT1 - First part - mov bx,1000h ; 768 bytes - mov cx,30h ; 48 symbols - mov dx,80h ; 128 - position of first symbol - mov ax,1100h - int 10h + mov bp, RU_FNT1 ; RU_FNT1 - First part + mov bx, 1000h ; 768 bytes + mov cx, 30h ; 48 symbols + mov dx, 80h ; 128 - position of first symbol + mov ax, 1100h + int 10h - mov bp,RU_FNT2 ; RU_FNT2 -Second part - mov bx,1000h ; 512 bytes - mov cx,20h ; 32 symbols - mov dx,0E0h ; 224 - position of first symbol - mov ax,1100h - int 10h + mov bp, RU_FNT2 ; RU_FNT2 -Second part + mov bx, 1000h ; 512 bytes + mov cx, 20h ; 32 symbols + mov dx, 0E0h ; 224 - position of first symbol + mov ax, 1100h + int 10h ; End set VGA russian font else if lang eq et - mov bp,ET_FNT ; ET_FNT1 - mov bx,1000h ; - mov cx,255 ; 256 symbols - mov dx,0h ; 0 - position of first symbol - mov ax,1100h - int 10h + mov bp, ET_FNT ; ET_FNT1 + mov bx, 1000h ; + mov cx, 255 ; 256 symbols + xor dx, dx ; 0 - position of first symbol + mov ax, 1100h + int 10h end if ; draw frames - push 0xb800 - pop es - xor di, di - mov ah, 1*16+15 + push 0xb800 + pop es + xor di, di + mov ah, 1*16+15 ; draw top - mov si, d80x25_top - mov cx, d80x25_top_num * 80 + mov si, d80x25_top + mov cx, d80x25_top_num * 80 @@: - lodsb - stosw - loop @b + lodsb + stosw + loop @b ; draw spaces - mov si, space_msg - mov cx, 25 - d80x25_top_num - d80x25_bottom_num + mov si, space_msg + mov dx, 25 - d80x25_top_num - d80x25_bottom_num dfl1: - push cx - push si - mov cx, 80 + push si + mov cx, 80 @@: - lodsb - stosw - loop @b - pop si - pop cx - loop dfl1 + lodsb + stosw + loop @b + pop si + dec dx + jnz dfl1 ; draw bottom - mov si, d80x25_bottom - mov cx, d80x25_bottom_num * 80 + mov si, d80x25_bottom + mov cx, d80x25_bottom_num * 80 @@: - lodsb - stosw - loop @b + lodsb + stosw + loop @b - mov byte [space_msg+80], 0 ; now space_msg is null terminated + mov byte [space_msg+80], 0 ; now space_msg is null terminated - _setcursor d80x25_top_num,0 + _setcursor d80x25_top_num,0 ; TEST FOR 386+ - mov bx, 0x4000 + mov bx, 0x4000 pushf pop ax - mov dx,ax - xor ax,bx + mov dx, ax + xor ax, bx push ax popf pushf pop ax - and ax,bx - and dx,bx - cmp ax,dx + and ax, bx + and dx, bx + cmp ax, dx jnz cpugood - mov si,not386 + mov si, not386 sayerr: call print jmp $ cpugood: - push 0 + push 0 popf sti ; set up esp - movzx esp, sp + movzx esp, sp push 0 pop es @@ -247,19 +249,19 @@ sayerr: ; a) class 1, subclass 1, programming interface 0x80 mov ax, 0xB103 mov ecx, 1*10000h + 1*100h + 0x80 - mov si, 0 ; device index = 0 + xor si, si ; device index = 0 int 0x1A jnc .found ; b) class 1, subclass 1, programming interface 0x8A mov ax, 0xB103 mov ecx, 1*10000h + 1*100h + 0x8A - mov si, 0 ; device index = 0 + xor si, si ; device index = 0 int 0x1A jnc .found ; c) class 1, subclass 1, programming interface 0x85 mov ax, 0xB103 mov ecx, 1*10000h + 1*100h + 0x85 - mov si, 0 + xor si, si int 0x1A jc .nopci .found: @@ -273,73 +275,63 @@ sayerr: .nopci: ; \end{Mario79} - mov al,0xf6 ; ╤сЁюё ъыртшрЄєЁ√, ЁрчЁх°шЄ№ ёърэшЁютрэшх - out 0x60,al - xor cx,cx + mov al, 0xf6 ; ╤сЁюё ъыртшрЄєЁ√, ЁрчЁх°шЄ№ ёърэшЁютрэшх + out 0x60, al + xor cx, cx wait_loop: ; variant 2 ; reading state of port of 8042 controller - in al,64h - and al,00000010b ; ready flag + in al, 64h + and al, 00000010b ; ready flag ; wait until 8042 controller is ready loopnz wait_loop ; --------------- APM --------------------- - push 0 - pop es - mov word [es : 0x9044], 0 ; ver = 0.0 (APM not found) - mov ax, 0x5300 - xor bx, bx - int 0x15 - jc apm_end ; APM not found - test cx, 2 - jz apm_end ; APM 32-bit protected-mode interface not supported - mov [es : 0x9044], ax ; Save APM Version - mov [es : 0x9046], cx ; Save APM flags + and word [es:0x9044], 0 ; ver = 0.0 (APM not found) + mov ax, 0x5300 + xor bx, bx + int 0x15 + jc apm_end ; APM not found + test cx, 2 + jz apm_end ; APM 32-bit protected-mode interface not supported + mov [es:0x9044], ax ; Save APM Version + mov [es:0x9046], cx ; Save APM flags - ; Write APM ver ---- - and ax, 0xf0f - add ax, '00' - mov si, msg_apm - mov [si + 5], ah - mov [si + 7], al - _setcursor 0, 3 - call printplain - ; ------------------ + ; Write APM ver ---- + and ax, 0xf0f + add ax, '00' + mov si, msg_apm + mov [si + 5], ah + mov [si + 7], al + _setcursor 0, 3 + call printplain + ; ------------------ - mov ax, 0x5304 ; Disconnect interface - xor bx, bx - int 0x15 - mov ax, 0x5303 ; Connect 32 bit mode interface - xor bx, bx - int 0x15 + mov ax, 0x5304 ; Disconnect interface + xor bx, bx + int 0x15 + mov ax, 0x5303 ; Connect 32 bit mode interface + xor bx, bx + int 0x15 - push 0 - pop es - - mov [es:0x9040], ebx - mov [es:0x9050], ax - mov [es:0x9052], cx - mov [es:0x9054], dx + mov [es:0x9040], ebx + mov [es:0x9050], ax + mov [es:0x9052], cx + mov [es:0x9054], dx apm_end: _setcursor d80x25_top_num, 0 ; DISPLAY VESA INFORMATION - push 0 - pop es - mov ax,0x4f00 - mov di,0xa000 + mov ax, 0x4f00 + mov di, 0xa000 int 0x10 - cmp ax,0x004f - mov si, novesa - jnz @f - mov bx, word [es:di+0x12] - shl ebx,16 - mov [es:0x9050], ebx - mov ax,[es:di+4] - add ax,'0'*256+'0' - mov si,vervesa + cmp ax, 0x004f + mov si, novesa + jnz @f + mov ax, [es:di+4] + add ax, '0'*256+'0' + mov si, vervesa mov [si+vervesa_off], ah mov [si+vervesa_off+2], al @@: call print @@ -349,212 +341,219 @@ cfgmanager: ; settings: ; a) preboot_graph = graphical mode ; preboot_gprobe = probe this mode? -; b) preboot_dma_write = use DMA write? +; b) preboot_dma = use DMA access? ; c) preboot_vrrm = use VRR? ; d) preboot_device = from what boot? - mov di, preboot_graph + mov di, preboot_graph ; check bootloader block - cmp [.loader_block], -1 - jz .noloaderblock - les bx, [.loader_block] - cmp byte [es:bx], 1 - mov si, loader_block_error - jnz sayerr - test byte [es:bx+1], 1 - jz @f + cmp [.loader_block], -1 + jz .noloaderblock + les bx, [.loader_block] + cmp byte [es:bx], 1 + mov si, loader_block_error + jnz sayerr + test byte [es:bx+1], 1 + jz @f ; image in memory present - cmp [di+preboot_device-preboot_graph], 0 - jnz @f - mov [di+preboot_device-preboot_graph], 3 + cmp [di+preboot_device-preboot_graph], 0 + jnz @f + mov [di+preboot_device-preboot_graph], 3 @@: .noloaderblock: ; determine default settings - mov [.bSettingsChanged], 0 - cmp byte [di], 0 - jnz .preboot_gr_end - mov [di+preboot_gprobe-preboot_graph], 0 - mov al, [vervesa+vervesa_off] - cmp al, 'x' - jz .novesa - cmp al, '1' - jz .vesa12 - mov [di+preboot_gprobe-preboot_graph], 2 - mov al, 3 - jmp @f + mov [.bSettingsChanged], 0 + cmp byte [di], 0 + jnz .preboot_gr_end + mov [di+preboot_gprobe-preboot_graph], 0 + mov al, [vervesa+vervesa_off] + cmp al, 'x' + jz .novesa + cmp al, '1' + jz .vesa12 + mov [di+preboot_gprobe-preboot_graph], 2 + mov al, 3 + jmp @f .vesa12: - mov al, 7 - jmp @f + mov al, 7 + jmp @f .novesa: - mov al, 10 + mov al, 10 @@: - mov [di], al + mov [di], al .preboot_gr_end: - cmp [di+preboot_dma_write-preboot_graph], 1 - adc [di+preboot_dma_write-preboot_graph], 0 - cmp [di+preboot_vrrm-preboot_graph], 1 - adc [di+preboot_vrrm-preboot_graph], 0 - cmp [di+preboot_device-preboot_graph], 1 - adc [di+preboot_device-preboot_graph], 0 +; following 6 lines set variables to 1 if its current value is 0 + cmp [di+preboot_dma-preboot_graph], 1 + adc [di+preboot_dma-preboot_graph], 0 + cmp [di+preboot_vrrm-preboot_graph], 1 + adc [di+preboot_vrrm-preboot_graph], 0 + cmp [di+preboot_device-preboot_graph], 1 + adc [di+preboot_device-preboot_graph], 0 ; notify user - mov si, linef - call print - mov si, start_msg - call print - mov si, time_msg - call print + mov si, linef + call print + mov si, start_msg + call print + mov si, time_msg + call print ; get start time - call .gettime - mov [.starttime], eax - mov word [.timer], .newtimer - mov word [.timer+2], cs + call .gettime + mov [.starttime], eax + mov word [.timer], .newtimer + mov word [.timer+2], cs .printcfg: - _setcursor 9,0 - mov si, current_cfg_msg - call print - mov si, curvideo_msg - call print - mov al, [preboot_graph] - cmp al, 8 - ja .pnovesa - mov dl, al - and eax, 3 - mov si, [modes_msg+eax*2] - call printplain - mov si, modevesa20 - cmp dl, 4 - jbe @f - mov si, modevesa12 + _setcursor 9,0 + mov si, current_cfg_msg + call print + mov si, curvideo_msg + call print + mov al, [preboot_graph] + cmp al, 8 + ja .pnovesa + mov dl, al + and eax, 3 + mov si, [modes_msg+eax*2] + call printplain + mov si, modevesa20 + cmp dl, 4 + jbe @f + mov si, modevesa12 @@: - call printplain - cmp dl, 4 - ja .x - mov si, probeno_msg - cmp [preboot_gprobe], 2 - jnz @f - mov si, probeok_msg + call printplain + cmp dl, 4 + ja .x + mov si, probeno_msg + cmp [preboot_gprobe], 2 + jnz @f + mov si, probeok_msg @@: - call printplain + call printplain .x: - jmp .c + jmp .c .pnovesa: - cmp al, 9 - mov si, mode9 - jz @b - mov si, mode10 - jmp @b + cmp al, 9 + mov si, mode9 + jz @b + mov si, mode10 + jmp @b .c: - mov si, linef - call printplain - mov si, dma_msg - cmp [preboot_dma_write], 1 - call .say_on_off - mov si, vrrm_msg - cmp [preboot_vrrm], 1 - call .say_on_off - mov si, preboot_device_msg - call print - mov al, [preboot_device] - and eax, 3 - mov si, [preboot_device_msgs+eax*2] - call printplain + mov si, linef + call printplain + mov si, dma_msg + call print + cmp [preboot_dma], 2 + mov si, on_msg + jb @f + mov si, off_msg + ja @f + mov si, readonly_msg +@@: + call printplain + mov si, vrrm_msg + cmp [preboot_vrrm], 1 + call .say_on_off + mov si, preboot_device_msg + call print + mov al, [preboot_device] + and eax, 3 + mov si, [preboot_device_msgs+eax*2] + call printplain .wait: - _setcursor 25,0 ; out of screen + _setcursor 25,0 ; out of screen ; set timer interrupt handler - cli - push 0 - pop es - mov eax, [es:8*4] - mov [.oldtimer], eax - mov eax, [.timer] - mov [es:8*4], eax - sti + cli + push 0 + pop es + mov eax, [es:8*4] + mov [.oldtimer], eax + mov eax, [.timer] + mov [es:8*4], eax + sti ; wait for keypressed - mov ah, 0 - int 16h - push ax + mov ah, 0 + int 16h + push ax ; restore timer interrupt - push 0 - pop es - mov eax, [.oldtimer] - mov [es:8*4], eax - mov [.timer], eax - _setcursor 7,0 - mov si, space_msg - call printplain - pop ax + push 0 + pop es + mov eax, [.oldtimer] + mov [es:8*4], eax + mov [.timer], eax + _setcursor 7,0 + mov si, space_msg + call printplain + pop ax ; switch on key - cmp al, 13 - jz .continue - or al, 20h - cmp al, 'a' - jz .change_a - cmp al, 'b' - jz .change_b - cmp al, 'c' - jz .change_c - cmp al, 'd' - jnz .wait - _setcursor 15,0 - mov si,bdev - call print - mov bx,'13' - call getkey - mov [preboot_device], al - _setcursor 13,0 + cmp al, 13 + jz .continue + or al, 20h + cmp al, 'a' + jz .change_a + cmp al, 'b' + jz .change_b + cmp al, 'c' + jz .change_c + cmp al, 'd' + jnz .wait + _setcursor 15,0 + mov si, bdev + call print + mov bx, '13' + call getkey + mov [preboot_device], al + _setcursor 13,0 .d: - mov [.bSettingsChanged], 1 - mov si, space_msg - call printplain - _setcursor 15,0 - mov cx, 6 + mov [.bSettingsChanged], 1 + mov si, space_msg + call printplain + _setcursor 15,0 + mov cx, 6 @@: - call printplain - loop @b - jmp .printcfg + call printplain + loop @b + jmp .printcfg .change_a: - _setcursor 15,0 - mov si, gr_mode - call printplain - mov bx, '09' - call getkey - mov [preboot_graph], al - cmp al, 4 - ja @f - mov si, probetext - call printplain - mov bx, '12' - call getkey - mov [preboot_gprobe], al + _setcursor 15,0 + mov si, gr_mode + call printplain + mov bx, '09' + call getkey + mov [preboot_graph], al + cmp al, 4 + ja @f + mov si, probetext + call printplain + mov bx, '12' + call getkey + mov [preboot_gprobe], al @@: - _setcursor 10,0 - jmp .d + _setcursor 10,0 + jmp .d .change_b: - _setcursor 15,0 - mov si, ask_dma - call print - mov bx, '12' - call getkey - mov [preboot_dma_write], al - _setcursor 11,0 - jmp .d + _setcursor 15,0 + mov si, ask_dma + call print + mov bx, '13' + call getkey + mov [preboot_dma], al + _setcursor 11,0 + jmp .d .change_c: - _setcursor 15,0 - mov si, vrrmprint - call print - mov bx, '12' - call getkey - mov [preboot_vrrm], al - _setcursor 12,0 - jmp .d + _setcursor 15,0 + mov si, vrrmprint + call print + mov bx, '12' + call getkey + mov [preboot_vrrm], al + _setcursor 12,0 + jmp .d .say_on_off: - pushf - call print - mov si, on_msg - popf - jz @f - mov si, off_msg -@@: call printplain - ret + pushf + call print + mov si, on_msg + popf + jz @f + mov si, off_msg +@@: jmp printplain ; novesa and vervesa strings are not used at the moment of executing this code virtual at novesa .oldtimer dd ? @@ -564,246 +563,250 @@ virtual at novesa end virtual .loader_block dd -1 .gettime: - mov ah, 0 - int 1Ah - xchg ax, cx - shl eax, 10h - xchg ax, dx - ret + mov ah, 0 + int 1Ah + xchg ax, cx + shl eax, 10h + xchg ax, dx + ret .newtimer: - push ds - push cs - pop ds - pushf - call [.oldtimer] - pushad - call .gettime - sub eax, [.starttime] - sub ax, 18*5 - jae .timergo - neg ax - add ax, 18-1 - mov bx, 18 - xor dx, dx - div bx + push ds + push cs + pop ds + pushf + call [.oldtimer] + pushad + call .gettime + sub eax, [.starttime] + sub ax, 18*5 + jae .timergo + neg ax + add ax, 18-1 + mov bx, 18 + xor dx, dx + div bx if lang eq ru ; подождите 5 секунд, 4/3/2 секунды, 1 секунду - cmp al, 5 - mov cl, ' ' - jae @f - cmp al, 1 - mov cl, 'у' - jz @f - mov cl, 'ы' -@@: mov [time_str+9], cl + cmp al, 5 + mov cl, ' ' + jae @f + cmp al, 1 + mov cl, 'у' + jz @f + mov cl, 'ы' +@@: mov [time_str+9], cl else if lang eq et - cmp al, 1 - ja @f - mov [time_str+9], ' ' - mov [time_str+10],' ' + cmp al, 1 + ja @f + mov [time_str+9], ' ' + mov [time_str+10],' ' @@: else ; wait 5/4/3/2 seconds, 1 second - cmp al, 1 - mov cl, 's' - ja @f - mov cl, ' ' -@@: mov [time_str+9], cl + cmp al, 1 + mov cl, 's' + ja @f + mov cl, ' ' +@@: mov [time_str+9], cl end if - add al, '0' - mov [time_str+1], al - mov si, time_msg - _setcursor 7,0 - call print - _setcursor 25,0 - popad - pop ds - iret + add al, '0' + mov [time_str+1], al + mov si, time_msg + _setcursor 7,0 + call print + _setcursor 25,0 + popad + pop ds + iret .timergo: - push 0 - pop es - mov eax, [.oldtimer] - mov [es:8*4], eax - mov sp, 0EC00h + push 0 + pop es + mov eax, [.oldtimer] + mov [es:8*4], eax + mov sp, 0EC00h .continue: - sti - _setcursor 6,0 - mov si, space_msg - call printplain - call printplain - _setcursor 6,0 - mov si, loading_msg - call print - _setcursor 15,0 - cmp [.bSettingsChanged], 0 - jz .load - cmp [.loader_block], -1 - jz .load - les bx, [.loader_block] - mov eax, [es:bx+3] - push ds - pop es - test eax, eax - jz .load - push eax - mov si, save_quest - call print + sti + _setcursor 6,0 + mov si, space_msg + call printplain + call printplain + _setcursor 6,0 + mov si, loading_msg + call print + _setcursor 15,0 + cmp [.bSettingsChanged], 0 + jz .load + cmp [.loader_block], -1 + jz .load + les bx, [.loader_block] + mov eax, [es:bx+3] + push ds + pop es + test eax, eax + jz .load + push eax + mov si, save_quest + call print .waityn: - mov ah, 0 - int 16h - or al, 20h - cmp al, 'n' - jz .loadc - cmp al, 'y' - jnz .waityn - call putchar - mov byte [space_msg+80], 186 - pop eax - push cs - push .cont - push eax - retf + mov ah, 0 + int 16h + or al, 20h + cmp al, 'n' + jz .loadc + cmp al, 'y' + jnz .waityn + call putchar + mov byte [space_msg+80], 186 + pop eax + push cs + push .cont + push eax + retf .loadc: - pop eax + pop eax .cont: - push cs - pop ds - mov si, space_msg - mov byte [si+80], 0 - _setcursor 15,0 - call printplain - _setcursor 15,0 + push cs + pop ds + mov si, space_msg + mov byte [si+80], 0 + _setcursor 15,0 + call printplain + _setcursor 15,0 .load: ; \end{diamond}[02.12.2005] ; ASK GRAPHICS MODE - movzx ax, [preboot_graph] - push 0 - pop es + movzx ax, [preboot_graph] + push 0 + pop es ; address is gr_table+6*(ax-1) - add ax, ax - lea si, [gr_table + eax + eax*2 - 6] - mov bx,[si+0] - mov cx,[si+2] - mov dx,[si+4] - cmp al, 9*2 - mov al, 32 ; BPP - jb @f - mov [es:0x9000], al - mov dword [es:0x9018], 0xFFFFFFFF; 0x800000 - @@: - mov [es:0x9008],bx - mov [es:0x900A],cx - mov [es:0x900C],dx + add ax, ax + lea si, [gr_table + eax + eax*2 - 6] + mov bx, [si+0] + mov cx, [si+2] + mov dx, [si+4] + cmp al, 9*2 + mov al, 32 ; BPP + jb @f + mov [es:0x9000], al + or dword [es:0x9018], 0xFFFFFFFF; 0x800000 +@@: + mov [es:0x9008], bx + mov [es:0x900A], cx + mov [es:0x900C], dx test bh, bh - jz nov + jz nov ; USE DEFAULTS OR PROBE ; bx - mode : cx - x size : dx - y size - cmp [preboot_gprobe], 1 - jz noprobe + cmp [preboot_gprobe], 1 + jz noprobe - mov bx,0x100 + mov bx, 0x100 newprobe: inc bx - cmp bx,0x17f - mov si,prnotfnd - jz sayerr + cmp bx, 0x17f + mov si, prnotfnd + jz invalid_video_mode probemore: - push cx - mov ax,0x4f01 - mov cx,bx - and cx,0xfff - mov di,0xa000 + push cx + mov ax, 0x4f01 + mov cx, bx + mov di, 0xa000 int 0x10 - pop cx + pop cx - test byte [es:di], 80h ; lfb? - jz newprobe - cmp [es:di+0x12], cx ; x size? - jnz newprobe - cmp [es:di+0x14], dx ; y size? - jnz newprobe - cmp byte [es:di+0x19], 32 ;24 - jb newprobe + test byte [es:di], 80h ; lfb? + jz newprobe + cmp [es:di+0x12], cx ; x size? + jnz newprobe + cmp [es:di+0x14], dx ; y size? + jnz newprobe + cmp byte [es:di+0x19], 32 ;24 + jb newprobe -; add bx,0100000000000000b - or bh, 40h - mov [es:0x9008],bx +; add bx, 0100000000000000b + or bh, 40h + mov [es:0x9008], bx noprobe: ; FIND VESA 2.0 LFB & BPP - mov ax,0x4f01 - mov cx,bx - and cx,0xfff - mov di,0xa000 + mov ax, 0x4f01 + mov cx, bx + and cx, 0xfff + mov di, 0xa000 int 0x10 ; LFB - mov eax,[es:di+0x28] - mov [es:0x9018],eax + mov eax, [es:di+0x28] + mov [es:0x9018], eax ; ---- vbe voodoo BytesPerLine equ 0x10 - mov ax, [es:di+BytesPerLine] - mov [es:0x9001],ax + mov ax, [es:di+BytesPerLine] + mov [es:0x9001], ax ; BPP - mov al,byte [es:di+0x19] - mov [es:0x9000],al - nov: - cmp al,24 - mov si,bt24 - jz bppl - cmp al,32 - mov si,bt32 - jz bppl - mov si,btns - jmp sayerr - bppl: + mov al, byte [es:di+0x19] + mov [es:0x9000], al +nov: + cmp al, 24 + mov si, bt24 + jz bppl + cmp al, 32 + mov si, bt32 + jz bppl + mov si, btns +invalid_video_mode: + call print + _setcursor (d80x25_top_num+2), 0 + mov si, start_msg + call print + jmp cfgmanager.printcfg +bppl: call print ; FIND VESA 1.2 PM BANK SWITCH ADDRESS - push es - mov ax,0x4f0A - xor bx, bx + push es + mov ax, 0x4f0A + xor bx, bx int 0x10 - xor eax,eax - mov ax,es - shl eax,4 - movzx ebx,di - add eax,ebx - mov bx,[es:di] - add eax,ebx + xor eax, eax + mov ax, es + shl eax, 4 + movzx ebx, di + add eax, ebx + mov bx, [es:di] + add eax, ebx pop es - mov [es:0x9014],eax + mov [es:0x9014], eax ; GRAPHICS ACCELERATION ; force yes mov [es:0x901C], byte 1 -; DMA WRITE +; DMA ACCESS TO HD - mov al, [preboot_dma_write] - mov [es:0x901F],al + mov al, [preboot_dma] + mov [es:0x901F], al ; VRR_M USE mov al,[preboot_vrrm] - mov [es:0x9030],al - mov [es:0x901E],byte 1 + mov [es:0x9030], al + mov [es:0x901E], byte 1 ; BOOT DEVICE - mov al, [preboot_device] + mov al, [preboot_device] dec al - mov [boot_dev],al + mov [boot_dev], al ; READ DISKETTE TO MEMORY @@ -811,8 +814,8 @@ end if 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 int 0x13 ; now load floppy image to memory ; at first load boot sector and first FAT table @@ -1004,59 +1007,59 @@ sayerr_floppy: ; readdone: ; pop ax - mov si,backspace2 + mov si, backspace2 call printplain - mov si,okt + mov si, okt call printplain - no_sys_on_floppy: - xor ax, ax ; reset drive - xor dx, dx +no_sys_on_floppy: + xor ax, ax ; reset drive + xor dx, dx int 0x13 - mov dx,0x3f2 ; floppy motor off - mov al,0 - out dx,al + mov dx, 0x3f2 ; floppy motor off + mov al, 0 + out dx, al ; SET GRAPHICS - xor ax, ax - mov es, ax + xor ax, ax + mov es, ax - mov ax,[es:0x9008] ; vga & 320x200 - mov bx, ax - cmp ax,0x13 + mov ax, [es:0x9008] ; vga & 320x200 + mov bx, ax + cmp ax, 0x13 je setgr - cmp ax,0x12 + cmp ax, 0x12 je setgr - mov ax,0x4f02 ; Vesa + mov ax, 0x4f02 ; Vesa setgr: int 0x10 - test ah,ah - mov si, fatalsel - jnz sayerr + test ah, ah + mov si, fatalsel + jnz sayerr ; set mode 0x12 graphics registers: - cmp bx,0x12 + cmp bx, 0x12 jne gmok2 - mov al,0x05 - mov dx,0x03ce + mov al, 0x05 + mov dx, 0x03ce push dx - out dx,al ; select GDC mode register - mov al,0x02 - inc dx - out dx,al ; set write mode 2 + out dx, al ; select GDC mode register + mov al, 0x02 + inc dx + out dx, al ; set write mode 2 - mov al,0x02 - mov dx,0x03c4 - out dx,al ; select VGA sequencer map mask register - mov al,0x0f - inc dx - out dx,al ; set mask for all planes 0-3 + mov al, 0x02 + mov dx, 0x03c4 + out dx, al ; select VGA sequencer map mask register + mov al, 0x0f + inc dx + out dx, al ; set mask for all planes 0-3 - mov al,0x08 - pop dx - out dx,al ; select GDC bit mask register + mov al, 0x08 + pop dx + out dx, al ; select GDC bit mask register ; for writes to 0x03cf gmok2: push ds - pop es + pop es diff --git a/kernel/trunk/boot/booteng.inc b/kernel/trunk/boot/booteng.inc index d4f3836389..fc8786faac 100644 --- a/kernel/trunk/boot/booteng.inc +++ b/kernel/trunk/boot/booteng.inc @@ -34,7 +34,7 @@ vrrmprint db "Apply VRR? (picture frequency greater than 60Hz" ; db " Select port [1-3]: ",0 ;no_com1 db 13,10,186, " No COM1 mouse",0 ;no_com2 db 13,10,186, " No COM2 mouse",0 -ask_dma db "Use DMA for HDD writing? [1-yes/2-no]: ",0 +ask_dma db "Use DMA for HDD access? [1-yes, 2-only for reading, 3-no]: ",0 ;gr_direct db 186," Use direct LFB writing? " ; db "[1-yes/2-no] ? ",0 ;mem_model db 13,10,186," Motherboard memory [1-16 Mb / 2-32 Mb / " @@ -80,9 +80,10 @@ mode9 db "320x200, EGA/CGA 256 colors",0 mode10 db "640x480, VGA 16 colors",0 probeno_msg db " (standard mode)",0 probeok_msg db " (check nonstandard modes)",0 -dma_msg db " [b] Use DMA for HDD writing:",0 +dma_msg db " [b] Use DMA for HDD access:",0 on_msg db " on",13,10,0 off_msg db " off",13,10,0 +readonly_msg db " only for reading",13,10,0 vrrm_msg db " [c] Use VRR:",0 preboot_device_msg db " [d] Floppy image: ",0 preboot_device_msgs dw 0,pdm1,pdm2,pdm3 diff --git a/kernel/trunk/boot/bootet.inc b/kernel/trunk/boot/bootet.inc index 3e3b8e57a4..e5408860b8 100644 --- a/kernel/trunk/boot/bootet.inc +++ b/kernel/trunk/boot/bootet.inc @@ -34,7 +34,7 @@ vrrmprint db "Kinnita VRR? (ekraani sagedus suurem kui 60Hz" ; db " Vali port [1-3]: ",0 ;no_com1 db 13,10,186, " No COM1 mouse",0 ;no_com2 db 13,10,186, " No COM2 mouse",0 -ask_dma db "Use DMA for HDD writing? [1-jah/2-ei]: ",0 +ask_dma db "Use DMA for HDD access? [1-yes, 2-only for reading, 3-no]: ",0 ;gr_direct db 186," Use direct LFB writing? " ; db "[1-yes/2-no] ? ",0 ;mem_model db 13,10,186," Motherboard memory [1-16 Mb / 2-32 Mb / " @@ -80,9 +80,10 @@ mode9 db "320x200, EGA/CGA 256 v mode10 db "640x480, VGA 16 vфrvi",0 probeno_msg db " (standard reziim)",0 probeok_msg db " (kontrolli ebastandardseid reziime)",0 -dma_msg db " [b] Use DMA for HDD writing:",0 +dma_msg db " [b] Use DMA for HDD access:",0 on_msg db " sees",13,10,0 off_msg db " vфljas",13,10,0 +readonly_msg db " only for reading",13,10,0 vrrm_msg db " [c] Kasuta VRR:",0 preboot_device_msg db " [d] Disketi kujutis: ",0 preboot_device_msgs dw 0,pdm1,pdm2,pdm3 diff --git a/kernel/trunk/boot/bootge.inc b/kernel/trunk/boot/bootge.inc index 15c14f61b4..7c3d9798ec 100644 --- a/kernel/trunk/boot/bootge.inc +++ b/kernel/trunk/boot/bootge.inc @@ -39,7 +39,7 @@ vrrmprint db "VRR verwenden? (Monitorfrequenz groesser als 60Hz" ; db " Waehle Port [1-3]: ",0 ;no_com1 db 13,10,186, " Keine COM1 Maus",0 ;no_com2 db 13,10,186, " Keine COM2 Maus",0 -ask_dma db "Nutze DMA zum HDD Aufschreiben? [1-ja/2-nein]: ",0 +ask_dma db "Nutze DMA zum HDD Zugriff? [1-ja, 2-allein fur Lesen, 3-nein]: ",0 ;gr_direct db 186," Benutze direct LFB? " ; db "[1-ja/2-nein] ? ",0 ;mem_model db 13,10,186," Hauptspeicher [1-16 Mb / 2-32 Mb / " @@ -88,6 +88,7 @@ probeok_msg db " (teste nicht-standard Modi)",0 dma_msg db " [b] Nutze DMA zum HDD Aufschreiben:",0 on_msg db " an",13,10,0 off_msg db " aus",13,10,0 +readonly_msg db " fur Lesen",13,10,0 vrrm_msg db " [c] Nutze VRR:",0 preboot_device_msg db " [d] Diskettenimage: ",0 preboot_device_msgs dw 0,pdm1,pdm2,pdm3 diff --git a/kernel/trunk/boot/bootru.inc b/kernel/trunk/boot/bootru.inc index b7883e79b4..2edcf77db6 100644 --- a/kernel/trunk/boot/bootru.inc +++ b/kernel/trunk/boot/bootru.inc @@ -34,7 +34,7 @@ vrrmprint db " ; db " Выберите порт [1-3]: ",0 ;no_com1 db 13,10,186," No COM1 mouse",0 ;no_com2 db 13,10,186," No COM2 mouse",0 -ask_dma db "Использовать DMA для записи на HDD? [1-да/2-нет]: ",0 +ask_dma db "Использовать DMA для доступа к HDD? [1-да, 2-только чтение, 3-нет]: ",0 ;gr_direct db 186," Использовать линейный видеобуфер? " ; db "[1-да/2-нет]: ",0 ;mem_model db 13,10,186," Объ+м памяти [1-16 Mb / 2-32 Mb / " @@ -80,9 +80,10 @@ mode9 db "320x200, EGA/CGA 256 цветов",0 mode10 db "640x480, VGA 16 цветов",0 probeno_msg db " (стандартный видеорежим)",0 probeok_msg db " (проверить нестандартные режимы)",0 -dma_msg db " [b] Использование DMA для записи на HDD:",0 +dma_msg db " [b] Использование DMA для доступа к HDD:",0 on_msg db " вкл",13,10,0 off_msg db " выкл",13,10,0 +readonly_msg db " только чтение",13,10,0 vrrm_msg db " [c] Использование VRR:",0 preboot_device_msg db " [d] Образ дискеты: ",0 preboot_device_msgs dw 0,pdm1,pdm2,pdm3 diff --git a/kernel/trunk/boot/preboot.inc b/kernel/trunk/boot/preboot.inc index b6a482df88..c65480b7c3 100644 --- a/kernel/trunk/boot/preboot.inc +++ b/kernel/trunk/boot/preboot.inc @@ -18,7 +18,7 @@ display_atboot db 0 ; show boot screen messages ( 2-no ) preboot_graph db 0 ; graph mode preboot_gprobe db 0 ; probe vesa3 videomodes (1-no, 2-yes) preboot_vrrm db 0 ; use VRR_M (1-yes, 2- no) -preboot_dma_write db 0 ; use DMA for writing to HDD (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) ;!!!! 0 - autodetect !!!! diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 77ce857265..4ee58508d2 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -321,8 +321,8 @@ high_code: ; ----------------------------------------- ; movzx eax,byte [BOOT_VAR+0x9010] ; mouse port ; mov [0xF604],byte 1 ;al - mov al, [BOOT_VAR+0x901F] ; DMA writing - mov [allow_dma_write], al + mov al, [BOOT_VAR+0x901F] ; DMA access + mov [allow_dma_access], al mov al,[BOOT_VAR+0x9000] ; bpp mov [ScreenBPP],al movzx eax,word [BOOT_VAR+0x900A] ; X max diff --git a/kernel/trunk/unpacker.inc b/kernel/trunk/unpacker.inc old mode 100755 new mode 100644