forked from KolibriOS/kolibrios
Return value of 58 function is corrected. Shutdown.inc optimized. Changes from diamond.
git-svn-id: svn://kolibrios.org@61 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
0ea1d629b0
commit
03b4d7367e
@ -10,170 +10,165 @@
|
||||
|
||||
system_shutdown: ; shut down the system
|
||||
|
||||
mov eax,3 ; stop playing cd
|
||||
push 3 ; stop playing cd
|
||||
pop eax
|
||||
call sys_cd_audio
|
||||
cli
|
||||
cld
|
||||
|
||||
mov al,[0x2f0000+0x9030]
|
||||
cmp al,1
|
||||
jl no_shutdown_parameter
|
||||
cmp al,4
|
||||
jg no_shutdown_parameter
|
||||
jmp yes_shutdown_param
|
||||
jle yes_shutdown_param
|
||||
no_shutdown_parameter:
|
||||
|
||||
movzx ecx,word [0x2f0000+0x900A]
|
||||
movzx esi,word [0x2f0000+0x900C]
|
||||
imul ecx,esi ;[0xfe04]
|
||||
; mov ecx,0x500000/4 ;3fff00/4 ; darken screen
|
||||
push ecx
|
||||
mov esi,[0xfe80]
|
||||
cmp esi,32*0x100000
|
||||
jbe no_darken_screen
|
||||
mov edi,16*0x100000
|
||||
sdnewpix:
|
||||
mov eax,[esi]
|
||||
add esi,4
|
||||
shr eax,1
|
||||
and eax,0x7f7f7f7f
|
||||
stosd
|
||||
loop sdnewpix
|
||||
pop ecx
|
||||
mov esi,16*0x100000
|
||||
mov edi,[0xfe80]
|
||||
cld
|
||||
rep movsd
|
||||
no_darken_screen:
|
||||
; movzx ecx,word [0x2f0000+0x900A]
|
||||
; movzx esi,word [0x2f0000+0x900C]
|
||||
; imul ecx,esi ;[0xfe04]
|
||||
;; mov ecx,0x500000/4 ;3fff00/4 ; darken screen
|
||||
; push ecx
|
||||
; mov esi,[0xfe80]
|
||||
; cmp esi,32*0x100000
|
||||
; jbe no_darken_screen
|
||||
; mov edi,16*0x100000
|
||||
; push esi edi
|
||||
; sdnewpix:
|
||||
; lodsd
|
||||
; shr eax,1
|
||||
; and eax,0x7f7f7f7f
|
||||
; stosd
|
||||
; loop sdnewpix
|
||||
; pop ecx
|
||||
; pop esi edi
|
||||
; rep movsd
|
||||
; no_darken_screen:
|
||||
|
||||
; read shutdown code:
|
||||
; 1) display shutdown "window"
|
||||
|
||||
mov eax,[0xfe00]
|
||||
shr eax,1
|
||||
sub eax,220
|
||||
lea esi,[eax+220] ; x end
|
||||
sub eax,220 ; x start
|
||||
|
||||
mov ebx,[0xfe04]
|
||||
shr ebx,1
|
||||
mov [shutdownpos],ebx
|
||||
sub ebx,120
|
||||
lea ebp,[ebx+105] ; y end
|
||||
sub ebx,120 ; y start
|
||||
|
||||
mov edi,1
|
||||
xor edi,edi
|
||||
inc edi ; force putpixel & dtext
|
||||
mov ecx,0x0000ff
|
||||
|
||||
; vertical loop begin
|
||||
sdnewpix1:
|
||||
push eax ; save x start
|
||||
|
||||
; horizontal loop begin
|
||||
sdnewpix2:
|
||||
|
||||
call [putpixel]
|
||||
|
||||
inc eax
|
||||
mov esi,[0xfe00]
|
||||
shr esi,1
|
||||
add esi,220
|
||||
cmp eax,esi
|
||||
jnz sdnewpix2
|
||||
; horizontal loop end
|
||||
|
||||
dec ecx
|
||||
dec ecx ; color
|
||||
pop eax ; restore x start
|
||||
|
||||
inc ebx ; advance y pos
|
||||
cmp ebx,ebp
|
||||
jnz sdnewpix1
|
||||
; vertical loop end
|
||||
|
||||
; 2) display text strings
|
||||
; a) version
|
||||
mov eax,[0xfe00]
|
||||
shr eax,1
|
||||
sub eax,220
|
||||
|
||||
inc ebx
|
||||
|
||||
mov edx,[shutdownpos]
|
||||
add edx,105
|
||||
cmp ebx,edx
|
||||
jnz sdnewpix2
|
||||
|
||||
|
||||
mov esi,[0xfe00] ; menuet version
|
||||
shr esi,1
|
||||
sub esi,220
|
||||
add esi,27
|
||||
shl esi,16
|
||||
mov eax,esi
|
||||
add eax,[shutdownpos]
|
||||
sub eax,105
|
||||
shl eax,16
|
||||
mov ax,word [shutdownpos]
|
||||
push eax
|
||||
sub eax,(220-27)*10000h + 105
|
||||
mov ebx,0xffff00
|
||||
mov ecx,version
|
||||
mov edx,34
|
||||
mov edi,1
|
||||
push 34
|
||||
pop edx
|
||||
call dtext
|
||||
|
||||
mov esi,[0xfe00] ; 'it is safe..'
|
||||
shr esi,1
|
||||
sub esi,220
|
||||
add esi,27
|
||||
shl esi,16
|
||||
mov eax,esi
|
||||
add eax,[shutdownpos]
|
||||
add eax,33
|
||||
mov esi,6
|
||||
mov ebx,0xffffff
|
||||
; b) variants
|
||||
add eax,105+33
|
||||
push 6
|
||||
pop esi
|
||||
; mov ebx,0xffffff
|
||||
mov bl,0xFF
|
||||
mov ecx,shutdowntext
|
||||
mov edx,40
|
||||
mov edi,1
|
||||
mov dl,40
|
||||
newsdt:
|
||||
call dtext
|
||||
add eax,10
|
||||
add ecx,40
|
||||
add ecx,edx
|
||||
dec esi
|
||||
jnz newsdt
|
||||
|
||||
; 3) load & display rose.txt
|
||||
mov eax,rosef ; load rose.txt
|
||||
mov ebx,0
|
||||
mov ecx,16800
|
||||
xor ebx,ebx
|
||||
push 2
|
||||
pop ecx
|
||||
mov edx,0x90000
|
||||
mov esi,12
|
||||
push edx
|
||||
push 12
|
||||
pop esi
|
||||
push edi ; may be destroyed
|
||||
call fileread
|
||||
pop edi
|
||||
|
||||
mov esi,[0xfe00] ; draw rose
|
||||
shr esi,1
|
||||
add esi,20
|
||||
shl esi,16
|
||||
mov eax,esi
|
||||
add eax,[shutdownpos]
|
||||
sub eax,110
|
||||
pop ecx
|
||||
inc ecx ; do not display stars from rose.txt
|
||||
pop eax
|
||||
add eax,20*10000h - 110
|
||||
|
||||
mov ebx,0x00ff00
|
||||
mov ecx,0x90001
|
||||
mov edx,27
|
||||
mov edi,1
|
||||
push 27
|
||||
pop edx
|
||||
|
||||
nrl:
|
||||
call dtext
|
||||
sub ebx,0x050000
|
||||
add eax,8
|
||||
add ecx,31
|
||||
cmp ecx,dword 0x90001+25*31
|
||||
cmp cx,word 0x0001+25*31
|
||||
jnz nrl
|
||||
|
||||
call checkEgaCga
|
||||
|
||||
yes_shutdown_param:
|
||||
|
||||
cli
|
||||
|
||||
mov eax,kernel ; load kernel.mnt to 0x8000:0
|
||||
mov esi,12
|
||||
mov ebx,0
|
||||
mov ecx,-1
|
||||
push 12
|
||||
pop esi
|
||||
xor ebx,ebx
|
||||
or ecx,-1
|
||||
mov edx,0x80000
|
||||
call fileread
|
||||
|
||||
mov esi,restart_kernel_4000 ; move kernel re-starter to 0x4000:0
|
||||
mov edi,0x40000
|
||||
mov ecx,1000
|
||||
cld
|
||||
rep movsb
|
||||
|
||||
mov eax,0x2F0000 ; restore 0x0 - 0xffff
|
||||
mov ebx,0x0000
|
||||
mov ecx,0xffff
|
||||
xor ebx,ebx
|
||||
mov ecx,0x10000
|
||||
call memmove
|
||||
|
||||
call restorefatchain
|
||||
|
||||
mov eax,pr_mode_exit
|
||||
mov [0x467+0],ax
|
||||
mov [0x467+2],word 0x1000
|
||||
mov word [0x467+0],pr_mode_exit-0x10000
|
||||
mov word [0x467+2],0x1000
|
||||
|
||||
mov al,0x0F
|
||||
out 0x70,al
|
||||
@ -195,25 +190,6 @@ pr_mode_exit:
|
||||
; setup ds
|
||||
push cs
|
||||
pop ds
|
||||
; mov ax,1000
|
||||
; mov ds,ax
|
||||
; mov es,ax
|
||||
; mov fs,ax
|
||||
; mov gs,ax
|
||||
; mov ss,ax
|
||||
; mov bl,[shutdown_parameter]
|
||||
; mov [es:shutdown_parameter-0x10000],bl
|
||||
|
||||
jmp real_mode-0x10000
|
||||
|
||||
old_ints_h:
|
||||
dw 4*0x20
|
||||
dd 0
|
||||
dw 0
|
||||
|
||||
rdelay:
|
||||
ret
|
||||
real_mode:
|
||||
|
||||
lidt [old_ints_h-0x10000]
|
||||
;remap IRQs
|
||||
@ -249,14 +225,20 @@ real_mode:
|
||||
out 0xA1,al
|
||||
sti
|
||||
|
||||
jmp temp_3456
|
||||
temp_3456:
|
||||
xor ax,ax
|
||||
mov es,ax
|
||||
mov al,byte [es:0x9030]
|
||||
cmp al,1
|
||||
jl nbw
|
||||
cmp al,4
|
||||
jle nbw32
|
||||
|
||||
nbw:
|
||||
xor ax,ax
|
||||
in al,0x60
|
||||
call pause_key
|
||||
cmp al,7
|
||||
jge nbw
|
||||
cmp al,6
|
||||
jae nbw
|
||||
mov bl,al
|
||||
nbw2:
|
||||
in al,0x60
|
||||
@ -266,7 +248,7 @@ real_mode:
|
||||
cmp al,240 ;ax,240
|
||||
jne nbw31
|
||||
mov al,bl
|
||||
dec al
|
||||
dec ax
|
||||
jmp nbw32
|
||||
nbw31:
|
||||
add bl,128
|
||||
@ -276,45 +258,40 @@ real_mode:
|
||||
|
||||
nbw32:
|
||||
|
||||
cmp al,1 ; write floppy
|
||||
jne no_floppy_write
|
||||
dec ax ; 1 = write floppy
|
||||
js nbw
|
||||
jnz no_floppy_write
|
||||
call floppy_write
|
||||
jmp temp_3456 ;nbw
|
||||
no_floppy_write:
|
||||
|
||||
cmp al,2 ; poweroff
|
||||
jne no_apm_off
|
||||
dec ax ; 2 = power off
|
||||
jnz no_apm_off
|
||||
call APM_PowerOff
|
||||
jmp $
|
||||
no_apm_off:
|
||||
|
||||
cmp al,3 ; boot
|
||||
jnz no_sys_boot
|
||||
mov ax,0x0040
|
||||
mov ds,ax
|
||||
dec ax ; 3 = reboot
|
||||
jnz restart_kernel ; 4 = restart kernel
|
||||
push 0x40
|
||||
pop ds
|
||||
mov word[0x0072],0x1234
|
||||
jmp 0xF000:0xFFF0
|
||||
no_sys_boot:
|
||||
|
||||
cmp al,4 ; restart kernel
|
||||
je restart_kernel
|
||||
|
||||
temp_3456:
|
||||
push word 0x0000
|
||||
pop es
|
||||
mov al,byte [es:0x9030]
|
||||
cmp al,1
|
||||
jl nbw
|
||||
cmp al,4
|
||||
jg nbw
|
||||
jmp nbw32
|
||||
|
||||
; jmp nbw
|
||||
pause_key:
|
||||
mov ecx,100
|
||||
mov cx,100
|
||||
pause_key_1:
|
||||
loop pause_key_1
|
||||
ret
|
||||
|
||||
old_ints_h:
|
||||
dw 0x400
|
||||
dd 0
|
||||
dw 0
|
||||
|
||||
rdelay:
|
||||
ret
|
||||
|
||||
iglobal
|
||||
kernel db 'KERNEL MNT'
|
||||
; shutdown_parameter db 0
|
||||
@ -361,10 +338,10 @@ restart_kernel_4000:
|
||||
xor si, si
|
||||
xor di, di
|
||||
rep movsw
|
||||
mov ax, 0x9000
|
||||
mov ds, ax
|
||||
mov ax, 0x2000
|
||||
mov es, ax
|
||||
push 0x9000
|
||||
pop ds
|
||||
push 0x2000
|
||||
pop es
|
||||
pop cx
|
||||
rep movsw
|
||||
|
||||
@ -434,93 +411,72 @@ mov bx,1
|
||||
mov cx,3
|
||||
int 0x15
|
||||
;!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
fwwritedone:
|
||||
ret
|
||||
uglobal
|
||||
flm db 0
|
||||
endg
|
||||
|
||||
flm db 0
|
||||
|
||||
floppy_write: ; write diskette image to physical floppy
|
||||
|
||||
pusha
|
||||
|
||||
mov ax,0x1000
|
||||
mov es,ax
|
||||
cmp [es:flm-0x10000],byte 1
|
||||
cmp [flm-0x10000],byte 1
|
||||
je fwwritedone
|
||||
mov [es:flm-0x10000],byte 1
|
||||
mov [flm-0x10000],byte 1
|
||||
|
||||
mov ax,0x0000 ; reset drive
|
||||
mov dx,0x0000
|
||||
xor ax, ax ; reset drive
|
||||
xor dx, dx
|
||||
int 0x13
|
||||
|
||||
mov cx,0x0001 ; startcyl,startsector
|
||||
mov dx,0x0000 ; starthead,drive
|
||||
push word 80*2 ; read no of sect
|
||||
; mov dx,0x0000 ; starthead,drive
|
||||
xor dx, dx
|
||||
mov ax, 80*2 ; read no of sect
|
||||
|
||||
fwwrites:
|
||||
pusha
|
||||
push ax
|
||||
|
||||
; move 1mb+ -> 0:a000
|
||||
|
||||
pusha
|
||||
mov si,fwmovedesc -0x10000
|
||||
push word 0x1000
|
||||
pop es
|
||||
mov cx,256*18
|
||||
mov ah,0x87
|
||||
push ds
|
||||
pop es
|
||||
int 0x15
|
||||
mov eax,[es:fwmovedesc-0x10000+0x12]
|
||||
add eax,512*18
|
||||
mov [es:fwmovedesc-0x10000+0x12],eax
|
||||
add dword [fwmovedesc-0x10000+0x12], 512*18
|
||||
popa
|
||||
|
||||
xor si,si
|
||||
mov es,si
|
||||
fwnewwrite:
|
||||
push word 0x0
|
||||
pop es
|
||||
mov bx,0xa000 ; es:bx -> data area
|
||||
mov ax,0x0300+18 ; read, no of sectors to read
|
||||
int 0x13
|
||||
|
||||
cmp ah,0
|
||||
test ah, ah
|
||||
jz fwgoodwrite
|
||||
|
||||
add si,1
|
||||
inc si
|
||||
cmp si,10
|
||||
jnz fwnewwrite
|
||||
|
||||
add esp,32+2
|
||||
|
||||
popa ; can't access diskette
|
||||
; can't access diskette - return
|
||||
pop ax
|
||||
ret
|
||||
|
||||
fwgoodwrite:
|
||||
|
||||
popa
|
||||
|
||||
inc dh
|
||||
cmp dh,2
|
||||
jnz fwbb2
|
||||
mov dh,0
|
||||
inc ch
|
||||
|
||||
fwbb2:
|
||||
|
||||
cld
|
||||
pop ax
|
||||
dec ax
|
||||
push ax
|
||||
cmp ax,0
|
||||
jnz fwrs
|
||||
|
||||
pop ax
|
||||
|
||||
jmp fwwritedone
|
||||
fwrs:
|
||||
jmp fwwrites
|
||||
jnz fwwrites
|
||||
ret
|
||||
|
||||
fwmovedesc:
|
||||
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
db 0xff,0xff,0x0,0x00,0x10,0x93,0x0,0x0
|
||||
@ -530,13 +486,6 @@ floppy_write: ; write diskette image to physical floppy
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
|
||||
fwwritedone:
|
||||
|
||||
popa
|
||||
|
||||
ret
|
||||
|
||||
|
||||
use32
|
||||
|
||||
uglobal
|
||||
@ -544,13 +493,15 @@ uglobal
|
||||
endg
|
||||
|
||||
iglobal
|
||||
;shutdowntext:
|
||||
; db "IT'S SAFE TO POWER OFF COMPUTER OR "
|
||||
; db ' '
|
||||
; db '1) SAVE RAMDISK TO FLOPPY '
|
||||
; db '2) APM - POWEROFF '
|
||||
; db '3) REBOOT '
|
||||
; db '4) RESTART KERNEL '
|
||||
if lang eq en
|
||||
shutdowntext:
|
||||
db "IT'S SAFE TO POWER OFF COMPUTER OR "
|
||||
db ' '
|
||||
db '1) SAVE RAMDISK TO FLOPPY '
|
||||
db '2) APM - POWEROFF '
|
||||
db '3) REBOOT '
|
||||
db '4) RESTART KERNEL '
|
||||
else
|
||||
shutdowntext:
|
||||
db "<EFBFBD>¥§®¯ ᮥ ¢ëª«î票¥ ª®¬¯ìîâ¥à ¨«¨ "
|
||||
db ' '
|
||||
@ -558,6 +509,7 @@ shutdowntext:
|
||||
db '2) APM - ¢ëª«î票¥ ¯¨â ¨ï '
|
||||
db '3) <20>¥à¥§ £à㧪 á¨á⥬ë '
|
||||
db '4) <20>¥áâ àâ ï¤à ¨§ Ž‡“ '
|
||||
end if
|
||||
rosef:
|
||||
db 'ROSE TXT'
|
||||
endg
|
||||
|
@ -86,6 +86,7 @@ new_start_application_floppy:
|
||||
call find_new_process_place ;find empty process slot
|
||||
sti
|
||||
test eax,eax
|
||||
mov ecx, -0x20 ; too many processes
|
||||
jz .failed
|
||||
|
||||
mov edi,eax
|
||||
@ -97,9 +98,9 @@ new_start_application_floppy:
|
||||
rep stosd ;clean extended information about process
|
||||
|
||||
;set new process name
|
||||
xor eax,eax
|
||||
mov [appl_path_size],eax
|
||||
mov eax,[esp] ;+8]
|
||||
pop eax
|
||||
push eax
|
||||
.find_last_byte:
|
||||
cmp byte [eax],0
|
||||
jz .find_last_byte_end
|
||||
@ -126,19 +127,22 @@ new_start_application_floppy:
|
||||
; cli
|
||||
call floppy_fileread ;read file from FD
|
||||
; sti
|
||||
cmp eax,0
|
||||
jne .cleanfailed
|
||||
mov ecx, eax
|
||||
neg ecx
|
||||
jnz .cleanfailed
|
||||
;check MENUET signature
|
||||
mov ecx, -0x1F ; not Menuet/Kolibri executable
|
||||
cmp [0x90000],dword 'MENU'
|
||||
jnz .cleanfailed
|
||||
cmp [0x90004],word 'ET'
|
||||
jnz .cleanfailed
|
||||
|
||||
call get_app_params ;parse header fields
|
||||
cmp esi,0
|
||||
test esi, esi
|
||||
jz .cleanfailed
|
||||
|
||||
mov eax,[new_process_place]
|
||||
inc ecx ; -0x1E = no memory
|
||||
call create_app_cr3_table ;create page directory for new process
|
||||
test eax,eax
|
||||
jz .cleanfailed_mem
|
||||
@ -152,6 +156,7 @@ new_start_application_floppy:
|
||||
mov edx,eax
|
||||
call mem_alloc_specified_region ;allocate memory for application
|
||||
test eax,eax
|
||||
mov ecx, -0x1E
|
||||
jz .cleanfailed_mem1
|
||||
|
||||
mov eax,[edx+(std_application_base_address shr 20)]
|
||||
@ -209,6 +214,7 @@ new_start_application_floppy:
|
||||
mov esi,start_not_enough_memory
|
||||
call sys_msg_board_str
|
||||
.cleanfailed: ;clean process name
|
||||
push ecx ; save error code
|
||||
;can't read file, clean process name.
|
||||
;this avoid problems with panel application.
|
||||
mov edi,[new_process_place]
|
||||
@ -218,13 +224,14 @@ new_start_application_floppy:
|
||||
mov eax,' '
|
||||
cld
|
||||
rep stosb
|
||||
pop eax
|
||||
.failed:
|
||||
;no more slots
|
||||
add esp,8+4
|
||||
mov [application_table_status],0
|
||||
mov [esp+1Ch], eax
|
||||
popad
|
||||
sti
|
||||
mov eax,-1
|
||||
ret
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
@ -258,6 +265,7 @@ new_start_application_fl:
|
||||
call find_new_process_place ;find empty process slot
|
||||
call safe_sti
|
||||
test eax,eax
|
||||
mov ecx, -0x20 ; too many processes
|
||||
jz .failed
|
||||
|
||||
mov edi,eax
|
||||
@ -284,20 +292,23 @@ new_start_application_fl:
|
||||
cli
|
||||
call fileread ;read file from RD
|
||||
call safe_sti
|
||||
cmp eax,0
|
||||
jne .cleanfailed
|
||||
mov ecx, eax
|
||||
neg ecx
|
||||
jnz .cleanfailed
|
||||
;check MENUET signature
|
||||
mov ecx, -0x1F ; not Menuet/Kolibri executable
|
||||
cmp [0x90000],dword 'MENU'
|
||||
jnz .cleanfailed
|
||||
cmp [0x90004],word 'ET'
|
||||
jnz .cleanfailed
|
||||
|
||||
call get_app_params ;parse header fields
|
||||
cmp esi,0
|
||||
test esi,esi
|
||||
jz .cleanfailed
|
||||
|
||||
mov eax,[new_process_place]
|
||||
call create_app_cr3_table ;create page directory for new process
|
||||
inc ecx ; -0x1E = no memory
|
||||
test eax,eax
|
||||
jz .cleanfailed_mem
|
||||
|
||||
@ -310,6 +321,7 @@ new_start_application_fl:
|
||||
mov edx,eax
|
||||
call mem_alloc_specified_region ;allocate memory for application
|
||||
test eax,eax
|
||||
mov ecx, -0x1E
|
||||
jz .cleanfailed_mem1
|
||||
|
||||
mov eax,[edx+(std_application_base_address shr 20)]
|
||||
@ -366,6 +378,7 @@ new_start_application_fl:
|
||||
mov esi,start_not_enough_memory
|
||||
call sys_msg_board_str
|
||||
.cleanfailed: ;clean process name
|
||||
push ecx ; save error code
|
||||
;can't read file, clean process name.
|
||||
;this avoid problems with panel application.
|
||||
mov edi,[new_process_place]
|
||||
@ -375,13 +388,14 @@ new_start_application_fl:
|
||||
mov eax,' '
|
||||
cld
|
||||
rep stosb
|
||||
pop eax
|
||||
.failed:
|
||||
;no more slots
|
||||
add esp,8
|
||||
mov [application_table_status],0
|
||||
mov [esp+1Ch], eax
|
||||
popad
|
||||
call safe_sti
|
||||
mov eax,-1
|
||||
ret
|
||||
|
||||
.add_app_parameters:
|
||||
@ -1203,6 +1217,7 @@ new_start_application_hd:
|
||||
call find_new_process_place ;find new process slot
|
||||
sti
|
||||
test eax,eax
|
||||
mov ecx, -0x20 ; too many processes
|
||||
jz .failed
|
||||
|
||||
;write application name
|
||||
@ -1231,11 +1246,14 @@ new_start_application_hd:
|
||||
mov ecx,1 ;read from first block
|
||||
mov edx,1 ;read 1 block
|
||||
call read_hd_file
|
||||
test eax,eax
|
||||
mov ecx, eax
|
||||
neg ecx
|
||||
jnz .cleanfailed
|
||||
|
||||
mov esi,[esp]
|
||||
pop esi
|
||||
push esi
|
||||
;check menuet signature
|
||||
mov ecx, -0x1F ; not Menuet/Kolibri executable
|
||||
cmp [esi+1024+0],dword 'MENU' ;read_hd_file function write file to +1024 offset
|
||||
jnz .cleanfailed
|
||||
cmp [esi+1024+4],word 'ET'
|
||||
@ -1246,12 +1264,14 @@ new_start_application_hd:
|
||||
cld
|
||||
rep movsd ;copy first block to 0x90000 address for get_app_params function
|
||||
call get_app_params
|
||||
mov ecx, -0x1F ; not Menuet/Kolibri executable
|
||||
test esi,esi
|
||||
jz .cleanfailed
|
||||
|
||||
mov eax,[new_process_place]
|
||||
call create_app_cr3_table ;create page directory
|
||||
test eax,eax
|
||||
inc ecx ; -0x1E = no memory
|
||||
jz .cleanfailed_mem
|
||||
|
||||
call MEM_Get_Linear_Address
|
||||
@ -1262,6 +1282,7 @@ new_start_application_hd:
|
||||
shr ecx,12
|
||||
mov edx,eax ;edx - linear address of page directory
|
||||
call mem_alloc_specified_region ;allocate memory for application
|
||||
mov ecx, -0x1E ; no memory
|
||||
test eax,eax
|
||||
jz .cleanfailed_mem1
|
||||
|
||||
@ -1350,6 +1371,7 @@ new_start_application_hd:
|
||||
mov esi,start_not_enough_memory
|
||||
call sys_msg_board_str
|
||||
.cleanfailed: ;clean process name
|
||||
push ecx
|
||||
;can't read file, clean process name.
|
||||
;this avoid problems with panel application.
|
||||
mov edi,[new_process_place]
|
||||
@ -1359,11 +1381,12 @@ new_start_application_hd:
|
||||
mov eax,' '
|
||||
cld
|
||||
rep stosb
|
||||
pop eax
|
||||
.failed:
|
||||
;no more slots
|
||||
add esp,16
|
||||
mov [esp+1Ch], eax
|
||||
popad
|
||||
mov eax,-1
|
||||
mov [application_table_status],0
|
||||
sti
|
||||
ret
|
||||
|
@ -48,7 +48,7 @@ file_system:
|
||||
; OUT:
|
||||
;
|
||||
; eax = 0 : read ok
|
||||
; eax = 1 : no fd base and/or partition defined
|
||||
; eax = 1 : no hd base and/or partition defined
|
||||
; eax = 2 : yet unsupported FS
|
||||
; eax = 3 : unknown FS
|
||||
; eax = 4 : partition not defined at hd
|
||||
@ -61,10 +61,31 @@ file_system:
|
||||
;
|
||||
; ebx = size
|
||||
|
||||
; Extract parameters
|
||||
; \begin{diamond}[18.03.2006]
|
||||
; for subfunction 16 (start application) error codes must be negative
|
||||
; because positive values are valid PIDs
|
||||
; so possible return values are:
|
||||
; eax > 0 : process created, eax=PID
|
||||
|
||||
mov edi,[0x3010]
|
||||
add eax,[edi+0x10] ; abs start of info block
|
||||
; -0x10 <= eax < 0 : -eax is filesystem error code:
|
||||
; eax = -1 = 0xFFFFFFFF : no hd base and/or partition defined
|
||||
; eax = -3 = 0xFFFFFFFD : unknown FS
|
||||
; eax = -5 = 0xFFFFFFFB : file not found
|
||||
; eax = -6 = 0xFFFFFFFA : unexpected end of file (probably not executable file)
|
||||
; eax = -9 = 0xFFFFFFF7 : fat table corrupted
|
||||
; eax = -10 = 0xFFFFFFF6 : access denied
|
||||
|
||||
; -0x20 <= eax < -0x10: eax is process creation error code:
|
||||
; eax = -0x20 = 0xFFFFFFE0 : too many processes
|
||||
; eax = -0x1F = 0xFFFFFFE1 : not Menuet/Kolibri executable
|
||||
; eax = -0x1E = 0xFFFFFFE2 : no memory
|
||||
|
||||
; ebx is not changed
|
||||
|
||||
; \end{diamond}[18.03.2006]
|
||||
|
||||
; Extract parameters
|
||||
add eax, std_application_base_address ; abs start of info block
|
||||
|
||||
cmp dword [eax+0],12 ; Get file size
|
||||
je fs_read
|
||||
@ -85,9 +106,6 @@ file_system:
|
||||
|
||||
cmp dword [0x3000],1 ; no memory checks for kernel requests
|
||||
jz no_checks_for_kernel
|
||||
;iglobal
|
||||
; buffer_failed db 'Buffer check failed',13,10,0
|
||||
;endg
|
||||
mov edx,eax
|
||||
cmp dword [eax+0],1
|
||||
jz .check_for_write_op
|
||||
@ -104,11 +122,11 @@ file_system:
|
||||
.error_output:
|
||||
mov esi,buffer_failed
|
||||
call sys_msg_board_str
|
||||
mov eax,7
|
||||
; mov eax,7
|
||||
mov dword [esp+36],7
|
||||
ret
|
||||
iglobal
|
||||
buffer_failed db 'Buffer check failed',13,10,0
|
||||
buffer_failed db 'K : Buffer check failed',13,10,0
|
||||
endg
|
||||
.usual_check:
|
||||
cmp dword [eax+0],0
|
||||
@ -122,22 +140,6 @@ endg
|
||||
call check_region
|
||||
test eax,eax
|
||||
jz .error_output
|
||||
jmp area_in_app_mem
|
||||
; mov ebx,[0x3000] ; pointer in application memory ?
|
||||
; shl ebx,8
|
||||
; mov ebx,[ebx+0x80000+0x8c]
|
||||
|
||||
; mov ebp,ebx ; save for checking at stack save
|
||||
; sub ebp,[eax+12]
|
||||
; shr ebp,9
|
||||
|
||||
; sub ebx,512 ; need atleast one block
|
||||
|
||||
; cmp ebx,[eax+12]
|
||||
; ja area_in_app_mem
|
||||
; mov eax,7
|
||||
; mov dword [esp+36],7
|
||||
; ret
|
||||
area_in_app_mem:
|
||||
mov eax,edx
|
||||
no_checks_for_kernel:
|
||||
@ -147,7 +149,7 @@ endg
|
||||
je fs_read
|
||||
cmp dword [eax+8],0 ; read or write 0 blocks/bytes ?
|
||||
jne fs_read
|
||||
mov dword [esp+36],0
|
||||
and dword [esp+36],0
|
||||
ret
|
||||
fs_read:
|
||||
|
||||
@ -157,26 +159,39 @@ endg
|
||||
test bh,bh
|
||||
jne fs_noroot
|
||||
fs_getroot:
|
||||
mov edx,[edi+0x10]
|
||||
; \begin{diamond}[18.03.2006]
|
||||
; root - only read is allowed
|
||||
; other operations return "access denied", eax=10
|
||||
; (execute operation returns eax=-10)
|
||||
cmp dword [eax], 0
|
||||
jz .read_root
|
||||
mov ecx, 10
|
||||
cmp dword [eax], 16
|
||||
jnz @f
|
||||
neg ecx
|
||||
@@: mov [esp+36], ecx
|
||||
ret
|
||||
.read_root:
|
||||
; \end{diamond}[18.03.2006]
|
||||
mov esi,dir0
|
||||
mov edi,[eax+12]
|
||||
add edi,edx
|
||||
add edi,std_application_base_address
|
||||
mov ecx,11
|
||||
cld
|
||||
push ecx
|
||||
; cld ; already is
|
||||
rep movsb
|
||||
mov eax,0x10
|
||||
mov al,0x10
|
||||
stosb
|
||||
add edi,32-11-1
|
||||
mov ecx,11
|
||||
pop ecx
|
||||
rep movsb
|
||||
stosb
|
||||
mov dword [esp+36],0 ; ok read
|
||||
and dword [esp+36],0 ; ok read
|
||||
mov dword [esp+24],32*2 ; size of root
|
||||
ret
|
||||
|
||||
fs_info: ;start of code - Mihasik
|
||||
mov edi,eax
|
||||
push edi
|
||||
push eax
|
||||
cmp [eax+21],byte 'h'
|
||||
je fs_info_h
|
||||
cmp [eax+21],byte 'H'
|
||||
@ -210,38 +225,26 @@ endg
|
||||
|
||||
fs_noroot:
|
||||
|
||||
mov ebx,[eax+0]
|
||||
push ebx ; read/write/delete/.../makedir/rename/lba/run
|
||||
mov ebx,[eax+4]
|
||||
push ebx ; 512 block number to read
|
||||
mov ebx,[eax+8]
|
||||
|
||||
; cmp dword [eax+0],0 ; if read, check that the data stays at
|
||||
; jne ret_size_fine ; application memory
|
||||
; cmp ebx,ebp
|
||||
; jbe ret_size_fine
|
||||
; mov ebx,ebp
|
||||
; ret_size_fine:
|
||||
|
||||
push ebx ; bytes to write/append or 512 blocks to read
|
||||
push dword [eax+0] ; read/write/delete/.../makedir/rename/lba/run
|
||||
push dword [eax+4] ; 512 block number to read
|
||||
push dword [eax+8] ; bytes to write/append or 512 blocks to read
|
||||
mov ebx,[eax+12]
|
||||
add ebx,[edi+0x10]
|
||||
add ebx,std_application_base_address
|
||||
push ebx ; abs start of return/save area
|
||||
|
||||
lea esi,[eax+20] ; abs start of dir + filename
|
||||
mov edi,[edi+0x10] ; abs start of work area
|
||||
add edi,[eax+16]
|
||||
mov edi,[eax+16]
|
||||
add edi,std_application_base_address ; abs start of work area
|
||||
|
||||
call expand_pathz
|
||||
|
||||
push edi ; dir start
|
||||
push ebx ; name of file start
|
||||
|
||||
mov ebx,[dir0+11] ; /RAMDISK
|
||||
mov eax,[edi+1]
|
||||
cmp eax,'RD '
|
||||
je fs_yesramdisk
|
||||
cmp eax,ebx
|
||||
cmp eax,'RAMD'
|
||||
jne fs_noramdisk
|
||||
|
||||
fs_yesramdisk:
|
||||
@ -249,11 +252,10 @@ endg
|
||||
cmp byte [edi+1+11],0
|
||||
je fs_give_dir1
|
||||
|
||||
mov ebx,[dir1] ; /FIRST
|
||||
mov eax,[edi+1+12]
|
||||
cmp eax,'1 '
|
||||
je fs_yesramdisk_first
|
||||
cmp eax,ebx
|
||||
cmp eax,'FIRS'
|
||||
jne fs_noramdisk
|
||||
|
||||
fs_yesramdisk_first:
|
||||
@ -312,17 +314,16 @@ endg
|
||||
add eax,2*12+1
|
||||
|
||||
xor ebx,ebx ; parameters to pass
|
||||
cmp dword [esp+12],0
|
||||
cmp dword [esp+12],ebx;0
|
||||
je no_fl_start_param
|
||||
mov ebx,[0x3010]
|
||||
mov ebx,[ebx+0x10]
|
||||
add ebx,[esp+12]
|
||||
mov ebx, [esp+12]
|
||||
add ebx, std_application_base_address
|
||||
no_fl_start_param:
|
||||
mov edx,[esp+16] ; flags
|
||||
|
||||
call start_application_fl
|
||||
|
||||
jmp file_system_return
|
||||
jmp file_system_startapp_return
|
||||
|
||||
fs_noramdisk_start_application: ;there's new code - Mihasik
|
||||
cmp dword [esp+20],2 ;DELETE
|
||||
@ -350,11 +351,10 @@ endg
|
||||
fs_noramdisk:
|
||||
|
||||
;********************************************************************
|
||||
mov ebx,[dir0+22] ; /FLOPPYDISK
|
||||
mov eax,[edi+1]
|
||||
cmp eax,'FD '
|
||||
je fs_yesflpdisk
|
||||
cmp eax,ebx
|
||||
cmp eax,'FLOP'
|
||||
jne fs_noflpdisk
|
||||
|
||||
fs_yesflpdisk:
|
||||
@ -363,16 +363,14 @@ endg
|
||||
cmp byte [edi+1+11],0
|
||||
je fs_give_dir1
|
||||
|
||||
mov ebx,[dir1] ; /FIRST
|
||||
mov eax,[edi+1+12]
|
||||
cmp eax,'1 '
|
||||
je fs_yesflpdisk_first
|
||||
cmp eax,ebx
|
||||
cmp eax,'FIRS'
|
||||
je fs_yesflpdisk_first
|
||||
mov ebx,[dir1+11] ; /SECOND
|
||||
cmp eax,'2 '
|
||||
je fs_yesflpdisk_second
|
||||
cmp eax,ebx
|
||||
cmp eax,'SECO'
|
||||
jne fs_noflpdisk
|
||||
jmp fs_yesflpdisk_second
|
||||
|
||||
@ -434,7 +432,7 @@ endg
|
||||
add eax,2*12+1
|
||||
|
||||
xor ebx,ebx ; parameters to pass
|
||||
cmp dword [esp+12],0
|
||||
cmp dword [esp+12],ebx;0
|
||||
je no_flp_start_param
|
||||
mov ebx,[0x3010]
|
||||
mov ebx,[ebx+0x10]
|
||||
@ -445,6 +443,8 @@ endg
|
||||
|
||||
call start_application_floppy
|
||||
|
||||
file_system_startapp_return:
|
||||
mov ebx, [esp+24+24] ; do not modify ebx in application
|
||||
jmp file_system_return
|
||||
|
||||
fs_noflpdisk_start_application:
|
||||
@ -495,9 +495,9 @@ choice_necessity_partition:
|
||||
call StringToNumber
|
||||
mov [fat32part],eax
|
||||
choice_necessity_partition_1:
|
||||
mov [0xfe10],dword 0 ; entries in hd cache
|
||||
mov ecx,[hdpos]
|
||||
xor eax,eax
|
||||
mov [0xfe10], eax ; entries in hd cache
|
||||
mov edx,0x40002
|
||||
search_partition_array:
|
||||
mov bl,[edx]
|
||||
@ -516,11 +516,10 @@ choice_necessity_partition_1:
|
||||
ret
|
||||
|
||||
old_path_harddisk:
|
||||
mov ebx,[dir0] ; /HARDDISK
|
||||
mov eax,[edi+1]
|
||||
cmp eax,'HD '
|
||||
je fs_yesharddisk
|
||||
cmp eax,ebx
|
||||
cmp eax,'HARD'
|
||||
jne fs_noharddisk
|
||||
|
||||
fs_yesharddisk:
|
||||
@ -543,6 +542,10 @@ choice_necessity_partition_1:
|
||||
|
||||
fs_yesharddisk_all:
|
||||
mov eax,1
|
||||
cmp dword [esp+20], 16
|
||||
jnz @f
|
||||
neg eax
|
||||
@@: mov ebx, [esp+24+24]
|
||||
cmp [hdpos],0 ; is hd base set?
|
||||
jz file_system_return ; no
|
||||
cmp [fat32part],0 ; is partition set?
|
||||
@ -661,19 +664,17 @@ choice_necessity_partition_1:
|
||||
add edi,12+1 ; continue after name
|
||||
call expand_pathz ; convert destination name
|
||||
|
||||
mov edx,[dir0] ; /HARDDISK
|
||||
mov eax,[edi+1]
|
||||
cmp eax,'HD '
|
||||
je fs_rename_test1
|
||||
cmp eax,edx
|
||||
cmp eax,'HARD'
|
||||
jne fs_rename_error
|
||||
|
||||
fs_rename_test1:
|
||||
mov edx,[dir1] ; /FIRST
|
||||
mov eax,[edi+1+12]
|
||||
cmp eax,'1 '
|
||||
je fs_rename_start
|
||||
cmp eax,edx
|
||||
cmp eax,'FIRS'
|
||||
jne fs_rename_error
|
||||
|
||||
fs_rename_start:
|
||||
@ -774,21 +775,28 @@ choice_necessity_partition_1:
|
||||
add ecx,512
|
||||
|
||||
xor ebp,ebp ; parameters to pass
|
||||
cmp dword [esp+12],0
|
||||
cmp dword [esp+12],ebp;0
|
||||
je no_hd_start_param
|
||||
mov ebp,[0x3010]
|
||||
mov ebp,[ebp+0x10]
|
||||
add ebp,[esp+12]
|
||||
mov ebp, [esp+12]
|
||||
add ebp, std_application_base_address
|
||||
no_hd_start_param:
|
||||
mov edx,[esp+16] ; flags
|
||||
|
||||
call start_application_hd
|
||||
|
||||
jmp file_system_return
|
||||
jmp file_system_startapp_return
|
||||
|
||||
fs_noharddisk_start_application:
|
||||
|
||||
fs_noharddisk:
|
||||
; \begin{diamond}[18.03.2006]
|
||||
mov eax, 5 ; file not found
|
||||
; à ìîæåò áûòü, âîçâðàùàòü äðóãîé êîä îøèáêè?
|
||||
cmp dword [esp+20], 16
|
||||
jnz @f
|
||||
neg eax
|
||||
@@: mov ebx, [esp+24+24] ; do not change ebx in application
|
||||
; \end{diamond}[18.03.2006]
|
||||
|
||||
file_system_return:
|
||||
|
||||
@ -801,13 +809,29 @@ choice_necessity_partition_1:
|
||||
|
||||
fs_give_dir1:
|
||||
|
||||
mov eax,0x10
|
||||
; \begin{diamond}[18.03.2006]
|
||||
; /RD,/FD,/HD - only read is allowed
|
||||
; other operations return "access denied", eax=10
|
||||
; (execute operation returns eax=-10)
|
||||
cmp dword [esp+20], 0
|
||||
jz .read
|
||||
add esp, 20
|
||||
pop ecx
|
||||
mov eax, 10
|
||||
cmp ecx, 16
|
||||
jnz @f
|
||||
neg eax
|
||||
@@: mov [esp+36], eax
|
||||
ret
|
||||
.read:
|
||||
; \end{diamond}[18.03.2006]
|
||||
mov al,0x10
|
||||
mov ebx,1
|
||||
mov edi,[esp+8]
|
||||
mov esi,dir1
|
||||
fs_d1_new:
|
||||
mov ecx,11
|
||||
cld
|
||||
; cld
|
||||
rep movsb
|
||||
stosb
|
||||
add edi,32-11-1
|
||||
@ -816,7 +840,7 @@ choice_necessity_partition_1:
|
||||
|
||||
add esp,24
|
||||
|
||||
mov dword [esp+36],0 ; ok read
|
||||
and dword [esp+36],0 ; ok read
|
||||
mov dword [esp+24],32*1 ; dir/data size
|
||||
ret
|
||||
|
||||
@ -851,7 +875,7 @@ LBA_read_ramdisk:
|
||||
shl esi,9
|
||||
add esi,0x100000
|
||||
mov ecx,512/4
|
||||
cld
|
||||
; cld
|
||||
rep movsd
|
||||
|
||||
popad
|
||||
|
@ -72,7 +72,7 @@ drawbar dd __sys_drawbar
|
||||
putpixel dd __sys_putpixel
|
||||
; } mike.dld
|
||||
|
||||
version db 'Kolibri OS version 0.5.2.9 ',13,10,13,10,0
|
||||
version db 'Kolibri OS version 0.5.3.0 ',13,10,13,10,0
|
||||
;dd endofcode-0x10000
|
||||
|
||||
;db 'Boot02'
|
||||
@ -2274,7 +2274,7 @@ endg
|
||||
|
||||
iglobal
|
||||
version_inf:
|
||||
db 0,5,2,9 ; version 0.5.2.9
|
||||
db 0,5,3,0 ; version 0.5.2.9
|
||||
db UID_KOLIBRI
|
||||
db 'Kolibri',0
|
||||
version_end:
|
||||
|
Loading…
Reference in New Issue
Block a user