1)new memory layout

2)Infinity 1.0

git-svn-id: svn://kolibrios.org@378 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-02-27 11:47:52 +00:00
parent 02bcaaab53
commit 73c568fb03
16 changed files with 1581 additions and 796 deletions

View File

@ -59,18 +59,18 @@ os_data_l:
db 0x00
app_code_l:
dw 0xFFFF;((0x80000000-std_application_base_address) shr 12) and 0xffff
dw 0xFFFF
dw 0
db 0x40
db 0
db cpl3
dw G32+D32+0x6000+0x7;
dw G32+D32+0x8000+0x7;
app_data_l:
dw 0xFFFF;(0x80000000-std_application_base_address) shr 12 and 0xffff
dw 0xFFFF
dw 0
db 0x40
db 0
db drw3
dw G32+D32+0x6000+0x7;
dw G32+D32+0x8000+0x7;
; --------------- APM ---------------------
apm_code_32:

View File

@ -231,14 +231,17 @@ resendQ equ OS_BASE+0x0770000
;skin_data equ OS_BASE+0x0778000
tss_data equ 0x780000
draw_data equ 0x988000
HEAP_BASE equ 0x98B000
page_tabs equ 0x60000000
master_tab equ 0x60180000
current_pgdir equ 0x60180000
LFB_BASE equ 0x7DC00000
page_tabs equ 0x7FC00000
master_tab equ 0x7FDFF000
app_page_tabs equ 0x7FE00000
sys_pgdir equ OS_BASE+0x00050000
sys_master_tab equ OS_BASE+0x00051000
@ -246,15 +249,14 @@ sys_pgmap equ OS_BASE+0x00052000
new_app_base equ 0x60400000
new_app_base equ 0x80000000
twdw equ (CURRENT_TASK-window_data)
std_application_base_address equ new_app_base
RING0_STACK_SIZE equ 0x2000 - 512 ;512 áàéò äëÿ êîíòåêñòà FPU
PAGES_USED equ 4
;PAGES_USED equ 4
PG_UNMAP equ 0x000
PG_MAP equ 0x001

View File

@ -1,8 +1,8 @@
DRV_ENTRY equ 1
DRV_EXIT equ -1
DRV_COMPAT equ 3 ;minimal required drivers version
DRV_CURRENT equ 3 ;current drivers model version
DRV_COMPAT equ 4 ;minimal required drivers version
DRV_CURRENT equ 4 ;current drivers model version
DRV_VERSION equ (DRV_COMPAT shl 16) or DRV_CURRENT

View File

@ -36,41 +36,95 @@ init_fpu:
fnsave [fpu_data]
ret
; param
; eax= 512 bytes memory area
align 4
proc fpu_save
fpu_save:
push ecx
push esi
push edi
pushfd
cli
clts
mov ebx, [fpu_owner]
shl ebx, 8
mov eax, [ebx+PROC_BASE+0x10]
mov ebx, [CURRENT_TASK]
mov [fpu_owner], ebx
mov edi, eax
mov ecx, [fpu_owner]
mov eax, [CURRENT_TASK]
cmp ecx, eax
jne .save
.copy:
shl eax, 8
mov esi, [eax+PROC_BASE+APPDATA.fpu_state]
mov ecx, 512/4
cld
rep movsd
fninit
popfd
pop edi
pop esi
pop ecx
ret
.save:
mov [fpu_owner], eax
shl ecx, 8
mov ecx, [ecx+PROC_BASE+APPDATA.fpu_state]
bt [cpu_caps], CAPS_SSE
jnc .no_SSE
fxsave [eax]
fninit ;re-init fpu
ret
fxsave [ecx]
jmp .copy
.no_SSE:
fnsave [eax]
ret
endp
fnsave [ecx]
jmp .copy
align 4
proc fpu_restore
mov ebx, [CURRENT_TASK]
shl ebx, 8
mov eax, [ebx+PROC_BASE+0x10]
fpu_restore:
push ecx
push esi
mov esi, eax
pushfd
cli
mov ecx, [fpu_owner]
mov eax, [CURRENT_TASK]
cmp ecx, eax
jne .copy
clts
bt [cpu_caps], CAPS_SSE
jnc .no_SSE
fxrstor [eax]
fxrstor [esi]
popfd
pop esi
pop ecx
ret
.no_SSE:
fnclex ;fix possible problems
frstor [eax]
frstor [esi]
popfd
pop esi
pop ecx
ret
.copy:
shl eax, 8
mov edi, [eax+PROC_BASE+APPDATA.fpu_state]
mov ecx, 512/4
cld
rep movsd
popfd
pop esi
pop ecx
ret
endp
align 4
e7: ;#NM exception handler

View File

@ -106,7 +106,7 @@ proc init_mem
dec ecx
jnz .map_kernel_tabs
mov dword [sys_pgdir+0x600], sys_pgdir+PG_SW
mov dword [sys_pgdir+(page_tabs shr 20)], sys_pgdir+PG_SW
ret
endp
@ -365,7 +365,7 @@ proc map_page_table stdcall, lin_addr:dword, phis_addr:dword
mov eax, [phis_addr]
and eax, not 0xFFF
or eax, PG_UW ;+PG_NOCACHE
mov dword [current_pgdir+ebx*4], eax
mov dword [master_tab+ebx*4], eax
mov eax, [lin_addr]
shr eax, 10
add eax, page_tabs
@ -376,6 +376,10 @@ endp
align 4
proc init_LFB
locals
pg_count dd ?
endl
cmp dword [LFBAddress], -1
jne @f
mov [0x2f0000+0x901c],byte 2
@ -388,18 +392,9 @@ proc init_LFB
mov [0x2f0000+0x901c],byte 2
ret
@@:
call map_LFB
ret
endp
align 4
proc map_LFB
locals
pg_count dd ?
endl
mov edi, [LFBSize]
mov edx, LFB_BASE
mov esi, [LFBAddress]
mov edi, [LFBSize]
mov dword [exp_lfb+4], esi
shr edi, 12
@ -408,13 +403,12 @@ proc map_LFB
bt [cpu_caps], CAPS_PSE
jnc .map_page_tables
mov ebx, esi
or esi, PG_LARGE+PG_UW
shr ebx, 20
mov ecx, ebx
shr edx, 20
mov ecx, edx
@@:
mov [sys_pgdir+ebx], esi
add ebx, 4
mov [sys_pgdir+edx], esi
add edx, 4
add esi, 0x00400000
dec edi
jnz @B
@ -423,6 +417,7 @@ proc map_LFB
jnc @F
or dword [sys_pgdir+ecx], PG_GLOBAL
@@:
mov dword [LFBAddress], LFB_BASE
mov eax, cr3 ;flush TLB
mov cr3, eax
ret
@ -431,31 +426,19 @@ proc map_LFB
@@:
call alloc_page
stdcall map_page_table, esi, eax
stdcall map_page_table, edx, eax
add esi, 0x00400000
dec edi
jnz @B
mov eax, [LFBAddress]
mov esi, eax
shr esi, 10
add esi, page_tabs
mov edi, page_tabs + (LFB_BASE shr 10)
or eax, PG_UW
mov ecx, [pg_count]
shr ecx, 2
.map:
mov [esi], eax
add eax, 0x1000
mov [esi+4], eax
add eax, 0x1000
mov [esi+8], eax
add eax, 0x1000
mov [esi+12], eax
add eax, 0x1000
add esi, 16
sub ecx, 1
jnz .map
cld
rep stosd
mov dword [LFBAddress], LFB_BASE
mov eax, cr3 ;flush TLB
mov cr3, eax
@ -488,10 +471,10 @@ proc new_mem_resize stdcall, new_size:dword
shr edi, 12
shr esi, 12
@@:
mov eax, [page_tabs+0x00181000+edi*4]
mov eax, [app_page_tabs+edi*4]
test eax, 1
jz .next
mov dword [page_tabs+0x00181000+edi*4], 2
mov dword [app_page_tabs+edi*4], 2
mov ebx, edi
shl ebx, 12
invlpg [ebx+std_application_base_address]
@ -636,18 +619,18 @@ proc page_fault_handler
mov ebx, [ebp-4]
cmp ebx, 0xe0000000
jae .lfb_addr
cmp ebx, 0x60400000
cmp ebx, 0x80000000
jae .user_space
cmp ebx, master_tab+0x1000
cmp ebx, app_page_tabs
jae .alloc
cmp ebx, 0x60000000
cmp ebx, page_tabs
jae .tab_space
cmp ebx, 0x7DC00000
jae .lfb_addr
jmp .kernel_space
.user_space:
@ -1075,7 +1058,7 @@ new_services:
@@:
cmp eax, 17
ja @f
stdcall srv_handlerEx, ebx
call srv_handlerEx ;ebx
mov [esp+36], eax
ret
@@:

View File

@ -386,23 +386,17 @@ proc create_app_space stdcall, app_size:dword,img_base:dword,img_size:dword
mov esi, sys_pgdir
mov edi, [tmp_task_pdir]
mov ecx, 384
mov ecx, (page_tabs shr 20)/4
cld
rep movsd
mov ecx, 384
xor eax, eax
cld
rep stosd
mov ecx, 256
mov esi, sys_pgdir+0xc00
rep movsd
mov eax, [dir_addr]
or eax, PG_SW
mov ebx, [tmp_task_pdir]
mov [ebx+0x600], eax
stosd ; [(page_tabs shr 20)]= eax
mov ecx, 0x800/4
xor eax, eax
rep stosd
mov eax, [dir_addr]
call set_cr3
@ -555,8 +549,8 @@ proc destroy_app_space stdcall, pg_dir:dword
and eax, not 0xFFF
stdcall map_page,[tmp_task_pdir],eax,dword PG_SW
mov esi, [tmp_task_pdir]
add esi, 0x604
mov edi, 383
add esi, 0x800
mov edi, 0x800/4
.destroy:
mov eax, [esi]
test eax, 1

View File

@ -65,9 +65,9 @@ R9800 equ 0x4E49 ;R350
R9800P equ 0x4E48 ;R350
R9800XT equ 0x4E4A ;R360
OS_BASE equ 0; 0x80400000
new_app_base equ 0x60400000; 0x01000000
PROC_BASE equ OS_BASE+0x0080000
OS_BASE equ 0
new_app_base equ 0x80000000
PROC_BASE equ 0x0080000
PG_SW equ 0x003
PG_NOCACHE equ 0x018
@ -232,7 +232,7 @@ proc service_proc stdcall, ioctl:dword
mov eax, [edi+input]
call video_free
.fail:
xor eax, eax
or eax, -1
ret
endp
@ -981,7 +981,7 @@ devices dd (R8500 shl 16)+VID_ATI
dd (R9800XT shl 16)+VID_ATI
dd 0 ;terminator
version dd 0x00030003
version dd 0x00040004
sz_ati_srv db 'HWCURSOR',0

View File

@ -67,7 +67,7 @@ proc setup_codec
xor eax, eax
stdcall codec_write, dword CODEC_AUX_VOL
mov eax, 0x1010
mov eax, 0x0B0B
stdcall codec_write, dword CODEC_MASTER_VOL_REG
mov ax, 0x08
@ -98,43 +98,40 @@ proc setup_codec
xor eax, eax ; exit with error
ret
endp
; param
; eax= volume -10000 - 0 for both channels
align 4
proc set_master_vol stdcall, vol:dword
mov ebx, 63
mov ecx, 20644
mov eax, [vol]
cmp eax, 90
jna @f
mov eax, 90
set_master_vol:
cmp eax, 0
jl @F
xor eax, eax
jmp .set
@@:
mul ecx
shr eax, 15
sub ebx, eax
mov ah, bl
mov al, bl
cmp eax, -9450
jg .set
mov eax, -9450 ;clamp into 6 bits
.set:
cdq
mov ebx, -150
idiv ebx
mov ah, al
stdcall codec_write, dword CODEC_MASTER_VOL_REG
xor eax, eax
ret
endp
align 4
proc get_master_vol stdcall, pvol:dword
stdcall codec_read, dword CODEC_MASTER_VOL_REG
and eax, 0x3F
mov ebx, 63
mov ecx, 20644
xchg eax, ebx
sub eax, ebx
shl eax, 15
xor edx, edx
div ecx
imul eax, -150
mov ebx, [pvol]
mov [ebx], eax
xor eax, eax
ret
endp

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
;
; This file is part of the Infinity sound AC97 driver.
; (C) copyright Serge 2006
; This file is part of the Infinity sound driver.
; (C) copyright Serge 2006-2007
; email: infinity_sound@mail.ru
;
; This program is free software; you can redistribute it and/or modify
@ -13,6 +13,20 @@
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
SOUND_VERSION equ 0x01000100
PLAY_SYNC equ 0x80000000
PCM_ALL equ 0
PCM_OUT equ 0x08000000
PCM_RING equ 0x10000000
PCM_STATIC equ 0x20000000
PCM_FLOAT equ 0x40000000 ;reserved
PCM_FILTER equ 0x80000000 ;reserved
PCM_2_16_48 equ 1
PCM_1_16_48 equ 2
@ -37,47 +51,53 @@ PCM_1_16_12 equ 14
PCM_2_16_11 equ 15
PCM_1_16_11 equ 16
PCM_2_8_48 equ 17
PCM_1_8_48 equ 18
PCM_2_16_8 equ 17
PCM_1_16_8 equ 18
PCM_2_8_44 equ 19
PCM_1_8_44 equ 20
PCM_2_8_48 equ 19
PCM_1_8_48 equ 20
PCM_2_8_32 equ 21
PCM_1_8_32 equ 22
PCM_2_8_44 equ 21
PCM_1_8_44 equ 22
PCM_2_8_24 equ 23
PCM_1_8_24 equ 24
PCM_2_8_32 equ 23
PCM_1_8_32 equ 24
PCM_2_8_22 equ 25
PCM_1_8_22 equ 26
PCM_2_8_24 equ 25
PCM_1_8_24 equ 26
PCM_2_8_16 equ 27
PCM_1_8_16 equ 28
PCM_2_8_22 equ 27
PCM_1_8_22 equ 28
PCM_2_8_12 equ 29
PCM_1_8_12 equ 30
PCM_2_8_16 equ 29
PCM_1_8_16 equ 30
PCM_2_8_11 equ 31
PCM_1_8_11 equ 32
PCM_2_8_12 equ 31
PCM_1_8_12 equ 32
SND_PLAY equ 1
SND_STOP equ 2
PCM_2_8_11 equ 33
PCM_1_8_11 equ 34
; struc SND_DEV
;{ .magic dd 0
; .size dd 0
; .count dd 0
; dd 0
; .snd_buff dd 16 dup (0)
;}
;virtual at 0
; SND_DEV SND_DEV
;end virtual
;SND_DEV_SIZE equ 80
PCM_2_8_8 equ 35
PCM_1_8_8 equ 36
SRV_GETVERSION equ 0
SND_CREATE_BUFF equ 1
SND_DESTROY_BUFF equ 2
SND_SETFORMAT equ 3
SND_GETFORMAT equ 4
SND_RESET equ 5
SND_SETPOS equ 6
SND_GETPOS equ 7
SND_SETBUFF equ 8
SND_OUT equ 9
SND_PLAY equ 10
SND_STOP equ 11
SND_SETVOLUME equ 12
SND_GETVOLUME equ 13
SND_SETPAN equ 14
SND_GETPAN equ 15
SND_GETBUFFSIZE equ 16
struc STREAM
{
@ -94,32 +114,35 @@ struc STREAM
.format dd ?
.flags dd ?
.work_buff dd ?
.work_read dd ?
.work_write dd ?
.work_count dd ?
.work_top dd ?
.out_base dd ?
.out_wp dd ?
.out_rp dd ?
.out_count dd ?
.out_top dd ?
.r_size dd ?
.r_end dd ?
.r_dt dd ?
.r_silence dd ?
.base dd ?
.limit dd ?
.seg_0 dd ?
.lim_0 dd ?
.seg_1 dd ?
.lim_1 dd ?
.curr_seg dd ?
.buff_size dd ?
.notify_off1 dd ?
.notify_off2 dd ?
; .notify_task dd ?
.resample dd ?
.l_vol dd ?
.r_vol dd ?
.l_amp dw ?
.r_amp dw ?
.pan dd ?
.in_base dd ?
.in_size dd ?
.in_wp dd ?
.in_rp dd ?
.in_count dd ?
.in_free dd ?
.in_top dd ?
.notify_event dd ?
.notify_id dd ?
}
STREAM_SIZE equ 31*4
STREAM_SIZE equ 34*4
FD_OFFSET equ 24
virtual at 0

View File

@ -13,93 +13,64 @@
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
align 4
mix_list rq 32
align 4
proc new_mix stdcall, output:dword
locals
mixCounter dd ?
mixIndex dd ?
streamIndex dd ?
inputCount dd ?
main_count dd ?
blockCount dd ?
mix_out dd ?
main_count rd 1
fpu_state rb 528 ;512+16
endl
mov [main_count], 32
call prepare_playlist
cmp [play_count], 0
je .exit
je .clear
lea eax, [fpu_state+16]
and eax, -16 ;must be 16b aligned
call FpuSave
mov [main_count], 32;
.l00:
mov [mix_buff_map], 0x0000FFFF;
xor eax, eax
mov [mixCounter], eax
mov [mixIndex],eax
mov [streamIndex], eax;
mov ebx, [play_count]
mov [inputCount], ebx
.l0:
mov ecx, 4
.l1:
mov ebx, [streamIndex]
mov esi, [play_list+ebx*4]
mov eax, [esi+STREAM.work_read]
add [esi+STREAM.work_read], 512
mov ebx, [mixIndex]
mov [mix_input+ebx*4], eax
inc [mixCounter]
inc [mixIndex]
inc [streamIndex]
dec [inputCount]
jz .m2
dec ecx
jnz .l1
cmp [mixCounter], 4
jnz .m2
stdcall mix_4_1, [mix_input],[mix_input+4],[mix_input+8],[mix_input+12]
sub [mixIndex],4
mov ebx, [mixIndex]
mov [mix_input+ebx*4], eax
inc [mixIndex]
mov [mixCounter], 0
cmp [inputCount], 0
jnz .l0
.m2:
cmp [mixIndex], 1
jne @f
stdcall copy_mem, [output], [mix_input]
jmp .m3
@@:
cmp [mixIndex], 2
jne @f
stdcall mix_2_1, [output], [mix_input], [mix_input+4]
jmp .m3
@@:
cmp [mixIndex], 3
jne @f
stdcall mix_3_1, [output],[mix_input],[mix_input+4],[mix_input+8]
jmp .m3
@@:
stdcall final_mix, [output],[mix_input],[mix_input+4],[mix_input+8], [mix_input+12]
.m3:
add [output],512
dec [main_count]
jnz .l00
call update_stream
emms
.mix:
lea eax, [mix_list]
call do_mix_list
test eax, eax
je .done
; cmp eax, 1
; je .copy
lea ebx, [mix_list]
stdcall mix_all, [output], ebx, eax
@@:
add [output], 512
dec [main_count]
jnz .mix
.exit:
lea eax, [fpu_state+16]
and eax, -16
call FpuRestore
ret
.exit:
.copy:
lea eax, [mix_list]
stdcall copy_mem, [output], [eax]
jmp @B
.done:
mov ecx, [main_count]
shl ecx, 7 ;ecx*= 512/4
mov edi, [output]
mov ecx, 0x1000
xor eax, eax
cld
rep stosd
jmp .exit
.clear:
mov edi, [output]
mov ecx, 4096
xor eax, eax
cld
rep stosd
@ -120,81 +91,62 @@ proc update_stream
mov edx, [stream_index]
mov esi, [play_list+edx*4]
mov eax, [esi+STREAM.work_read]
cmp eax, [esi+STREAM.work_top]
mov eax, [esi+STREAM.out_rp]
cmp eax, [esi+STREAM.out_top]
jb @f
sub eax, 64*1024
@@:
mov [esi+STREAM.work_read], eax
mov [esi+STREAM.out_rp], eax
cmp [esi+STREAM.format], PCM_2_16_48
cmp word [esi+STREAM.format], PCM_2_16_48
je .copy
sub [esi+STREAM.work_count], 16384
cmp [esi+STREAM.out_count], 16384
ja .skip
cmp [esi+STREAM.work_count], 32768
ja @f
test [esi+STREAM.format], PCM_RING
jnz .ring
stdcall refill, esi
@@:
.skip:
inc [stream_index]
dec [play_count]
jnz .l1
ret
.ring:
stdcall refill_ring, esi
jmp .skip
.copy:
mov ebx, esi
mov edi, [ebx+STREAM.work_write]
cmp edi, [ebx+STREAM.work_top]
mov edi, [ebx+STREAM.out_wp]
cmp edi, [ebx+STREAM.out_top]
jb @f
sub edi, 64*1024
mov [ebx+STREAM.work_write], edi
mov [ebx+STREAM.out_wp], edi
@@:
mov esi, [ebx+STREAM.curr_seg]
mov esi, [ebx+STREAM.in_rp]
mov ecx, 16384/4
cld
rep movsd
mov [ebx+STREAM.work_write], edi
mov [ebx+STREAM.out_wp], edi
cmp esi, [ebx+STREAM.lim_0]
cmp esi, [ebx+STREAM.in_top]
jb @f
mov esi, [ebx+STREAM.seg_0]
mov eax, [ebx+STREAM.lim_0]
xchg esi, [ebx+STREAM.seg_1]
xchg eax, [ebx+STREAM.lim_1]
mov [ebx+STREAM.seg_0], esi
mov [ebx+STREAM.lim_0], eax
sub esi, 0x10000
@@:
mov [ebx+STREAM.curr_seg], esi
mov [ebx+STREAM.in_rp], esi
xor ecx, ecx
cmp esi, [ebx+STREAM.notify_off2]
je @f
mov ecx,0x8000
cmp esi, [ebx+STREAM.notify_off1]
je @f
inc [stream_index]
dec [play_count]
jnz .l1
ret
@@:
mov [ev_code], 0xFF000001
mov [ev_offs], ecx
mov eax, [ebx+STREAM.pid]
lea edx, [ev_code]
push ebx
stdcall SendEvent, eax, edx
pop ebx
test eax, eax
jnz .l_end
not eax
mov [ebx+STREAM.pid], eax ;-1
jz .l_end
mov eax, [ebx+STREAM.notify_event]
mov ebx, [ebx+STREAM.notify_id]
mov ecx, EVENT_WATCHED
xor edx, edx
call RaiseEvent ;eax, ebx, ecx, edx
.l_end:
inc [stream_index]
dec [play_count]
@ -205,72 +157,186 @@ endp
align 4
proc refill stdcall, str:dword
locals
ev_code dd ? ;EVENT
ev_offs dd ?
rd 4
r_size rd 1
event rd 6
endl
mov ebx, [str]
mov edi, [ebx+STREAM.work_write]
cmp edi, [ebx+STREAM.work_top]
mov edi, [ebx+STREAM.out_wp]
cmp edi, [ebx+STREAM.out_top]
jb @F
sub edi, 64*1024
mov [ebx+STREAM.work_write], edi
sub edi, 0x10000
mov [ebx+STREAM.out_wp], edi
@@:
mov esi, [ebx+STREAM.curr_seg]
mov edi, [ebx+STREAM.work_write]
mov eax, [ebx+STREAM.in_count]
test eax, eax
jz .done
mov ecx, [ebx+STREAM.r_size]
cmp eax, ecx
jle @F
mov eax, ecx
@@:
mov ecx, eax
cmp word [ebx+STREAM.format], PCM_1_16_8
ja @F
shr eax, 1 ;two channles
@@:
test [ebx+STREAM.format], 1 ;even formats mono
jz @F
shr eax, 1 ;eax= samples
@@:
shl eax, 15 ;eax*=32768 =r_end
mov [r_size], ecx
mov esi, [ebx+STREAM.in_rp]
mov edi, [ebx+STREAM.out_wp]
stdcall [ebx+STREAM.resample], edi, esi, \
[ebx+STREAM.r_dt],[ebx+STREAM.r_size],[ebx+STREAM.r_end]
[ebx+STREAM.r_dt], ecx, eax
mov ebx, [str]
add [ebx+STREAM.work_count], eax;
add [ebx+STREAM.work_write], eax;
add [ebx+STREAM.out_count], eax;
add [ebx+STREAM.out_wp], eax;
mov eax, [ebx+STREAM.curr_seg]
add eax, [ebx+STREAM.r_size]
cmp eax, [ebx+STREAM.lim_0]
mov eax, [ebx+STREAM.in_rp]
mov ecx, [r_size]
add eax, ecx
add [ebx+STREAM.in_free], ecx
sub [ebx+STREAM.in_count], ecx
cmp eax, [ebx+STREAM.in_top]
jb @f
mov esi, [ebx+STREAM.seg_0]
lea edi, [esi-128]
add esi, 0x7F80
mov ecx, 128/4
cld
rep movsd
mov eax, [ebx+STREAM.seg_0]
mov ecx, [ebx+STREAM.lim_0]
xchg eax, [ebx+STREAM.seg_1]
xchg ecx, [ebx+STREAM.lim_1]
mov [ebx+STREAM.seg_0], eax
mov [ebx+STREAM.lim_0], ecx
sub eax, [ebx+STREAM.in_size]
@@:
mov [ebx+STREAM.curr_seg], eax
mov [ebx+STREAM.in_rp], eax
xor ecx, ecx
cmp eax, [ebx+STREAM.notify_off2]
je @f
mov ecx,0x8000
cmp eax, [ebx+STREAM.notify_off1]
je @f
ret
@@:
mov [ev_code], 0xFF000001
mov [ev_offs], ecx
mov eax, [ebx+STREAM.pid]
lea edx, [ev_code]
push ebx
stdcall SendEvent, eax, edx
pop ebx
.done:
mov eax, [ebx+STREAM.notify_event]
test eax, eax
jnz @F
not eax
mov [ebx+STREAM.pid], eax ;-1
jz .exit
mov ebx, [ebx+STREAM.notify_id]
mov ecx, EVENT_WATCHED
xor edx, edx
call RaiseEvent ;eax, ebx, ecx, edx
.exit:
ret
endp
align 4
proc refill_ring stdcall, str:dword
locals
event rd 6
endl
mov ebx, [str]
mov edi, [ebx+STREAM.out_wp]
cmp edi, [ebx+STREAM.out_top]
jb @F
sub edi, 0x10000
mov [ebx+STREAM.out_wp], edi
@@:
mov ecx, [ebx+STREAM.r_size]
mov eax, ecx
cmp word [ebx+STREAM.format], PCM_1_16_8
ja @F
shr eax, 1 ;two channles
@@:
test [ebx+STREAM.format], 1 ;even formats mono
jz @F
shr eax, 1 ;eax= samples
@@:
shl eax, 15 ;eax*=32768 =r_end
mov esi, [ebx+STREAM.in_rp]
mov edi, [ebx+STREAM.out_wp]
stdcall [ebx+STREAM.resample], edi, esi, \
[ebx+STREAM.r_dt], ecx, eax
mov ebx, [str]
add [ebx+STREAM.out_count], eax;
add [ebx+STREAM.out_wp], eax;
mov eax, [ebx+STREAM.in_rp]
mov ecx, [ebx+STREAM.r_size]
add eax, ecx
add [ebx+STREAM.in_free], ecx
sub [ebx+STREAM.in_count], ecx
cmp eax, [ebx+STREAM.in_top]
jb @f
sub eax, [ebx+STREAM.in_size]
@@:
mov [ebx+STREAM.in_rp], eax
sub eax, [ebx+STREAM.in_base]
sub eax, 128
lea edx, [event]
mov dword [edx], RT_INP_EMPTY
mov dword [edx+4], 0
mov dword [edx+8], ebx
mov dword [edx+12], eax
mov eax, [ebx+STREAM.notify_event]
test eax, eax
jz .exit
mov ebx, [ebx+STREAM.notify_id]
xor ecx, ecx
call RaiseEvent ;eax, ebx, ecx, edx
.exit:
ret
endp
align 4
proc mix_all stdcall, dest:dword, list:dword, count:dword
mov edi, [dest]
mov ebx, 64
.mix:
mov edx, [list]
mov ecx, [count]
mov eax, [edx]
movq mm0, [eax]
movd mm1, [edx+4]
punpckldq mm1,mm1
pmulhw mm0, mm1
psllw mm0, 1
.mix_loop:
add dword [edx], 8
add edx, 8
dec ecx
jz @F
mov eax, [edx]
movq mm1, [eax]
movd mm2, [edx+4]
punpckldq mm2,mm2
pmulhw mm1, mm2
psllw mm1, 1
paddsw mm0, mm1
jmp .mix_loop
@@:
movq [edi], mm0
add edi, 8
dec ebx
jnz .mix
ret
endp
@ -282,14 +348,14 @@ proc resample_1 stdcall, dest:dword,src:dword,\
; src equ esp+12
; r_dt equ esp+16
; r_size equ esp+20
;r_end equ esp+24
; r_end equ esp+24
mov edi, [dest]
mov edx, [src]
sub edx, 32*2
mov eax, 16
align 16
align 4
.l1:
mov ecx, eax
mov esi, eax
@ -342,7 +408,7 @@ proc resample_18 stdcall, dest:dword,src:dword,\
mov esi, 16
align 16
align 4
.l1:
mov ecx, esi
mov eax, esi
@ -413,7 +479,7 @@ proc resample_2 stdcall, dest:dword,src:dword,\
mov eax, 16
emms
align 16
align 4
.l1:
mov ecx, eax
mov esi, eax
@ -466,7 +532,7 @@ proc resample_28 stdcall, dest:dword,src:dword,\
movq mm7,[mm80]
movq mm6,[mm_mask]
align 16
align 4
.l1:
mov ecx, eax
mov esi, eax
@ -840,6 +906,8 @@ proc mix_4_1 stdcall, str0:dword, str1:dword,\
and eax, eax
jz .err
mov [output], eax
mov edi, eax
mov eax, [str0]
mov ebx, [str1]
@ -939,4 +1007,100 @@ proc memcpy
ret
endp
if 0
align 4
proc new_mix stdcall, output:dword
locals
mixCounter dd ?
mixIndex dd ?
streamIndex dd ?
inputCount dd ?
main_count dd ?
blockCount dd ?
mix_out dd ?
endl
call prepare_playlist
cmp [play_count], 0
je .exit
call FpuSave
mov [main_count], 32;
.l00:
mov [mix_buff_map], 0x0000FFFF;
xor eax, eax
mov [mixCounter], eax
mov [mixIndex],eax
mov [streamIndex], eax;
mov ebx, [play_count]
mov [inputCount], ebx
.l0:
mov ecx, 4
.l1:
mov ebx, [streamIndex]
mov esi, [play_list+ebx*4]
mov eax, [esi+STREAM.work_read]
add [esi+STREAM.work_read], 512
mov ebx, [mixIndex]
mov [mix_input+ebx*4], eax
inc [mixCounter]
inc [mixIndex]
inc [streamIndex]
dec [inputCount]
jz .m2
dec ecx
jnz .l1
cmp [mixCounter], 4
jnz .m2
stdcall mix_4_1, [mix_input],[mix_input+4],[mix_input+8],[mix_input+12]
sub [mixIndex],4
mov ebx, [mixIndex]
mov [mix_input+ebx*4], eax
inc [mixIndex]
mov [mixCounter], 0
cmp [inputCount], 0
jnz .l0
.m2:
cmp [mixIndex], 1
jne @f
stdcall copy_mem, [output], [mix_input]
jmp .m3
@@:
cmp [mixIndex], 2
jne @f
stdcall mix_2_1, [output], [mix_input], [mix_input+4]
jmp .m3
@@:
cmp [mixIndex], 3
jne @f
stdcall mix_3_1, [output],[mix_input],[mix_input+4],[mix_input+8]
jmp .m3
@@:
stdcall final_mix, [output],[mix_input],[mix_input+4],[mix_input+8], [mix_input+12]
.m3:
add [output],512
dec [main_count]
jnz .l00
call update_stream
emms
call FpuRestore
ret
.exit:
mov edi, [output]
mov ecx, 0x1000
xor eax, eax
cld
rep stosd
ret
endp
end if

View File

@ -244,8 +244,8 @@ end virtual
EVENT_NOTIFY equ 0x00000200
OS_BASE equ 0; 0x80400000
new_app_base equ 0x60400000; 0x01000000
PROC_BASE equ OS_BASE+0x0080000
new_app_base equ 0x80000000
public START
public service_proc
@ -361,16 +361,15 @@ proc service_proc stdcall, ioctl:dword
@@:
cmp eax, DEV_SET_MASTERVOL
jne @F
mov ebx, [edi+input]
stdcall set_master_vol, [ebx]
mov eax, [edi+input]
mov eax, [eax]
call set_master_vol ;eax= vol
ret
@@:
cmp eax, DEV_GET_MASTERVOL
jne @F
mov ebx, [edi+output]
test ebx, ebx
jz .fail
add ebx, new_app_base
stdcall get_master_vol, ebx
ret
@@:
@ -381,7 +380,7 @@ proc service_proc stdcall, ioctl:dword
ret
@@:
.fail:
xor eax, eax
or eax, -1
ret
endp
@ -401,7 +400,7 @@ proc ac97_irq
; end if
mov edx, PCM_OUT_CR_REG
mov al, 0x14
mov al, 0x10
call [ctrl.ctrl_write8]
mov ax, 0x1c
@ -424,11 +423,11 @@ proc ac97_irq
call [ctrl.ctrl_write8]
mov edx, PCM_OUT_CR_REG
mov ax, 0x1D
mov ax, 0x11
call [ctrl.ctrl_write8]
mov eax, [civ_val]
add eax, 2
add eax, 1
and eax, 31
mov ebx, dword [buff_list+eax*4]
@ -441,7 +440,7 @@ proc ac97_irq
.skip:
mov edx, PCM_OUT_CR_REG
mov ax, 0x1D
mov ax, 0x11
call [ctrl.ctrl_write8]
ret
endp
@ -455,6 +454,7 @@ proc create_primary_buff
mov edi, eax
mov ecx, 0x10000/4
xor eax, eax
cld
rep stosd
mov eax, [ctrl.buffer]
@ -1132,7 +1132,7 @@ align 4
devices dd (CTRL_SIS shl 16)+VID_SIS,msg_AC, set_SIS
dd 0
version dd 0x00030003
version dd 0x00040004
msg_AC db '7012 AC97 controller',13,10, 0
msg_SIS db 'Silicon Integrated Systems',13,10, 0

View File

@ -271,8 +271,8 @@ end virtual
EVENT_NOTIFY equ 0x00000200
OS_BASE equ 0;
new_app_base equ 0x60400000
PROC_BASE equ OS_BASE+0x0080000
new_app_base equ 0x80000000
public START
public service_proc
@ -405,27 +405,26 @@ proc service_proc stdcall, ioctl:dword
@@:
cmp eax, DEV_SET_MASTERVOL
jne @F
mov ebx, [edi+input]
stdcall set_master_vol, [ebx]
mov eax, [edi+input]
mov eax, [eax]
call set_master_vol ;eax= vol
ret
@@:
cmp eax, DEV_GET_MASTERVOL
jne @F
mov ebx, [edi+output]
test ebx, ebx
jz .fail
add ebx, new_app_base
stdcall get_master_vol, ebx
ret
@@:
cmp eax, DEV_GET_INFO
jne @F
mov ebx, [edi+output]
stdcall get_dev_info, ebx
ret
;@@:
; cmp eax, DEV_GET_INFO
; jne @F
; mov ebx, [edi+output]
; stdcall get_dev_info, ebx
; ret
@@:
.fail:
xor eax, eax
or eax, -1
ret
endp
@ -1004,8 +1003,7 @@ proc cold_reset
endp
align 4
proc play
play:
mov eax, 16
mov [ctrl.lvi_reg], eax
mov edx, PCM_OUT_LVI_REG
@ -1014,11 +1012,11 @@ proc play
mov edx, PCM_OUT_CR_REG
mov ax, 0x1D
call [ctrl.ctrl_write8]
xor eax, eax
ret
endp
align 4
proc stop
stop:
mov edx, PCM_OUT_CR_REG
mov ax, 0x0
call [ctrl.ctrl_write8]
@ -1026,8 +1024,8 @@ proc stop
mov ax, 0x1c
mov edx, PCM_OUT_SR_REG
call [ctrl.ctrl_write16]
xor eax, eax
ret
endp
align 4
proc get_dev_info stdcall, p_info:dword
@ -1353,7 +1351,7 @@ devices dd (CTRL_ICH shl 16)+VID_INTEL,msg_ICH, set_ICH
dd 0 ;terminator
version dd 0x00030003
version dd 0x00040004
msg_ICH db 'Intel ICH', 13,10, 0
msg_ICH0 db 'Intel ICH0', 13,10, 0

View File

@ -169,7 +169,7 @@ include 'unpacker.inc'
__DEBUG__ fix 1
__DEBUG_LEVEL__ fix 1
include 'debug-fdo.inc'
include 'fdo.inc'
iglobal
boot_memdetect db 'Determining amount of memory',0
@ -372,7 +372,7 @@ B32:
bts [cpu_caps], CAPS_TSC ;force use rdtsc
; -------- Fast System Call init ----------
; Intel SYSENTER/SYSEXIT (AMD CPU support it too)
; Intel SYSENTER/SYSEXIT (AMD CPU support it too)
bt [cpu_caps], CAPS_SEP
jnc .SEnP ; SysEnter not Present
xor edx, edx
@ -386,7 +386,7 @@ B32:
mov eax, sysenter_entry
wrmsr
.SEnP:
; AMD SYSCALL/SYSRET
; AMD SYSCALL/SYSRET
cmp byte[cpu_vendor], 'A'
jne .noSYSCALL
mov eax, 0x80000001
@ -414,8 +414,11 @@ B32:
.noSYSCALL:
; -----------------------------------------
; MEMORY MODEL
call mem_test
call init_mtrr
call init_mem
call init_page_map
@ -430,8 +433,8 @@ B32:
call init_kernel_heap
stdcall kernel_alloc, 0x2000
mov [os_stack], eax
call init_LFB
call init_mtrr
call init_fpu
call init_malloc
@ -4872,6 +4875,7 @@ read_from_hd: ; Read from hd - fn not in use
align 4
paleholder:
ret
; --------------- APM ---------------------
apm_entry dp 0
apm_vf dd 0

View File

@ -211,8 +211,14 @@
;
;
; 0x0098B000 -> kernel heap
;
; 0x01FFFFFF heam min limit
; 0x7DBFFFFF heap max limit
; 0x7DC00000 -> 0x7FBFFFFF LFB 32Mb
; 0x7DC00000 -> 0x7E3FFFFF application available LFB 8Mb
; 0x7E400000 -> 0x7FBFFFFF kernel LFB part 24 Mb
; 0x7FC00000 -> 0x7FFFFFFF page tables 4Mb
; 0x80000000 -> 0xFFFFFFFF application 2Gb