Sync net branch with trunk

git-svn-id: svn://kolibrios.org@3405 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2013-03-23 11:56:23 +00:00
parent 16919a6ad9
commit 372fe91892
9 changed files with 330 additions and 205 deletions

View File

@ -155,12 +155,12 @@ pci_make_config_cmd:
align 4
pci_read_reg:
push ebx esi
cmp byte [BOOT_VAR+0x9020], 2;what mechanism will we use?
je pci_read_reg_2
; mechanism 1
push esi ; save register size into ESI
mov esi, eax
mov esi, eax ; save register size into ESI
and esi, 3
call pci_make_config_cmd
@ -202,15 +202,14 @@ pci_fin_read1:
out dx, eax
pop eax
pop esi
pop esi ebx
ret
pci_read_reg_2:
test bh, 128 ;mech#2 only supports 16 devices per bus
jnz pci_read_reg_err
push esi; save register size into ESI
mov esi, eax
mov esi, eax ; save register size into ESI
and esi, 3
push eax
@ -262,12 +261,13 @@ pci_fin_read2:
out dx, al
pop eax
pop esi
pop esi ebx
ret
pci_read_reg_err:
xor eax, eax
dec eax
pop esi ebx
ret
@ -286,12 +286,12 @@ pci_read_reg_err:
align 4
pci_write_reg:
push esi ebx
cmp byte [BOOT_VAR+0x9020], 2;what mechanism will we use?
je pci_write_reg_2
; mechanism 1
push esi ; save register size into ESI
mov esi, eax
mov esi, eax ; save register size into ESI
and esi, 3
call pci_make_config_cmd
@ -335,7 +335,7 @@ pci_fin_write1:
out dx, eax
xor eax, eax
pop esi
pop ebx esi
ret
pci_write_reg_2:
@ -344,8 +344,7 @@ pci_write_reg_2:
jnz pci_write_reg_err
push esi; save register size into ESI
mov esi, eax
mov esi, eax ; save register size into ESI
and esi, 3
push eax
@ -397,12 +396,13 @@ pci_fin_write2:
out dx, al
xor eax, eax
pop esi
pop ebx esi
ret
pci_write_reg_err:
xor eax, eax
dec eax
pop ebx esi
ret
if defined mmio_pci_addr ; must be set above
@ -658,3 +658,67 @@ sys_pcibios:
.return_a:
mov dword[esp + 32], eax
ret
proc pci_enum
push ebp
mov ebp, esp
push 0
virtual at ebp-4
.devfn db ?
.bus db ?
end virtual
.loop:
mov ah, [.bus]
mov al, 2
mov bh, [.devfn]
mov bl, 0
call pci_read_reg
cmp eax, 0xFFFFFFFF
jnz .has_device
test byte [.devfn], 7
jnz .next_func
jmp .no_device
.has_device:
push eax
push sizeof.PCIDEV
pop eax
call malloc
pop ecx
test eax, eax
jz .nomemory
mov edi, eax
mov [edi+PCIDEV.vendor_device_id], ecx
mov eax, pcidev_list
mov ecx, [eax+PCIDEV.bk]
mov [edi+PCIDEV.bk], ecx
mov [edi+PCIDEV.fd], eax
mov [ecx+PCIDEV.fd], edi
mov [eax+PCIDEV.bk], edi
mov eax, dword [.devfn]
mov word [edi+PCIDEV.devfn], ax
mov bh, al
mov al, 2
mov bl, 8
call pci_read_reg
shr eax, 8
mov [edi+PCIDEV.class], eax
test byte [.devfn], 7
jnz .next_func
mov ah, [.bus]
mov al, 0
mov bh, [.devfn]
mov bl, 0Eh
call pci_read_reg
test al, al
js .next_func
.no_device:
or byte [.devfn], 7
.next_func:
inc dword [.devfn]
mov ah, [.bus]
cmp ah, [BOOT_VAR+0x9021]
jbe .loop
.nomemory:
leave
ret
endp

View File

@ -571,6 +571,35 @@ struct MUTEX
count dd ?
ends
struct PCIDEV
bk dd ?
fd dd ?
vendor_device_id dd ?
class dd ?
devfn db ?
bus db ?
ends
; The following macro assume that we are on uniprocessor machine.
; Serious work is needed for multiprocessor machines.
macro spin_lock_irqsave spinlock
{
pushf
cli
}
macro spin_unlock_irqrestore spinlock
{
popf
}
macro spin_lock_irq spinlock
{
cli
}
macro spin_unlock_irq spinlock
{
sti
}
struct MEM_STATE
mutex MUTEX
smallmap dd ?

View File

@ -154,11 +154,11 @@ proc init_kernel_heap
mov [ecx+block_next], eax
mov [ecx+block_prev], ebx
mov [edi+list_fd], eax
mov [edi+list_bk], eax
mov [edi+block_base], eax
mov [edi+block_size], eax
mov [edi+block_flags], USED_BLOCK
mov [ecx+list_fd], eax
mov [ecx+list_bk], eax
mov [ecx+block_base], eax
mov [ecx+block_size], eax
mov [ecx+block_flags], USED_BLOCK
mov [ebx+block_next], ecx
mov [ebx+block_prev], edi

View File

@ -283,11 +283,15 @@ __exports:
alloc_page, 'AllocPage', \ ; gcc ABI
alloc_pages, 'AllocPages', \ ; stdcall
commit_pages, 'CommitPages', \ ; eax, ebx, ecx
\
disk_add, 'DiskAdd', \ ;stdcall
disk_media_changed, 'DiskMediaChanged', \ ;stdcall
\
create_event, 'CreateEvent', \ ; ecx, esi
destroy_event, 'DestroyEvent', \ ;
raise_event, 'RaiseEvent', \ ; eax, ebx, edx, esi
wait_event, 'WaitEvent', \ ; eax, ebx
wait_event_timeout, 'WaitEventTimeout', \ ; eax, ebx, ecx
get_event_ex, 'GetEvent', \ ; edi
\
create_kernel_object, 'CreateObject', \

View File

@ -888,6 +888,7 @@ v86_irq2:
.cont2:
pop ecx
.cont:
add ebx, 0x100
loop .scan
mov ecx, edi
call irq_eoi

View File

@ -181,6 +181,10 @@ dll_list:
.bk dd dll_list
.fd dd dll_list
pcidev_list:
.bk dd pcidev_list
.fd dd pcidev_list
MAX_DEFAULT_DLL_ADDR = 0x80000000
MIN_DEFAULT_DLL_ADDR = 0x70000000
dll_cur_addr dd MIN_DEFAULT_DLL_ADDR

View File

@ -565,7 +565,7 @@ ext2_HdReadFolder:
rep movsd
pop ecx
@@:
cmp [ebp + EXT2_INODE_STRUC.i_blocks], 0 ;папка пуста
cmp [ebp + EXT2_INODE_STRUC.i_size], 0 ;папка пуста
je .error_empty_dir
push edx ;адрес результата [edi + 28]
@ -616,14 +616,14 @@ ext2_HdReadFolder:
test ebx, 0x3 ; длина записи должна делиться на 4
jnz .error_bad_len
sub [ebp + EXT2_INODE_STRUC.i_size], ebx ;вычитаем напрямую из структуры inode
add esi, ebx ; к следующей записи
cmp esi, [edi + 24] ; сравниваем с концом блока
jb .find_wanted_start
push .find_wanted_start
.end_block: ;вылетели из цикла
mov ebx, [ext2_data.count_block_in_block]
sub [ebp + EXT2_INODE_STRUC.i_blocks], ebx ;вычитаем напрямую из структуры inode
cmp [ebp + EXT2_INODE_STRUC.i_size], 0
jle .end_dir
inc dword [edi] ;получаем новый блок
@ -727,6 +727,7 @@ ext2_HdReadFolder:
test ebx, 0x3 ; длина записи должна делиться на 4
jnz .error_bad_len
sub [ebp + EXT2_INODE_STRUC.i_size], ebx ;вычитаем напрямую из структуры inode
add esi, ebx
cmp esi, [edi + 24] ;дошли ли до конца блока?
jb .wanted_start
@ -1095,6 +1096,7 @@ ext2_find_lfn:
push [ebp + EXT2_INODE_STRUC.i_blocks]
xor ecx, ecx
.folder_block_cycle:
push ecx
call ext2_get_inode_block
test eax, eax
jnz .error_get_inode_block
@ -1107,7 +1109,7 @@ ext2_find_lfn:
push esi
call ext2_test_block_by_name
pop edi
pop edi ecx
cmp edi, esi ;нашли имя?
je .next_folder_block ;не нашли -> к след. блоку
@ -1153,6 +1155,7 @@ ext2_find_lfn:
.error_get_inode_block:
.error_get_block:
pop ecx
.error_get_inode:
pop ebx
.error_empty_root:

View File

@ -307,6 +307,23 @@ wait_event: ;; EXPORT use
jmp wait_finish
;-----------------------------------------------------------------------------
align 4
wait_event_timeout:
;param:
; eax - event
; ebx - uid (for Dummy testing)
; ecx - timeout in timer ticks
;retval:
; eax - EVENT handle or 0 if timeout
call DummyTest
mov ebx, ecx
mov ecx, eax ; wait_param
mov edx, get_event_alone ; wait_test
call Wait_events_ex
test eax, eax
jnz wait_finish
ret
;-----------------------------------------------------------------------------
align 4
get_event_ex: ;; f68:14
;info:
; Ожидание любого события в очереди EventList текущего слота

View File

@ -792,6 +792,7 @@ end if
; call boot_log
mov [pci_access_enabled], 1
call pci_enum
; SET PRELIMINARY WINDOW STACK AND POSITIONS
@ -4617,9 +4618,10 @@ sys_msg_board_dword:
popad
ret
msg_board_data_size = 65536 ; Must be power of two
uglobal
msg_board_data:
times 4096 db 0
msg_board_data rb msg_board_data_size
msg_board_count dd 0x0
endg
@ -4652,7 +4654,7 @@ end if
mov [msg_board_data+ecx], bl
inc ecx
and ecx, 4095
and ecx, msg_board_data_size - 1
mov [msg_board_count], ecx
mov [check_idle_semaphore], 5
ret
@ -4745,7 +4747,8 @@ align 4
mov [eax], edx
mov [ecx], eax
mov [eax+12], ecx
jecxz @f
test edx, edx
jz @f
mov [edx+12], eax
@@:
and dword [esp+32], 0