forked from KolibriOS/kolibrios
Kernel: updated to Kolibri 0.6.0.0 distr
Programs from K0600 distr: CDP, KEYASCII git-svn-id: svn://kolibrios.org@147 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
87aca91906
commit
990e3f745c
@ -56,566 +56,6 @@ safe_sti:
|
||||
sti
|
||||
@@:ret
|
||||
|
||||
new_start_application_floppy:
|
||||
;input:
|
||||
; eax - pointer to filename
|
||||
; ebx - parameters to pass
|
||||
; edx - flags
|
||||
;result:
|
||||
; eax - pid of new process
|
||||
; or 0 if call fails.
|
||||
mov [appl_path],edi
|
||||
pushad
|
||||
mov esi,new_process_loading
|
||||
call sys_msg_board_str ;write to debug board
|
||||
|
||||
;wait application_table_status mutex
|
||||
.table_status:
|
||||
cli
|
||||
cmp [application_table_status],0
|
||||
jz .stf
|
||||
sti
|
||||
call change_task
|
||||
jmp .table_status
|
||||
.stf:
|
||||
call set_application_table_status
|
||||
;we can change system tables now
|
||||
push edi
|
||||
push ebx
|
||||
push eax
|
||||
call find_new_process_place ;find empty process slot
|
||||
sti
|
||||
test eax,eax
|
||||
mov ecx, -0x20 ; too many processes
|
||||
jz .failed
|
||||
|
||||
mov edi,eax
|
||||
shl edi,8
|
||||
add edi,0x80000
|
||||
mov ecx,256/4
|
||||
xor eax,eax
|
||||
cld
|
||||
rep stosd ;clean extended information about process
|
||||
|
||||
;set new process name
|
||||
mov [appl_path_size],eax
|
||||
pop eax
|
||||
push eax
|
||||
.find_last_byte:
|
||||
cmp byte [eax],0
|
||||
jz .find_last_byte_end
|
||||
inc eax
|
||||
inc [appl_path_size]
|
||||
jmp .find_last_byte
|
||||
.find_last_byte_end:
|
||||
add [appl_path_size],24
|
||||
sub eax,11 ;last 11 bytes = application name
|
||||
; mov eax,[esp] ;eax - pointer to file name
|
||||
mov ebx,[new_process_place]
|
||||
shl ebx,8
|
||||
add ebx,0x80000 + APPDATA.app_name
|
||||
mov ecx,11
|
||||
call memmove
|
||||
|
||||
;read header of file
|
||||
mov eax,[esp]
|
||||
mov ebx,1 ;index of first block
|
||||
mov ecx,2 ;number of blocks
|
||||
mov edx,0x90000 ;temp area
|
||||
mov esi,12 ;file name length
|
||||
mov edi,[esp+8]
|
||||
; cli
|
||||
call floppy_fileread ;read file from FD
|
||||
; sti
|
||||
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
|
||||
jc .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
|
||||
|
||||
call MEM_Get_Linear_Address ;calculate linear address of it
|
||||
|
||||
mov ebx,std_application_base_address
|
||||
mov ecx,[app_mem]
|
||||
add ecx,4095
|
||||
shr ecx,12
|
||||
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)]
|
||||
and eax,not (4096-1) ;eax - physical address of first (for application memory) page table
|
||||
call MEM_Get_Linear_Address
|
||||
mov edx,eax
|
||||
|
||||
;read file
|
||||
mov ebx,1
|
||||
mov esi,12 ;length of file name
|
||||
.loop1:
|
||||
;edx = linear address of current page table entry
|
||||
;ebx = index of current block in file
|
||||
push edx
|
||||
mov eax,[edx]
|
||||
and eax,not (4096-1)
|
||||
call MEM_Get_Linear_Address
|
||||
mov edx,eax ;read file block to current page
|
||||
mov eax,[esp+4] ;restore pointer to file name
|
||||
mov ecx,8 ;number of blocks read
|
||||
mov ebp,edx ;save buffer address for .endofimage
|
||||
push ebx
|
||||
mov edi,[esp+16]
|
||||
; cli
|
||||
call floppy_fileread
|
||||
;ebx=file size
|
||||
; sti
|
||||
pop ecx
|
||||
add ecx,8
|
||||
test eax,eax
|
||||
jnz .endloop1 ;check io errors
|
||||
mov eax,[app_i_end]
|
||||
add eax,511
|
||||
shr eax,9
|
||||
cmp ecx,eax
|
||||
jg .endofimage ;we have loaded whole program
|
||||
add ebx,511
|
||||
shr ebx,9
|
||||
cmp ecx,ebx
|
||||
jg .endloop1 ;if end of file?
|
||||
mov ebx,ecx
|
||||
pop edx
|
||||
add edx,4
|
||||
jmp .loop1
|
||||
|
||||
.endofimage: ;set to zero memory at end of page
|
||||
mov ecx,[app_i_end]
|
||||
and ecx,4096-1
|
||||
jz .endloop1
|
||||
lea edi,[ebp+ecx]
|
||||
neg ecx
|
||||
add ecx,4096
|
||||
xor eax,eax
|
||||
cld
|
||||
rep stosb
|
||||
.endloop1:
|
||||
add esp,8+4 ;pop linear address of page table entry and pointer to file name
|
||||
call new_start_application_fl.add_app_parameters
|
||||
mov [esp+28],eax
|
||||
popad
|
||||
ret
|
||||
|
||||
.cleanfailed_mem1:
|
||||
;there is mem for directory entry, but there is no mem for pages
|
||||
;so free directory entry
|
||||
mov eax,[new_process_place]
|
||||
shl eax,8
|
||||
mov eax,[0x80000+eax+APPDATA.dir_table]
|
||||
call MEM_Free_Page
|
||||
.cleanfailed_mem:
|
||||
;there is no mem for directory entry, display message.
|
||||
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]
|
||||
shl edi,8
|
||||
add edi,0x80000 + APPDATA.app_name
|
||||
mov ecx,11
|
||||
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
|
||||
ret
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
new_start_application_fl:
|
||||
;input:
|
||||
; eax - pointer to filename
|
||||
; ebx - parameters to pass
|
||||
; edx - flags
|
||||
;result:
|
||||
; eax - pid of new process
|
||||
; or 0 if call fails.
|
||||
mov [appl_path],edi
|
||||
mov [appl_path_size],36
|
||||
pushad
|
||||
mov esi,new_process_loading
|
||||
call sys_msg_board_str ;write to debug board
|
||||
|
||||
;wait application_table_status mutex
|
||||
.table_status:
|
||||
cli
|
||||
cmp [application_table_status],0
|
||||
jz .stf
|
||||
sti
|
||||
call change_task
|
||||
jmp .table_status
|
||||
.stf:
|
||||
call set_application_table_status
|
||||
;we can change system tables now
|
||||
push ebx
|
||||
push eax
|
||||
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
|
||||
shl edi,8
|
||||
add edi,0x80000
|
||||
mov ecx,256/4
|
||||
xor eax,eax
|
||||
cld
|
||||
rep stosd ;clean extended information about process
|
||||
|
||||
;set new process name
|
||||
mov eax,[esp] ;eax - pointer to file name
|
||||
mov ebx,[new_process_place]
|
||||
shl ebx,8
|
||||
add ebx,0x80000 + APPDATA.app_name
|
||||
mov ecx,11
|
||||
call memmove
|
||||
|
||||
;read header of file
|
||||
mov ebx,1 ;index of first block
|
||||
mov ecx,2 ;number of blocks
|
||||
mov edx,0x90000 ;temp area
|
||||
mov esi,12 ;file name length
|
||||
cli
|
||||
call fileread ;read file from RD
|
||||
call safe_sti
|
||||
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
|
||||
jc .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
|
||||
|
||||
call MEM_Get_Linear_Address ;calculate linear address of it
|
||||
|
||||
mov ebx,std_application_base_address
|
||||
mov ecx,[app_mem]
|
||||
add ecx,4095
|
||||
shr ecx,12
|
||||
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)]
|
||||
and eax,not (4096-1) ;eax - physical address of first (for application memory) page table
|
||||
call MEM_Get_Linear_Address
|
||||
mov edx,eax
|
||||
|
||||
;read file
|
||||
mov ebx,1
|
||||
mov esi,12 ;length of file name
|
||||
.loop1:
|
||||
;edx = linear address of current page table entry
|
||||
;ebx = index of current block in file
|
||||
push edx
|
||||
mov eax,[edx]
|
||||
and eax,not (4096-1)
|
||||
call MEM_Get_Linear_Address
|
||||
mov edx,eax ;read file block to current page
|
||||
mov eax,[esp+4] ;restore pointer to file name
|
||||
mov ecx,8 ;number of blocks read
|
||||
mov ebp,edx ;save buffer address for .endofimage
|
||||
push ebx
|
||||
cli
|
||||
call fileread
|
||||
;ebx=file size
|
||||
call safe_sti
|
||||
pop ecx
|
||||
add ecx,8
|
||||
test eax,eax
|
||||
jnz .endloop1 ;check io errors
|
||||
mov eax,[app_i_end]
|
||||
add eax,511
|
||||
shr eax,9
|
||||
cmp ecx,eax
|
||||
jg .endofimage ;we have loaded whole program
|
||||
add ebx,511
|
||||
shr ebx,9
|
||||
cmp ecx,ebx
|
||||
jg .endloop1 ;if end of file?
|
||||
mov ebx,ecx
|
||||
pop edx
|
||||
add edx,4
|
||||
jmp .loop1
|
||||
|
||||
.endofimage: ;set to zero memory at end of page
|
||||
mov ecx,[app_i_end]
|
||||
and ecx,4096-1
|
||||
jz .endloop1
|
||||
lea edi,[ebp+ecx]
|
||||
neg ecx
|
||||
add ecx,4096
|
||||
xor eax,eax
|
||||
cld
|
||||
rep stosb
|
||||
.endloop1:
|
||||
add esp,8 ;pop linear address of page table entry and pointer to file name
|
||||
call .add_app_parameters
|
||||
mov [esp+28],eax
|
||||
popad
|
||||
ret
|
||||
|
||||
.cleanfailed_mem1:
|
||||
;there is mem for directory entry, but there is no mem for pages
|
||||
;so free directory entry
|
||||
mov eax,[new_process_place]
|
||||
shl eax,8
|
||||
mov eax,[0x80000+eax+APPDATA.dir_table]
|
||||
call MEM_Free_Page
|
||||
.cleanfailed_mem:
|
||||
;there is no mem for directory entry, display message.
|
||||
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]
|
||||
shl edi,8
|
||||
add edi,0x80000+APPDATA.app_name
|
||||
mov ecx,11
|
||||
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
|
||||
ret
|
||||
|
||||
.add_app_parameters:
|
||||
;input:
|
||||
; [esp] - pointer to parameters
|
||||
; [esp+4]-[esp+36] pushad registers.
|
||||
;result
|
||||
; eax - pid of new process
|
||||
; or zero if failed
|
||||
cli
|
||||
mov ebx,[new_process_place]
|
||||
cmp ebx,[0x3004]
|
||||
jle .noinc
|
||||
inc dword [0x3004] ;update number of processes
|
||||
.noinc:
|
||||
|
||||
; mov ebx,[new_process_place]
|
||||
;set 0x8c field of extended information about process
|
||||
;(size of application memory)
|
||||
shl ebx,8
|
||||
mov eax,[app_mem]
|
||||
mov [second_base_address+0x80000+APPDATA.mem_size+ebx],eax
|
||||
;set 0x10 field of information about process
|
||||
;(application base address)
|
||||
; mov ebx,[new_process_place]
|
||||
; shl ebx,5
|
||||
shr ebx,3
|
||||
mov dword [second_base_address+0x3000+ebx+TASKDATA.mem_start],std_application_base_address
|
||||
|
||||
;add command line parameters
|
||||
.add_command_line:
|
||||
mov edx,[app_i_param]
|
||||
test edx,edx
|
||||
jz .no_command_line ;application don't need parameters
|
||||
mov eax,[esp+4]
|
||||
test eax,eax
|
||||
jz .no_command_line ;no parameters specified
|
||||
;calculate parameter length
|
||||
mov esi,eax
|
||||
xor ecx,ecx
|
||||
inc ecx ; include terminating null
|
||||
.command_line_len:
|
||||
cmp byte [esi],0
|
||||
jz .command_line_len_end
|
||||
inc esi
|
||||
inc ecx
|
||||
cmp ecx,256
|
||||
jl .command_line_len
|
||||
|
||||
.command_line_len_end:
|
||||
;ecx - parameter length
|
||||
;edx - address of parameters in new process address space
|
||||
mov ebx,eax ;ebx - address of parameters in our address space
|
||||
mov eax,[new_process_place]
|
||||
call write_process_memory ;copy parameters to new process address space
|
||||
|
||||
.no_command_line:
|
||||
;******************************************************************
|
||||
mov edx,[app_i_icon]
|
||||
test edx,edx
|
||||
jz .no_command_line_1 ;application don't need path of file
|
||||
mov ebx,[appl_path]
|
||||
mov ecx,[appl_path_size]
|
||||
mov eax,[new_process_place]
|
||||
call write_process_memory ;copy path of file to new process address space
|
||||
.no_command_line_1:
|
||||
;******************************************************************
|
||||
mov ebx,[new_process_place]
|
||||
mov eax,ebx
|
||||
shl ebx,5
|
||||
add ebx,0x3000 ;ebx - pointer to information about process
|
||||
mov [ebx+TASKDATA.wnd_number],al ;set window number on screen = process slot
|
||||
|
||||
mov [ebx+TASKDATA.event_mask],dword 1+2+4 ;set default event flags (see 40 function)
|
||||
|
||||
inc dword [process_number]
|
||||
mov eax,[process_number]
|
||||
mov [ebx+TASKDATA.pid],eax ;set PID
|
||||
|
||||
mov ecx,ebx
|
||||
add ecx,draw_data-0x3000 ;ecx - pointer to draw data
|
||||
;set draw data to full screen
|
||||
mov [ecx+RECT.left],dword 0
|
||||
mov [ecx+RECT.top],dword 0
|
||||
mov eax,[0xfe00]
|
||||
mov [ecx+RECT.right],eax
|
||||
mov eax,[0xfe04]
|
||||
mov [ecx+RECT.bottom],eax
|
||||
;set window state to 'normal' (non-minimized/maximized/rolled-up) state
|
||||
mov [ecx+WDATA.fl_wstate],WSTATE_NORMAL
|
||||
;set cr3 register in TSS of application
|
||||
mov ecx,[new_process_place]
|
||||
shl ecx,8
|
||||
mov eax,[0x80000+APPDATA.dir_table+ecx]
|
||||
add eax,8+16 ;add flags
|
||||
mov [l.cr3],eax
|
||||
|
||||
mov eax,[app_start]
|
||||
mov [l.eip],eax ;set eip in TSS
|
||||
mov eax,[app_esp]
|
||||
mov [l.esp],eax ;set stack in TSS
|
||||
|
||||
;gdt
|
||||
;mov ebx,[new_process_place]
|
||||
;shl ebx,3
|
||||
mov ax,app_code ;ax - selector of code segment
|
||||
;add ax,bx
|
||||
mov [l.cs],ax
|
||||
mov ax,app_data
|
||||
;add ax,bx ;ax - selector of data segment
|
||||
mov [l.ss],ax
|
||||
mov [l.ds],ax
|
||||
mov [l.es],ax
|
||||
mov [l.fs],ax
|
||||
mov ax,graph_data ;ax - selector of graphic segment
|
||||
mov [l.gs],ax
|
||||
mov [l.io],word 128
|
||||
mov [l.eflags],dword 0x11202
|
||||
mov [l.ss0],os_data
|
||||
mov ebx,[new_process_place]
|
||||
shl ebx,12
|
||||
add ebx,sysint_stack_data+4096
|
||||
mov [l.esp0],ebx
|
||||
|
||||
;copy tss to it place
|
||||
mov eax,tss_sceleton
|
||||
mov ebx,[new_process_place]
|
||||
imul ebx,tss_step
|
||||
add ebx,tss_data ;ebx - address of application TSS
|
||||
mov ecx,120
|
||||
call memmove
|
||||
|
||||
;Add IO access table - bit array of permitted ports
|
||||
or eax,-1
|
||||
mov edi,[new_process_place]
|
||||
imul edi,tss_step
|
||||
add edi,tss_data+128
|
||||
mov ecx,2048
|
||||
cld
|
||||
rep stosd ;full access to 2048*8=16384 ports
|
||||
|
||||
mov ecx,ebx ;ecx - address of application TSS
|
||||
mov edi,[new_process_place]
|
||||
shl edi,3
|
||||
;set TSS descriptor
|
||||
mov [edi+gdts+tss0+0],word tss_step ;limit (size)
|
||||
mov [edi+gdts+tss0+2],cx ;part of offset
|
||||
mov eax,ecx
|
||||
shr eax,16
|
||||
mov [edi+gdts+tss0+4],al ;part of offset
|
||||
mov [edi+gdts+tss0+7],ah ;part of offset
|
||||
mov [edi+gdts+tss0+5],word 01010000b*256+11101001b ;system flags
|
||||
|
||||
|
||||
;flush keyboard and buttons queue
|
||||
mov [0xf400],byte 0
|
||||
mov [0xf500],byte 0
|
||||
|
||||
mov edi,[new_process_place]
|
||||
shl edi,5
|
||||
add edi,window_data
|
||||
mov ebx,[new_process_place]
|
||||
movzx esi,word [0xC000+ebx*2]
|
||||
lea esi,[0xC400+esi*2]
|
||||
call windowactivate ;gui initialization
|
||||
|
||||
mov ebx,[new_process_place]
|
||||
shl ebx,5
|
||||
; set if debuggee
|
||||
test byte [esp+28], 1
|
||||
jz .no_debug
|
||||
mov [0x3000+ebx+TASKDATA.state], 1 ; set process state - suspended
|
||||
mov eax, [0x3000]
|
||||
mov [0x80000+ebx*8+APPDATA.debugger_slot], eax ;set debugger PID - current
|
||||
jmp .debug
|
||||
.no_debug:
|
||||
mov [0x3000+ebx+TASKDATA.state], 0 ; set process state - running
|
||||
.debug:
|
||||
|
||||
mov esi,new_process_running
|
||||
call sys_msg_board_str ;output information about succefull startup
|
||||
|
||||
; add esp,4 ;pop pointer to parameters
|
||||
; popad
|
||||
mov eax,[process_number] ;set result
|
||||
mov [application_table_status],0 ;unlock application_table_status mutex
|
||||
call safe_sti
|
||||
ret 4
|
||||
;-----------------------------------------------------------------------------
|
||||
new_sys_threads:
|
||||
;eax=1 - create thread
|
||||
@ -676,7 +116,7 @@ new_sys_threads:
|
||||
; call addreference_app_cr3_table
|
||||
|
||||
push 0 ;no parameters
|
||||
call new_start_application_fl.add_app_parameters ;start thread
|
||||
call fs_execute.add_app_parameters ;start thread
|
||||
mov [esp+28],eax
|
||||
popad
|
||||
ret
|
||||
@ -1222,209 +662,6 @@ trans_address:
|
||||
add eax,std_application_base_address
|
||||
ret
|
||||
;-----------------------------------------------------------------------------
|
||||
new_start_application_hd:
|
||||
;eax - file name (kernel address)
|
||||
;ebx - file name length
|
||||
;ecx - work area (kernel address)
|
||||
;edx - flags
|
||||
;ebp - parameters
|
||||
mov [appl_path],edi
|
||||
pushad
|
||||
|
||||
mov esi,new_process_loading
|
||||
call sys_msg_board_str ;write message to message board
|
||||
|
||||
;lock application_table_status mutex
|
||||
.table_status:
|
||||
cli
|
||||
cmp [application_table_status],0
|
||||
jz .stf
|
||||
sti
|
||||
call change_task
|
||||
jmp .table_status
|
||||
.stf:
|
||||
call set_application_table_status
|
||||
|
||||
push ebp
|
||||
push ebx
|
||||
push eax
|
||||
push ecx
|
||||
call find_new_process_place ;find new process slot
|
||||
sti
|
||||
test eax,eax
|
||||
mov ecx, -0x20 ; too many processes
|
||||
jz .failed
|
||||
|
||||
;write application name
|
||||
xor eax,eax
|
||||
mov [appl_path_size],eax
|
||||
mov eax,[esp+4]
|
||||
.find_last_byte:
|
||||
cmp byte [eax],0
|
||||
jz .find_last_byte_end
|
||||
inc eax
|
||||
inc [appl_path_size]
|
||||
jmp .find_last_byte
|
||||
.find_last_byte_end:
|
||||
add [appl_path_size],24
|
||||
lea esi,[eax-11] ;last 11 bytes = application name
|
||||
mov edi,[new_process_place]
|
||||
shl edi,8
|
||||
add edi,0x80000+APPDATA.app_name
|
||||
mov ecx,11
|
||||
cld
|
||||
rep movsb ;copy name to extended information about process
|
||||
|
||||
;read header
|
||||
mov eax,[esp+4] ;file name
|
||||
mov esi,[esp] ;work area
|
||||
mov ecx,1 ;read from first block
|
||||
mov edx,1 ;read 1 block
|
||||
call read_hd_file
|
||||
mov ecx, eax
|
||||
neg ecx
|
||||
jnz .cleanfailed
|
||||
|
||||
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'
|
||||
jnz .cleanfailed
|
||||
add esi,1024
|
||||
mov edi,0x90000
|
||||
mov ecx,512/4
|
||||
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
|
||||
jc .cleanfailed
|
||||
|
||||
mov eax,[new_process_place]
|
||||
inc ecx ; -0x1E = no memory
|
||||
call create_app_cr3_table ;create page directory
|
||||
test eax,eax
|
||||
jz .cleanfailed_mem
|
||||
|
||||
call MEM_Get_Linear_Address
|
||||
|
||||
mov ebx,std_application_base_address
|
||||
mov ecx,[app_mem]
|
||||
add ecx,4096-1
|
||||
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
|
||||
|
||||
add edx,(std_application_base_address shr 20)
|
||||
mov eax,[edx]
|
||||
and eax,not (4096-1)
|
||||
call MEM_Get_Linear_Address
|
||||
push edx ;save pointer to first page table
|
||||
mov edx,eax
|
||||
;read file
|
||||
mov ecx,1
|
||||
xor ebp,ebp
|
||||
.loop1:
|
||||
;[esp] - pointer to current page directory entry
|
||||
;edx - pointer to current page table
|
||||
;ebp - offset in page
|
||||
;ecx - current cluster
|
||||
push edx
|
||||
mov eax,[esp+12] ;file name
|
||||
mov ebx,[esp+16] ;file name length
|
||||
mov esi,[esp+8] ;work area
|
||||
mov edx,1 ;number of blocks to read
|
||||
push ecx
|
||||
push ebp
|
||||
cli
|
||||
call read_hd_file
|
||||
sti
|
||||
pop ebp
|
||||
test eax,eax
|
||||
jnz .endloop1 ;check io errors
|
||||
|
||||
mov esi,[esp+8+4] ;work area
|
||||
add esi,1024
|
||||
mov eax,[esp+4] ;current page table
|
||||
mov eax,[eax]
|
||||
and eax,not (4096-1)
|
||||
call MEM_Get_Linear_Address;calculate linear page address
|
||||
lea edi,[eax+ebp] ;add page offset
|
||||
mov ecx,512/4
|
||||
cld
|
||||
rep movsd ;copy data
|
||||
|
||||
pop ecx
|
||||
inc ecx ;next block
|
||||
mov eax,[app_i_end] ;todo: precalculate ([app_i_end]+4095)/4096
|
||||
add eax,512-1
|
||||
shr eax,9 ;calculate application image size
|
||||
cmp ecx,eax
|
||||
jg .endloop11
|
||||
pop edx
|
||||
add ebp,512 ;new offset
|
||||
test ebp,4096
|
||||
jz .loop1
|
||||
xor ebp,ebp
|
||||
add edx,4 ;go to next page
|
||||
test edx,(4096-1)
|
||||
jnz .loop1
|
||||
add dword [esp],4 ;go to next directory entry
|
||||
mov eax,[esp]
|
||||
mov eax,[eax]
|
||||
and eax,not (4096-1)
|
||||
call MEM_Get_Linear_Address
|
||||
mov edx,eax
|
||||
jmp .loop1
|
||||
.endloop1:
|
||||
add esp,4 ;pop ecx
|
||||
.endloop11:
|
||||
add esp,4+4 ;pop edx, pop edx
|
||||
|
||||
;add_app_parameters
|
||||
add esp,12 ;now pointer to parameters is on the top of the stack
|
||||
call new_start_application_fl.add_app_parameters ;start process
|
||||
mov [esp+28],eax
|
||||
popad
|
||||
ret
|
||||
|
||||
.cleanfailed_mem1:
|
||||
;there is mem for directory entry, but there is no mem for pages
|
||||
;so free directory entry
|
||||
mov eax,[new_process_place]
|
||||
shl eax,8
|
||||
mov eax,[0x80000+eax+APPDATA.dir_table]
|
||||
call MEM_Free_Page
|
||||
.cleanfailed_mem:
|
||||
;there is no mem for directory entry, display message.
|
||||
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]
|
||||
shl edi,8
|
||||
add edi,0x80000+APPDATA.app_name
|
||||
mov ecx,11
|
||||
mov eax,' '
|
||||
cld
|
||||
rep stosb
|
||||
pop eax
|
||||
.failed:
|
||||
;no more slots
|
||||
add esp,16
|
||||
mov [esp+1Ch], eax
|
||||
popad
|
||||
mov [application_table_status],0
|
||||
sti
|
||||
ret
|
||||
end if
|
||||
|
||||
; \begin{diamond}
|
||||
include 'debug.inc'
|
||||
@ -1608,7 +845,7 @@ fs_execute:
|
||||
pop edx
|
||||
cmp eax, 6
|
||||
jnz .cleanfailed_mem2
|
||||
call new_start_application_fl.add_app_parameters
|
||||
call .add_app_parameters
|
||||
mov [esp+28], eax
|
||||
popad
|
||||
ret
|
||||
@ -1649,3 +886,191 @@ fs_execute:
|
||||
call safe_sti
|
||||
ret
|
||||
; \end{diamond}
|
||||
.add_app_parameters:
|
||||
;input:
|
||||
; [esp] - pointer to parameters
|
||||
; [esp+4]-[esp+36] pushad registers.
|
||||
;result
|
||||
; eax - pid of new process
|
||||
; or zero if failed
|
||||
cli
|
||||
mov ebx,[new_process_place]
|
||||
cmp ebx,[0x3004]
|
||||
jle .noinc
|
||||
inc dword [0x3004] ;update number of processes
|
||||
.noinc:
|
||||
|
||||
; mov ebx,[new_process_place]
|
||||
;set 0x8c field of extended information about process
|
||||
;(size of application memory)
|
||||
shl ebx,8
|
||||
mov eax,[app_mem]
|
||||
mov [second_base_address+0x80000+APPDATA.mem_size+ebx],eax
|
||||
;set 0x10 field of information about process
|
||||
;(application base address)
|
||||
; mov ebx,[new_process_place]
|
||||
; shl ebx,5
|
||||
shr ebx,3
|
||||
mov dword [second_base_address+0x3000+ebx+TASKDATA.mem_start],std_application_base_address
|
||||
|
||||
;add command line parameters
|
||||
.add_command_line:
|
||||
mov edx,[app_i_param]
|
||||
test edx,edx
|
||||
jz .no_command_line ;application don't need parameters
|
||||
mov eax,[esp+4]
|
||||
test eax,eax
|
||||
jz .no_command_line ;no parameters specified
|
||||
;calculate parameter length
|
||||
mov esi,eax
|
||||
xor ecx,ecx
|
||||
inc ecx ; include terminating null
|
||||
.command_line_len:
|
||||
cmp byte [esi],0
|
||||
jz .command_line_len_end
|
||||
inc esi
|
||||
inc ecx
|
||||
cmp ecx,256
|
||||
jl .command_line_len
|
||||
|
||||
.command_line_len_end:
|
||||
;ecx - parameter length
|
||||
;edx - address of parameters in new process address space
|
||||
mov ebx,eax ;ebx - address of parameters in our address space
|
||||
mov eax,[new_process_place]
|
||||
call write_process_memory ;copy parameters to new process address space
|
||||
|
||||
.no_command_line:
|
||||
;******************************************************************
|
||||
mov edx,[app_i_icon]
|
||||
test edx,edx
|
||||
jz .no_command_line_1 ;application don't need path of file
|
||||
mov ebx,[appl_path]
|
||||
mov ecx,[appl_path_size]
|
||||
mov eax,[new_process_place]
|
||||
call write_process_memory ;copy path of file to new process address space
|
||||
.no_command_line_1:
|
||||
;******************************************************************
|
||||
mov ebx,[new_process_place]
|
||||
mov eax,ebx
|
||||
shl ebx,5
|
||||
mov [ebx+window_data+WDATA.fl_wstate],WSTATE_NORMAL
|
||||
mov [ebx+window_data+WDATA.fl_redraw],1
|
||||
add ebx,0x3000 ;ebx - pointer to information about process
|
||||
mov [ebx+TASKDATA.wnd_number],al ;set window number on screen = process slot
|
||||
|
||||
mov [ebx+TASKDATA.event_mask],dword 1+2+4 ;set default event flags (see 40 function)
|
||||
|
||||
inc dword [process_number]
|
||||
mov eax,[process_number]
|
||||
mov [ebx+TASKDATA.pid],eax ;set PID
|
||||
|
||||
mov ecx,ebx
|
||||
add ecx,draw_data-0x3000 ;ecx - pointer to draw data
|
||||
;set draw data to full screen
|
||||
mov [ecx+RECT.left],dword 0
|
||||
mov [ecx+RECT.top],dword 0
|
||||
mov eax,[0xfe00]
|
||||
mov [ecx+RECT.right],eax
|
||||
mov eax,[0xfe04]
|
||||
mov [ecx+RECT.bottom],eax
|
||||
;set cr3 register in TSS of application
|
||||
mov ecx,[new_process_place]
|
||||
shl ecx,8
|
||||
mov eax,[0x80000+APPDATA.dir_table+ecx]
|
||||
add eax,8+16 ;add flags
|
||||
mov [l.cr3],eax
|
||||
|
||||
mov eax,[app_start]
|
||||
mov [l.eip],eax ;set eip in TSS
|
||||
mov eax,[app_esp]
|
||||
mov [l.esp],eax ;set stack in TSS
|
||||
|
||||
;gdt
|
||||
;mov ebx,[new_process_place]
|
||||
;shl ebx,3
|
||||
mov ax,app_code ;ax - selector of code segment
|
||||
;add ax,bx
|
||||
mov [l.cs],ax
|
||||
mov ax,app_data
|
||||
;add ax,bx ;ax - selector of data segment
|
||||
mov [l.ss],ax
|
||||
mov [l.ds],ax
|
||||
mov [l.es],ax
|
||||
mov [l.fs],ax
|
||||
mov ax,graph_data ;ax - selector of graphic segment
|
||||
mov [l.gs],ax
|
||||
mov [l.io],word 128
|
||||
mov [l.eflags],dword 0x11202
|
||||
mov [l.ss0],os_data
|
||||
mov ebx,[new_process_place]
|
||||
shl ebx,12
|
||||
add ebx,sysint_stack_data+4096
|
||||
mov [l.esp0],ebx
|
||||
|
||||
;copy tss to it place
|
||||
mov eax,tss_sceleton
|
||||
mov ebx,[new_process_place]
|
||||
imul ebx,tss_step
|
||||
add ebx,tss_data ;ebx - address of application TSS
|
||||
mov ecx,120
|
||||
call memmove
|
||||
|
||||
;Add IO access table - bit array of permitted ports
|
||||
or eax,-1
|
||||
mov edi,[new_process_place]
|
||||
imul edi,tss_step
|
||||
add edi,tss_data+128
|
||||
mov ecx,2048
|
||||
cld
|
||||
rep stosd ;full access to 2048*8=16384 ports
|
||||
|
||||
mov ecx,ebx ;ecx - address of application TSS
|
||||
mov edi,[new_process_place]
|
||||
shl edi,3
|
||||
;set TSS descriptor
|
||||
mov [edi+gdts+tss0+0],word tss_step ;limit (size)
|
||||
mov [edi+gdts+tss0+2],cx ;part of offset
|
||||
mov eax,ecx
|
||||
shr eax,16
|
||||
mov [edi+gdts+tss0+4],al ;part of offset
|
||||
mov [edi+gdts+tss0+7],ah ;part of offset
|
||||
mov [edi+gdts+tss0+5],word 01010000b*256+11101001b ;system flags
|
||||
|
||||
|
||||
;flush keyboard and buttons queue
|
||||
mov [0xf400],byte 0
|
||||
mov [0xf500],byte 0
|
||||
|
||||
mov edi,[new_process_place]
|
||||
shl edi,5
|
||||
add edi,window_data
|
||||
mov ebx,[new_process_place]
|
||||
movzx esi,word [0xC000+ebx*2]
|
||||
lea esi,[0xC400+esi*2]
|
||||
call windowactivate ;gui initialization
|
||||
|
||||
mov ebx,[new_process_place]
|
||||
shl ebx,5
|
||||
; set if debuggee
|
||||
test byte [esp+28], 1
|
||||
jz .no_debug
|
||||
mov [0x3000+ebx+TASKDATA.state], 1 ; set process state - suspended
|
||||
mov eax, [0x3000]
|
||||
mov [0x80000+ebx*8+APPDATA.debugger_slot], eax ;set debugger PID - current
|
||||
jmp .debug
|
||||
.no_debug:
|
||||
mov [0x3000+ebx+TASKDATA.state], 0 ; set process state - running
|
||||
.debug:
|
||||
|
||||
mov esi,new_process_running
|
||||
call sys_msg_board_str ;output information about succefull startup
|
||||
|
||||
; add esp,4 ;pop pointer to parameters
|
||||
; popad
|
||||
mov eax,[process_number] ;set result
|
||||
mov [application_table_status],0 ;unlock application_table_status mutex
|
||||
call safe_sti
|
||||
ret 4
|
||||
|
||||
end if
|
||||
|
@ -665,19 +665,6 @@ get_app_params:
|
||||
ret
|
||||
|
||||
|
||||
start_application_fl:
|
||||
jmp new_start_application_fl
|
||||
|
||||
;************************************************************************
|
||||
|
||||
start_application_floppy:
|
||||
jmp new_start_application_floppy
|
||||
|
||||
;********************************************************************
|
||||
|
||||
start_application_hd:
|
||||
jmp new_start_application_hd
|
||||
|
||||
uglobal
|
||||
new_process_place dd 0x0
|
||||
app_start dd 0x0
|
||||
@ -691,13 +678,6 @@ uglobal
|
||||
appl_path_size dd 0x0
|
||||
endg
|
||||
|
||||
;iglobal
|
||||
;hd_app_string db 'HDAPP '
|
||||
;process_loading db 'K : Process - loading ',13,10,0
|
||||
;process_running db 'K : Process - done',13,10,0
|
||||
;first_gdt_search dd 0x2
|
||||
;endg
|
||||
|
||||
|
||||
sys_threads:
|
||||
|
||||
|
@ -87,7 +87,7 @@ iglobal
|
||||
dd sys_cachetodiskette ; 16-FlushFloppyCache
|
||||
dd sys_getbutton ; 17-GetButton
|
||||
dd sys_system ; 18-System Services
|
||||
dd syscall_startapp ; 19-StartApp
|
||||
dd undefined_syscall ; 19-reserved
|
||||
dd sys_midi ; 20-ResetMidi and OutputMidi
|
||||
dd sys_setup ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,.
|
||||
dd sys_settime ; 22-setting date,time,clock and alarm-clock
|
||||
|
@ -1,4 +1,4 @@
|
||||
‘ˆ‘’…Œ<EFBFBD>›… ”“<E2809D>Š–ˆˆ Ž<>…<EFBFBD>€–ˆŽ<CB86><C5BD>Ž‰ ‘ˆ‘’…Œ› Kolibri 0.5.8.1
|
||||
‘ˆ‘’…Œ<EFBFBD>›… ”“<E2809D>Š–ˆˆ Ž<>…<EFBFBD>€–ˆŽ<CB86><C5BD>Ž‰ ‘ˆ‘’…Œ› Kolibri 0.6.0.0
|
||||
|
||||
<EFBFBD>®¬¥à äãªæ¨¨ ¯®¬¥é ¥âáï ¢ ॣ¨áâà eax.
|
||||
‚맮¢ á¨á⥬®© äãªæ¨¨ ®áãé¥á⢫ï¥âáï ª®¬ ¤®© "int 0x40".
|
||||
@ -878,8 +878,8 @@
|
||||
db a,b,c,d ¤«ï ¢¥àᨨ a.b.c.d
|
||||
db UID_xxx: ®¤® ¨§ UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
|
||||
db 'name',0 - ASCIIZ-áâப á ¨¬¥¥¬
|
||||
„«ï ï¤à Kolibri 0.5.8.1:
|
||||
db 0,5,8,1
|
||||
„«ï ï¤à Kolibri 0.6.0.0:
|
||||
db 0,6,0,0
|
||||
db 2
|
||||
db 'Kolibri',0
|
||||
|
||||
@ -1005,23 +1005,6 @@ db 'Kolibri',0
|
||||
¨ ¯à®¢¥à¨âì, çâ® ãáâ ¢«¨¢ ¥¬®¥ ¯®«®¦¥¨¥ ¥ ¢ë室¨â § ¯à¥¤¥«ë
|
||||
íªà .
|
||||
|
||||
======================================================================
|
||||
============ ”ãªæ¨ï 19 - § ¯ãáâ¨âì ¯à®£à ¬¬ã á à ¬¤¨áª . ============
|
||||
======================================================================
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 19 - ®¬¥à äãªæ¨¨
|
||||
* ebx = 㪠§ â¥«ì ¨¬ï ¯à®£à ¬¬ë ¢ ä®à¬ â¥, «®£¨ç®¬ äãªæ¨¨ 6
|
||||
* ecx = 0 ¨«¨ ecx = 㪠§ â¥«ì ¯ à ¬¥âàë ª®¬ ¤®© áâப¨
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* …᫨ eax > 0, â® eax ᮤ¥à¦¨â PID ᮧ¤ ®£® ¯à®æ¥áá
|
||||
* …᫨ eax < 0, â® -eax - ª®¤ ®è¨¡ª¨ ä ©«®¢®© á¨á⥬ë
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>â äãªæ¨ï ãáâ ५ ; ¨á¯®«ì§ã©â¥ ¯®¤äãªæ¨î 7 äãªæ¨¨ 70.
|
||||
* Š®¬ ¤ ï áâப ¤®«¦ § ª 稢 âìáï ᨬ¢®«®¬ á ª®¤®¬ 0
|
||||
(ASCIIZ-áâப ); ãç¨âë¢ îâáï «¨¡® ¢á¥ ᨬ¢®«ë ¤® § ¢¥àè î饣® ã«ï
|
||||
¢ª«îç¨â¥«ì®, «¨¡® ¯¥à¢ë¥ 256 ᨬ¢®«®¢, ¢ § ¢¨á¨¬®á⨠®â ⮣®,
|
||||
çâ® ¬¥ìè¥.
|
||||
|
||||
======================================================================
|
||||
==================== ”ãªæ¨ï 20 - ¨â¥à䥩á MIDI. ====================
|
||||
======================================================================
|
||||
@ -2927,7 +2910,6 @@ dword-
|
||||
* ¯®¤äãªæ¨ï 5 - ¯¥à¥¨¬¥®¢ ¨¥/¯¥à¥¬¥é¥¨¥ ä ©« /¯ ¯ª¨
|
||||
* ¯®¤äãªæ¨ï 8 - LBA-ç⥨¥ á ãáâனáâ¢
|
||||
* ¯®¤äãªæ¨ï 15 - ¯®«ã票¥ ¨ä®à¬ 樨 ® ä ©«®¢®© á¨á⥬¥
|
||||
* ¯®¤äãªæ¨ï 16 - § ¯ã᪠¯à¨«®¦¥¨ï
|
||||
|
||||
======================================================================
|
||||
========== ”ãªæ¨ï 58, ¯®¤äãªæ¨ï 0 - ¯à®ç¨â âì ä ©«/¯ ¯ªã. ==========
|
||||
@ -3186,37 +3168,6 @@ dword-
|
||||
¯®¤á¨áâ¥¬ë ¬®¦® ®¯à¥¤¥«¨âì à §¬¥à ª« áâ¥à (â ¬ ® åà ¨âáï
|
||||
¢ ᥪâ®à å) ¨ ®¡é¥¥ ç¨á«® ª« áâ¥à®¢ ¤«ï ¦ñáâª¨å ¤¨áª®¢.
|
||||
|
||||
======================================================================
|
||||
========== ”ãªæ¨ï 58, ¯®¤äãªæ¨ï 16 - § ¯ãáâ¨âì ¯à®£à ¬¬ã. ==========
|
||||
======================================================================
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 58 - ®¬¥à äãªæ¨¨
|
||||
* ebx = 㪠§ â¥«ì ¨ä®à¬ 樮ãî áâàãªâãàã
|
||||
”®à¬ â ¨ä®à¬ 樮®© áâàãªâãàë:
|
||||
* +0: dword: 16 = ®¬¥à ¯®¤äãªæ¨¨
|
||||
* +4: dword: ¯®«¥ ä« £®¢:
|
||||
* ¡¨â 0: § ¯ãáâ¨âì ¯à®æ¥áá ª ª ®â« ¦¨¢ ¥¬ë©
|
||||
* ®áâ «ìë¥ ¡¨âë § १¥à¢¨à®¢ ë ¨ ¤®«¦ë ¡ëâì ãáâ ®¢«¥ë ¢ 0
|
||||
* +8: dword: 0 ¨«¨ 㪠§ ⥫ì ASCIIZ-áâபã á ¯ à ¬¥âà ¬¨
|
||||
* +12 = +0xC: dword: ¨£®à¨àã¥âáï
|
||||
* +16 = +0x10: dword: 㪠§ â¥«ì ¡ãä¥à ¤«ï à ¡®âë á¨á⥬ë
|
||||
(4096 ¡ ©â)
|
||||
* +20 = +0x14: ASCIIZ-¨¬ï ä ©« , ¯à ¢¨« ä®à¬¨à®¢ ¨ï ¨¬ñ 㪠§ ë ¢
|
||||
®¡é¥¬ ®¯¨á ¨¨
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* eax > 0 - ¯à®£à ¬¬ § £à㦥 , eax ᮤ¥à¦¨â PID
|
||||
* eax < 0 - ¯à®¨§®è« ®è¨¡ª , -eax ᮤ¥à¦¨â
|
||||
ª®¤ ®è¨¡ª¨ ä ©«®¢®© á¨á⥬ë
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>â äãªæ¨ï ãáâ ५ , ¨á¯®«ì§ã©â¥ ¯®¤äãªæ¨î 7 äãªæ¨¨ 70.
|
||||
* Š®¬ ¤ ï áâப ¤®«¦ § ª 稢 âìáï ᨬ¢®«®¬ á ª®¤®¬ 0
|
||||
(ASCIIZ-áâப ); ãç¨âë¢ îâáï «¨¡® ¢á¥ ᨬ¢®«ë ¤® § ¢¥àè î饣® ã«ï
|
||||
¢ª«îç¨â¥«ì®, «¨¡® ¯¥à¢ë¥ 256 ᨬ¢®«®¢, ¢ § ¢¨á¨¬®á⨠®â ⮣®,
|
||||
çâ® ¬¥ìè¥.
|
||||
* …᫨ ¯à®æ¥áá § ¯ã᪠¥âáï ª ª ®â« ¦¨¢ ¥¬ë©, ® ᮧ¤ ñâáï
|
||||
¢ § ¬®à®¦¥®¬ á®áâ®ï¨¨; ¤«ï § ¯ã᪠¨á¯®«ì§ã©â¥
|
||||
¯®¤äãªæ¨î 5 äãªæ¨¨ 69.
|
||||
|
||||
======================================================================
|
||||
=== ”ãªæ¨ï 59 - ¯®«ãç¨âì ¨ä®à¬ æ¨î ® ¯®á«¥¤¨å á¨á⥬ëå ¢ë§®¢ å. ==
|
||||
======================================================================
|
||||
|
@ -1,4 +1,4 @@
|
||||
SYSTEM FUNCTIONS of OS Kolibri 0.5.8.1
|
||||
SYSTEM FUNCTIONS of OS Kolibri 0.6.0.0
|
||||
|
||||
Number of the function is located in the register eax.
|
||||
The call of the system function is executed by "int 0x40" command.
|
||||
@ -874,8 +874,8 @@ Structure of the buffer:
|
||||
db a,b,c,d for version a.b.c.d
|
||||
db UID_xxx: one of UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
|
||||
db 'name',0 - ASCIIZ-string with the name
|
||||
For Kolibri 0.5.8.1 kernel:
|
||||
db 0,5,8,1
|
||||
For Kolibri 0.6.0.0 kernel:
|
||||
db 0,6,0,0
|
||||
db 2
|
||||
db 'Kolibri',0
|
||||
|
||||
@ -1000,24 +1000,6 @@ Remarks:
|
||||
and check that the value of position is inside the limits of the
|
||||
screen.
|
||||
|
||||
======================================================================
|
||||
============ Function 19 - start application from ramdisk. ===========
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 19 - function number
|
||||
* ebx = pointer to the application name in format similar
|
||||
to function 6
|
||||
* ecx = 0 or ecx = pointer to command line parameters
|
||||
Returned value:
|
||||
* If eax > 0, then eax contains PID of the created process
|
||||
* If eax < 0, then -eax - file system error code
|
||||
Remarks:
|
||||
* This function is obsolete; use subfunction 7 of function 70.
|
||||
* Command line must be terminated by the character with the code 0
|
||||
(ASCIIZ-string); function takes into account either all characters
|
||||
up to terminating zero inclusively or first 256 character
|
||||
regarding what is less.
|
||||
|
||||
======================================================================
|
||||
==================== Function 20 - MIDI interface. ===================
|
||||
======================================================================
|
||||
@ -2897,7 +2879,6 @@ Existing subfunctions:
|
||||
* subfunction 5 - rename/move file/folder
|
||||
* subfunction 8 - LBA-read from device
|
||||
* subfunction 15 - get file system information
|
||||
* subfunction 16 - start application
|
||||
|
||||
======================================================================
|
||||
=========== Function 58, subfunction 0 - read file/folder. ===========
|
||||
@ -3155,36 +3136,6 @@ Remarks:
|
||||
it is stored in sectors) and total number of clusters
|
||||
for hard disks.
|
||||
|
||||
======================================================================
|
||||
========== Function 58, subfunction 16 - start application. ==========
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 58 - function number
|
||||
* ebx = pointer to the information structure
|
||||
Format of the information structure:
|
||||
* +0: dword: 16 = subfunction number
|
||||
* +4: dword: flags:
|
||||
* bit 0: start the process as debugged
|
||||
* other bits are reserved and must be cleared
|
||||
* +8: dword: 0 or pointer to ASCIIZ-string with parameters
|
||||
* +12 = +0xC: dword: ignored
|
||||
* +16 = +0x10: dword: pointer to buffer for system operations
|
||||
(4096 bytes)
|
||||
* +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
|
||||
given in the general description
|
||||
Returned value:
|
||||
* eax > 0 - the program is loaded, eax contains PID
|
||||
* eax < 0 - an error has occured, -eax contains
|
||||
file system error code
|
||||
Remarks:
|
||||
* This function is obsolete, use subfunction 7 of function 70.
|
||||
* Command line must be terminated by character with code 0
|
||||
(ASCIIZ-string); function takes into account either all characters
|
||||
up to terminating null inclusively or the first 256 charachters
|
||||
depending on what is less.
|
||||
* If the process is started as debugged, it is created in
|
||||
the suspended state; to run use subfunction 5 of function 69.
|
||||
|
||||
======================================================================
|
||||
=============== Function 59 - trace last system calls. ===============
|
||||
======================================================================
|
||||
|
@ -42,7 +42,6 @@ file_system:
|
||||
; eax = 5 ; rename file/directory
|
||||
; eax = 8 ; lba read
|
||||
; eax = 15 ; get_disk_info
|
||||
; eax = 16 ; start application
|
||||
;
|
||||
; OUT:
|
||||
;
|
||||
@ -89,8 +88,6 @@ file_system:
|
||||
|
||||
cmp dword [eax+0],15 ; GET_DISK_INFO
|
||||
je fs_info
|
||||
cmp dword [eax+0],16 ; RUN - dont care about read&write blocks
|
||||
je fs_read
|
||||
cmp dword [eax+0],5 ; RENAME - dont care about read&write blocks
|
||||
je fs_read
|
||||
cmp dword [eax+0],4 ; MAKEDIR - dont care about read&write blocks
|
||||
@ -149,11 +146,7 @@ endg
|
||||
; (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
|
||||
mov dword [esp+36], 10
|
||||
ret
|
||||
.read_root:
|
||||
; \end{diamond}[18.03.2006]
|
||||
@ -291,25 +284,6 @@ endg
|
||||
|
||||
fs_noramdisk_write:
|
||||
|
||||
cmp dword [esp+20],16 ; START APPLICATION
|
||||
jne fs_noramdisk_start_application
|
||||
|
||||
mov eax,[esp+4] ; fname
|
||||
add eax,2*12+1
|
||||
|
||||
xor ebx,ebx ; parameters to pass
|
||||
cmp dword [esp+12],ebx;0
|
||||
je no_fl_start_param
|
||||
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_startapp_return
|
||||
|
||||
fs_noramdisk_start_application: ;there's new code - Mihasik
|
||||
cmp dword [esp+20],2 ;DELETE
|
||||
jne fs_noramdisk_delete
|
||||
mov eax,[esp+4] ; fname
|
||||
@ -395,29 +369,6 @@ endg
|
||||
jmp file_system_return
|
||||
|
||||
fs_noflpdisk_delete:
|
||||
cmp dword [esp+20],16 ; START APPLICATION
|
||||
jne fs_noflpdisk_start_application
|
||||
|
||||
mov eax,[esp+4] ; fname
|
||||
add eax,2*12+1
|
||||
|
||||
xor ebx,ebx ; parameters to pass
|
||||
cmp dword [esp+12],ebx;0
|
||||
je no_flp_start_param
|
||||
mov ebx,[0x3010]
|
||||
mov ebx,[ebx+0x10]
|
||||
add ebx,[esp+12]
|
||||
|
||||
no_flp_start_param:
|
||||
mov edx,[esp+16] ; flags
|
||||
|
||||
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:
|
||||
|
||||
fs_noflpdisk:
|
||||
;*****************************************************************
|
||||
@ -511,10 +462,7 @@ choice_necessity_partition_1:
|
||||
|
||||
fs_yesharddisk_all:
|
||||
mov eax,1
|
||||
cmp dword [esp+20], 16
|
||||
jnz @f
|
||||
neg eax
|
||||
@@: mov ebx, [esp+24+24]
|
||||
mov ebx, [esp+24+24]
|
||||
cmp [hdpos],0 ; is hd base set?
|
||||
jz hd_err_return
|
||||
cmp [fat32part],0 ; is partition set?
|
||||
@ -657,41 +605,11 @@ hd_err_return:
|
||||
|
||||
fs_noharddisk_rename:
|
||||
|
||||
cmp dword [esp+20],16 ; START APPLICATION
|
||||
jne fs_noharddisk_start_application
|
||||
|
||||
mov eax,[esp+4] ; fname
|
||||
add eax,12*2
|
||||
|
||||
mov ebx,[esp+0] ; length
|
||||
sub ebx,eax
|
||||
add ebx,12
|
||||
|
||||
mov ecx,[esp+4] ; work area
|
||||
add ecx,512
|
||||
|
||||
xor ebp,ebp ; parameters to pass
|
||||
cmp dword [esp+12],ebp;0
|
||||
je no_hd_start_param
|
||||
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_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
|
||||
mov ebx, [esp+24+24] ; do not change ebx in application
|
||||
; \end{diamond}[18.03.2006]
|
||||
|
||||
file_system_return:
|
||||
@ -713,11 +631,7 @@ hd_err_return:
|
||||
jz .read
|
||||
add esp, 20
|
||||
pop ecx
|
||||
mov eax, 10
|
||||
cmp ecx, 16
|
||||
jnz @f
|
||||
neg eax
|
||||
@@: mov [esp+36], eax
|
||||
mov dword [esp+36], 10
|
||||
ret
|
||||
.read:
|
||||
; \end{diamond}[18.03.2006]
|
||||
|
@ -76,7 +76,7 @@ drawbar dd __sys_drawbar.forced
|
||||
putpixel dd __sys_putpixel
|
||||
; } mike.dld
|
||||
|
||||
version db 'Kolibri OS version 0.5.8.1 ',13,10,13,10,0
|
||||
version db 'Kolibri OS version 0.6.0.0 ',13,10,13,10,0
|
||||
;dd endofcode-0x10000
|
||||
|
||||
;db 'Boot02'
|
||||
@ -2235,7 +2235,7 @@ endg
|
||||
|
||||
iglobal
|
||||
version_inf:
|
||||
db 0,5,8,1 ; version 0.5.8.1
|
||||
db 0,6,0,0 ; version 0.6.0.0
|
||||
db UID_KOLIBRI
|
||||
db 'Kolibri',0
|
||||
version_end:
|
||||
@ -2988,8 +2988,6 @@ sys_set_window:
|
||||
mov [edi+WDATA.cl_titlebar],edx
|
||||
mov [edi+WDATA.cl_frames],esi
|
||||
|
||||
call set_window_clientbox
|
||||
|
||||
; check flag (?)
|
||||
cmp [edi+WDATA.fl_wdrawn],1
|
||||
jz newd
|
||||
@ -3007,6 +3005,7 @@ sys_set_window:
|
||||
mov word[edi+WDATA.box.left],ax
|
||||
mov word[edi+WDATA.box.top],bx
|
||||
|
||||
call set_window_clientbox
|
||||
|
||||
call check_window_position
|
||||
|
||||
@ -4862,57 +4861,12 @@ syscall_getscreensize: ; GetScreenSize
|
||||
|
||||
align 4
|
||||
|
||||
syscall_startapp: ; StartApp
|
||||
mov edi,[0x3010]
|
||||
add edi, TASKDATA.mem_start
|
||||
add eax,[edi]
|
||||
test ebx,ebx
|
||||
jz noapppar
|
||||
add ebx,[edi]
|
||||
noapppar:
|
||||
; call start_application_fl
|
||||
xor edx,edx ; compatibility - flags=0
|
||||
call new_start_application_fl
|
||||
mov [esp+36],eax
|
||||
ret
|
||||
|
||||
|
||||
align 4
|
||||
|
||||
syscall_cdaudio: ; CD
|
||||
|
||||
call sys_cd_audio
|
||||
mov [esp+36],eax
|
||||
ret
|
||||
|
||||
; <diamond> ReadHd and StartHdApp functions are obsolete. Use 58 or 70 functions instead.
|
||||
;align 4
|
||||
;
|
||||
;syscall_readhd: ; ReadHd
|
||||
;
|
||||
; mov edi,[0x3010]
|
||||
; add edi,0x10
|
||||
; add esi,[edi]
|
||||
; add eax,[edi]
|
||||
; call read_hd_file
|
||||
; mov [esp+36],eax
|
||||
; mov [esp+24],ebx
|
||||
; ret
|
||||
|
||||
;align 4
|
||||
;
|
||||
;syscall_starthdapp: ; StartHdApp
|
||||
;
|
||||
; mov edi,[0x3010]
|
||||
; add edi,0x10
|
||||
; add eax,[edi]
|
||||
; add ecx,[edi]
|
||||
; xor ebp,ebp
|
||||
; xor edx,edx ; compatibility - flags=0
|
||||
; call start_application_hd
|
||||
; mov [esp+36],eax
|
||||
; ret
|
||||
|
||||
align 4
|
||||
|
||||
syscall_delramdiskfile: ; DelRamdiskFile
|
||||
|
@ -89,7 +89,7 @@ draw_window:
|
||||
mov edx,labelt ; pointer to text beginning
|
||||
mov esi,labellen-labelt ; text length
|
||||
int 0x40
|
||||
not ecx
|
||||
xor ecx,0xFFFFFF
|
||||
mov esi,4
|
||||
add ebx,23
|
||||
mov edx,tdec
|
||||
|
@ -4,8 +4,8 @@
|
||||
; ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
include "lang.inc"
|
||||
include "macros.inc"
|
||||
include "lang.inc"
|
||||
|
||||
FALSE equ 0
|
||||
TRUE equ 1
|
||||
@ -758,7 +758,7 @@ draw_window:
|
||||
; WINDOW LABEL
|
||||
mov eax,4 ; function 4 : write text to window
|
||||
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
|
||||
mov ecx,0xf000ffff ; color of text RRGGBB
|
||||
mov ecx,0x1000ffff ; color of text RRGGBB
|
||||
mov edx,labelt ; pointer to text beginning
|
||||
mov esi,labellen-labelt ; text length
|
||||
int 0x40
|
||||
@ -805,7 +805,7 @@ draw_window:
|
||||
; text
|
||||
mov eax,4
|
||||
mov ebx,19*65536+142
|
||||
mov ecx,0xf00f73f5;ffff0f
|
||||
mov ecx,0x100f73f5;ffff0f
|
||||
mov edx,but_mode_lab
|
||||
mov esi,1
|
||||
int 0x40
|
||||
@ -995,7 +995,7 @@ draw_window:
|
||||
jne flag3
|
||||
mov eax,4
|
||||
mov ebx, 20 shl 16 +67
|
||||
mov ecx,0xf0ffff00
|
||||
mov ecx,0x10ffff00
|
||||
mov edx,define_cdrom
|
||||
mov esi,define_cdrom_len-define_cdrom
|
||||
int 0x40
|
||||
@ -1004,7 +1004,7 @@ draw_window:
|
||||
jne flag4
|
||||
mov eax,4
|
||||
mov ebx, 47 shl 16 +67
|
||||
mov ecx,0xf0ffff00
|
||||
mov ecx,0x10ffff00
|
||||
mov edx,no_cda
|
||||
mov esi,no_cda_len-no_cda
|
||||
int 0x40
|
||||
|
Loading…
Reference in New Issue
Block a user