/kernel/branches/net/applications/arpcfg/arpcfg.asm |
---|
35,27 → 35,12 |
mcall 4, 25 shl 16 + 31, 0x80000000, title |
;; call draw_stats |
mcall 12, 2 |
jmp draw_stats |
mainloop: |
mcall 23,50 ; wait for event with timeout (0,5 s) |
cmp eax, 1 |
je redraw |
cmp eax, 2 |
je key |
cmp eax, 3 |
je button |
draw_stats: |
mov edx, 50 shl 16 + 50 |
mov [last],0 |
.loop: |
mcall 75, 0x06080003, [last],,,ARP_ENTRY |
130,7 → 115,20 |
jmp .loop |
mainloop: |
mcall 23,50 ; wait for event with timeout (0,5 s) |
cmp eax, 1 |
je redraw |
cmp eax, 2 |
je key |
cmp eax, 3 |
je button |
jmp draw_stats |
key: |
mcall 2 |
jmp mainloop |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/applications/config.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/applications/debug-fdo.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/applications/macros.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/applications/netcfg/drivers.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/applications/netcfg/netcfg.asm |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/applications/netcfg/proc32.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/applications/netcfg/struct.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/applications/netcfg/vendors.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/applications/netstat/netstat.asm |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/applications/network_lib/network.asm |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/applications/network_lib/network.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/applications/nslookup/dll.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/applications/nslookup/nslookup.asm |
---|
20,7 → 20,7 |
; entry point |
start: |
; load libraries |
stdcall dll.Load, @IMPORT |
stdcall dll.Load, @IMPORT |
test eax, eax |
jnz exit |
; initialize console |
116,10 → 116,10 |
align 4 |
@IMPORT: |
library network, 'network.obj', console, 'console.obj' |
library network, 'network.obj', console, 'console.obj' |
import network, \ |
getaddrinfo, 'getaddrinfo', \ |
freeaddrinfo, 'freeaddrinfo', \ |
freeaddrinfo, 'freeaddrinfo', \ |
inet_ntoa, 'inet_ntoa' |
import console, \ |
con_start, 'START', \ |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/applications/proc32.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/applications/struct.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/applications/zeroconf/dhcp.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/applications/zeroconf/dll.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/applications/zeroconf/zeroconf.asm |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/blkdev/cd_drv.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 758 $ |
$Revision$ |
;********************************************************** |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/blkdev/cdrom.inc |
---|
5,7 → 5,7 |
;; Distributed under terms of the GNU General Public License ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 593 $ |
$Revision$ |
sys_cd_audio: |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/blkdev/fdc.inc |
---|
5,7 → 5,7 |
;; Distributed under terms of the GNU General Public License ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 766 $ |
$Revision$ |
iglobal |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/blkdev/flp_drv.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 593 $ |
$Revision$ |
;********************************************************** |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/blkdev/hd_drv.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 820 $ |
$Revision$ |
; Low-level driver for HDD access |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/blkdev/ide_cache.inc |
---|
21,7 → 21,7 |
; |
;************************************************************************** |
$Revision: 750 $ |
$Revision$ |
align 4 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/blkdev/rd.inc |
---|
9,7 → 9,7 |
;; LFN support by diamond ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 1021 $ |
$Revision$ |
; calculate fat chain |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/blkdev/rdsave.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 684 $ |
$Revision$ |
iglobal |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/boot/bootcode.inc |
---|
11,7 → 11,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 1018 $ |
$Revision$ |
;========================================================================== |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/boot/booteng.inc |
---|
11,7 → 11,7 |
; |
;====================================================================== |
$Revision: 750 $ |
$Revision$ |
d80x25_bottom: |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/boot/bootet.inc |
---|
11,7 → 11,7 |
; |
;====================================================================== |
$Revision: 750 $ |
$Revision$ |
d80x25_bottom: |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/boot/bootge.inc |
---|
11,7 → 11,7 |
; |
;====================================================================== |
$Revision: 750 $ |
$Revision$ |
d80x25_bottom: |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/boot/bootru.inc |
---|
11,7 → 11,7 |
; |
;================================================================= |
$Revision: 751 $ |
$Revision$ |
d80x25_bottom: |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/boot/bootstr.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 750 $ |
$Revision$ |
; boot data: common strings (for all languages) |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/boot/bootvesa.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 947 $ |
$Revision$ |
struc VBE_VGAInfo { |
.VESASignature dd ? ; char |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/boot/et.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 750 $ |
$Revision$ |
; Full ASCII code font |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/boot/preboot.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 767 $ |
$Revision$ |
display_modechg db 0 ; display mode change for text, yes/no (0 or 2) |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/boot/rdload.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 593 $ |
$Revision$ |
; READ RAMDISK IMAGE FROM HD |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/boot/ru.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 774 $ |
$Revision$ |
; Generated by RUFNT.EXE |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/boot/shutdown.inc |
---|
11,7 → 11,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 748 $ |
$Revision$ |
align 4 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/bus/pci/pci16.inc |
---|
15,7 → 15,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 593 $ |
$Revision$ |
init_pci_16: |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/bus/pci/pci32.inc |
---|
21,7 → 21,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 750 $ |
$Revision$ |
;*************************************************************************** |
; Function |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/const.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
dpl0 equ 10010000b ; data read dpl0 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/core/conf_lib.inc |
---|
10,7 → 10,7 |
; {SPraid.simba} |
;------------------------------------------------------------------------- |
$Revision: 802 $ |
$Revision$ |
conf_path_sect: db 'path',0 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/core/debug.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 750 $ |
$Revision$ |
; diamond, 2006 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/core/dll.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 1018 $ |
$Revision$ |
DRV_COMPAT equ 5 ;minimal required drivers version |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/core/export.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 750 $ |
$Revision$ |
; Macroinstruction for making export section |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/core/exports.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 924 $ |
$Revision$ |
iglobal |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/core/ext_lib.inc |
---|
11,7 → 11,7 |
; |
;============================================================================ |
$Revision: 750 $ |
$Revision$ |
macro library [name,fname] |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/core/fpu.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 750 $ |
$Revision$ |
init_fpu: |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/core/heap.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
struc MEM_BLOCK |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/core/malloc.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 753 $ |
$Revision$ |
; Small heap based on malloc/free/realloc written by Doug Lea |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/core/memory.inc |
---|
5,113 → 5,113 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
align 4 |
proc alloc_page |
pushfd |
cli |
push ebx |
mov ebx, [page_start] |
mov ecx, [page_end] |
pushfd |
cli |
push ebx |
mov ebx, [page_start] |
mov ecx, [page_end] |
.l1: |
bsf eax,[ebx]; |
jnz .found |
add ebx,4 |
cmp ebx, ecx |
jb .l1 |
pop ebx |
popfd |
xor eax,eax |
ret |
bsf eax,[ebx]; |
jnz .found |
add ebx,4 |
cmp ebx, ecx |
jb .l1 |
pop ebx |
popfd |
xor eax,eax |
ret |
.found: |
btr [ebx], eax |
mov [page_start],ebx |
sub ebx, sys_pgmap |
lea eax, [eax+ebx*8] |
shl eax, 12 |
dec [pg_data.pages_free] |
pop ebx |
popfd |
ret |
btr [ebx], eax |
mov [page_start],ebx |
sub ebx, sys_pgmap |
lea eax, [eax+ebx*8] |
shl eax, 12 |
dec [pg_data.pages_free] |
pop ebx |
popfd |
ret |
endp |
align 4 |
proc alloc_pages stdcall, count:dword |
pushfd |
push ebx |
push edi |
cli |
mov eax, [count] |
add eax, 7 |
shr eax, 3 |
mov [count], eax |
cmp eax, [pg_data.pages_free] |
ja .fail |
pushfd |
push ebx |
push edi |
cli |
mov eax, [count] |
add eax, 7 |
shr eax, 3 |
mov [count], eax |
cmp eax, [pg_data.pages_free] |
ja .fail |
mov ecx, [page_start] |
mov ebx, [page_end] |
mov ecx, [page_start] |
mov ebx, [page_end] |
.find: |
mov edx, [count] |
mov edi, ecx |
mov edx, [count] |
mov edi, ecx |
.match: |
cmp byte [ecx], 0xFF |
jne .next |
dec edx |
jz .ok |
inc ecx |
cmp ecx,ebx |
jb .match |
cmp byte [ecx], 0xFF |
jne .next |
dec edx |
jz .ok |
inc ecx |
cmp ecx,ebx |
jb .match |
.fail: |
xor eax, eax |
pop edi |
pop ebx |
popfd |
ret |
xor eax, eax |
pop edi |
pop ebx |
popfd |
ret |
.next: |
inc ecx |
cmp ecx, ebx |
jb .find |
pop edi |
pop ebx |
popfd |
xor eax, eax |
ret |
inc ecx |
cmp ecx, ebx |
jb .find |
pop edi |
pop ebx |
popfd |
xor eax, eax |
ret |
.ok: |
sub ecx, edi |
inc ecx |
push esi |
mov esi, edi |
xor eax, eax |
rep stosb |
sub esi, sys_pgmap |
shl esi, 3+12 |
mov eax, esi |
mov ebx, [count] |
shl ebx, 3 |
sub [pg_data.pages_free], ebx |
pop esi |
pop edi |
pop ebx |
popfd |
ret |
sub ecx, edi |
inc ecx |
push esi |
mov esi, edi |
xor eax, eax |
rep stosb |
sub esi, sys_pgmap |
shl esi, 3+12 |
mov eax, esi |
mov ebx, [count] |
shl ebx, 3 |
sub [pg_data.pages_free], ebx |
pop esi |
pop edi |
pop ebx |
popfd |
ret |
endp |
align 4 |
proc map_page stdcall,lin_addr:dword,phis_addr:dword,flags:dword |
push ebx |
mov eax, [phis_addr] |
and eax, not 0xFFF |
or eax, [flags] |
mov ebx, [lin_addr] |
shr ebx, 12 |
mov [page_tabs+ebx*4], eax |
mov eax, [lin_addr] |
invlpg [eax] |
pop ebx |
ret |
push ebx |
mov eax, [phis_addr] |
and eax, not 0xFFF |
or eax, [flags] |
mov ebx, [lin_addr] |
shr ebx, 12 |
mov [page_tabs+ebx*4], eax |
mov eax, [lin_addr] |
invlpg [eax] |
pop ebx |
ret |
endp |
align 4 |
118,70 → 118,70 |
map_space: ;not implemented |
ret |
ret |
align 4 |
proc free_page |
;arg: eax page address |
pushfd |
cli |
shr eax, 12 ;page index |
bts dword [sys_pgmap], eax ;that's all! |
cmc |
adc [pg_data.pages_free], 0 |
shr eax, 3 |
and eax, not 3 ;dword offset from page_map |
add eax, sys_pgmap |
cmp [page_start], eax |
ja @f |
popfd |
ret |
pushfd |
cli |
shr eax, 12 ;page index |
bts dword [sys_pgmap], eax ;that's all! |
cmc |
adc [pg_data.pages_free], 0 |
shr eax, 3 |
and eax, not 3 ;dword offset from page_map |
add eax, sys_pgmap |
cmp [page_start], eax |
ja @f |
popfd |
ret |
@@: |
mov [page_start], eax |
popfd |
ret |
mov [page_start], eax |
popfd |
ret |
endp |
proc map_io_mem stdcall, base:dword, size:dword, flags:dword |
push ebx |
push edi |
mov eax, [size] |
add eax, 4095 |
and eax, -4096 |
mov [size], eax |
stdcall alloc_kernel_space, eax |
test eax, eax |
jz .fail |
push eax |
push ebx |
push edi |
mov eax, [size] |
add eax, 4095 |
and eax, -4096 |
mov [size], eax |
stdcall alloc_kernel_space, eax |
test eax, eax |
jz .fail |
push eax |
mov edi, 0x1000 |
mov ebx, eax |
mov ecx,[size] |
mov edx, [base] |
shr eax, 12 |
shr ecx, 12 |
and edx, -4096 |
or edx, [flags] |
mov edi, 0x1000 |
mov ebx, eax |
mov ecx,[size] |
mov edx, [base] |
shr eax, 12 |
shr ecx, 12 |
and edx, -4096 |
or edx, [flags] |
@@: |
mov [page_tabs+eax*4], edx |
; push eax |
; invlpg [ebx] |
; pop eax |
inc eax |
add ebx, edi |
add edx, edi |
loop @B |
mov [page_tabs+eax*4], edx |
; push eax |
; invlpg [ebx] |
; pop eax |
inc eax |
add ebx, edi |
add edx, edi |
loop @B |
pop eax |
mov edx, [base] |
and edx, 4095 |
add eax, edx |
pop eax |
mov edx, [base] |
and edx, 4095 |
add eax, edx |
.fail: |
pop edi |
pop ebx |
ret |
pop edi |
pop ebx |
ret |
endp |
; param |
191,31 → 191,31 |
align 4 |
commit_pages: |
push edi |
test ecx, ecx |
jz .fail |
push edi |
test ecx, ecx |
jz .fail |
mov edi, ebx |
mov ebx, pg_data.pg_mutex |
call wait_mutex ;ebx |
mov edi, ebx |
mov ebx, pg_data.pg_mutex |
call wait_mutex ;ebx |
mov edx, 0x1000 |
mov ebx, edi |
shr ebx, 12 |
mov edx, 0x1000 |
mov ebx, edi |
shr ebx, 12 |
@@: |
mov [page_tabs+ebx*4], eax |
; push eax |
; invlpg [edi] |
; pop eax |
add edi, edx |
add eax, edx |
inc ebx |
dec ecx |
jnz @B |
mov [pg_data.pg_mutex],ecx |
mov [page_tabs+ebx*4], eax |
; push eax |
; invlpg [edi] |
; pop eax |
add edi, edx |
add eax, edx |
inc ebx |
dec ecx |
jnz @B |
mov [pg_data.pg_mutex],ecx |
.fail: |
pop edi |
ret |
pop edi |
ret |
; param |
225,49 → 225,49 |
align 4 |
release_pages: |
pushad |
mov ebx, pg_data.pg_mutex |
call wait_mutex ;ebx |
pushad |
mov ebx, pg_data.pg_mutex |
call wait_mutex ;ebx |
mov esi, eax |
mov edi, eax |
mov esi, eax |
mov edi, eax |
shr esi, 10 |
add esi, page_tabs |
shr esi, 10 |
add esi, page_tabs |
mov ebp, [pg_data.pages_free] |
mov ebx, [page_start] |
mov edx, sys_pgmap |
mov ebp, [pg_data.pages_free] |
mov ebx, [page_start] |
mov edx, sys_pgmap |
@@: |
xor eax, eax |
xchg eax, [esi] |
push eax |
invlpg [edi] |
pop eax |
xor eax, eax |
xchg eax, [esi] |
push eax |
invlpg [edi] |
pop eax |
test eax, 1 |
jz .next |
test eax, 1 |
jz .next |
shr eax, 12 |
bts [edx], eax |
cmc |
adc ebp, 0 |
shr eax, 3 |
and eax, -4 |
add eax, edx |
cmp eax, ebx |
jae .next |
shr eax, 12 |
bts [edx], eax |
cmc |
adc ebp, 0 |
shr eax, 3 |
and eax, -4 |
add eax, edx |
cmp eax, ebx |
jae .next |
mov ebx, eax |
mov ebx, eax |
.next: |
add edi, 0x1000 |
add esi, 4 |
dec ecx |
jnz @B |
mov [pg_data.pages_free], ebp |
and [pg_data.pg_mutex],0 |
popad |
ret |
add edi, 0x1000 |
add esi, 4 |
dec ecx |
jnz @B |
mov [pg_data.pages_free], ebp |
and [pg_data.pg_mutex],0 |
popad |
ret |
; param |
; eax= base |
276,229 → 276,229 |
align 4 |
unmap_pages: |
push edi |
push edi |
mov edi, eax |
mov edx, eax |
mov edi, eax |
mov edx, eax |
shr edi, 10 |
add edi, page_tabs |
shr edi, 10 |
add edi, page_tabs |
xor eax, eax |
xor eax, eax |
@@: |
stosd |
invlpg [edx] |
add edx, 0x1000 |
loop @b |
stosd |
invlpg [edx] |
add edx, 0x1000 |
loop @b |
pop edi |
ret |
pop edi |
ret |
align 4 |
proc map_page_table stdcall, lin_addr:dword, phis_addr:dword |
push ebx |
mov ebx, [lin_addr] |
shr ebx, 22 |
mov eax, [phis_addr] |
and eax, not 0xFFF |
or eax, PG_UW ;+PG_NOCACHE |
mov dword [master_tab+ebx*4], eax |
mov eax, [lin_addr] |
shr eax, 10 |
add eax, page_tabs |
invlpg [eax] |
pop ebx |
ret |
push ebx |
mov ebx, [lin_addr] |
shr ebx, 22 |
mov eax, [phis_addr] |
and eax, not 0xFFF |
or eax, PG_UW ;+PG_NOCACHE |
mov dword [master_tab+ebx*4], eax |
mov eax, [lin_addr] |
shr eax, 10 |
add eax, page_tabs |
invlpg [eax] |
pop ebx |
ret |
endp |
align 4 |
proc init_LFB |
locals |
pg_count dd ? |
endl |
locals |
pg_count dd ? |
endl |
cmp dword [LFBAddress], -1 |
jne @f |
mov [BOOT_VAR+0x901c],byte 2 |
stdcall kernel_alloc, 0x280000 |
mov [LFBAddress], eax |
ret |
cmp dword [LFBAddress], -1 |
jne @f |
mov [BOOT_VAR+0x901c],byte 2 |
stdcall kernel_alloc, 0x280000 |
mov [LFBAddress], eax |
ret |
@@: |
test [SCR_MODE],word 0100000000000000b |
jnz @f |
mov [BOOT_VAR+0x901c],byte 2 |
ret |
test [SCR_MODE],word 0100000000000000b |
jnz @f |
mov [BOOT_VAR+0x901c],byte 2 |
ret |
@@: |
call init_mtrr |
call init_mtrr |
mov edx, LFB_BASE |
mov esi, [LFBAddress] |
mov edi, 0x00800000 |
mov dword [exp_lfb+4], edx |
mov edx, LFB_BASE |
mov esi, [LFBAddress] |
mov edi, 0x00800000 |
mov dword [exp_lfb+4], edx |
shr edi, 12 |
mov [pg_count], edi |
shr edi, 10 |
shr edi, 12 |
mov [pg_count], edi |
shr edi, 10 |
bt [cpu_caps], CAPS_PSE |
jnc .map_page_tables |
or esi, PG_LARGE+PG_UW |
mov edx, sys_pgdir+(LFB_BASE shr 20) |
bt [cpu_caps], CAPS_PSE |
jnc .map_page_tables |
or esi, PG_LARGE+PG_UW |
mov edx, sys_pgdir+(LFB_BASE shr 20) |
@@: |
mov [edx], esi |
add edx, 4 |
add esi, 0x00400000 |
dec edi |
jnz @B |
mov [edx], esi |
add edx, 4 |
add esi, 0x00400000 |
dec edi |
jnz @B |
bt [cpu_caps], CAPS_PGE |
jnc @F |
or dword [sys_pgdir+(LFB_BASE shr 20)], PG_GLOBAL |
bt [cpu_caps], CAPS_PGE |
jnc @F |
or dword [sys_pgdir+(LFB_BASE shr 20)], PG_GLOBAL |
@@: |
mov dword [LFBAddress], LFB_BASE |
mov eax, cr3 ;flush TLB |
mov cr3, eax |
ret |
mov dword [LFBAddress], LFB_BASE |
mov eax, cr3 ;flush TLB |
mov cr3, eax |
ret |
.map_page_tables: |
@@: |
call alloc_page |
stdcall map_page_table, edx, eax |
add edx, 0x00400000 |
dec edi |
jnz @B |
call alloc_page |
stdcall map_page_table, edx, eax |
add edx, 0x00400000 |
dec edi |
jnz @B |
mov eax, [LFBAddress] |
mov edi, page_tabs + (LFB_BASE shr 10) |
or eax, PG_UW |
mov ecx, [pg_count] |
cld |
mov eax, [LFBAddress] |
mov edi, page_tabs + (LFB_BASE shr 10) |
or eax, PG_UW |
mov ecx, [pg_count] |
cld |
@@: |
stosd |
add eax, 0x1000 |
dec ecx |
jnz @B |
stosd |
add eax, 0x1000 |
dec ecx |
jnz @B |
mov dword [LFBAddress], LFB_BASE |
mov eax, cr3 ;flush TLB |
mov cr3, eax |
mov dword [LFBAddress], LFB_BASE |
mov eax, cr3 ;flush TLB |
mov cr3, eax |
ret |
ret |
endp |
align 4 |
proc new_mem_resize stdcall, new_size:dword |
mov ebx, pg_data.pg_mutex |
call wait_mutex ;ebx |
mov ebx, pg_data.pg_mutex |
call wait_mutex ;ebx |
mov edi, [new_size] |
add edi,4095 |
and edi,not 4095 |
mov [new_size], edi |
mov edi, [new_size] |
add edi,4095 |
and edi,not 4095 |
mov [new_size], edi |
mov edx,[current_slot] |
cmp [edx+APPDATA.heap_base],0 |
jne .exit |
mov edx,[current_slot] |
cmp [edx+APPDATA.heap_base],0 |
jne .exit |
mov esi, [edx+APPDATA.mem_size] |
add esi, 4095 |
and esi, not 4095 |
mov esi, [edx+APPDATA.mem_size] |
add esi, 4095 |
and esi, not 4095 |
cmp edi, esi |
jae .expand |
cmp edi, esi |
jae .expand |
shr edi, 12 |
shr esi, 12 |
shr edi, 12 |
shr esi, 12 |
@@: |
mov eax, [app_page_tabs+edi*4] |
test eax, 1 |
jz .next |
mov dword [app_page_tabs+edi*4], 2 |
mov ebx, edi |
shl ebx, 12 |
push eax |
invlpg [ebx] |
pop eax |
call free_page |
mov eax, [app_page_tabs+edi*4] |
test eax, 1 |
jz .next |
mov dword [app_page_tabs+edi*4], 2 |
mov ebx, edi |
shl ebx, 12 |
push eax |
invlpg [ebx] |
pop eax |
call free_page |
.next: add edi, 1 |
cmp edi, esi |
jb @B |
.next: add edi, 1 |
cmp edi, esi |
jb @B |
.update_size: |
mov ebx, [new_size] |
call update_mem_size |
mov ebx, [new_size] |
call update_mem_size |
xor eax, eax |
dec [pg_data.pg_mutex] |
ret |
xor eax, eax |
dec [pg_data.pg_mutex] |
ret |
.expand: |
push esi |
push edi |
push esi |
push edi |
add edi, 0x3FFFFF |
and edi, not(0x3FFFFF) |
add esi, 0x3FFFFF |
and esi, not(0x3FFFFF) |
add edi, 0x3FFFFF |
and edi, not(0x3FFFFF) |
add esi, 0x3FFFFF |
and esi, not(0x3FFFFF) |
cmp esi, edi |
jae .grow |
cmp esi, edi |
jae .grow |
xchg esi, edi |
xchg esi, edi |
@@: |
call alloc_page |
test eax, eax |
jz .exit_pop |
call alloc_page |
test eax, eax |
jz .exit_pop |
stdcall map_page_table, edi, eax |
stdcall map_page_table, edi, eax |
push edi |
shr edi, 10 |
add edi, page_tabs |
mov ecx, 1024 |
xor eax, eax |
cld |
rep stosd |
pop edi |
push edi |
shr edi, 10 |
add edi, page_tabs |
mov ecx, 1024 |
xor eax, eax |
cld |
rep stosd |
pop edi |
add edi, 0x00400000 |
cmp edi, esi |
jb @B |
add edi, 0x00400000 |
cmp edi, esi |
jb @B |
.grow: |
pop edi |
pop esi |
pop edi |
pop esi |
@@: |
call alloc_page |
test eax, eax |
jz .exit |
stdcall map_page,esi,eax,dword PG_UW |
call alloc_page |
test eax, eax |
jz .exit |
stdcall map_page,esi,eax,dword PG_UW |
push edi |
mov edi, esi |
xor eax, eax |
mov ecx, 1024 |
cld |
rep stosd |
pop edi |
push edi |
mov edi, esi |
xor eax, eax |
mov ecx, 1024 |
cld |
rep stosd |
pop edi |
add esi, 0x1000 |
cmp esi, edi |
jb @B |
add esi, 0x1000 |
cmp esi, edi |
jb @B |
jmp .update_size |
jmp .update_size |
.exit_pop: |
pop edi |
pop esi |
pop edi |
pop esi |
.exit: |
xor eax, eax |
inc eax |
dec [pg_data.pg_mutex] |
ret |
xor eax, eax |
inc eax |
dec [pg_data.pg_mutex] |
ret |
endp |
update_mem_size: |
506,31 → 506,31 |
; ebx = new memory size |
; destroys eax,ecx,edx |
mov [APPDATA.mem_size+edx],ebx |
mov [APPDATA.mem_size+edx],ebx |
;search threads and update |
;application memory size infomation |
mov ecx,[APPDATA.dir_table+edx] |
mov eax,2 |
mov ecx,[APPDATA.dir_table+edx] |
mov eax,2 |
.search_threads: |
;eax = current slot |
;ebx = new memory size |
;ecx = page directory |
cmp eax,[TASK_COUNT] |
jg .search_threads_end |
mov edx,eax |
shl edx,5 |
cmp word [CURRENT_TASK+edx+TASKDATA.state],9 ;if slot empty? |
jz .search_threads_next |
shl edx,3 |
cmp [SLOT_BASE+edx+APPDATA.dir_table],ecx ;if it is our thread? |
jnz .search_threads_next |
mov [SLOT_BASE+edx+APPDATA.mem_size],ebx ;update memory size |
cmp eax,[TASK_COUNT] |
jg .search_threads_end |
mov edx,eax |
shl edx,5 |
cmp word [CURRENT_TASK+edx+TASKDATA.state],9 ;if slot empty? |
jz .search_threads_next |
shl edx,3 |
cmp [SLOT_BASE+edx+APPDATA.dir_table],ecx ;if it is our thread? |
jnz .search_threads_next |
mov [SLOT_BASE+edx+APPDATA.mem_size],ebx ;update memory size |
.search_threads_next: |
inc eax |
jmp .search_threads |
inc eax |
jmp .search_threads |
.search_threads_end: |
ret |
ret |
; param |
; eax= linear address |
540,10 → 540,10 |
align 4 |
get_pg_addr: |
shr eax, 12 |
mov eax, [page_tabs+eax*4] |
and eax, 0xFFFFF000 |
ret |
shr eax, 12 |
mov eax, [page_tabs+eax*4] |
and eax, 0xFFFFF000 |
ret |
align 4 |
550,13 → 550,13 |
; Now it is called from core/sys32::exc_c (see stack frame there) |
proc page_fault_handler |
.err_addr equ ebp-4 |
.err_addr equ ebp-4 |
push ebx ;save exception number (#PF) |
mov ebp, esp |
mov ebx, cr2 |
push ebx ;that is locals: .err_addr = cr2 |
inc [pg_data.pages_faults] |
push ebx ;save exception number (#PF) |
mov ebp, esp |
mov ebx, cr2 |
push ebx ;that is locals: .err_addr = cr2 |
inc [pg_data.pages_faults] |
; push eax |
; push edx |
566,136 → 566,136 |
; pop edx |
; pop eax |
mov eax, [pf_err_code] |
mov eax, [pf_err_code] |
cmp ebx, OS_BASE ;ebx == .err_addr |
jb .user_space ;ñòðà Ãèöà â ïà ìÿòè ïðèëîæåÃèÿ ; |
cmp ebx, OS_BASE ;ebx == .err_addr |
jb .user_space ;ñòðà Ãèöà â ïà ìÿòè ïðèëîæåÃèÿ ; |
cmp ebx, page_tabs |
jb .kernel_space ;ñòðà Ãèöà â ïà ìÿòè ÿäðà |
cmp ebx, page_tabs |
jb .kernel_space ;ñòðà Ãèöà â ïà ìÿòè ÿäðà |
cmp ebx, kernel_tabs |
jb .alloc;.app_tabs ;òà áëèöû ñòðà Ãèö ïðèëîæåÃèÿ ; |
;ïðîñòî ñîçäà äèì îäÃó |
cmp ebx, kernel_tabs |
jb .alloc;.app_tabs ;òà áëèöû ñòðà Ãèö ïðèëîæåÃèÿ ; |
;ïðîñòî ñîçäà äèì îäÃó |
if 0 ;ïîêà ýòî ïðîñòî ëèøÃåå |
cmp ebx, LFB_BASE |
jb .core_tabs ;òà áëèöû ñòðà Ãèö ÿäðà |
;Îøèáêà |
cmp ebx, LFB_BASE |
jb .core_tabs ;òà áëèöû ñòðà Ãèö ÿäðà |
;Îøèáêà |
.lfb: |
;îáëà ñòü LFB |
;Îøèáêà |
jmp .fail |
;îáëà ñòü LFB |
;Îøèáêà |
jmp .fail |
end if |
.core_tabs: |
.fail: ;simply return to caller |
mov esp, ebp |
pop ebx ;restore exception number (#PF) |
ret |
.fail: ;simply return to caller |
mov esp, ebp |
pop ebx ;restore exception number (#PF) |
ret |
.user_space: |
test eax, PG_MAP |
jnz .err_access ;Ñòðà Ãèöà ïðèñóòñòâóåò |
;Îøèáêà äîñòóïà ? |
test eax, PG_MAP |
jnz .err_access ;Ñòðà Ãèöà ïðèñóòñòâóåò |
;Îøèáêà äîñòóïà ? |
shr ebx, 12 |
mov ecx, ebx |
shr ecx, 10 |
mov edx, [master_tab+ecx*4] |
test edx, PG_MAP |
jz .fail ;òà áëèöà ñòðà Ãèö ÃÃ¥ ñîçäà Ãà |
;ÃåâåðÃûé à äðåñ â ïðîãðà ììå |
shr ebx, 12 |
mov ecx, ebx |
shr ecx, 10 |
mov edx, [master_tab+ecx*4] |
test edx, PG_MAP |
jz .fail ;òà áëèöà ñòðà Ãèö ÃÃ¥ ñîçäà Ãà |
;ÃåâåðÃûé à äðåñ â ïðîãðà ììå |
mov eax, [page_tabs+ebx*4] |
test eax, 2 |
jz .fail ;à äðåñ ÃÃ¥ çà ðåçåðâèðîâà à äëÿ ; |
;èñïîëüçîâà Ãèÿ. Îøèáêà |
mov eax, [page_tabs+ebx*4] |
test eax, 2 |
jz .fail ;à äðåñ ÃÃ¥ çà ðåçåðâèðîâà à äëÿ ; |
;èñïîëüçîâà Ãèÿ. Îøèáêà |
.alloc: |
call alloc_page |
test eax, eax |
jz .fail |
call alloc_page |
test eax, eax |
jz .fail |
stdcall map_page,[.err_addr],eax,dword PG_UW |
stdcall map_page,[.err_addr],eax,dword PG_UW |
mov edi, [.err_addr] |
and edi, 0xFFFFF000 |
mov ecx, 1024 |
xor eax, eax |
mov edi, [.err_addr] |
and edi, 0xFFFFF000 |
mov ecx, 1024 |
xor eax, eax |
;cld ;caller is duty for this |
rep stosd |
.exit: ;iret with repeat fault instruction |
add esp,12 ;clear in stack: locals(.err_addr) + #PF + ret_to_caller |
restore_ring3_context |
iretd |
rep stosd |
.exit: ;iret with repeat fault instruction |
add esp,12 ;clear in stack: locals(.err_addr) + #PF + ret_to_caller |
restore_ring3_context |
iretd |
.err_access = .fail |
.err_access = .fail |
;Ãèêîãäà ÃÃ¥ ïðîèñõîäèò |
;jmp .fail |
.kernel_space: |
test eax, PG_MAP |
jz .fail ;ñòðà Ãèöà ÃÃ¥ ïðèñóòñòâóåò |
test eax, PG_MAP |
jz .fail ;ñòðà Ãèöà ÃÃ¥ ïðèñóòñòâóåò |
test eax,12 ;U/S (+below) |
jnz .fail ;ïðèëîæåÃèå îáðà òèëîñü ê ïà ìÿòè |
;ÿäðà |
test eax,12 ;U/S (+below) |
jnz .fail ;ïðèëîæåÃèå îáðà òèëîñü ê ïà ìÿòè |
;ÿäðà |
;test eax, 8 |
;jnz .fail ;óñòà Ãîâëåà çà ðåçåðâèðîâà ÃÃûé áèò |
;â òà áëèöà õ ñòðà Ãèö. äîáà âëåÃî â P4/Xeon |
;â òà áëèöà õ ñòðà Ãèö. äîáà âëåÃî â P4/Xeon |
;ïîïûòêà çà ïèñè â çà ùèù¸ÃÃóþ ñòðà Ãèöó ÿäðà |
cmp ebx, tss._io_map_0 |
jb .fail |
cmp ebx, tss._io_map_0 |
jb .fail |
cmp ebx, tss._io_map_0+8192 |
jae .fail |
cmp ebx, tss._io_map_0+8192 |
jae .fail |
; io permission map |
; copy-on-write protection |
call alloc_page |
test eax, eax |
jz .fail |
call alloc_page |
test eax, eax |
jz .fail |
push eax |
stdcall map_page,[.err_addr],eax,dword PG_SW |
pop eax |
mov edi, [.err_addr] |
and edi, -4096 |
lea esi, [edi+(not tss._io_map_0)+1]; -tss._io_map_0 |
push eax |
stdcall map_page,[.err_addr],eax,dword PG_SW |
pop eax |
mov edi, [.err_addr] |
and edi, -4096 |
lea esi, [edi+(not tss._io_map_0)+1]; -tss._io_map_0 |
mov ebx, esi |
shr ebx, 12 |
mov edx, [current_slot] |
or eax, PG_SW |
mov [edx+APPDATA.io_map+ebx*4], eax |
mov ebx, esi |
shr ebx, 12 |
mov edx, [current_slot] |
or eax, PG_SW |
mov [edx+APPDATA.io_map+ebx*4], eax |
add esi, [default_io_map] |
mov ecx, 4096/4 |
add esi, [default_io_map] |
mov ecx, 4096/4 |
;cld ;caller is duty for this |
rep movsd |
jmp .exit |
rep movsd |
jmp .exit |
endp |
align 4 |
proc map_mem stdcall, lin_addr:dword,pdir:dword,\ |
ofs:dword,buf_size:dword |
mov eax, [buf_size] |
test eax, eax |
jz .exit |
ofs:dword,buf_size:dword |
mov eax, [buf_size] |
test eax, eax |
jz .exit |
mov eax, [pdir] |
and eax, 0xFFFFF000 |
mov eax, [pdir] |
and eax, 0xFFFFF000 |
stdcall map_page,[ipc_pdir],eax,PG_UW |
mov ebx, [ofs] |
shr ebx, 22 |
mov esi, [ipc_pdir] |
mov edi, [ipc_ptab] |
mov eax, [esi+ebx*4] |
and eax, 0xFFFFF000 |
jz .exit |
stdcall map_page,edi,eax,PG_UW |
stdcall map_page,[ipc_pdir],eax,PG_UW |
mov ebx, [ofs] |
shr ebx, 22 |
mov esi, [ipc_pdir] |
mov edi, [ipc_ptab] |
mov eax, [esi+ebx*4] |
and eax, 0xFFFFF000 |
jz .exit |
stdcall map_page,edi,eax,PG_UW |
; inc ebx |
; add edi, 0x1000 |
; mov eax, [esi+ebx*4] |
704,85 → 704,85 |
; and eax, 0xFFFFF000 |
; stdcall map_page, edi, eax |
@@: mov edi, [lin_addr] |
and edi, 0xFFFFF000 |
mov ecx, [buf_size] |
add ecx, 4095 |
shr ecx, 12 |
inc ecx |
@@: mov edi, [lin_addr] |
and edi, 0xFFFFF000 |
mov ecx, [buf_size] |
add ecx, 4095 |
shr ecx, 12 |
inc ecx |
mov edx, [ofs] |
shr edx, 12 |
and edx, 0x3FF |
mov esi, [ipc_ptab] |
mov edx, [ofs] |
shr edx, 12 |
and edx, 0x3FF |
mov esi, [ipc_ptab] |
.map: mov eax, [esi+edx*4] |
and eax, 0xFFFFF000 |
jz .exit |
stdcall map_page,edi,eax,PG_UW |
dec ecx |
jz .exit |
add edi, 0x1000 |
inc edx |
cmp edx, 0x400 |
jnz .map |
inc ebx |
mov eax, [ipc_pdir] |
mov eax, [eax+ebx*4] |
and eax, 0xFFFFF000 |
jz .exit |
stdcall map_page,esi,eax,PG_UW |
xor edx, edx |
jmp .map |
.map: mov eax, [esi+edx*4] |
and eax, 0xFFFFF000 |
jz .exit |
stdcall map_page,edi,eax,PG_UW |
dec ecx |
jz .exit |
add edi, 0x1000 |
inc edx |
cmp edx, 0x400 |
jnz .map |
inc ebx |
mov eax, [ipc_pdir] |
mov eax, [eax+ebx*4] |
and eax, 0xFFFFF000 |
jz .exit |
stdcall map_page,esi,eax,PG_UW |
xor edx, edx |
jmp .map |
.exit: |
ret |
ret |
endp |
align 4 |
proc map_memEx stdcall, lin_addr:dword,pdir:dword,\ |
ofs:dword,buf_size:dword |
mov eax, [buf_size] |
test eax, eax |
jz .exit |
ofs:dword,buf_size:dword |
mov eax, [buf_size] |
test eax, eax |
jz .exit |
mov eax, [pdir] |
and eax, 0xFFFFF000 |
mov eax, [pdir] |
and eax, 0xFFFFF000 |
stdcall map_page,[proc_mem_pdir],eax,dword PG_UW |
mov ebx, [ofs] |
shr ebx, 22 |
mov esi, [proc_mem_pdir] |
mov edi, [proc_mem_tab] |
mov eax, [esi+ebx*4] |
and eax, 0xFFFFF000 |
test eax, eax |
jz .exit |
stdcall map_page,edi,eax,dword PG_UW |
stdcall map_page,[proc_mem_pdir],eax,dword PG_UW |
mov ebx, [ofs] |
shr ebx, 22 |
mov esi, [proc_mem_pdir] |
mov edi, [proc_mem_tab] |
mov eax, [esi+ebx*4] |
and eax, 0xFFFFF000 |
test eax, eax |
jz .exit |
stdcall map_page,edi,eax,dword PG_UW |
@@: mov edi, [lin_addr] |
and edi, 0xFFFFF000 |
mov ecx, [buf_size] |
add ecx, 4095 |
shr ecx, 12 |
inc ecx |
@@: mov edi, [lin_addr] |
and edi, 0xFFFFF000 |
mov ecx, [buf_size] |
add ecx, 4095 |
shr ecx, 12 |
inc ecx |
mov edx, [ofs] |
shr edx, 12 |
and edx, 0x3FF |
mov esi, [proc_mem_tab] |
mov edx, [ofs] |
shr edx, 12 |
and edx, 0x3FF |
mov esi, [proc_mem_tab] |
.map: mov eax, [esi+edx*4] |
.map: mov eax, [esi+edx*4] |
; and eax, 0xFFFFF000 |
; test eax, eax |
; jz .exit |
stdcall map_page,edi,eax,dword PG_UW |
add edi, 0x1000 |
inc edx |
dec ecx |
jnz .map |
stdcall map_page,edi,eax,dword PG_UW |
add edi, 0x1000 |
inc edx |
dec ecx |
jnz .map |
.exit: |
ret |
ret |
endp |
798,345 → 798,345 |
; ecx=address of message |
; edx=size of message |
cmp eax,1 |
jne @f |
call set_ipc_buff |
mov [esp+36], eax |
ret |
cmp eax,1 |
jne @f |
call set_ipc_buff |
mov [esp+36], eax |
ret |
@@: |
cmp eax, 2 |
jne @f |
stdcall sys_ipc_send, ebx, ecx, edx |
mov [esp+36], eax |
ret |
cmp eax, 2 |
jne @f |
stdcall sys_ipc_send, ebx, ecx, edx |
mov [esp+36], eax |
ret |
@@: |
xor eax, eax |
not eax |
mov [esp+36], eax |
ret |
xor eax, eax |
not eax |
mov [esp+36], eax |
ret |
align 4 |
proc set_ipc_buff |
mov eax,[current_slot] |
pushf |
cli |
mov [eax+APPDATA.ipc_start],ebx ;set fields in extended information area |
mov [eax+APPDATA.ipc_size],ecx |
mov eax,[current_slot] |
pushf |
cli |
mov [eax+APPDATA.ipc_start],ebx ;set fields in extended information area |
mov [eax+APPDATA.ipc_size],ecx |
add ecx, ebx |
add ecx, 4095 |
and ecx, not 4095 |
add ecx, ebx |
add ecx, 4095 |
and ecx, not 4095 |
.touch: mov eax, [ebx] |
add ebx, 0x1000 |
cmp ebx, ecx |
jb .touch |
add ebx, 0x1000 |
cmp ebx, ecx |
jb .touch |
popf |
xor eax, eax |
ret |
popf |
xor eax, eax |
ret |
endp |
proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword |
locals |
dst_slot dd ? |
dst_offset dd ? |
buf_size dd ? |
used_buf dd ? |
endl |
locals |
dst_slot dd ? |
dst_offset dd ? |
buf_size dd ? |
used_buf dd ? |
endl |
pushf |
cli |
pushf |
cli |
mov eax, [PID] |
call pid_to_slot |
test eax,eax |
jz .no_pid |
mov eax, [PID] |
call pid_to_slot |
test eax,eax |
jz .no_pid |
mov [dst_slot], eax |
shl eax,8 |
mov edi,[eax+SLOT_BASE+0xa0] ;is ipc area defined? |
test edi,edi |
jz .no_ipc_area |
mov [dst_slot], eax |
shl eax,8 |
mov edi,[eax+SLOT_BASE+0xa0] ;is ipc area defined? |
test edi,edi |
jz .no_ipc_area |
mov ebx, edi |
and ebx, 0xFFF |
mov [dst_offset], ebx |
mov ebx, edi |
and ebx, 0xFFF |
mov [dst_offset], ebx |
mov esi, [eax+SLOT_BASE+0xa4] |
mov [buf_size], esi |
mov esi, [eax+SLOT_BASE+0xa4] |
mov [buf_size], esi |
mov ecx, [ipc_tmp] |
cmp esi, 0x40000-0x1000 ; size of [ipc_tmp] minus one page |
jbe @f |
push eax esi edi |
add esi,0x1000 |
stdcall alloc_kernel_space,esi |
mov ecx, eax |
pop edi esi eax |
mov ecx, [ipc_tmp] |
cmp esi, 0x40000-0x1000 ; size of [ipc_tmp] minus one page |
jbe @f |
push eax esi edi |
add esi,0x1000 |
stdcall alloc_kernel_space,esi |
mov ecx, eax |
pop edi esi eax |
@@: |
mov [used_buf], ecx |
stdcall map_mem, ecx, [SLOT_BASE+eax+0xB8],\ |
edi, esi |
mov [used_buf], ecx |
stdcall map_mem, ecx, [SLOT_BASE+eax+0xB8],\ |
edi, esi |
mov edi, [dst_offset] |
add edi, [used_buf] |
cmp dword [edi], 0 |
jnz .ipc_blocked ;if dword [buffer]<>0 - ipc blocked now |
mov edi, [dst_offset] |
add edi, [used_buf] |
cmp dword [edi], 0 |
jnz .ipc_blocked ;if dword [buffer]<>0 - ipc blocked now |
mov edx, dword [edi+4] |
lea ebx, [edx+8] |
add ebx, [msg_size] |
cmp ebx, [buf_size] |
ja .buffer_overflow ;esi<0 - not enough memory in buffer |
mov edx, dword [edi+4] |
lea ebx, [edx+8] |
add ebx, [msg_size] |
cmp ebx, [buf_size] |
ja .buffer_overflow ;esi<0 - not enough memory in buffer |
mov dword [edi+4], ebx |
mov eax,[TASK_BASE] |
mov eax, [eax+0x04] ;eax - our PID |
add edi, edx |
mov [edi], eax |
mov ecx, [msg_size] |
mov dword [edi+4], ebx |
mov eax,[TASK_BASE] |
mov eax, [eax+0x04] ;eax - our PID |
add edi, edx |
mov [edi], eax |
mov ecx, [msg_size] |
mov [edi+4], ecx |
add edi, 8 |
mov esi, [msg_addr] |
mov [edi+4], ecx |
add edi, 8 |
mov esi, [msg_addr] |
; add esi, new_app_base |
cld |
rep movsb |
cld |
rep movsb |
mov ebx, [ipc_tmp] |
mov edx, ebx |
shr ebx, 12 |
xor eax, eax |
mov [page_tabs+ebx*4], eax |
invlpg [edx] |
mov ebx, [ipc_tmp] |
mov edx, ebx |
shr ebx, 12 |
xor eax, eax |
mov [page_tabs+ebx*4], eax |
invlpg [edx] |
mov ebx, [ipc_pdir] |
mov edx, ebx |
shr ebx, 12 |
xor eax, eax |
mov [page_tabs+ebx*4], eax |
invlpg [edx] |
mov ebx, [ipc_pdir] |
mov edx, ebx |
shr ebx, 12 |
xor eax, eax |
mov [page_tabs+ebx*4], eax |
invlpg [edx] |
mov ebx, [ipc_ptab] |
mov edx, ebx |
shr ebx, 12 |
xor eax, eax |
mov [page_tabs+ebx*4], eax |
invlpg [edx] |
mov ebx, [ipc_ptab] |
mov edx, ebx |
shr ebx, 12 |
xor eax, eax |
mov [page_tabs+ebx*4], eax |
invlpg [edx] |
mov eax, [dst_slot] |
shl eax, 8 |
or [eax+SLOT_BASE+0xA8],dword 0x40 |
cmp dword [check_idle_semaphore],20 |
jge .ipc_no_cis |
mov eax, [dst_slot] |
shl eax, 8 |
or [eax+SLOT_BASE+0xA8],dword 0x40 |
cmp dword [check_idle_semaphore],20 |
jge .ipc_no_cis |
mov dword [check_idle_semaphore],5 |
mov dword [check_idle_semaphore],5 |
.ipc_no_cis: |
push 0 |
jmp .ret |
push 0 |
jmp .ret |
.no_pid: |
popf |
mov eax, 4 |
ret |
popf |
mov eax, 4 |
ret |
.no_ipc_area: |
popf |
xor eax, eax |
inc eax |
ret |
popf |
xor eax, eax |
inc eax |
ret |
.ipc_blocked: |
push 2 |
jmp .ret |
push 2 |
jmp .ret |
.buffer_overflow: |
push 3 |
push 3 |
.ret: |
mov eax, [used_buf] |
cmp eax, [ipc_tmp] |
jz @f |
stdcall free_kernel_space,eax |
mov eax, [used_buf] |
cmp eax, [ipc_tmp] |
jz @f |
stdcall free_kernel_space,eax |
@@: |
pop eax |
popf |
ret |
pop eax |
popf |
ret |
endp |
align 4 |
sysfn_meminfo: |
; add ecx, new_app_base |
cmp ecx, OS_BASE |
jae .fail |
; add ecx, new_app_base |
cmp ecx, OS_BASE |
jae .fail |
mov eax, [pg_data.pages_count] |
mov [ecx], eax |
shl eax, 12 |
mov [esp+32], eax |
mov eax, [pg_data.pages_free] |
mov [ecx+4], eax |
mov eax, [pg_data.pages_faults] |
mov [ecx+8], eax |
mov eax, [heap_size] |
mov [ecx+12], eax |
mov eax, [heap_free] |
mov [ecx+16], eax |
mov eax, [heap_blocks] |
mov [ecx+20], eax |
mov eax, [free_blocks] |
mov [ecx+24], eax |
ret |
mov eax, [pg_data.pages_count] |
mov [ecx], eax |
shl eax, 12 |
mov [esp+32], eax |
mov eax, [pg_data.pages_free] |
mov [ecx+4], eax |
mov eax, [pg_data.pages_faults] |
mov [ecx+8], eax |
mov eax, [heap_size] |
mov [ecx+12], eax |
mov eax, [heap_free] |
mov [ecx+16], eax |
mov eax, [heap_blocks] |
mov [ecx+20], eax |
mov eax, [free_blocks] |
mov [ecx+24], eax |
ret |
.fail: |
mov dword [esp+32], -1 |
ret |
mov dword [esp+32], -1 |
ret |
align 4 |
f68call: |
dd f68.11 |
dd f68.12 |
dd f68.13 |
dd f68.14 |
dd f68.fail ;moved to f68.24 |
dd f68.16 |
dd f68.17 |
dd f68.fail ;moved to f68.25 |
dd f68.19 |
dd f68.20 |
dd f68.21 |
dd f68.22 |
dd f68.23 |
dd f68.24 |
dd f68.25 |
dd f68.11 |
dd f68.12 |
dd f68.13 |
dd f68.14 |
dd f68.fail ;moved to f68.24 |
dd f68.16 |
dd f68.17 |
dd f68.fail ;moved to f68.25 |
dd f68.19 |
dd f68.20 |
dd f68.21 |
dd f68.22 |
dd f68.23 |
dd f68.24 |
dd f68.25 |
align 4 |
f68: |
cmp eax,4 |
jle sys_sheduler |
cmp eax,4 |
jle sys_sheduler |
cmp eax, 11 |
jb .fail |
cmp eax, 11 |
jb .fail |
cmp eax, 25 |
ja .fail |
cmp eax, 25 |
ja .fail |
jmp dword [f68call+eax*4-11*4] |
jmp dword [f68call+eax*4-11*4] |
.11: |
call init_heap |
mov [esp+36], eax |
ret |
call init_heap |
mov [esp+36], eax |
ret |
.12: |
stdcall user_alloc, ebx |
mov [esp+36], eax |
ret |
stdcall user_alloc, ebx |
mov [esp+36], eax |
ret |
.13: |
stdcall user_free, ebx |
mov [esp+36], eax |
ret |
stdcall user_free, ebx |
mov [esp+36], eax |
ret |
.14: |
cmp ebx, OS_BASE |
jae .fail |
mov edi,ebx |
call get_event_ex |
mov [esp+36], eax |
ret |
cmp ebx, OS_BASE |
jae .fail |
mov edi,ebx |
call get_event_ex |
mov [esp+36], eax |
ret |
.24: |
mov eax, [current_slot] |
xchg ebx, [eax+APPDATA.exc_handler] |
xchg ecx, [eax+APPDATA.except_mask] |
mov [esp+36], ebx ; reg_eax+8 |
mov [esp+24], ecx ; reg_ebx+8 |
ret |
mov eax, [current_slot] |
xchg ebx, [eax+APPDATA.exc_handler] |
xchg ecx, [eax+APPDATA.except_mask] |
mov [esp+36], ebx ; reg_eax+8 |
mov [esp+24], ecx ; reg_ebx+8 |
ret |
.16: |
test ebx, ebx |
jz .fail |
cmp ebx, OS_BASE |
jae .fail |
stdcall get_service, ebx |
mov [esp+36], eax |
ret |
test ebx, ebx |
jz .fail |
cmp ebx, OS_BASE |
jae .fail |
stdcall get_service, ebx |
mov [esp+36], eax |
ret |
.17: |
call srv_handlerEx ;ebx |
mov [esp+36], eax |
ret |
call srv_handlerEx ;ebx |
mov [esp+36], eax |
ret |
.25: |
cmp ebx,32 |
jae .fail |
mov eax, [current_slot] |
btr [eax+APPDATA.except_mask],ebx |
setc byte[esp+36] |
jecxz @f |
bts [eax+APPDATA.except_mask],ebx |
cmp ebx,32 |
jae .fail |
mov eax, [current_slot] |
btr [eax+APPDATA.except_mask],ebx |
setc byte[esp+36] |
jecxz @f |
bts [eax+APPDATA.except_mask],ebx |
@@: ret |
.19: |
cmp ebx, OS_BASE |
jae .fail |
stdcall load_library, ebx |
mov [esp+36], eax |
ret |
cmp ebx, OS_BASE |
jae .fail |
stdcall load_library, ebx |
mov [esp+36], eax |
ret |
.20: |
mov eax, ecx |
call user_realloc |
mov [esp+36], eax |
ret |
mov eax, ecx |
call user_realloc |
mov [esp+36], eax |
ret |
.21: |
cmp ebx, OS_BASE |
jae .fail |
cmp ebx, OS_BASE |
jae .fail |
stdcall load_PE, ebx |
stdcall load_PE, ebx |
test eax, eax |
jz @F |
test eax, eax |
jz @F |
mov esi, eax |
stdcall eax, DRV_ENTRY |
mov esi, eax |
stdcall eax, DRV_ENTRY |
test eax, eax |
jz @F |
test eax, eax |
jz @F |
mov [eax+SRV.entry], esi |
mov [eax+SRV.entry], esi |
@@: |
mov [esp+36], eax |
ret |
mov [esp+36], eax |
ret |
.22: |
cmp ebx, OS_BASE |
jae .fail |
cmp ebx, OS_BASE |
jae .fail |
stdcall shmem_open, ebx, ecx, edx |
mov [esp+28], edx |
mov [esp+36], eax |
ret |
stdcall shmem_open, ebx, ecx, edx |
mov [esp+28], edx |
mov [esp+36], eax |
ret |
.23: |
cmp ebx, OS_BASE |
jae .fail |
cmp ebx, OS_BASE |
jae .fail |
stdcall shmem_close, ebx |
mov [esp+36], eax |
ret |
stdcall shmem_close, ebx |
mov [esp+36], eax |
ret |
.fail: |
xor eax, eax |
mov [esp+36], eax |
ret |
xor eax, eax |
mov [esp+36], eax |
ret |
align 4 |
proc load_pe_driver stdcall, file:dword |
stdcall load_PE, [file] |
test eax, eax |
jz .fail |
stdcall load_PE, [file] |
test eax, eax |
jz .fail |
mov esi, eax |
stdcall eax, DRV_ENTRY |
test eax, eax |
jz .fail |
mov esi, eax |
stdcall eax, DRV_ENTRY |
test eax, eax |
jz .fail |
mov [eax+SRV.entry], esi |
ret |
mov [eax+SRV.entry], esi |
ret |
.fail: |
xor eax, eax |
ret |
xor eax, eax |
ret |
endp |
1143,166 → 1143,166 |
align 4 |
proc init_mtrr |
cmp [BOOT_VAR+0x901c],byte 2 |
je .exit |
cmp [BOOT_VAR+0x901c],byte 2 |
je .exit |
bt [cpu_caps], CAPS_MTRR |
jnc .exit |
bt [cpu_caps], CAPS_MTRR |
jnc .exit |
mov eax, cr0 |
or eax, 0x60000000 ;disable caching |
mov cr0, eax |
wbinvd ;invalidate cache |
mov eax, cr0 |
or eax, 0x60000000 ;disable caching |
mov cr0, eax |
wbinvd ;invalidate cache |
mov ecx, 0x2FF |
rdmsr ; |
push eax |
mov ecx, 0x2FF |
rdmsr ; |
push eax |
xor edx, edx |
xor eax, eax |
mov ecx, 0x2FF |
wrmsr ;disable all MTRR |
xor edx, edx |
xor eax, eax |
mov ecx, 0x2FF |
wrmsr ;disable all MTRR |
mov eax, [MEM_AMOUNT] |
mov eax, [MEM_AMOUNT] |
; round eax up to next power of 2 |
dec eax |
bsr ecx, eax |
mov eax, 2 |
shl eax, cl |
stdcall set_mtrr, edx,edx,eax,MEM_WB |
stdcall set_mtrr, 1,[LFBAddress],[LFBSize],MEM_WC |
xor edx, edx |
xor eax, eax |
mov ecx, 0x204 |
mov ebx, 6 |
dec eax |
bsr ecx, eax |
mov eax, 2 |
shl eax, cl |
stdcall set_mtrr, edx,edx,eax,MEM_WB |
stdcall set_mtrr, 1,[LFBAddress],[LFBSize],MEM_WC |
xor edx, edx |
xor eax, eax |
mov ecx, 0x204 |
mov ebx, 6 |
@@: |
wrmsr ;disable unused MTRR |
inc ecx |
wrmsr |
inc ecx |
dec ebx |
jnz @b |
wrmsr ;disable unused MTRR |
inc ecx |
wrmsr |
inc ecx |
dec ebx |
jnz @b |
wbinvd ;again invalidate |
wbinvd ;again invalidate |
pop eax |
or eax, 0x800 ;set default memtype to UC |
and al, 0xF0 |
mov ecx, 0x2FF |
wrmsr ;and enable MTRR |
pop eax |
or eax, 0x800 ;set default memtype to UC |
and al, 0xF0 |
mov ecx, 0x2FF |
wrmsr ;and enable MTRR |
mov eax, cr0 |
and eax, not 0x60000000 |
mov cr0, eax ; enable caching |
mov eax, cr0 |
and eax, not 0x60000000 |
mov cr0, eax ; enable caching |
.exit: |
ret |
ret |
endp |
align 4 |
proc set_mtrr stdcall, reg:dword,base:dword,size:dword,mem_type:dword |
xor edx, edx |
mov eax, [base] |
or eax, [mem_type] |
mov ecx, [reg] |
lea ecx, [0x200+ecx*2] |
wrmsr |
xor edx, edx |
mov eax, [base] |
or eax, [mem_type] |
mov ecx, [reg] |
lea ecx, [0x200+ecx*2] |
wrmsr |
mov ebx, [size] |
dec ebx |
mov eax, 0xFFFFFFFF |
mov edx, 0x0000000F |
sub eax, ebx |
sbb edx, 0 |
or eax, 0x800 |
inc ecx |
wrmsr |
ret |
mov ebx, [size] |
dec ebx |
mov eax, 0xFFFFFFFF |
mov edx, 0x0000000F |
sub eax, ebx |
sbb edx, 0 |
or eax, 0x800 |
inc ecx |
wrmsr |
ret |
endp |
align 4 |
proc stall stdcall, delay:dword |
push ecx |
push edx |
push ebx |
push eax |
push ecx |
push edx |
push ebx |
push eax |
mov eax, [delay] |
mul [stall_mcs] |
mov ebx, eax ;low |
mov ecx, edx ;high |
rdtsc |
add ebx, eax |
adc ecx,edx |
mov eax, [delay] |
mul [stall_mcs] |
mov ebx, eax ;low |
mov ecx, edx ;high |
rdtsc |
add ebx, eax |
adc ecx,edx |
@@: |
rdtsc |
sub eax, ebx |
sbb edx, ecx |
jb @B |
rdtsc |
sub eax, ebx |
sbb edx, ecx |
jb @B |
pop eax |
pop ebx |
pop edx |
pop ecx |
ret |
pop eax |
pop ebx |
pop edx |
pop ecx |
ret |
endp |
align 4 |
proc create_ring_buffer stdcall, size:dword, flags:dword |
locals |
buf_ptr dd ? |
endl |
locals |
buf_ptr dd ? |
endl |
mov eax, [size] |
test eax, eax |
jz .fail |
mov eax, [size] |
test eax, eax |
jz .fail |
add eax, eax |
stdcall alloc_kernel_space, eax |
test eax, eax |
jz .fail |
add eax, eax |
stdcall alloc_kernel_space, eax |
test eax, eax |
jz .fail |
push ebx |
push ebx |
mov [buf_ptr], eax |
mov [buf_ptr], eax |
mov ebx, [size] |
shr ebx, 12 |
push ebx |
mov ebx, [size] |
shr ebx, 12 |
push ebx |
stdcall alloc_pages, ebx |
pop ecx |
stdcall alloc_pages, ebx |
pop ecx |
test eax, eax |
jz .mm_fail |
test eax, eax |
jz .mm_fail |
push edi |
push edi |
or eax, [flags] |
mov edi, [buf_ptr] |
mov ebx, [buf_ptr] |
mov edx, ecx |
shl edx, 2 |
shr edi, 10 |
or eax, [flags] |
mov edi, [buf_ptr] |
mov ebx, [buf_ptr] |
mov edx, ecx |
shl edx, 2 |
shr edi, 10 |
@@: |
mov [page_tabs+edi], eax |
mov [page_tabs+edi+edx], eax |
invlpg [ebx] |
invlpg [ebx+0x10000] |
add eax, 0x1000 |
add ebx, 0x1000 |
add edi, 4 |
dec ecx |
jnz @B |
mov [page_tabs+edi], eax |
mov [page_tabs+edi+edx], eax |
invlpg [ebx] |
invlpg [ebx+0x10000] |
add eax, 0x1000 |
add ebx, 0x1000 |
add edi, 4 |
dec ecx |
jnz @B |
mov eax, [buf_ptr] |
pop edi |
pop ebx |
ret |
mov eax, [buf_ptr] |
pop edi |
pop ebx |
ret |
.mm_fail: |
stdcall free_kernel_space, [buf_ptr] |
xor eax, eax |
pop ebx |
stdcall free_kernel_space, [buf_ptr] |
xor eax, eax |
pop ebx |
.fail: |
ret |
ret |
endp |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/core/peload.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 978 $ |
$Revision$ |
include 'export.inc' |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/core/sched.inc |
---|
5,7 → 5,7 |
;; Distributed under terms of the GNU General Public License ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 907 $ |
$Revision$ |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/core/string.inc |
---|
5,7 → 5,7 |
;; Author: Kees J. Bot 1 Jan 1994 ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 750 $ |
$Revision$ |
; size_t strncat(char *s1, const char *s2, size_t n) |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/core/sync.inc |
---|
7,7 → 7,7 |
;; Author: Halyavin Andrey, halyavin@land.ru ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 750 $ |
$Revision$ |
if ~defined sync_inc |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/core/sys32.inc |
---|
11,7 → 11,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 982 $ |
$Revision$ |
align 4 ;3A08 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/core/syscall.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 940 $ |
$Revision$ |
; Old style system call converter |
align 16 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/core/taskman.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 819 $ |
$Revision$ |
GREEDY_KERNEL equ 0 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/core/v86.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 979 $ |
$Revision$ |
; Virtual-8086 mode manager |
; diamond, 2007, 2008 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/data16.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 750 $ |
$Revision$ |
flm db 0 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/data32.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 1018 $ |
$Revision$ |
keymap: |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/detect/biosdisk.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/detect/biosmem.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/detect/dev_fd.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 593 $ |
$Revision$ |
;*************************************************** |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/detect/dev_hdcd.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 593 $ |
$Revision$ |
;****************************************************** |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/detect/disks.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 750 $ |
$Revision$ |
include 'dev_fd.inc' |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/detect/getcache.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 750 $ |
$Revision$ |
pusha |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/detect/sear_par.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 709 $ |
$Revision$ |
;**************************************************** |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/drivers/RTL8029.asm |
---|
18,6 → 18,8 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision$ |
format MS COFF |
API_VERSION equ 0x01000100 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/drivers/RTL8139.asm |
---|
14,6 → 14,8 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision$ |
format MS COFF |
API_VERSION equ 0x01000100 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/drivers/fdo.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/drivers/i8255x.asm |
---|
16,6 → 16,8 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision$ |
format MS COFF |
API_VERSION equ 0x01000100 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/drivers/imports.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/drivers/pcnet32.asm |
---|
10,7 → 10,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;$Revision$ |
$Revision$ |
format MS COFF |
77,7 → 77,7 |
; The following fields up to .tx_ring_phys inclusive form |
; initialization block for hardware; do not modify |
align 4 ; initialization block must be dword-aligned |
align 4 ; initialization block must be dword-aligned |
.private: |
.mode_ dw ? |
.tlen_rlen dw ? |
955,8 → 955,8 |
; ------------------------------------------------ |
end if |
; mov esi, 1 |
; call Sleep |
; mov esi, 1 |
; call Sleep |
reset: |
1217,7 → 1217,7 |
align 4 |
int_handler: |
; DEBUGF 1,"IRQ %x ",eax:2 ; no, you cant replace 'eax:2' with 'al', this must be a bug in FDO |
; DEBUGF 1,"IRQ %x ",eax:2 ; no, you cant replace 'eax:2' with 'al', this must be a bug in FDO |
; find pointer of device wich made IRQ occur |
1300,7 → 1300,7 |
and ecx, 3 |
rep movsb |
; mov word [eax + buf_head.length], PCNET_PKT_BUF_SZ_NEG |
; mov word [eax + buf_head.length], PCNET_PKT_BUF_SZ_NEG |
mov word [eax + buf_head.status], PCNET_RXSTAT_OWN ; Set OWN bit back to 1 (controller may write to tx-buffer again now) |
inc [ebx + device.cur_rx] ; update descriptor |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/drivers/proc32.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/drivers/sb16/CONFIG.INC |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/drivers/sb16/SB16.INC |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/drivers/sb16/sb16.asm |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/drivers/sceletone.asm |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/drivers/usb/urb.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/drivers/usb/usb.asm |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/fdo.inc |
---|
4,7 → 4,7 |
;; Distributed under terms of the GNU General Public License ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 750 $ |
$Revision$ |
; |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/fs/fat12.inc |
---|
8,7 → 8,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 593 $ |
$Revision$ |
n_sector dd 0 ; temporary save for sector value |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/fs/fat32.inc |
---|
44,7 → 44,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 709 $ |
$Revision$ |
cache_max equ 1919 ; max. is 1919*512+0x610000=0x6ffe00 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/fs/fs.inc |
---|
17,7 → 17,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 709 $ |
$Revision$ |
iglobal |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/fs/fs_lfn.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 709 $ |
$Revision$ |
image_of_eax EQU esp+36 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/fs/iso9660.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
uglobal |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/fs/ntfs.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
ntfs_test_bootsec: |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/fs/parse_fn.inc |
---|
14,7 → 14,7 |
; |
;------------------------------------------------------------------------- |
$Revision: 750 $ |
$Revision$ |
iglobal |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/fs/part_set.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 709 $ |
$Revision$ |
;************************************************************* |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/gui/button.inc |
---|
5,7 → 5,7 |
;; Distributed under terms of the GNU General Public License ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
max_buttons=4095 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/gui/event.inc |
---|
5,7 → 5,7 |
;; Distributed under terms of the GNU General Public License ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 671 $ |
$Revision$ |
uglobal |
align 4 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/gui/font.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
; // Alver 22.06.2008 // { |
align 4 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/gui/mouse.inc |
---|
5,7 → 5,7 |
;; Distributed under terms of the GNU General Public License ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 593 $ |
$Revision$ |
iglobal |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/gui/skincode.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 593 $ |
$Revision$ |
include "skindata.inc" |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/gui/skindata.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 593 $ |
$Revision$ |
; |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/gui/window.inc |
---|
6,7 → 6,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 994 $ |
$Revision$ |
get_titlebar_height: ; edi = window draw_data pointer |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/hid/keyboard.inc |
---|
5,7 → 5,7 |
;; Distributed under terms of the GNU General Public License ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 641 $ |
$Revision$ |
;// mike.dld [ |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/hid/mousedrv.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
; check mouse |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/hid/set_dtc.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 593 $ |
$Revision$ |
;setting date,time,clock and alarm-clock |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/imports.inc |
---|
11,7 → 11,7 |
; |
;============================================================================ |
$Revision: 750 $ |
$Revision$ |
align 4 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/init.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
MEM_WB equ 6 ;write-back memory |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/kernel.asm |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/kernel32.inc |
---|
13,7 → 13,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
;struc db [a] { common . db a |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/kglobals.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 750 $ |
$Revision$ |
;------------------------------------------------------------------ |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/macros.inc |
---|
9,7 → 9,7 |
\} |
} |
$Revision: 750 $ |
$Revision$ |
; structure definition helper |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/memmap.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/network/ARP.inc |
---|
17,7 → 17,7 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
ARP_NO_ENTRY equ 0 |
26,7 → 26,7 |
ARP_RESPONSE_TIMEOUT equ 3 |
ARP_REQUEST_TTL = 20 ; in seconds |
ARP_ENTRY_TTL = 30 ; in seconds |
ARP_ENTRY_TTL = 600 ; in seconds |
ETHER_ARP equ 0x0608 |
135,8 → 135,10 |
mov ebx, [IP_LIST+edx] |
and ebx, [SUBNET_LIST+edx] |
mov ecx, eax |
and ecx, [SUBNET_LIST+edx] |
cmp ecx, ebx |
je .local |
146,12 → 148,13 |
.local: |
; try to find it on the list |
mov ecx, [NumARP] |
test ecx, ecx |
jz .not_in_list |
mov esi, ARPTable + ARP_ENTRY.IP |
.scan_loop: |
scasd |
jz .found_it |
add esi, ARP_ENTRY.size - 4 |
cmp [esi], eax |
je .found_it |
add esi, ARP_ENTRY.size |
loop .scan_loop |
.not_in_list: |
177,7 → 180,8 |
ret |
.found_it: |
DEBUGF 1,"Found MAC! (%u-%u-%u-%u-%u-%u)\n",[esi+0]:2,[esi+1]:2,[esi+2]:2,[esi+3]:2,[esi+4]:2,[esi+5]:2 |
add esi, ARP_ENTRY.MAC |
DEBUGF 1,"Found MAC! (%x-%x-%x-%x-%x-%x)\n",[esi+0]:2,[esi+1]:2,[esi+2]:2,[esi+3]:2,[esi+4]:2,[esi+5]:2 |
movzx eax, word [esi] |
mov ebx, [esi+2] |
221,35 → 225,31 |
cmp edi, -1 |
je .exit |
mov word [edi + ARP_Packet.HardwareType], 0x0100 ;Ethernet |
mov word [edi + ARP_Packet.ProtocolType], 0x0008 ;IP |
mov byte [edi + ARP_Packet.HardwareSize], 6 ;MAC-addr length |
mov byte [edi + ARP_Packet.ProtocolSize], 4 ;IP-addr length |
mov word [edi + ARP_Packet.Opcode], ARP_REQ_OPCODE ;Request |
mov ecx, eax |
mov [edi + ARP_Packet.HardwareType], 0x0100 ;Ethernet |
mov [edi + ARP_Packet.ProtocolType], 0x0008 ;IP |
mov [edi + ARP_Packet.HardwareSize], 6 ;MAC-addr length |
mov [edi + ARP_Packet.ProtocolSize], 4 ;IP-addr length |
mov [edi + ARP_Packet.Opcode], ARP_REQ_OPCODE ;Request |
add edi, ARP_Packet.SenderMAC ; sendermac |
lea esi, [edx + ETH_DEVICE.mac] ; |
lea esi, [ebx + ETH_DEVICE.mac] ; |
movsw ; |
movsd ; |
pop eax ; |
stosd ; |
mov eax, -1 ; destmac |
stosd ; |
stosw ; |
pop eax |
stosd ; |
xor eax, eax ; destmac |
movsw ; |
movsw ; |
DEBUGF 1,"ARP Packet for device %x created successfully\n", ebx |
pop eax |
movsd ; |
push edx ecx |
jmp ETH_Sender |
DEBUGF 1,"ARP Packet for device %x created successfully\n", edx |
call esi |
inc [ARP_PACKETS_TX+4*edi] |
ret |
.exit: |
add esp, 8 |
DEBUGF 1,"Create ARP Packet - failed\n" |
278,30 → 278,31 |
.timer_loop: |
movsx esi, word [ebx + ARP_ENTRY.TTL] |
cmp esi, 0xFFFFFFFF |
cmp [ebx + ARP_ENTRY.TTL], 0xFFFF |
je .timer_loop_end ;if TTL==0xFFFF then it's static entry |
test esi, esi |
cmp [ebx + ARP_ENTRY.TTL], 0 |
jnz .timer_loop_end_with_dec ;if TTL!=0 |
; Ok, TTL is 0 |
;if Status==AWAITING_RESPONSE and TTL==0 |
;then we have to change it to ARP_RESPONSE_TIMEOUT |
cmp word [ebx + ARP_ENTRY.Status], ARP_AWAITING_RESPONSE |
cmp [ebx + ARP_ENTRY.Status], ARP_AWAITING_RESPONSE |
jne @f |
mov word [ebx + ARP_ENTRY.Status], ARP_RESPONSE_TIMEOUT |
mov word [ebx + ARP_ENTRY.TTL], word 0x000A ;10 sec |
mov [ebx + ARP_ENTRY.Status], ARP_RESPONSE_TIMEOUT |
mov [ebx + ARP_ENTRY.TTL], word 0x000A ;10 sec |
jmp .timer_loop_end |
@@: |
;if TTL==0 and Status==VALID_MAPPING, we have to delete it |
;if TTL==0 and Status==RESPONSE_TIMEOUT, delete too |
mov esi, dword[NumARP] |
mov esi, [NumARP] |
sub esi, ecx ;esi=index of entry, will be deleted |
push ebx ecx |
call ARP_del_entry |
pop ecx ebx |
jmp .timer_loop_end |
308,7 → 309,7 |
.timer_loop_end_with_dec: |
dec word [ebx + ARP_ENTRY.TTL] ;decrease TTL |
dec [ebx + ARP_ENTRY.TTL] ;decrease TTL |
.timer_loop_end: |
338,6 → 339,8 |
align 4 |
ARP_add_entry: |
DEBUGF 1,"ARP add entry: " |
mov ecx, [NumARP] |
test ecx, ecx |
jz .add |
355,7 → 358,7 |
cmp dword[esi + ARP_ENTRY.TTL], 0xFFFF ; static entry |
jne .notstatic |
cmp dword[esp + ARP_ENTRY.TTL], 0xFFFF |
jne .exit |
jne .error |
.notstatic: |
mov ebx, [NumARP] |
369,14 → 372,13 |
mov ecx, [NumARP] |
cmp ecx, ARP_TABLE_SIZE |
jge .full |
jge .error |
.add: |
push ecx |
imul ecx, ARP_ENTRY.size |
lea edi, [ecx + ARPTable] |
lea esi, [esp + 4] |
lea esi, [esp + 8] |
mov ecx, ARP_ENTRY.size/2 |
repz movsw |
384,17 → 386,19 |
pop eax |
.exit: |
pop ebx ; return addr |
add esp, ARP_ENTRY.size |
DEBUGF 1,"Exiting\n" |
jmp ebx |
add esp, 14 |
ret |
.error: |
.full: |
DEBUGF 1,"error! \n" |
mov eax, -1 |
jmp .exit |
;--------------------------------------------------------------------------- |
; |
; ARP_del_entry |
407,6 → 411,13 |
align 4 |
ARP_del_entry: |
DEBUGF 1,"ARP del entry %u, total entrys: %u\n", esi, [NumARP] |
cmp esi, [NumARP] |
jge .error |
DEBUGF 1,"deleting the entry..\n" |
imul esi, ARP_ENTRY.size |
mov ecx, (ARP_TABLE_SIZE - 1) * ARP_ENTRY.size |
416,10 → 427,10 |
lea esi, [edi + ARP_ENTRY.size] ;esi=ptr to next entry |
shr ecx,1 ;ecx/2 => ARP_ENTRY_SIZE MUST BE EVEN NUMBER! |
cld |
rep movsw |
dec [NumARP] ;decrease arp-entries counter |
.error: |
ret |
449,35 → 460,41 |
cmp word [edx + ARP_Packet.Opcode], ARP_REP_OPCODE ; Is this a reply packet? |
jne .maybe_request |
DEBUGF 1,"ARP_Handler - it's a reply packet from %u.%u.%u.%u\n",\ |
[edx + ARP_Packet.SenderIP]:1,[edx + ARP_Packet.SenderIP+1]:1,[edx + ARP_Packet.SenderIP+2]:1,[edx + ARP_Packet.SenderIP+3]:1, |
mov ecx, [NumARP] |
test ecx, ecx |
jz .exit |
mov eax, [esp] |
mov eax, [eax + ARP_Packet.SenderIP] |
mov eax, [edx + ARP_Packet.SenderIP] |
mov esi, ARPTable+ARP_ENTRY.IP |
.loop: |
scasd |
jz .gotit |
add esi, ARP_ENTRY.size-4 |
cmp [esi], eax |
je .gotit |
add esi, ARP_ENTRY.size |
loop .loop |
jmp .exit |
.gotit: |
cmp [esi-4+ARP_ENTRY.Status], 0x0300 ;if it is a static entry, dont touch it |
DEBUGF 1,"ARP_Handler - found matching entry\n" |
cmp [esi+ARP_ENTRY.Status], 0x0300 ;if it is a static entry, dont touch it |
je .exit |
mov [esi-4+ARP_ENTRY.Status], ARP_VALID_MAPPING |
mov [esi+ARP_ENTRY.TTL-4], ARP_ENTRY_TTL |
DEBUGF 1,"ARP_Handler - updating entry\n" |
mov ebx, [esp] |
mov eax, dword [ebx + ARP_Packet.SenderMAC] |
mov dword [esi+ARP_ENTRY.MAC-4], eax |
mov ax , word [ebx + ARP_Packet.SenderMAC + 4] |
mov word [esi+ARP_ENTRY.MAC-4+4], ax |
mov [esi+ARP_ENTRY.Status], ARP_VALID_MAPPING |
mov [esi+ARP_ENTRY.TTL], ARP_ENTRY_TTL |
mov eax, dword [edx + ARP_Packet.SenderMAC] |
mov dword [esi+ARP_ENTRY.MAC], eax |
mov ax , word [edx + ARP_Packet.SenderMAC + 4] |
mov word [esi+ARP_ENTRY.MAC+4], ax |
jmp .exit |
489,7 → 506,7 |
jne .exit |
call ETH_struc2dev |
DEBUGF 1,"ARP Packet came from device: %u\n", edi |
DEBUGF 1,"ARP Request packet through device: %u\n", edi |
inc [ARP_PACKETS_RX+4*edi] |
cmp edi, -1 |
jz .exit |
536,6 → 553,8 |
; mov ax , ETHER_ARP |
; stosw |
DEBUGF 1,"ARP_Handler - Sending reply \n" |
jmp ETH_Sender ; And send it! |
.exit: |
542,7 → 561,7 |
call kernel_free |
add esp, 4 ; pop (balance stack) |
DEBUGF 1,"ARP_Handler - fail\n" |
DEBUGF 1,"ARP_Handler - exiting\n" |
ret |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/network/IPv4.inc |
---|
16,7 → 16,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 922 $ |
$Revision$ |
; IP underlying protocols numbers |
507,11 → 507,13 |
align 4 |
IPv4_create_packet: |
DEBUGF 1,"Create IPv4 Packet\n" |
DEBUGF 1,"Create IPv4 Packet (size=%u)\n", ecx |
cmp ecx, 1514 |
cmp ecx, 1480 |
jg .exit_ |
push ecx eax ebx dx di |
cmp eax, -1 |
je .broadcast ; If it is broadcast, just send |
518,18 → 520,10 |
call ARP_IP_to_MAC |
cmp eax, -1 |
jne .found |
je .not_found |
DEBUGF 1,"Create IPv4 Packet - ARP entry not found!\n" |
; TODO: QUEUE! |
or edi, -1 |
ret |
.found: |
push ebx |
push ax |
push ebx |
jmp .send |
537,19 → 531,17 |
push word -1 |
push dword -1 |
.send: |
push ecx eax ebx dx di |
call IPv4_dest_to_dev |
inc [IP_PACKETS_TX+4*edi] |
mov edi, [ETH_DRV_LIST + 4*edi] |
lea eax, [edi + ETH_DEVICE.mac] |
lea ebx, [esp+16] |
mov ecx, [esp+12] |
mov edx, [ETH_DRV_LIST + 4*edi] |
lea eax, [edx + ETH_DEVICE.mac] |
mov ebx, esp |
mov ecx, [esp+18] ;; 18 or 22 ?? |
add ecx, IPv4_Packet.DataOrOptional |
mov edx, edi ;;; |
mov di , ETHER_IPv4 |
call ETH_create_Packet ; TODO: figure out a way to make this work with other protocols too |
add esp, 6 |
cmp edi, -1 |
je .exit |
578,12 → 570,14 |
DEBUGF 1,"IPv4 Packet for device %x created successfully\n", edx |
add esp, 6 |
ret |
.not_found: |
DEBUGF 1,"Create IPv4 Packet - ARP entry not found!\n" |
; TODO: QUEUE! |
.exit: |
add esp, 16+6 |
add esp, 16 |
.exit_: |
DEBUGF 1,"Create IPv4 Packet - failed\n" |
or edi, -1 |
591,6 → 585,7 |
;--------------------------------------------------------------------------- |
; |
; IPv4_dest_to_dev |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/network/IPv6.inc |
---|
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/network/ethernet.inc |
---|
14,7 → 14,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
MAX_ETH_DEVICES equ MAX_NET_DEVICES |
ETH_QUEUE_SIZE equ 16 |
352,11 → 352,11 |
; device number in edx |
; protocol in di |
; |
; OUT: edi is -1 on error, pointer to buffer otherwise ;; TODO: XCHG EDX AND EBX output parameters |
; OUT: edi is -1 on error, pointer to buffer otherwise |
; eax points to buffer start |
; ebx is size of complete buffer |
; ebx is pointer to device structure |
; ecx is unchanged (packet size of embedded data) |
; edx is pointer to device structure |
; edx is size of complete buffer |
; esi points to procedure wich needs to be called to send packet |
; |
;--------------------------------------------------------------------------- |
364,11 → 364,9 |
align 4 |
ETH_create_Packet: |
DEBUGF 1,"Creating Ethernet Packet:\n" |
DEBUGF 1,"Creating Ethernet Packet (size=%u): \n", ecx |
cmp ecx, 60-ETH_FRAME.Data |
jl .exit |
cmp ecx, 1514-ETH_FRAME.Data |
cmp ecx, 1500 |
jg .exit |
push ecx di eax ebx edx |
394,25 → 392,34 |
stosw |
lea eax, [edi - ETH_FRAME.Data] ; Set eax to buffer start |
mov ebx, ecx ; Set ebx to complete buffer size |
mov edx, ecx ; Set ebx to complete buffer size |
pop ecx |
mov esi, ETH_Sender |
xor edx, edx ;;;; TODO: Fixme |
mov edx, [ETH_DRV_LIST + edx] |
xor ebx, ebx ;;;; TODO: Fixme |
mov ebx, [ETH_DRV_LIST + ebx] |
DEBUGF 1,"done: %x size:%u device:%x\n", eax, ebx, edx |
cmp edx, 46 + ETH_FRAME.Data ; If data size is less then 46, add padding bytes |
jg .continue |
mov edx, 46 + ETH_FRAME.Data |
.continue: |
DEBUGF 1,"done: %x size:%u device:%x\n", eax, edx, ebx |
ret |
.pop_exit: |
DEBUGF 1,"Out of ram space!!\n" |
add esp, 18 |
or edi,-1 |
ret |
.exit: |
DEBUGF 1,"Packet too large!\n" |
or edi, -1 |
ret |
;--------------------------------------------------------------------------- |
; |
; ETH_API |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/network/icmp.inc |
---|
17,7 → 17,7 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 593 $ |
$Revision$ |
; ICMP types & codes |
214,7 → 214,7 |
.check_sockets: |
; TODO: validate the header & checksum. Discard buffer if error |
; TODO: validate the header & checksum. |
; Look for an open ICMP socket |
387,7 → 387,7 |
cmp edi, -1 |
je .exit |
DEBUGF 1,"full icmp packet size: %u\n", ebx |
DEBUGF 1,"full icmp packet size: %u\n", edx |
pop eax |
mov word [edi + ICMP_Packet.Type], ax ; Write both type and code bytes at once |
411,8 → 411,7 |
and cx , 3 |
rep movsb |
sub edi, ebx ;; TODO: find a better way to remember start of packet |
xchg ebx, edx |
sub edi, edx ;; TODO: find a better way to remember start of packet |
mov ecx, [ebx + ETH_DEVICE.transmit] |
push edx edi ecx |
DEBUGF 1,"Sending ICMP Packet\n" |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/network/queue.inc |
---|
12,7 → 12,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
struct queue |
.size dd ? |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/network/socket.inc |
---|
14,7 → 14,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 1019 $ |
$Revision$ |
align 4 |
struct SOCKET |
27,8 → 27,8 |
.Protocol dd ? ; ICMP/IPv4/ARP/ |
.LocalIP dd ? ; local IP address |
.RemoteIP dd ? ; remote IP address |
.LocalPort dw ? ; local port |
.RemotePort dw ? ; remote port |
.LocalPort dw ? ; local port (In INET byte order) |
.RemotePort dw ? ; remote port (IN INET byte order |
.OrigRemoteIP dd ? ; original remote IP address (used to reset to LISTEN state) |
.OrigRemotePort dw ? ; original remote port (used to reset to LISTEN state) |
.rxDataCount dd ? ; rx data count |
130,6 → 130,7 |
; OUT: eax is socket num, -1 on error |
; |
;----------------------------------------------- |
align 4 |
socket_open: |
DEBUGF 1,"socket_open: domain: %u, type: %u",ecx, edx |
162,7 → 163,7 |
; OUT: 0 on success |
; |
;----------------------------------------------- |
align 4 |
socket_bind: |
DEBUGF 1,"Socket_bind: socknum: %u sockaddr: %x, length: %u, ",ecx,edx,esi |
175,51 → 176,32 |
jl s_error |
cmp word [edx], AF_INET4 |
je .af_inet4 |
jne s_error |
jmp s_error |
.af_inet4: |
cmp esi, 6 |
jl s_error |
mov ecx, [eax + SOCKET.Type] |
mov bx, word [edx + 2] |
rol bx,8 ;;; |
DEBUGF 1,"local port: %u ",bx |
DEBUGF 1,"local port: %x ",bx |
test bx, bx |
jnz .check_only |
jz .find_free |
mov bx , [last_UDP_port] |
call socket_check_port |
test bx, bx |
je s_error |
jmp .got_port |
.find_port_loop: |
inc bx |
inc [last_UDP_port] |
.find_free: |
.check_only: |
mov esi, net_sockets |
call socket_find_port |
test bx, bx |
je s_error |
.next_udp_socket: |
mov esi, [esi + SOCKET.NextPtr] |
or esi, esi |
jz .udp_port_ok |
cmp [esi + SOCKET.Type], IP_PROTO_UDP |
jne .next_udp_socket |
cmp [esi + SOCKET.LocalPort], bx |
jne .next_udp_socket |
cmp word [edx + 2], 0 |
jne s_error |
cmp bx, MAX_EPHEMERAL_PORT |
jle .find_port_loop |
mov [last_UDP_port], MIN_EPHEMERAL_PORT |
jmp s_error |
.udp_port_ok: |
.got_port: |
DEBUGF 1,"using port: %x ",bx |
mov word [eax + SOCKET.LocalPort], bx |
mov ebx, dword [edx + 4] |
246,7 → 228,6 |
; |
;----------------------------------------------- |
align 4 |
socket_connect: |
DEBUGF 1,"Socket_connect: socknum: %u sockaddr: %x, length: %u,",ecx,edx,esi |
274,8 → 255,8 |
cmp [eax + SOCKET.Type], IP_PROTO_ICMP |
je .icmp |
; cmp [eax + SOCKET.Type], IP_PROTO_TCP |
; je .tcp |
cmp [eax + SOCKET.Type], IP_PROTO_TCP |
je .tcp |
jmp s_error |
282,14 → 263,11 |
.udp: |
mov bx , word [edx + 2] |
rol bx, 8 |
mov word [eax + SOCKET.RemotePort], bx |
DEBUGF 1,"remote port: %x ",bx |
DEBUGF 1,"remote port: %u ",bx |
mov ebx, dword [edx + 4] |
mov dword [eax + SOCKET.RemoteIP], ebx |
DEBUGF 1,"remote ip: %u.%u.%u.%u\n",[edx+4]:1,[edx+5]:1,[edx+6]:1,[edx+7]:1 |
mov dword [esp+32],0 |
395,7 → 373,7 |
; OUT: eax is socket num, -1 on error |
; |
;----------------------------------------------- |
align 4 |
socket_listen: |
DEBUGF 1,"Socket_listen: socknum: %u backlog: %u\n",ecx,edx |
432,8 → 410,7 |
; OUT: eax is socket num, -1 on error |
; |
;----------------------------------------------- |
align 4 |
socket_accept: |
DEBUGF 1,"Socket_accept: socknum: %u sockaddr: %x, length: %u\n",ecx,edx,esi |
479,7 → 456,7 |
; OUT: eax is socket num, -1 on error |
; |
;----------------------------------------------- |
align 4 |
socket_close: |
DEBUGF 1,"Socket_close: socknum: %u\n",ecx |
495,8 → 472,8 |
cmp [eax + SOCKET.Type], IP_PROTO_ICMP |
je .icmp |
; cmp [eax + SOCKET.Type], IP_PROTO_TCP |
; je .tcp |
cmp [eax + SOCKET.Type], IP_PROTO_TCP |
je .tcp |
jmp s_error |
629,7 → 606,7 |
; OUT: eax is number of bytes copied, -1 on error |
; |
;----------------------------------------------- |
align 4 |
socket_recv: |
DEBUGF 1,"Socket_receive: socknum: %u sockaddr: %x, length: %u, flags: %x\n",ecx,edx,esi,edi |
703,13 → 680,13 |
; |
; |
; IN: socket number in ecx |
; addr in edx |
; addrlen in esi |
; pointer to data in edx |
; datalength in esi |
; flags in edi |
; OUT: -1 on error |
; |
;----------------------------------------------- |
align 4 |
socket_send: |
DEBUGF 1,"Socket_send: socknum: %u sockaddr: %x, length: %u, flags: %x, ",ecx,edx,esi,edi |
718,6 → 695,13 |
or eax, eax |
jz s_error |
cmp word [eax + SOCKET.Domain], AF_INET4 |
je .af_inet4 |
jmp s_error |
.af_inet4: |
DEBUGF 1,"Socket type:%u\n", [eax + SOCKET.Type]:4 |
cmp [eax + SOCKET.Type], IP_PROTO_UDP |
726,21 → 710,30 |
cmp [eax + SOCKET.Type], IP_PROTO_ICMP |
je .icmp |
; cmp [eax + SOCKET.Type], IP_PROTO_TCP |
; je .tcp |
cmp [eax + SOCKET.Type], IP_PROTO_TCP |
je .tcp |
jmp s_error |
.udp: |
DEBUGF 1,"type: UDP\n" |
DEBUGF 1,"type: UDP, " |
cmp [eax + SOCKET.LocalPort],0 |
jne .port_ok |
mov ecx, [eax + SOCKET.Type] |
call socket_find_port |
test bx, bx |
je s_error |
mov [eax + SOCKET.LocalPort], bx |
.port_ok: |
mov ecx, esi |
mov esi, edx |
mov edx, dword [eax + SOCKET.LocalPort] ; load local port and remote port at once |
DEBUGF 1,"local port: %u, remote port:%u\n",[eax + SOCKET.LocalPort]:2, [eax + SOCKET.RemotePort]:2 |
bswap edx ;;; |
rol edx, 16 ;;; |
DEBUGF 1,"local port: %x, remote port: %x\n",[eax + SOCKET.LocalPort]:2, [eax + SOCKET.RemotePort]:2 |
mov ebx, [eax + SOCKET.LocalIP] |
mov eax, [eax + SOCKET.RemoteIP] |
781,10 → 774,177 |
;----------------------------------------------- |
; |
; SOCKET_find_free_port (local port) |
; |
; works with INET byte order |
; |
; IN: type in ecx (TCP/UDP) |
; OUT: bx = 0 on error, portnumber otherwise |
; |
;----------------------------------------------- |
align 4 |
socket_find_port: |
DEBUGF 1,"Socket_find_free_port, type: %u ",eax |
cmp ecx, IP_PROTO_UDP |
je .udp |
cmp ecx, IP_PROTO_TCP |
je .tcp |
.udp: |
mov bx, [last_UDP_port] |
je .continue |
.tcp: |
mov bx, [last_TCP_port] |
.continue: |
inc bx |
.check_only: |
mov esi, net_sockets |
.next_socket: |
mov esi, [esi + SOCKET.NextPtr] |
or esi, esi |
jz .port_ok |
cmp [esi + SOCKET.Type], ecx |
jne .next_socket |
rol bx, 8 |
cmp [esi + SOCKET.LocalPort], bx |
rol bx, 8 ; this doesnt change the zero flag, does it ? |
jne .next_socket |
cmp bx, MAX_EPHEMERAL_PORT |
jle .continue |
; todo: WRAP! |
; mov [last_UDP_port], MIN_EPHEMERAL_PORT |
.exit: |
xor ebx, ebx |
.port_ok: |
rol bx, 8 |
ret |
;----------------------------------------------- |
; |
; SOCKET_check_port (local port) |
; |
; works with INET byte order |
; |
; IN: type in ecx (TCP/UDP) |
; port to check in bx |
; OUT: bx = 0 on error, unchanged otherwise |
; |
;----------------------------------------------- |
align 4 |
socket_check_port: |
mov esi, net_sockets |
.next_socket: |
mov esi, [esi + SOCKET.NextPtr] |
or esi, esi |
jz .port_ok |
cmp [esi + SOCKET.Type], ecx |
jne .next_socket |
cmp [esi + SOCKET.LocalPort], bx |
jne .next_socket |
xor ebx, ebx |
.port_ok: |
ret |
;----------------------------------------------- |
; |
; SOCKET_internal_receiver |
; |
; Checks if any socket wants the received data |
; If so, update the socket |
; |
; IN: eax = socket number |
; ecx = number of bytes |
; esi = pointer to beginning of data |
; dx = Remote port (in INET byte order) |
; edi = IP address of sender |
; |
; OUT: xxx |
; |
;----------------------------------------------- |
align 4 |
socket_internal_receiver: |
DEBUGF 1,"internal socket receiver\n" |
lea ebx, [eax + SOCKET.lock] |
call wait_mutex |
mov [eax + SOCKET.RemotePort], dx ; update remote port number |
mov [eax + SOCKET.RemoteIP], edi |
mov edx, [eax + SOCKET.rxDataCount] ; get # of bytes already in buffer |
DEBUGF 1,"bytes already in socket: %u ", edx |
lea edi, [ecx + edx] ; check for buffer overflow |
cmp edi, SOCKETBUFFSIZE - SOCKETHEADERSIZE ; |
jg .dump ; |
lea edi, [eax + SOCKET.rxData + edx] |
add [eax + SOCKET.rxDataCount], ecx ; increment the count of bytes in buffer |
DEBUGF 1,"adding %u bytes\n", ecx |
; copy the data across |
push cx |
shr ecx, 2 |
rep movsd |
pop cx |
and cx, 3 |
rep movsb |
DEBUGF 1,"socket updated\n" |
mov [eax + SOCKET.lock], 0 |
; flag an event to the application |
mov edx, [eax + SOCKET.PID] ; get socket owner PID |
mov ecx, 1 |
mov esi, TASK_DATA + TASKDATA.pid |
.next_pid: |
cmp [esi], edx |
je .found_pid |
inc ecx |
add esi, 0x20 |
cmp ecx, [TASK_COUNT] |
jbe .next_pid |
ret |
.found_pid: |
shl ecx, 8 |
or [ecx + SLOT_BASE + APPDATA.event_mask], EVENT_NETWORK ; stack event |
mov [check_idle_semaphore], 200 |
ret |
.dump: |
mov [eax + SOCKET.lock], 0 |
ret |
; Allocate memory for socket data and put new socket into the list |
; Newly created socket is initialized with calling PID and number and |
; put into beginning of list (which is a fastest way). |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/network/stack.inc |
---|
17,7 → 17,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
uglobal |
last_1sTick db ? |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/network/tcp.inc |
---|
15,7 → 15,7 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 1019 $ |
$Revision$ |
; TCP TCB states |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/network/udp.inc |
---|
14,7 → 14,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
struct UDP_Packet |
44,7 → 44,6 |
; OUT: / |
; |
;----------------------------------------------------------------- |
align 4 |
UDP_init: |
72,117 → 71,67 |
; OUT: / |
; |
;----------------------------------------------------------------- |
align 4 |
UDP_handler: |
DEBUGF 1,"UDP_Handler\n" |
; TODO: First validate the header & checksum. Discard buffer if error |
; TODO: First validate the header & checksum! |
; Look for a socket where |
; IP Packet UDP Destination Port = local Port |
; IP Packet SA = Remote IP |
mov esi, net_sockets |
mov eax, net_sockets |
.try_more: |
mov ax , [edx + UDP_Packet.DestinationPort] ; get the local port from the IP Packet's UDP header |
rol ax , 8 |
mov bx , [edx + UDP_Packet.DestinationPort] ; get the local port from the IP Packet's UDP header |
.next_socket: |
mov esi, [esi + SOCKET.NextPtr] |
or esi, esi |
mov eax, [eax + SOCKET.NextPtr] |
or eax, eax |
jz .dump |
cmp [esi + SOCKET.Type], IP_PROTO_UDP |
cmp [eax + SOCKET.Domain], AF_INET4 |
jne .next_socket |
cmp [esi + SOCKET.LocalPort], ax |
cmp [eax + SOCKET.Type], IP_PROTO_UDP |
jne .next_socket |
cmp [eax + SOCKET.LocalPort], bx |
jne .next_socket |
; For dhcp, we must allow any remote server to respond. |
; I will accept the first incoming response to be the one |
; I bind to, if the socket is opened with a destination IP address of |
; 255.255.255.255 |
cmp [esi + SOCKET.RemoteIP], 0xffffffff |
je @f |
cmp [eax + SOCKET.RemoteIP], 0xffffffff |
je .ok1 |
mov eax, [esp] |
mov eax, [eax + ETH_FRAME.Data + IPv4_Packet.SourceAddress] ; get the Source address from the IP Packet |
cmp [esi + SOCKET.RemoteIP], eax |
mov ebx, [esp] |
mov ebx, [ebx + ETH_FRAME.Data + IPv4_Packet.SourceAddress] ; get the Source address from the IP Packet |
cmp [eax + SOCKET.RemoteIP], eax |
jne .try_more ; Quit if the source IP is not valid, check for more sockets with this IP/PORT combination |
@@: |
DEBUGF 1,"Found valid UDP packet for socket %x\n", esi |
.ok1: |
; sub ecx, UDP_Packet.Data ; get # of bytes in ecx |
; mov eax, ecx |
mov bx, [edx + UDP_Packet.SourcePort] ; Remote port must be 0, or equal to sourceport of packet |
movzx ecx, [edx + UDP_Packet.Length] |
xchg cl , ch |
cmp [eax + SOCKET.RemotePort],0 |
je .ok2 |
; cmp ecx, eax ; If UDP packet size is bigger then IP packet told us, |
; jg .error ; Something must went wrong! |
cmp [eax + SOCKET.RemotePort], bx |
jne .dump |
lea ebx, [esi + SOCKET.lock] |
call wait_mutex |
.ok2: |
; OK - we have a valid UDP Packet for this socket. |
; First, update the sockets remote port number with the incoming msg |
; - it will have changed |
; from the original ( 69 normally ) to allow further connects |
mov ax, [edx + UDP_Packet.SourcePort] ; get the UDP source port |
xchg al, ah |
mov [esi + SOCKET.RemotePort], ax |
DEBUGF 1,"Found valid UDP packet for socket %x\n", eax |
lea esi, [edx + UDP_Packet.Data] |
movzx ecx, [edx + UDP_Packet.Length] |
rol cx , 8 |
sub cx , UDP_Packet.Data |
mov dx , bx |
; Now, copy data to socket. We have socket address as [eax + sockets]. |
; We have IP Packet in edx |
call socket_internal_receiver |
add edx, UDP_Packet.Data |
mov eax, [esi + SOCKET.rxDataCount] ; get # of bytes already in buffer |
DEBUGF 1,"bytes in socket: %u ", eax |
lea edi, [ecx + eax] ; check for buffer overflow |
cmp edi, SOCKETBUFFSIZE - SOCKETHEADERSIZE ; |
jg .dump ; |
add [esi + SOCKET.rxDataCount], ecx ; increment the count of bytes in buffer |
DEBUGF 1,"adding %u bytes\n", ecx |
inc [UDP_PACKETS_RX] |
; ecx has count, edx points to data |
lea edi, [esi + eax + SOCKETHEADERSIZE] |
push esi |
push ecx |
mov esi, edx |
shr ecx, 2 |
rep movsd ; copy the data across |
pop ecx |
and ecx, 3 |
rep movsb |
pop esi |
DEBUGF 1,"UDP socket updated\n" |
mov [esi + SOCKET.lock], 0 |
; flag an event to the application |
mov eax, [esi + SOCKET.PID] ; get socket owner PID |
mov ecx, 1 |
mov esi, TASK_DATA + TASKDATA.pid |
.next_pid: |
cmp [esi], eax |
je .found_pid |
inc ecx |
add esi, 0x20 |
cmp ecx, [TASK_COUNT] |
jbe .next_pid |
jmp .dump |
.found_pid: |
shl ecx, 8 |
or [ecx + SLOT_BASE + APPDATA.event_mask], EVENT_NETWORK ; stack event |
mov [check_idle_semaphore], 200 |
.dump: |
DEBUGF 1,"UDP_handler - dumping\n" |
.dump: |
DEBUGF 1,"Dumping UDP packet\n" |
call kernel_free |
add esp, 4 ; pop (balance stack) |
205,7 → 154,7 |
UDP_create_packet: |
DEBUGF 1,"Create UDP Packet\n" |
DEBUGF 1,"Create UDP Packet (size=%u)\n",ecx |
push edx esi |
216,7 → 165,7 |
call IPv4_create_packet ; TODO: figure out a way to choose between IPv4 and IPv6 |
cmp edi, -1 |
je .exit |
je .fail |
mov byte[edi + UDP_Packet.Length], ch |
mov byte[edi + UDP_Packet.Length+1], cl |
234,17 → 183,15 |
pop edi |
pop ecx |
; bswap ecx ; convert little endian - big endian |
; rol ecx, 16 ; |
mov dword [edi + UDP_Packet.SourcePort], ecx ; notice: we write both port's at once |
mov [edi + UDP_Packet.Checksum], 0 |
; TODO: calculate checksum using Pseudo-header (However, using a 0 as checksum shouldnt generate any errors :) |
push ebx eax ; TODO: make this work on other protocols besides ethernet |
mov ebx,edx ; |
inc [UDP_PACKETS_TX] |
push edx eax ; TODO: make this work on other protocols besides ethernet |
DEBUGF 1,"Sending UDP Packet to device %x\n", ebx ; |
jmp ETH_Sender ; |
251,8 → 198,13 |
.exit: |
ret |
.fail: |
; todo: queue the packet |
add esp, 8 |
ret |
;--------------------------------------------------------------------------- |
; |
; UDP_API |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/proc32.inc |
---|
1,5 → 1,5 |
$Revision: 750 $ |
$Revision$ |
; Macroinstructions for defining and calling procedures |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/sound/playnote.inc |
---|
16,7 → 16,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
align 4 |
sound_interface: |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/unpacker.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 750 $ |
$Revision$ |
; void __stdcall unpack(void* packed_data, void* unpacked_data); |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/video/cursors.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
LOAD_FROM_FILE equ 0 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/video/vesa12.inc |
---|
15,7 → 15,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
TRIDENT equ 0 |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/video/vesa20.inc |
---|
17,7 → 17,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 983 $ |
$Revision$ |
; If you're planning to write your own video driver I suggest |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/video/vga.inc |
---|
11,7 → 11,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 593 $ |
$Revision$ |
paletteVGA: |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/vmodeint.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 753 $ |
$Revision$ |
; |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |
/kernel/branches/net/vmodeld.inc |
---|
5,7 → 5,7 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision: 750 $ |
$Revision$ |
; |
Property changes: |
Added: svn:keywords |
+Revision |
\ No newline at end of property |