Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3239 → Rev 3240

/kernel/branches/net/core/taskman.inc
31,6 → 31,24
ends
 
 
hdrVersion1 = 1 ; it is the old version of the header, without console fields
hdrVersionConsole = 2 ; it is the new version of the header, containing 2 mode dword fields
 
struct APP_HEADER_02_
banner dq ? ; 'MENUET01'
version dd ? ;+8 ; == hdrVersionConsole
start dd ? ;+12
i_end dd ? ;+16
mem_size dd ? ;+20
stack_top dd ? ;+24
i_param dd ? ;+28
i_icon dd ? ;+32
 
stdio dd ?
stderr dd ?
ends
 
 
struct APP_PARAMS
app_cmdline dd ? ;0x00
app_path dd ? ;0x04
39,28 → 57,31
app_mem dd ? ;0x10
ends
 
macro _clear_ op
{ mov ecx, op/4
xor eax, eax
cld
rep stosd
}
; not needed
;macro _clear_ op
;{ mov ecx, op/4
; xor eax, eax
; cld
; rep stosd
;}
 
fs_execute_from_sysdir:
xor ebx, ebx
xor ebx, ebx ; command line arguments.
fs_execute_from_sysdir_param:
xor edx, edx
xor eax, eax ; no STDIO
xor ecx, ecx ; no STDERR
 
xor edx, edx ; flags (currently only debug flag).
mov esi, sysdir_path
 
align 4
proc fs_execute
; eax - STDIO handle
; ecx - STDERR handle
 
;fn_read:dword, file_size:dword, cluster:dword
 
; ebx - cmdline
; edx - flags
; ebp - full filename
; [esp+4] = procedure DoRead, [esp+8] = filesize & [esp+12]... - arguments for it
 
locals
cmdline rd 64 ;256/4
80,12 → 101,19
hdr_esp dd ? ;0x0C
hdr_mem dd ? ;0x10
hdr_i_end dd ? ;0x14
 
hdr_stdio dd ?
hdr_stderr dd ?
endl
 
pushad
 
mov [hdr_stdio], eax
mov [hdr_stderr], ecx
 
cmp [SCR_MODE], word 0x13
jbe @f
 
pushad
stdcall set_cursor, [def_cursor_clock]
mov [handle], eax
92,6 → 120,7
mov [redrawmouse_unconditional], 1
call __sys_draw_pointer
popad
 
@@:
mov [flags], edx
 
148,10 → 177,28
 
lea ebx, [hdr_cmdline]
call test_app_header
mov esi, -0x1F
mov esi, -ERROR_INVALID_HEADER
test eax, eax
jz .err_hdr
 
; The header is OK, so check for the version and if == hdrVersionConsole, patch the header with
; the handles of the console IO socket handlers.
mov edx, [hdr_stdio]
mov ecx, [hdr_stderr]
 
cmp [eax+APP_HEADER_02_.version], hdrVersionConsole
jae .patch_header
 
or edx, ecx
jz .wait_lock
 
mov esi, -ERROR_WRONG_HEADER_VERSION
jmp .err_hdr
 
.patch_header:
mov [eax+APP_HEADER_02_.stdio], edx
mov [eax+APP_HEADER_02_.stderr], ecx
 
.wait_lock:
cmp [application_table_status], 0
je .get_lock
168,7 → 215,7
 
call get_new_process_place
test eax, eax
mov esi, -0x20 ; too many processes
mov esi, -ERROR_TOO_MANY_PROCESSES
jz .err
 
mov [slot], eax
176,8 → 223,13
add eax, SLOT_BASE
mov [slot_base], eax
mov edi, eax
_clear_ 256 ;clean extended information about process
 
;_clear_ 256 ;clean extended information about process
mov ecx, 256/4
xor eax, eax
cld
rep stosd
 
; write application name
lea eax, [filename]
stdcall strrchr, eax, '/' ; now eax points to name without path
203,7 → 255,7
mov [save_cr3], ebx
 
stdcall create_app_space, [hdr_mem], [file_base], [file_size]
mov esi, -30; no memory
mov esi, -ERROR_MEMORY_NOT_ENOUGH ; no memory
test eax, eax
jz .failed
 
255,6 → 307,7
.failed:
mov eax, [save_cr3]
call set_cr3
 
.err:
.err_hdr:
stdcall kernel_free, [file_base]
/kernel/branches/net/fs/fs_lfn.inc
21,9 → 21,39
ERROR_ACCESS_DENIED = 10
ERROR_DEVICE = 11
 
; Errors specific to fn.70.7 - program start
 
ERROR_MEMORY_NOT_ENOUGH = 30
ERROR_INVALID_HEADER = 31
ERROR_TOO_MANY_PROCESSES = 32
ERROR_WRONG_HEADER_VERSION = 33 ; the version of the header is lower than needed for specific feature.
 
image_of_eax EQU esp+32
image_of_ebx EQU esp+20
 
 
struc FileInfoBlock {
.sub_fn dd ?
.offset dd ?
.flags dd ?
.size dd ?
.ptr_buff dd ?
.filename rb 1
.pFilename dd ?
 
; variants
 
label .execFlags dword at .offset
label .execPtrArg dword at .flags
label .execStdIO dword at .size
label .execStdErr dword at .ptr_buff
}
 
virtual at 0
FileInfoBlock FileInfoBlock
end virtual
 
 
; System function 70 - files with long names (LFN)
; diamond, 2006
 
103,6 → 133,8
dd 0
 
endg
 
 
file_system_lfn:
; in: ebx->fileinfo block
; operation codes:
118,11 → 150,11
; 9 : create directory
 
; parse file name
lea esi, [ebx+20]
lea esi, [ebx+FileInfoBlock.filename]
lodsb
test al, al
jnz @f
mov esi, [esi]
mov esi, [esi] ; FileInfoBlock.pFilename actually.
lodsb
@@:
cmp al, '/'
142,13 → 174,18
call process_replace_file_name
.parse_normal:
cmp dword [ebx], 7
jne @F
mov edx, [ebx+4]
mov ebx, [ebx+8]
jne .not_execute
 
mov eax, [ebx+FileInfoBlock.execStdIO] ; or NULL if not needed.
mov ecx, [ebx+FileInfoBlock.execStdErr] ; or NULL if not needed.
mov edx, [ebx+FileInfoBlock.execFlags] ; now only debug flag
mov ebx, [ebx+FileInfoBlock.execPtrArg] ; pointer to string with command line arguments.
 
call fs_execute; esi+ebp, ebx, edx
mov [image_of_eax], eax
ret
@@:
 
.not_execute:
mov edi, rootdirs-8
xor ecx, ecx
push esi
181,8 → 218,8
cmp dword [ebx], 1
jnz .access_denied
xor eax, eax
mov ebp, [ebx+12] ;количество блоков для считывания
mov edx, [ebx+16] ;куда записывать рузельтат
mov ebp, [ebx+12] ; block count to be read.
mov edx, [ebx+16] ; where to write the result.
; add edx, std_application_base_address
push dword [ebx+4] ; first block
mov ebx, [ebx+8] ; flags
/kernel/branches/net/kernel.asm
77,7 → 77,7
USE_COM_IRQ equ 1 ; make irq 3 and irq 4 available for PCI devices
 
; Enabling the next line will enable serial output console
;debug_com_base equ 0x2f8 ; 0x3f8 is com1, 0x2f8 is com2, 0x3e8 is com3, 0x2e8 is com4, no irq's are used
debug_com_base equ 0x3f8 ; 0x3f8 is com1, 0x2f8 is com2, 0x3e8 is com3, 0x2e8 is com4, no irq's are used
 
include "proc32.inc"
include "kglobals.inc"