[KERNEL]: Replaced magic numbers with constants and cleaned code

git-svn-id: svn://kolibrios.org@9917 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Doczom 2023-06-17 18:40:54 +00:00
parent 7f50e02fca
commit cd441e7929
6 changed files with 149 additions and 148 deletions

View File

@ -278,10 +278,7 @@ master_tab = page_tabs + (page_tabs shr 10) ;0xFDFF70000
LFB_BASE = 0xFE000000
new_app_base = 0;
std_application_base_address = new_app_base
std_application_base_address = 0
RING0_STACK_SIZE = 0x2000
REG_SS = RING0_STACK_SIZE - 4
@ -350,6 +347,9 @@ EVENT_DEBUG = 0x00000100
EVENT_NETWORK2 = 0x00000200
EVENT_EXTENDED = 0x00000400
EVM_MOUSE_FILTER = 0x80000000 ; see in macros.inc for apps
EVM_CURSOR_FILTER = 0x40000000
EV_INTR = 1
STDIN_FILENO = 0

View File

@ -1016,7 +1016,7 @@ proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
mov [edi+4], ecx
add edi, 8
mov esi, [msg_addr]
; add esi, new_app_base
; add esi, std_application_base_address
cld
rep movsb

View File

@ -331,11 +331,11 @@ nosb8:
mov [background_defined], 1
mov [draw_data+32 + RECT.left], eax
mov [draw_data+32 + RECT.top], ebx
mov [draw_data + sizeof.RECT + RECT.left], eax
mov [draw_data + sizeof.RECT + RECT.top], ebx
mov [draw_data+32 + RECT.right], ecx
mov [draw_data+32 + RECT.bottom], edx
mov [draw_data + sizeof.RECT + RECT.right], ecx
mov [draw_data + sizeof.RECT + RECT.bottom], edx
inc [REDRAW_BACKGROUND]
call wakeup_osloop
@ -356,15 +356,15 @@ endg
align 4
force_redraw_background:
and [draw_data+32 + RECT.left], 0
and [draw_data+32 + RECT.top], 0
and [draw_data + sizeof.RECT + RECT.left], 0
and [draw_data + sizeof.RECT + RECT.top], 0
push eax ebx
mov eax, [_display.width]
mov ebx, [_display.height]
dec eax
dec ebx
mov [draw_data+32 + RECT.right], eax
mov [draw_data+32 + RECT.bottom], ebx
mov [draw_data + sizeof.RECT + RECT.right], eax
mov [draw_data + sizeof.RECT + RECT.bottom], ebx
pop ebx eax
inc [REDRAW_BACKGROUND]
call wakeup_osloop

View File

@ -2282,12 +2282,12 @@ sysfn_getdiskinfo: ; 18.11 = get disk info table
;------------------------------------------------------------------------------
sysfn_getversion: ; 18.13 = get kernel ID and version
; if given memory address belongs to kernel then error
stdcall is_region_userspace, ecx, version_end-version_inf
stdcall is_region_userspace, ecx, version_inf.size
jnz .addr_error
mov edi, ecx
mov esi, version_inf
mov ecx, version_end-version_inf
mov ecx, version_inf.size
rep movsb
ret
.addr_error: ; if given memory address is illegal
@ -2466,15 +2466,12 @@ sound_flag db 0
endg
;UID_NONE=0
;UID_KOLIBRI=2 ;russian
iglobal
version_inf:
db 0,7,7,0 ; version 0.7.7.0
db 0
.rev dd __REV__
version_end:
.size = $ - version_inf
endg
;------------------------------------------------------------------------------
align 4
@ -2646,7 +2643,7 @@ sys_redrawstat:
jnz .srl1
mov edx, [current_slot_idx] ; return whole screen draw area for this app
shl edx, 5 ;?
shl edx, BSF sizeof.RECT
add edx, draw_data
mov [edx + RECT.left], 0
mov [edx + RECT.top], 0
@ -2814,7 +2811,7 @@ align 4
mov ecx, [thread_count]
movzx eax, word [WIN_POS + ecx*2] ; active window
shl eax, 8
shl eax, BSF sizeof.APPDATA ;8
push eax
movzx eax, word [MOUSE_X]
@ -2824,7 +2821,7 @@ align 4
.set_mouse_event:
add edi, sizeof.APPDATA
add ebx, sizeof.WDATA
test [SLOT_BASE + edi + APPDATA.event_mask], 0x80000000
test [SLOT_BASE + edi + APPDATA.event_mask], EVM_MOUSE_FILTER
jz .pos_filter
cmp edi, [esp] ; skip if filtration active
@ -2832,7 +2829,7 @@ align 4
;--------------------------------------
align 4
.pos_filter:
test [SLOT_BASE + edi + APPDATA.event_mask], 0x40000000
test [SLOT_BASE + edi + APPDATA.event_mask], EVM_CURSOR_FILTER
jz .set
mov esi, [ebx + WDATA.box.left]
@ -2869,14 +2866,14 @@ align 4
;--------------------------------------
align 4
backgr:
mov eax, [draw_data + 32 + RECT.left]
mov eax, [draw_data + sizeof.RECT + RECT.left]
shl eax, 16
add eax, [draw_data + 32 + RECT.right]
add eax, [draw_data + sizeof.RECT + RECT.right]
mov [BG_Rect_X_left_right], eax ; [left]*65536 + [right]
mov eax, [draw_data + 32 + RECT.top]
mov eax, [draw_data + sizeof.RECT + RECT.top]
shl eax, 16
add eax, [draw_data + 32 + RECT.bottom]
add eax, [draw_data + sizeof.RECT + RECT.bottom]
mov [BG_Rect_Y_top_bottom], eax ; [top]*65536 + [bottom]
call drawbackground
@ -2927,10 +2924,10 @@ set_bgr_event:
jnz backgr
xor eax, eax
mov [draw_data + 32 + RECT.left], eax
mov [draw_data + 32 + RECT.top], eax
mov [draw_data + 32 + RECT.right], eax
mov [draw_data + 32 + RECT.bottom], eax
mov [draw_data + sizeof.RECT + RECT.left], eax
mov [draw_data + sizeof.RECT + RECT.top], eax
mov [draw_data + sizeof.RECT + RECT.right], eax
mov [draw_data + sizeof.RECT + RECT.bottom], eax
;--------------------------------------
align 4
nobackgr:
@ -3448,14 +3445,14 @@ r_f_port_area:
jnz .free_port_area
cmp ecx, edx ; beginning > end ?
ja .rpal1
ja .err
cmp edx, 65536 ;test ebx, not 0xffff
jae .rpal1
jae .err
mov eax, [RESERVED_PORTS]
test eax, eax ; no reserved areas ?
je .rpal2
cmp eax, 255 ; max reserved
jae .rpal1
jae .err
.rpal3:
mov ebx, eax
shl ebx, 4 ;16 byte is sizeof item in RESERVED_PORTS table
@ -3463,15 +3460,16 @@ r_f_port_area:
cmp ecx, [ebx+8]
ja .rpal4
cmp edx, [ebx+4]
jae .rpal1
jae .err
.rpal4:
dec eax
jnz .rpal3
jmp .rpal2
.rpal1:
.err:
xor eax, eax
inc eax
ret
.rpal2:
; enable port access at port IO map
pushad ; start enable io map
@ -3484,7 +3482,7 @@ r_f_port_area:
inc eax
cmp eax, edx
jbe .new_port_access
;no_unmask_io:
sti
popad ; end enable io map
@ -3551,7 +3549,7 @@ r_f_port_area:
inc eax
cmp eax, edx
jbe .new_port_access_disable
;no_mask_io: ; end disable io map
; end disable io map
xor eax, eax
ret
;-----------------------------------------------------------------------------

View File

@ -40,6 +40,8 @@ struct SOCKET
snd_proc dd ?
rcv_proc dd ?
connect_proc dd ?
;sndto_proc dd ?
;rcvfrom_proc dd ?
ends
@ -256,7 +258,7 @@ macro socket_init {
align 4
sys_socket:
mov dword[esp+20], 0 ; Set error code to 0
mov dword[esp + SYSCALL_STACK.ebx], 0 ; Set error code to 0
cmp ebx, 255
jz socket_debug
@ -277,11 +279,14 @@ sys_socket:
dd socket_set_opt ; 8
dd socket_get_opt ; 9
dd socket_pair ; 10
;dd socket_sendto ; 11
;dd socket_recvfrom ; 12
.number = ($ - .table) / 4 - 1
.error:
mov dword[esp+32], -1
mov dword[esp+20], EINVAL
mov dword[esp + SYSCALL_STACK.eax], -1
mov dword[esp + SYSCALL_STACK.ebx], EINVAL
ret
@ -309,7 +314,7 @@ socket_open:
test eax, eax
jz .nobuffs
mov [esp+32], edi ; return socketnumber
mov [esp + SYSCALL_STACK.eax], edi ; return socketnumber
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_open: socknum=%u\n", edi
test edx, SO_NONBLOCK
@ -349,13 +354,13 @@ socket_open:
push eax
call socket_free
pop eax
mov dword[esp+20], EOPNOTSUPP
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.ebx], EOPNOTSUPP
mov dword[esp + SYSCALL_STACK.eax], -1
ret
.nobuffs:
mov dword[esp+20], ENOBUFS
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.ebx], ENOBUFS
mov dword[esp + SYSCALL_STACK.eax], -1
ret
.raw:
@ -459,18 +464,18 @@ socket_bind:
je .af_local
.notsupp:
mov dword[esp+20], EOPNOTSUPP
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.ebx], EOPNOTSUPP
mov dword[esp + SYSCALL_STACK.eax], -1
ret
.invalid:
mov dword[esp+20], EINVAL
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.ebx], EINVAL
mov dword[esp + SYSCALL_STACK.eax], -1
ret
.af_local:
; TODO: write code here
mov dword[esp+32], 0
mov dword[esp + SYSCALL_STACK.eax], 0
ret
.af_inet4:
@ -505,12 +510,12 @@ socket_bind:
[eax + IP_SOCKET.LocalIP + 0]:1,[eax + IP_SOCKET.LocalIP + 1]:1,\
[eax + IP_SOCKET.LocalIP + 2]:1,[eax + IP_SOCKET.LocalIP + 3]:1
mov dword[esp+32], 0
mov dword[esp + SYSCALL_STACK.eax], 0
ret
.addrinuse:
mov dword[esp+32], -1
mov dword[esp+20], EADDRINUSE
mov dword[esp + SYSCALL_STACK.eax], -1
mov dword[esp + SYSCALL_STACK.ebx], EADDRINUSE
ret
@ -549,24 +554,24 @@ socket_connect:
call [eax + SOCKET.connect_proc]
mov dword[esp+20], ebx
mov dword[esp+32], eax
mov dword[esp + SYSCALL_STACK.ebx], ebx
mov dword[esp + SYSCALL_STACK.eax], eax
ret
.notsupp:
mov dword[esp+20], EOPNOTSUPP
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.ebx], EOPNOTSUPP
mov dword[esp + SYSCALL_STACK.eax], -1
ret
.invalid:
mov dword[esp+20], EINVAL
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.ebx], EINVAL
mov dword[esp + SYSCALL_STACK.eax], -1
ret
.already:
mov dword[esp+20], EALREADY
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.ebx], EALREADY
mov dword[esp + SYSCALL_STACK.eax], -1
ret
@ -627,22 +632,22 @@ socket_listen:
init_queue (eax + SOCKET_QUEUE_LOCATION) ; Set up sockets queue
pop eax
mov dword[esp+32], 0
mov dword[esp + SYSCALL_STACK.eax], 0
ret
.notsupp:
mov dword[esp+20], EOPNOTSUPP
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.ebx], EOPNOTSUPP
mov dword[esp + SYSCALL_STACK.eax], -1
ret
.invalid:
mov dword[esp+20], EINVAL
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.ebx], EINVAL
mov dword[esp + SYSCALL_STACK.eax], -1
ret
.already:
mov dword[esp+20], EALREADY
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.ebx], EALREADY
mov dword[esp + SYSCALL_STACK.eax], -1
ret
@ -694,7 +699,7 @@ socket_accept:
; Return socket number to caller
mov eax, [eax + SOCKET.Number]
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
.block:
@ -705,18 +710,18 @@ socket_accept:
jmp .loop
.wouldblock:
mov dword[esp+20], EWOULDBLOCK
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.ebx], EWOULDBLOCK
mov dword[esp + SYSCALL_STACK.eax], -1
ret
.invalid:
mov dword[esp+20], EINVAL
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.ebx], EINVAL
mov dword[esp + SYSCALL_STACK.eax], -1
ret
.notsupp:
mov dword[esp+20], EOPNOTSUPP
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.ebx], EOPNOTSUPP
mov dword[esp + SYSCALL_STACK.eax], -1
ret
;-----------------------------------------------------------------;
@ -739,7 +744,7 @@ socket_close:
test eax, eax
jz .invalid
mov dword[esp+32], 0 ; The socket exists, so we will succeed in closing it.
mov dword[esp + SYSCALL_STACK.eax], 0 ; The socket exists, so we will succeed in closing it.
or [eax + SOCKET.options], SO_NONBLOCK ; Mark the socket as non blocking, we dont want it to block any longer!
@ -772,8 +777,8 @@ socket_close:
.invalid:
mov dword[esp+20], EINVAL
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.ebx], EINVAL
mov dword[esp + SYSCALL_STACK.eax], -1
ret
@ -831,8 +836,8 @@ socket_receive:
.return_err:
mov ecx, -1
.return:
mov [esp+20], ebx
mov [esp+32], ecx
mov [esp + SYSCALL_STACK.ebx], ebx
mov [esp + SYSCALL_STACK.eax], ecx
ret
.last_data:
@ -1019,8 +1024,8 @@ socket_send:
jmp [eax + SOCKET.snd_proc]
.invalid:
mov dword[esp+20], EINVAL
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.ebx], EINVAL
mov dword[esp + SYSCALL_STACK.eax], -1
ret
@ -1029,15 +1034,15 @@ socket_send_udp:
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: UDP\n"
mov [esp+32], ecx
mov [esp + SYSCALL_STACK.eax], ecx
call udp_output
cmp eax, -1
je .error
ret
.error:
mov dword[esp+32], -1
mov dword[esp+20], EMSGSIZE ; FIXME: UDP_output should return error codes!
mov dword[esp + SYSCALL_STACK.eax], -1
mov dword[esp + SYSCALL_STACK.ebx], EMSGSIZE ; FIXME: UDP_output should return error codes!
ret
@ -1051,13 +1056,13 @@ socket_send_tcp:
call socket_ring_write
pop eax
mov [esp+32], ecx
mov [esp + SYSCALL_STACK.eax], ecx
mov [eax + SOCKET.errorcode], 0
push eax
call tcp_output ; FIXME: this doesnt look pretty, does it?
pop eax
mov eax, [eax + SOCKET.errorcode]
mov [esp+20], eax
mov [esp + SYSCALL_STACK.ebx], eax
ret
@ -1066,15 +1071,15 @@ socket_send_ip:
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: IPv4\n"
mov [esp+32], ecx
mov [esp + SYSCALL_STACK.eax], ecx
call ipv4_output_raw
cmp eax, -1
je .error
ret
.error:
mov dword[esp+32], eax
mov dword[esp+20], ebx
mov dword[esp + SYSCALL_STACK.eax], eax
mov dword[esp + SYSCALL_STACK.ebx], ebx
ret
@ -1083,15 +1088,15 @@ socket_send_icmp:
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: ICMP\n"
mov [esp+32], ecx
mov [esp + SYSCALL_STACK.eax], ecx
call icmp_output_raw
cmp eax, -1
je .error
ret
.error:
mov dword[esp+32], eax
mov dword[esp+20], ebx
mov dword[esp + SYSCALL_STACK.eax], eax
mov dword[esp + SYSCALL_STACK.ebx], ebx
ret
@ -1100,7 +1105,7 @@ socket_send_icmp:
;
; DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: PPPoE\n"
;
; mov [esp+32], ecx
; mov [esp + SYSCALL_STACK.eax], ecx
; mov ebx, [eax + SOCKET.device]
;
; call pppoe_discovery_output ; FIXME: errorcodes
@ -1109,8 +1114,8 @@ socket_send_icmp:
; ret
;
; .error:
; mov dword[esp+32], -1
; mov dword[esp+20], EMSGSIZE
; mov dword[esp + SYSCALL_STACK.eax], -1
; mov dword[esp + SYSCALL_STACK.ebx], EMSGSIZE
; ret
@ -1147,7 +1152,7 @@ socket_send_local_initialized:
pop eax
; return the number of written bytes (or errorcode) to application
mov [esp+32], ecx
mov [esp + SYSCALL_STACK.eax], ecx
; and notify the other end
call socket_notify
@ -1155,8 +1160,8 @@ socket_send_local_initialized:
ret
.invalid:
mov dword[esp+32], -1
mov dword[esp+20], EINVAL
mov dword[esp + SYSCALL_STACK.eax], -1
mov dword[esp + SYSCALL_STACK.ebx], EINVAL
ret
@ -1213,12 +1218,12 @@ socket_get_opt:
jz @f
mov [eax], ecx
@@:
mov dword [esp+32], 0
mov dword [esp + SYSCALL_STACK.eax], 0
ret
.invalid:
mov dword[esp+32], -1
mov dword[esp+20], EINVAL
mov dword[esp + SYSCALL_STACK.eax], -1
mov dword[esp + SYSCALL_STACK.ebx], EINVAL
ret
@ -1267,13 +1272,13 @@ socket_set_opt:
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_set_opt: Bound socket %x to device %x\n", eax, edx
mov dword[esp+32], 0 ; success!
mov dword[esp + SYSCALL_STACK.eax], 0 ; success!
ret
.unbind:
mov [eax + SOCKET.device], 0
mov dword[esp+32], 0 ; success!
mov dword[esp + SYSCALL_STACK.eax], 0 ; success!
ret
.ip:
@ -1284,17 +1289,17 @@ socket_set_opt:
mov bl, byte[edx + socket_options.optval]
mov [eax + IP_SOCKET.ttl], bl
mov dword[esp+32], 0 ; success!
mov dword[esp + SYSCALL_STACK.eax], 0 ; success!
ret
.already:
mov dword[esp+20], EALREADY
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.ebx], EALREADY
mov dword[esp + SYSCALL_STACK.eax], -1
ret
.invalid:
mov dword[esp+20], EINVAL
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.ebx], EINVAL
mov dword[esp + SYSCALL_STACK.eax], -1
ret
@ -1320,7 +1325,7 @@ socket_pair:
call socket_alloc
test eax, eax
jz .nomem1
mov [esp+32], edi ; application's eax
mov [esp + SYSCALL_STACK.eax], edi ; application's eax
mov [eax + SOCKET.Domain], AF_LOCAL
mov [eax + SOCKET.Type], SOCK_STREAM
@ -1333,7 +1338,7 @@ socket_pair:
call socket_alloc
test eax, eax
jz .nomem2
mov [esp+20], edi ; application's ebx
mov [esp + SYSCALL_STACK.ebx], edi ; application's ebx
mov [eax + SOCKET.Domain], AF_LOCAL
mov [eax + SOCKET.Type], SOCK_STREAM
@ -1359,15 +1364,15 @@ socket_pair:
ret
.nomem2:
mov eax, [esp+20]
mov eax, [esp + SYSCALL_STACK.ebx]
call socket_free
.nomem1:
mov eax, [esp+32]
mov eax, [esp + SYSCALL_STACK.eax]
call socket_free
mov dword[esp+32], -1
mov dword[esp+20], ENOMEM
mov dword[esp + SYSCALL_STACK.eax], -1
mov dword[esp + SYSCALL_STACK.ebx], ENOMEM
ret
@ -1420,12 +1425,12 @@ socket_debug:
.done:
xor eax, eax
stosd
mov dword[esp+32], eax
mov dword[esp + SYSCALL_STACK.eax], eax
ret
.invalid:
mov dword[esp+32], -1
mov dword[esp+20], EINVAL
mov dword[esp + SYSCALL_STACK.eax], -1
mov dword[esp + SYSCALL_STACK.ebx], EINVAL
ret
@ -1904,7 +1909,7 @@ socket_notify:
call socket_check
jz .error
; Find the associated thread's TASK_DATA
; Find the associated thread's
push ebx ecx esi
mov ebx, [eax + SOCKET.TID]
test ebx, ebx
@ -1936,8 +1941,7 @@ socket_notify:
; Socket and thread exists and socket is of non blocking type.
; We'll try to flag an event to the thread.
shl ecx, BSF sizeof.APPDATA
or [SLOT_BASE + ecx + APPDATA.occurred_events], EVENT_NETWORK
or [esi + APPDATA.occurred_events], EVENT_NETWORK
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_notify: poking thread %u!\n", ebx
pop esi ecx ebx
@ -1948,8 +1952,7 @@ socket_notify:
; Socket and thread exists and socket is of blocking type
; We'll try to unblock it.
and [eax + SOCKET.state], not SS_BLOCKED ; Clear the 'socket is blocked' flag
shl ecx, BSF sizeof.APPDATA
mov [SLOT_BASE + ecx + APPDATA.state], TSTATE_RUNNING ; Run the thread
mov [esi + APPDATA.state], TSTATE_RUNNING ; Run the thread
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_notify: Unblocked socket!\n"
pop esi ecx ebx
@ -2539,6 +2542,6 @@ socket_cant_send_more:
jmp socket_notify
.notconn:
mov dword[esp+20], ENOTCONN
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.ebx], ENOTCONN
mov dword[esp + SYSCALL_STACK.eax], -1
ret

View File

@ -779,7 +779,7 @@ sys_network:
jne @f
mov eax, [net_device_count]
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
@@:
@ -824,7 +824,7 @@ sys_network:
.get_type:
mov eax, [eax + NET_DEVICE.device_type]
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
.get_dev_name:
@ -837,93 +837,93 @@ sys_network:
rep movsd
xor eax, eax
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
.reset:
call [eax + NET_DEVICE.reset]
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
.stop:
call [eax + NET_DEVICE.unload]
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
.get_ptr:
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
.get_drv_name:
xor eax, eax
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
.packets_tx:
mov eax, [eax + NET_DEVICE.packets_tx]
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
.packets_rx:
mov eax, [eax + NET_DEVICE.packets_rx]
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
.bytes_tx:
mov ebx, dword[eax + NET_DEVICE.bytes_tx + 4]
mov [esp+20], ebx
mov [esp + SYSCALL_STACK.ebx], ebx
mov eax, dword[eax + NET_DEVICE.bytes_tx]
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
.bytes_rx:
mov ebx, dword[eax + NET_DEVICE.bytes_rx + 4]
mov [esp+20], ebx
mov [esp + SYSCALL_STACK.ebx], ebx
mov eax, dword[eax + NET_DEVICE.bytes_rx]
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
.packets_tx_err:
mov eax, [eax + NET_DEVICE.packets_tx_err]
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
.packets_tx_drop:
mov eax, [eax + NET_DEVICE.packets_tx_drop]
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
.packets_tx_ovr:
mov eax, [eax + NET_DEVICE.packets_tx_ovr]
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
.packets_rx_err:
mov eax, [eax + NET_DEVICE.packets_rx_err]
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
.packets_rx_drop:
mov eax, [eax + NET_DEVICE.packets_rx_drop]
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
.packets_rx_ovr:
mov eax, [eax + NET_DEVICE.packets_rx_ovr]
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
.state:
mov eax, [eax + NET_DEVICE.link_state]
mov [esp+32], eax
mov [esp + SYSCALL_STACK.eax], eax
ret
.doesnt_exist:
.bad_buffer: ; Sanity check failed, exit
mov dword[esp+32], -1
mov dword[esp + SYSCALL_STACK.eax], -1
ret
@ -979,5 +979,5 @@ sys_protocols:
mov eax, -1
.return:
mov [esp+28+4], eax ; return eax value to the program
mov [esp + SYSCALL_STACK.eax], eax ; return eax value to the program
ret