forked from KolibriOS/kolibrios
small changes and optimization
git-svn-id: svn://kolibrios.org@1369 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
dd75d94380
commit
abfe37adc4
@ -428,16 +428,6 @@ sys_resize_app_memory:
|
||||
.no_application_mem_resize:
|
||||
ret
|
||||
|
||||
sys_threads:
|
||||
|
||||
; eax=1 create thread
|
||||
;
|
||||
; ebx=thread start
|
||||
; ecx=thread stack value
|
||||
;
|
||||
; on return : eax = pid
|
||||
jmp new_sys_threads
|
||||
|
||||
iglobal
|
||||
; process_terminating db 'K : Process - terminating',13,10,0
|
||||
; process_terminated db 'K : Process - done',13,10,0
|
||||
|
@ -126,35 +126,35 @@ iglobal
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0 ; 24-PlayCdTrack,StopCd and GetCdPlaylist
|
||||
dd 0 ; 25
|
||||
dd 0 ; 26
|
||||
dd 0
|
||||
dd 0 ;
|
||||
dd 0
|
||||
dd 0 ; 30-Get/SetCurrentDirectory
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0 ; 37-GetMousePosition_ScreenRelative,.
|
||||
dd 0 ; 38-DrawLine
|
||||
dd 0 ; 39-GetBackgroundSize,ReadBgrData,.
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0 ; 43-SendDeviceData
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0 ; 46-ReservePortArea and FreePortArea
|
||||
dd display_number ; 47-WriteNum
|
||||
dd 0 ; 48-SetRedrawType and SetButtonType
|
||||
dd 0 ; 49-Advanced Power Management (APM)
|
||||
dd syscall_set_window_shape ; 50-Window shape & scale
|
||||
dd syscall_threads ; 51-Threads
|
||||
dd stack_driver_stat ; 52-Stack driver status
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd socket ; 53-Socket interface
|
||||
dd 0
|
||||
dd sound_interface ; 55-Sound interface
|
||||
@ -166,14 +166,13 @@ iglobal
|
||||
dd sys_gs ; 61-Direct graphics access
|
||||
dd sys_pci ; 62-PCI functions
|
||||
dd sys_msg_board ; 63-System message board
|
||||
dd 0 ; 64-Resize application memory usage
|
||||
dd 0
|
||||
dd syscall_putimage_palette; 65-PutImagePalette
|
||||
dd sys_process_def ; 66-Process definitions - keyboard
|
||||
dd sys_window_move ; 67-Window move or resize
|
||||
dd 0 ; 68-Some internal services
|
||||
dd 0 ; 69-Debug
|
||||
dd 0
|
||||
dd 0
|
||||
dd file_system_lfn ; 70-Common file system interface, version 2
|
||||
; dd 0 ; 71-Window settings
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; NEW SYSTEM FUNCTIONS TABLE ;;
|
||||
@ -228,12 +227,12 @@ iglobal
|
||||
dd sys_programirq ; 44-ProgramIrqs
|
||||
dd reserve_free_irq ; 45-ReserveIrq and FreeIrq
|
||||
dd syscall_reserveportarea ; 46-ReservePortArea and FreePortArea
|
||||
dd cross_order ; 47-WriteNum
|
||||
dd display_number ; 47-WriteNum
|
||||
dd syscall_display_settings ; 48-SetRedrawType and SetButtonType
|
||||
dd sys_apm ; 49-Advanced Power Management (APM)
|
||||
dd cross_order ; 50-Window shape & scale
|
||||
dd cross_order ; 51-Threads
|
||||
dd cross_order ; 52-Stack driver status
|
||||
dd syscall_set_window_shape ; 50-Window shape & scale
|
||||
dd syscall_threads ; 51-Threads
|
||||
dd stack_driver_stat ; 52-Stack driver status
|
||||
dd cross_order ; 53-Socket interface
|
||||
dd undefined_syscall ; 54-reserved
|
||||
dd cross_order ; 55-Sound interface
|
||||
|
@ -864,15 +864,14 @@ proc new_sys_threads
|
||||
app_mem dd ? ;0x10
|
||||
endl
|
||||
|
||||
cmp eax,1
|
||||
cmp ebx,1
|
||||
jne .failed ;other subfunctions
|
||||
|
||||
xor eax,eax
|
||||
mov [app_eip], ecx
|
||||
mov [app_cmdline], eax
|
||||
mov [app_esp], edx
|
||||
mov [app_path], eax
|
||||
mov [app_eip], ebx
|
||||
mov [app_esp], ecx
|
||||
|
||||
;mov esi,new_process_loading
|
||||
;call sys_msg_board_str
|
||||
.wait_lock:
|
||||
|
@ -246,23 +246,23 @@ align 4
|
||||
syscall_set_window_shape: ;///// system function 50 ///////////////////////////
|
||||
;------------------------------------------------------------------------------
|
||||
;; Set window shape address:
|
||||
;> eax = 0
|
||||
;> ebx = shape data address
|
||||
;> ebx = 0
|
||||
;> ecx = shape data address
|
||||
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
;; Set window shape scale:
|
||||
;> eax = 1
|
||||
;> ebx = scale power (resulting scale is 2^ebx)
|
||||
;> ebx = 1
|
||||
;> ecx = scale power (resulting scale is 2^ebx)
|
||||
;------------------------------------------------------------------------------
|
||||
mov edi, [current_slot]
|
||||
|
||||
test eax, eax
|
||||
test ebx, ebx
|
||||
jne .shape_scale
|
||||
mov [edi + APPDATA.wnd_shape], ebx
|
||||
mov [edi + APPDATA.wnd_shape], ecx
|
||||
|
||||
.shape_scale:
|
||||
dec eax
|
||||
dec ebx
|
||||
jnz .exit
|
||||
mov [edi + APPDATA.wnd_shape_scale], ebx
|
||||
mov [edi + APPDATA.wnd_shape_scale], ecx
|
||||
|
||||
.exit:
|
||||
ret
|
||||
|
@ -1245,7 +1245,12 @@ sys_outport:
|
||||
ret
|
||||
|
||||
display_number:
|
||||
|
||||
;It is not optimization
|
||||
mov eax, ebx
|
||||
mov ebx, ecx
|
||||
mov ecx, edx
|
||||
mov edx, esi
|
||||
mov esi, edi
|
||||
; eax = print type, al=0 -> ebx is number
|
||||
; al=1 -> ebx is pointer
|
||||
; ah=0 -> display decimal
|
||||
@ -5371,9 +5376,16 @@ syscall_reserveportarea: ; ReservePortArea and FreePortArea
|
||||
align 4
|
||||
|
||||
syscall_threads: ; CreateThreads
|
||||
; eax=1 create thread
|
||||
;
|
||||
; ebx=thread start
|
||||
; ecx=thread stack value
|
||||
;
|
||||
; on return : eax = pid
|
||||
|
||||
call sys_threads
|
||||
mov [esp+36],eax
|
||||
call new_sys_threads
|
||||
|
||||
mov [esp+32],eax
|
||||
ret
|
||||
|
||||
align 4
|
||||
@ -5385,7 +5397,7 @@ stack_driver_stat:
|
||||
; mov [check_idle_semaphore],5 ; enable these for zero delay
|
||||
; call change_task ; between sent packet
|
||||
|
||||
mov [esp+36],eax
|
||||
mov [esp+32],eax
|
||||
ret
|
||||
|
||||
align 4
|
||||
|
@ -361,27 +361,48 @@ cs_exit:
|
||||
; It provides application access to the network interface layer
|
||||
;
|
||||
;***************************************************************************
|
||||
iglobal
|
||||
align 4
|
||||
f52call:
|
||||
dd app_stack_handler.00
|
||||
dd app_stack_handler.01
|
||||
dd app_stack_handler.02
|
||||
dd app_stack_handler.03
|
||||
dd app_stack_handler.fail ;04
|
||||
dd app_stack_handler.fail ;05
|
||||
dd stack_insert_packet ;app_stack_handler.06
|
||||
dd app_stack_handler.fail ;07
|
||||
dd stack_get_packet ;app_stack_handler.08
|
||||
dd app_stack_handler.09
|
||||
dd app_stack_handler.10
|
||||
dd app_stack_handler.11
|
||||
dd app_stack_handler.12
|
||||
dd app_stack_handler.13
|
||||
dd app_stack_handler.14
|
||||
dd app_stack_handler.15
|
||||
endg
|
||||
app_stack_handler:
|
||||
cmp eax, 0
|
||||
jnz not0
|
||||
;in ebx,ecx
|
||||
;out eax
|
||||
cmp ebx,15
|
||||
ja .fail ;if more than 15 then exit
|
||||
|
||||
jmp dword [f52call+ebx*4]
|
||||
|
||||
|
||||
.00:
|
||||
; Read the configuration word
|
||||
mov eax, [stack_config]
|
||||
ret
|
||||
|
||||
not0:
|
||||
cmp eax, 1
|
||||
jnz not1
|
||||
.01:
|
||||
; read the IP address
|
||||
|
||||
mov eax, [stack_ip]
|
||||
ret
|
||||
|
||||
not1:
|
||||
cmp eax, 2
|
||||
jnz not2
|
||||
|
||||
.02:
|
||||
; write the configuration word
|
||||
mov [stack_config], ebx
|
||||
mov [stack_config], ecx
|
||||
|
||||
; <Slip shouldn't be active anyway - thats an operational issue.>
|
||||
; If ethernet now enabled, probe for the card, reset it and empty
|
||||
@ -391,155 +412,90 @@ not1:
|
||||
; empty the tcpip data area too.
|
||||
|
||||
; ethernet interface is '3' in ls 7 bits
|
||||
and bl, 0x7f
|
||||
cmp bl, 3
|
||||
|
||||
and cl, 0x7f
|
||||
cmp cl, 3
|
||||
je ash_eth_enable
|
||||
; Ethernet isn't enabled, so make sure that the card is disabled
|
||||
mov [ethernet_active], byte 0
|
||||
|
||||
ret
|
||||
|
||||
ash_eth_enable:
|
||||
; Probe for the card. This will reset it and enable the interface
|
||||
; if found
|
||||
call eth_probe
|
||||
cmp eax, 0
|
||||
je ash_eth_done ; Abort if no hardware found
|
||||
|
||||
mov [ethernet_active], byte 1
|
||||
|
||||
ash_eth_done:
|
||||
ret
|
||||
|
||||
not2:
|
||||
cmp eax, 3
|
||||
jnz not3
|
||||
.03:
|
||||
; write the IP Address
|
||||
mov [stack_ip], ebx
|
||||
mov [stack_ip], ecx
|
||||
ret
|
||||
|
||||
;old functions was deleted
|
||||
|
||||
not3:
|
||||
cmp eax, 6
|
||||
jnz not6
|
||||
|
||||
;.06:
|
||||
; Insert an IP packet into the stacks received packet queue
|
||||
call stack_insert_packet
|
||||
ret
|
||||
|
||||
not6:
|
||||
cmp eax, 7
|
||||
jnz not7
|
||||
; call stack_insert_packet
|
||||
; ret
|
||||
|
||||
; Test for any packets queued for transmission over the network
|
||||
|
||||
not7:
|
||||
cmp eax, 8
|
||||
jnz not8
|
||||
|
||||
call stack_get_packet
|
||||
;.08:
|
||||
; call stack_get_packet
|
||||
; Extract a packet queued for transmission by the network
|
||||
ret
|
||||
|
||||
not8:
|
||||
cmp eax, 9
|
||||
jnz not9
|
||||
; ret
|
||||
|
||||
.09:
|
||||
; read the gateway IP address
|
||||
|
||||
mov eax, [gateway_ip]
|
||||
ret
|
||||
|
||||
not9:
|
||||
cmp eax, 10
|
||||
jnz not10
|
||||
|
||||
.10:
|
||||
; read the subnet mask
|
||||
|
||||
mov eax, [subnet_mask]
|
||||
ret
|
||||
|
||||
not10:
|
||||
cmp eax, 11
|
||||
jnz not11
|
||||
|
||||
.11:
|
||||
; write the gateway IP Address
|
||||
mov [gateway_ip], ebx
|
||||
|
||||
mov [gateway_ip], ecx
|
||||
ret
|
||||
|
||||
not11:
|
||||
cmp eax, 12
|
||||
jnz not12
|
||||
|
||||
.12:
|
||||
; write the subnet mask
|
||||
mov [subnet_mask], ebx
|
||||
|
||||
|
||||
not12:
|
||||
cmp eax, 13
|
||||
jnz not13
|
||||
mov [subnet_mask], ecx
|
||||
ret
|
||||
|
||||
.13:
|
||||
; read the dns
|
||||
|
||||
mov eax, [dns_ip]
|
||||
ret
|
||||
|
||||
not13:
|
||||
cmp eax, 14
|
||||
jnz not14
|
||||
|
||||
.14:
|
||||
; write the dns IP Address
|
||||
mov [dns_ip], ebx
|
||||
|
||||
mov [dns_ip], ecx
|
||||
ret
|
||||
|
||||
.15:
|
||||
;<added by Frank Sommer>
|
||||
not14:
|
||||
cmp eax, 15
|
||||
jnz not15
|
||||
|
||||
; in ebx we need 4 to read the last 2 bytes
|
||||
cmp ebx, dword 4
|
||||
je read
|
||||
|
||||
; in ecx we need 4 to read the last 2 bytes
|
||||
; or we need 0 to read the first 4 bytes
|
||||
cmp ebx, dword 0
|
||||
jnz param_error
|
||||
cmp ecx,4
|
||||
ja .param_error
|
||||
|
||||
; read MAC, returned (in mirrored byte order) in eax
|
||||
read:
|
||||
mov eax, [node_addr + ebx]
|
||||
jmp @f
|
||||
|
||||
param_error:
|
||||
mov eax, -1 ; params not accepted
|
||||
@@:
|
||||
mov eax, [node_addr + ecx]
|
||||
ret
|
||||
|
||||
.param_error:
|
||||
or eax, -1 ; params not accepted
|
||||
ret
|
||||
|
||||
.16:
|
||||
; 0 -> arp_probe
|
||||
; 1 -> arp_announce
|
||||
; 2 -> arp_responce (not supported yet)
|
||||
|
||||
not15: ; ARP stuff
|
||||
cmp eax, 16
|
||||
jnz not16
|
||||
|
||||
cmp ebx, 0
|
||||
test ecx,ecx
|
||||
je a_probe
|
||||
|
||||
cmp ebx, 1
|
||||
je a_ann ; arp announce
|
||||
dec ebx
|
||||
jz a_ann ; arp announce
|
||||
.fail:
|
||||
or eax, -1
|
||||
ret
|
||||
|
||||
; cmp ebx,2
|
||||
; jne a_resp ; arp response
|
||||
|
||||
jmp param15_error
|
||||
|
||||
|
||||
; arp probe, sender IP must be set to 0.0.0.0, target IP is set to address being probed
|
||||
; ecx: pointer to target MAC, MAC should set to 0 by application
|
||||
; edx: target IP
|
||||
@ -547,12 +503,12 @@ a_probe:
|
||||
push dword [stack_ip]
|
||||
|
||||
mov edx, [stack_ip]
|
||||
mov [stack_ip], dword 0
|
||||
and [stack_ip], dword 0
|
||||
mov esi, ecx ; pointer to target MAC address
|
||||
call arp_request
|
||||
|
||||
pop dword [stack_ip]
|
||||
jmp @f
|
||||
ret
|
||||
|
||||
; arp announce, sender IP must be set to target IP
|
||||
; ecx: pointer to target MAC
|
||||
@ -560,33 +516,30 @@ a_ann:
|
||||
mov edx, [stack_ip]
|
||||
mov esi, ecx ; pointer to target MAC address
|
||||
call arp_request
|
||||
jmp @f
|
||||
|
||||
param15_error:
|
||||
mov eax, -1
|
||||
|
||||
@@:
|
||||
ret
|
||||
|
||||
.17:
|
||||
;</added by Frank Sommer>
|
||||
; modified by [smb]
|
||||
|
||||
;<added by Johnny_B>
|
||||
; ARPTable manager interface
|
||||
not16:
|
||||
cmp eax, 17
|
||||
jnz stack_driver_end
|
||||
|
||||
;see "proc arp_table_manager" for more details
|
||||
stdcall arp_table_manager,ebx,ecx,edx ;Opcode,Index,Extra
|
||||
|
||||
stdcall arp_table_manager,ecx,edx,esi ;Opcode,Index,Extra
|
||||
ret
|
||||
;</added by Johnny_B>
|
||||
|
||||
stack_driver_end:
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
ash_eth_enable:
|
||||
; Probe for the card. This will reset it and enable the interface
|
||||
; if found
|
||||
call eth_probe
|
||||
test eax,eax
|
||||
jz ash_eth_done ; Abort if no hardware found
|
||||
|
||||
mov [ethernet_active], byte 1
|
||||
ash_eth_done:
|
||||
ret
|
||||
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; app_socket_handler
|
||||
@ -597,110 +550,65 @@ stack_driver_end:
|
||||
; such as opening sockets
|
||||
;
|
||||
;***************************************************************************
|
||||
iglobal
|
||||
align 4
|
||||
f53call:
|
||||
dd socket_open ;00
|
||||
dd socket_close ;01
|
||||
dd socket_poll ;02
|
||||
dd socket_read ;03
|
||||
dd socket_write ;04
|
||||
dd socket_open_tcp ;05
|
||||
dd socket_status ;06
|
||||
dd socket_write_tcp ;07
|
||||
dd socket_close_tcp ;08
|
||||
dd is_localport_unused ;09
|
||||
dd app_socket_handler.10
|
||||
dd socket_read_packet ;11
|
||||
endg
|
||||
|
||||
app_socket_handler:
|
||||
cmp eax, 0
|
||||
jnz nots0
|
||||
;in ebx,ecx,edx,wsi
|
||||
;out eax
|
||||
cmp eax,255
|
||||
je stack_internal_status
|
||||
|
||||
call socket_open
|
||||
ret
|
||||
cmp eax,11
|
||||
ja .fail ;if more than 15 then exit
|
||||
|
||||
nots0:
|
||||
cmp eax, 1
|
||||
jnz nots1
|
||||
|
||||
call socket_close
|
||||
ret
|
||||
|
||||
nots1:
|
||||
cmp eax, 2
|
||||
jnz nots2
|
||||
|
||||
call socket_poll
|
||||
ret
|
||||
|
||||
nots2:
|
||||
cmp eax, 3
|
||||
jnz nots3
|
||||
|
||||
call socket_read
|
||||
ret
|
||||
|
||||
nots3:
|
||||
cmp eax, 4
|
||||
jnz nots4
|
||||
|
||||
call socket_write
|
||||
ret
|
||||
|
||||
nots4:
|
||||
cmp eax, 5
|
||||
jnz nots5
|
||||
|
||||
call socket_open_tcp
|
||||
ret
|
||||
|
||||
nots5:
|
||||
cmp eax, 6
|
||||
jnz nots6
|
||||
|
||||
call socket_status
|
||||
ret
|
||||
|
||||
nots6:
|
||||
cmp eax, 7
|
||||
jnz nots7
|
||||
|
||||
call socket_write_tcp
|
||||
ret
|
||||
|
||||
nots7:
|
||||
cmp eax, 8
|
||||
jnz nots8
|
||||
|
||||
call socket_close_tcp
|
||||
ret
|
||||
|
||||
nots8:
|
||||
cmp eax, 9
|
||||
jnz nots9
|
||||
|
||||
call is_localport_unused
|
||||
ret
|
||||
|
||||
nots9:
|
||||
cmp eax, 10
|
||||
jnz nots10
|
||||
jmp dword [f53call+eax*4]
|
||||
|
||||
.10:
|
||||
mov eax,dword[drvr_cable]
|
||||
test eax,eax
|
||||
jnz @f ; if function is not implented, return -1
|
||||
mov al,-1
|
||||
or al,-1
|
||||
ret
|
||||
|
||||
@@:
|
||||
call dword[drvr_cable]
|
||||
jmp dword[drvr_cable]
|
||||
|
||||
.fail:
|
||||
or eax,-1
|
||||
ret
|
||||
uglobal
|
||||
ARPTmp:
|
||||
times 14 db 0
|
||||
endg
|
||||
|
||||
|
||||
nots10:
|
||||
cmp eax, 11
|
||||
jnz nots11
|
||||
|
||||
call socket_read_packet
|
||||
ret
|
||||
|
||||
nots11:
|
||||
cmp eax, 254
|
||||
jnz notdump
|
||||
|
||||
ret
|
||||
|
||||
notdump:
|
||||
cmp eax, 255
|
||||
jnz notsdebug
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; stack_internal_status
|
||||
;
|
||||
; Description
|
||||
; Returns information about the internal status of the stack
|
||||
; This is only useful for debugging
|
||||
; It works with the ethernet driver
|
||||
; sub function in ebx
|
||||
; return requested data in eax
|
||||
;
|
||||
;***************************************************************************
|
||||
; This sub function allows access to debugging information on the stack
|
||||
; ebx holds the request:
|
||||
; ecx holds the request:
|
||||
; 100 : return length of empty queue
|
||||
; 101 : return length of IPOUT QUEUE
|
||||
; 102 : return length of IPIN QUEUE
|
||||
@ -722,31 +630,7 @@ notdump:
|
||||
; 6 : return status of packet driver
|
||||
; ( 0 == not active, FFFFFFFF = successful )
|
||||
|
||||
call stack_internal_status
|
||||
ret
|
||||
|
||||
notsdebug:
|
||||
; Invalid Option
|
||||
ret
|
||||
|
||||
|
||||
uglobal
|
||||
ARPTmp:
|
||||
times 14 db 0
|
||||
endg
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; stack_internal_status
|
||||
;
|
||||
; Description
|
||||
; Returns information about the internal status of the stack
|
||||
; This is only useful for debugging
|
||||
; It works with the ethernet driver
|
||||
; sub function in ebx
|
||||
; return requested data in eax
|
||||
;
|
||||
;***************************************************************************
|
||||
stack_internal_status:
|
||||
cmp ebx, 100
|
||||
jnz notsis100
|
||||
|
Loading…
Reference in New Issue
Block a user