separate USB host controller code into external drivers

git-svn-id: svn://kolibrios.org@4418 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
CleverMouse
2013-12-30 11:18:33 +00:00
parent bcb5772288
commit a10422fbce
23 changed files with 1037 additions and 1171 deletions

View File

@@ -214,10 +214,35 @@ proc get_service stdcall, sz_name:dword
mov edx, [edx+SRV.fd]
jmp @B
.not_load:
mov eax, [sz_name]
; Try to load .dll driver first. If not, fallback to .obj.
push edi
sub esp, 36
mov edi, esp
mov dword [edi], '/sys'
mov dword [edi+4], '/dri'
mov dword [edi+8], 'vers'
mov byte [edi+12], '/'
@@:
mov dl, [eax]
mov [edi+13], dl
inc eax
inc edi
test dl, dl
jnz @b
mov dword [edi+12], '.sys'
mov byte [edi+16], 0
mov edi, esp
stdcall load_pe_driver, edi, 0
add esp, 36
pop edi
test eax, eax
jnz .nothing
pop ebp
jmp load_driver
.ok:
mov eax, edx
.nothing:
ret
endp

View File

@@ -45,6 +45,7 @@ __exports:
map_io_mem, 'MapIoMem', \ ; stdcall
map_page, 'MapPage', \ ; stdcall
get_pg_addr, 'GetPgAddr', \ ; eax
get_phys_addr, 'GetPhysAddr', \ ; eax
map_space, 'MapSpace', \
release_pages, 'ReleasePages', \
\
@@ -113,6 +114,7 @@ __exports:
usb_normal_transfer_async, 'USBNormalTransferAsync', \
usb_control_async, 'USBControlTransferAsync', \
usb_get_param, 'USBGetParam', \
usb_hc_func, 'USBHCFunc', \
\
NET_add_device, 'NetRegDev', \
NET_remove_device, 'NetUnRegDev', \

View File

@@ -1253,22 +1253,7 @@ f68:
cmp edx, OS_BASE
jae .fail
mov edi, edx
stdcall load_PE, ecx
mov esi, eax
test eax, eax
jz @F
push edi
push DRV_ENTRY
call eax
add esp, 8
test eax, eax
jz @F
mov [eax+SRV.entry], esi
@@:
stdcall load_pe_driver, ecx, edx
mov [esp+32], eax
ret
.22:
@@ -1348,26 +1333,32 @@ f68call: ; keep this table closer to main code
align 4
proc load_pe_driver stdcall, file:dword
proc load_pe_driver stdcall, file:dword, cmdline:dword
push esi
stdcall load_PE, [file]
test eax, eax
jz .fail
mov esi, eax
stdcall eax, DRV_ENTRY
push [cmdline]
push DRV_ENTRY
call eax
pop ecx
pop ecx
test eax, eax
jz .fail
mov [eax+SRV.entry], esi
pop esi
ret
.fail:
xor eax, eax
pop esi
ret
endp
align 4
proc init_mtrr
@@ -1415,9 +1406,9 @@ proc init_mtrr
xor eax, eax
xor edx, edx
@@:
wrmsr
inc ecx
cmp ecx, 0x210
wrmsr
cmp ecx, 0x20F
jb @b
; enable MTRRs
pop eax

View File

@@ -85,13 +85,12 @@ L3:
mov ecx, eax
add edi, DWORD PTR [edx+260]
add ecx, 3
shr ecx, 2
rep movsd
L4:
mov ecx, DWORD PTR [edx+256]
add ecx, 4095
and ecx, -4096
cmp ecx, eax
jbe L6
sub ecx, eax
@@ -178,6 +177,10 @@ L23:
mov ecx, DWORD PTR [eax-4]
mov DWORD PTR [esp+48], edi
mov edx, DWORD PTR [eax-20]
test edx, edx
jnz @f
mov edx, ecx
@@:
mov DWORD PTR [esp+52], 0
add ecx, ebp
add edx, ebp