infinity: remove direct access to kernel data
git-svn-id: svn://kolibrios.org@520 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
f111d6969f
commit
23bdfe5dc4
@ -39,7 +39,9 @@ iglobal
|
||||
szUserFree db 'UserFree',0
|
||||
szKmalloc db 'Kmalloc',0
|
||||
szKfree db 'Kfree',0
|
||||
szCreateRingBuffer db 'CreateRingBuffer',0
|
||||
|
||||
szGetPid db 'GetPid',0
|
||||
szCreateObject db 'CreateObject',0
|
||||
szDestroyObject db 'DestroyObject',0
|
||||
szCreateEvent db 'CreateEvent',0
|
||||
@ -101,7 +103,9 @@ kernel_export:
|
||||
dd szUserFree , user_free
|
||||
dd szKmalloc , malloc
|
||||
dd szKfree , free
|
||||
dd szCreateRingBuffer, create_ring_buffer
|
||||
|
||||
dd szGetPid , get_pid
|
||||
dd szCreateObject , create_kernel_object
|
||||
dd szDestroyObject , destroy_kernel_object
|
||||
dd szCreateEvent , create_event
|
||||
|
@ -1085,6 +1085,58 @@ proc stall stdcall, delay:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc create_ring_buffer stdcall, size:dword, flags:dword
|
||||
locals
|
||||
buf_ptr dd ?
|
||||
endl
|
||||
|
||||
mov eax, [size]
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
add eax, eax
|
||||
stdcall alloc_kernel_space, eax
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
mov [buf_ptr], eax
|
||||
|
||||
mov ebx, [size]
|
||||
shr ebx, 12
|
||||
push ebx
|
||||
|
||||
stdcall alloc_pages, ebx
|
||||
pop ecx
|
||||
|
||||
test eax, eax
|
||||
jz .mm_fail
|
||||
|
||||
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+esi]
|
||||
add eax, 0x1000
|
||||
add ebx, 0x1000
|
||||
add edi, 4
|
||||
dec ecx
|
||||
jnz @B
|
||||
|
||||
mov eax, [buf_ptr]
|
||||
ret
|
||||
.mm_fail:
|
||||
stdcall free_kernel_space, [buf_ptr]
|
||||
xor eax, eax
|
||||
.fail:
|
||||
ret
|
||||
endp
|
||||
|
||||
if 0
|
||||
push eax
|
||||
|
@ -544,6 +544,12 @@ proc destroy_app_space stdcall, pg_dir:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
get_pid:
|
||||
mov eax, [TASK_DATA]
|
||||
mov eax, [eax+4]
|
||||
ret
|
||||
|
||||
pid_to_slot:
|
||||
;Input:
|
||||
; eax - pid of process
|
||||
|
@ -88,7 +88,13 @@ end if
|
||||
if used Kfree
|
||||
extrn Kfree
|
||||
end if
|
||||
if used CreateRingBuffer
|
||||
extrn CreateRingBuffer
|
||||
end if
|
||||
|
||||
if used GetPid
|
||||
extrn GetPid
|
||||
end if
|
||||
if used CreateObject
|
||||
extrn CreateObject
|
||||
end if
|
||||
|
@ -15,7 +15,10 @@ SOUND_VERSION equ API_VERSION
|
||||
|
||||
|
||||
include 'proc32.inc'
|
||||
|
||||
;include 'system.inc'
|
||||
include 'main.inc'
|
||||
|
||||
include 'imports.inc'
|
||||
|
||||
FORCE_MMX equ 0 ;set to 1 to force use mmx or
|
||||
@ -27,9 +30,6 @@ DEBUG equ 1
|
||||
|
||||
|
||||
OS_BASE equ 0x80000000
|
||||
SLOT_BASE equ (OS_BASE+0x0080000)
|
||||
TASK_COUNT equ (OS_BASE+0x0003004)
|
||||
CURRENT_TASK equ (OS_BASE+0x0003000)
|
||||
|
||||
CAPS_SSE2 equ 26
|
||||
PG_SW equ 0x003
|
||||
@ -334,9 +334,9 @@ proc CreateBuffer stdcall, format:dword, size:dword
|
||||
test eax, PCM_OUT+PCM_STATIC
|
||||
jnz .fail
|
||||
.test_ok:
|
||||
mov ebx, [CURRENT_TASK] ;hack: direct accsess
|
||||
shl ebx, 5 ;to kernel data
|
||||
mov ebx, [CURRENT_TASK+ebx+4]
|
||||
|
||||
call GetPid
|
||||
mov ebx, eax
|
||||
mov eax, STREAM_SIZE
|
||||
|
||||
call CreateObject
|
||||
@ -390,9 +390,11 @@ proc CreateBuffer stdcall, format:dword, size:dword
|
||||
shr ebx, 12
|
||||
mov [ring_pages], ebx
|
||||
|
||||
add eax, eax ;double ring size
|
||||
stdcall AllocKernelSpace, eax
|
||||
stdcall CreateRingBuffer, eax, PG_SW
|
||||
|
||||
if 0
|
||||
stdcall AllocKernelSpace, eax
|
||||
end if
|
||||
mov edi, [str]
|
||||
mov ecx, [ring_size]
|
||||
mov [edi+STREAM.in_base], eax
|
||||
@ -407,6 +409,7 @@ proc CreateBuffer stdcall, format:dword, size:dword
|
||||
add eax, ecx
|
||||
mov [edi+STREAM.in_top], eax
|
||||
|
||||
if 0
|
||||
mov ebx, [ring_pages]
|
||||
stdcall AllocPages, ebx
|
||||
mov edi, [str]
|
||||
@ -421,7 +424,7 @@ proc CreateBuffer stdcall, format:dword, size:dword
|
||||
pop eax
|
||||
add ebx, [ring_size]
|
||||
call CommitPages ;double mapped
|
||||
|
||||
end if
|
||||
jmp .out_buff
|
||||
.static:
|
||||
mov ecx, [size]
|
||||
|
@ -84,7 +84,7 @@ endg
|
||||
|
||||
end_of_file_system_lfn:
|
||||
pop edx
|
||||
stdcall kernel_free, edx
|
||||
stdcall kernel_free, edx
|
||||
ret
|
||||
|
||||
|
||||
@ -103,38 +103,39 @@ file_system_lfn:
|
||||
; 9 : create directory
|
||||
|
||||
; çàìåíà àäðåñà âîçâðàòà
|
||||
push eax
|
||||
push eax
|
||||
stdcall kernel_alloc, 200
|
||||
mov edx,eax
|
||||
pop eax
|
||||
mov edx,eax
|
||||
pop eax
|
||||
|
||||
push edx
|
||||
push end_of_file_system_lfn
|
||||
mov ebx,edx
|
||||
|
||||
mov ecx, [eax]
|
||||
mov [ebx],ecx
|
||||
mov ebx,edx
|
||||
|
||||
add ebx,4
|
||||
mov ecx, [eax+4]
|
||||
mov [ebx],ecx
|
||||
mov ecx, [eax]
|
||||
mov [ebx],ecx
|
||||
|
||||
add ebx,4
|
||||
mov ecx, [eax+8]
|
||||
mov [ebx],ecx
|
||||
add ebx,4
|
||||
mov ecx, [eax+4]
|
||||
mov [ebx],ecx
|
||||
|
||||
add ebx,4
|
||||
mov ecx, [eax+12]
|
||||
mov [ebx],ecx
|
||||
add ebx,4
|
||||
mov ecx, [eax+8]
|
||||
mov [ebx],ecx
|
||||
|
||||
add ebx,4
|
||||
mov ecx, [eax+16]
|
||||
mov [ebx],ecx
|
||||
add ebx,4
|
||||
mov ecx, [eax+12]
|
||||
mov [ebx],ecx
|
||||
|
||||
add ebx,4
|
||||
add ebx,4
|
||||
mov ecx, [eax+16]
|
||||
mov [ebx],ecx
|
||||
|
||||
add ebx,4
|
||||
push edx ; !!!!!!!!!!!!!!!!!!!
|
||||
; eax - yíà÷àëî ñòàðîãî ïàêåòà
|
||||
; edx - íà÷àëî íîâîãî ïàêåòà
|
||||
; ebx - <EFBFBD>萵 <EFBFBD>跖<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>
|
||||
; ebx - <EFBFBD>萵 <EFBFBD>跖<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>
|
||||
add eax,20
|
||||
mov cl, [eax]
|
||||
test cl,cl
|
||||
@ -143,10 +144,7 @@ file_system_lfn:
|
||||
@@:
|
||||
stdcall full_file_name,eax,ebx
|
||||
pop eax
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; add eax, std_application_base_address
|
||||
|
Loading…
Reference in New Issue
Block a user