diff --git a/kernel/trunk/core/dll.inc b/kernel/trunk/core/dll.inc index 8c8bc73fd4..ea8c605300 100644 --- a/kernel/trunk/core/dll.inc +++ b/kernel/trunk/core/dll.inc @@ -543,6 +543,8 @@ proc get_proc_ex stdcall, proc_name:dword, imports:dword .look_up: mov edx, [imports] + test edx, edx + jz .end mov edx, [edx] test edx, edx jz .end @@ -806,6 +808,112 @@ proc load_driver stdcall, file_name:dword ret endp +align 4 +proc load_library stdcall, file_name:dword + locals + coff dd ? + sym dd ? + strings dd ? + img_size dd ? + img_base dd ? + exports dd ? + endl + + cli + + stdcall load_file, [file_name] + + test eax, eax + jz .fail + + mov [coff], eax + movzx ecx, [eax+CFH.nSections] + xor ebx, ebx + + lea edx, [eax+20] +@@: + add ebx, [edx+CFS.SizeOfRawData] + add ebx, 15 + and ebx, not 15 + add edx, 18 + dec ecx + jnz @B + mov [img_size], ebx + + call init_heap + stdcall user_alloc, [img_size] + + test eax, eax + jz .fail + mov [img_base], eax + + mov edx, [coff] + movzx ebx, [edx+CFH.nSections] + mov edi, [img_base] + lea eax, [edx+20] +@@: + mov [eax+CFS.VirtualAddress], edi + mov esi, [eax+CFS.PtrRawData] + test esi, esi + jnz .copy + add edi, [eax+CFS.SizeOfRawData] + jmp .next +.copy: + add esi, edx + add edi, new_app_base + mov ecx, [eax+CFS.SizeOfRawData] + cld + rep movsb +.next: + add edi, 15-new_app_base + and edi, not 15 + add eax, 40 + dec ebx + jnz @B + + mov ebx, [edx+CFH.pSymTable] + add ebx, edx + mov [sym], ebx + mov ecx, [edx+CFH.nSymbols] + add ecx,ecx + lea ecx,[ecx+ecx*8] ;ecx*=18 = nSymbols*CSYM_SIZE + add ecx, [sym] + mov [strings], ecx + + lea eax, [edx+20] + + stdcall fix_coff_symbols, eax, [sym], [edx+CFH.nSymbols],\ + [strings], dword 0 + test eax, eax + jnz @F + +@@: + mov edx, [coff] + movzx ebx, [edx+CFH.nSections] + mov edi, new_app_base + lea eax, [edx+20] +@@: + add [eax+CFS.VirtualAddress], edi ;patch user space offset + add eax, 40 + dec ebx + jnz @B + + add edx, 20 + stdcall fix_coff_relocs, [coff], edx, [sym] + + mov ebx, [coff] + stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],szEXPORTS + mov [exports], eax + + stdcall kernel_free, [coff] + mov eax, [exports] + ret +.fail: + xor eax, eax + ret +endp + + drv_sound db '/rd/1/unisound.obj', 0 drv_infinity db '/rd/1/infinity.obj', 0 diff --git a/kernel/trunk/core/memory.inc b/kernel/trunk/core/memory.inc index 0fd1ea0786..559916ebbc 100644 --- a/kernel/trunk/core/memory.inc +++ b/kernel/trunk/core/memory.inc @@ -972,14 +972,21 @@ new_services: mov [ecx+PROC_BASE+APPDATA.sse_handler], ebx mov [esp+36], eax ret - +@@: + cmp eax, 19 + ja @f + add ebx, new_app_base + cmp ebx, new_app_base + jb .fail + stdcall load_library, ebx + mov [esp+36], eax + ret @@: .fail: xor eax, eax mov [esp+36], eax ret - align 4 proc strncmp stdcall, str1:dword, str2:dword, count:dword diff --git a/kernel/trunk/core/taskman.inc b/kernel/trunk/core/taskman.inc index f9b69b322b..4d4b1b8fd0 100644 --- a/kernel/trunk/core/taskman.inc +++ b/kernel/trunk/core/taskman.inc @@ -1111,7 +1111,11 @@ proc new_sys_threads mov edi,edx mov ecx,11 rep movsb ;copy process name - mov eax,[ebx+0x8c] + mov eax,[ebx+APPDATA.heap_base] + mov [edx+APPDATA.heap_base], eax + mov ecx,[ebx+APPDATA.heap_top] + mov [edx+APPDATA.heap_top], ecx + mov eax,[ebx+APPDATA.mem_size] mov [app_mem],eax ;set memory size mov eax,[ebx+0xb8] mov [edx+0xb8],eax ;copy page directory diff --git a/kernel/trunk/drivers/infinity.asm b/kernel/trunk/drivers/infinity.asm index b1e63a7007..0dd943b3dc 100644 --- a/kernel/trunk/drivers/infinity.asm +++ b/kernel/trunk/drivers/infinity.asm @@ -614,7 +614,6 @@ proc prepare_updatelist ret endp - align 4 proc set_handler stdcall, hsrv:dword, handler_proc:dword locals diff --git a/kernel/trunk/drivers/unisound.asm b/kernel/trunk/drivers/unisound.asm index b1bbe9de3e..176fc30694 100644 --- a/kernel/trunk/drivers/unisound.asm +++ b/kernel/trunk/drivers/unisound.asm @@ -65,6 +65,11 @@ CTRL_ICH7 equ 0x27DE CTRL_NFORCE equ 0x01B1 CTRL_NFORCE2 equ 0x006A CTRL_NFORCE3 equ 0x00DA +CTRL_MCP04 equ 0x003A +CTRL_CK804 equ 0x0059 +CTRL_CK8 equ 0x008A +CTRL_CK8S equ 0x00EA +CTRL_MCP51 equ 0x026B PCM_OUT_BDL equ 0x10 ; PCM out buffer descriptors list @@ -1312,6 +1317,11 @@ devices dd (CTRL_ICH shl 16)+VID_INTEL,msg_ICH, set_ICH dd (CTRL_NFORCE shl 16)+VID_NVIDIA,msg_NForce, set_ICH dd (CTRL_NFORCE2 shl 16)+VID_NVIDIA,msg_NForce2,set_ICH dd (CTRL_NFORCE3 shl 16)+VID_NVIDIA,msg_NForce3,set_ICH + dd (CTRL_MCP04 shl 16)+VID_NVIDIA,msg_MCP04,set_ICH + dd (CTRL_CK804 shl 16)+VID_NVIDIA,msg_CK804,set_ICH + dd (CTRL_CK8 shl 16)+VID_NVIDIA,msg_CK8,set_ICH + dd (CTRL_CK8S shl 16)+VID_NVIDIA,msg_CK8S,set_ICH + dd (CTRL_MCP51 shl 16)+VID_NVIDIA,msg_MCP51,set_ICH dd 0 ;terminator @@ -1325,10 +1335,16 @@ msg_ICH6 db 'Intel ICH6', 13,10, 0 msg_ICH7 db 'Intel ICH7', 13,10, 0 msg_Intel db 'Intel Corp. ', 0 -msg_NForce db 'NForce', 13,10, 0 -msg_NForce2 db 'NForce 2', 13,10, 0 -msg_NForce3 db 'NForce 3', 13,10, 0 -msg_NVidia db 'NVidea', 0 +msg_NForce db 'NForce', 13,10, 0 +msg_NForce2 db 'NForce 2', 13,10, 0 +msg_NForce3 db 'NForce 3', 13,10, 0 +msg_MCP04 db 'NForce MCP04',13,10, 0 +msg_CK804 db 'NForce CK804',13,10, 0 +msg_CK8 db 'NForce CK8', 13,10, 0 +msg_CK8S db 'NForce CK8S', 13,10, 0 +msg_MCP51 db 'NForce MCP51',13,10, 0 + +msg_NVidia db 'NVidia', 0 szKernel db 'KERNEL', 0 sz_sound_srv db 'SOUND',0