From 92dc7c223f8fe67d6b5f4585268a043666b346dd Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Mon, 27 Sep 2010 22:53:05 +0000 Subject: [PATCH] f62/pci_api: and again git-svn-id: svn://kolibrios.org@1629 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/bus/pci/pci32.inc | 21 +++++++++++++--- kernel/trunk/core/memory.inc | 45 ++++++++++++++++++---------------- 2 files changed, 42 insertions(+), 24 deletions(-) diff --git a/kernel/trunk/bus/pci/pci32.inc b/kernel/trunk/bus/pci/pci32.inc index 0ee7f0b1b6..d639c89c4b 100644 --- a/kernel/trunk/bus/pci/pci32.inc +++ b/kernel/trunk/bus/pci/pci32.inc @@ -63,9 +63,6 @@ pci_api: mov ebx,ecx mov ecx,edx -align 4 -pci_api_drv: - cmp [pci_access_enabled],1 jne pci_service_not_supported @@ -82,6 +79,24 @@ end if call dword [f62call+edx*4] mov dword [esp+32],eax ret + + +align 4 +pci_api_drv: + + cmp [pci_access_enabled],1 + jne .fail + + cmp eax, 2 + ja .fail + + jmp dword [f62call+eax*4] + +.fail: + or eax,-1 + ret + + ;; ============================================ pci_fn_0: diff --git a/kernel/trunk/core/memory.inc b/kernel/trunk/core/memory.inc index 78f9a137b1..6eb3bd331a 100644 --- a/kernel/trunk/core/memory.inc +++ b/kernel/trunk/core/memory.inc @@ -32,7 +32,7 @@ proc alloc_page xor eax,eax ret .found: -;//- +;//- dec [pg_data.pages_free] jz .out_of_memory ;//- @@ -1166,25 +1166,7 @@ sysfn_meminfo: .fail: or dword [esp+32], -1 ret -iglobal -align 4 -f68call: - dd f68.11 ; init_heap - dd f68.12 ; user_alloc - dd f68.13 ; user_free - dd f68.14 ; get_event_ex - dd f68.fail ;moved to f68.24 - dd f68.16 ; get_service - dd f68.17 ; call_service - dd f68.fail ;moved to f68.25 - dd f68.19 ; load_dll - dd f68.20 ; user_realloc - dd f68.21 ; load_driver - dd f68.22 ; shmem_open - dd f68.23 ; shmem_close - dd f68.24 - dd f68.25 -endg + align 4 f68: cmp ebx,4 @@ -1236,7 +1218,7 @@ f68: ret .20: mov eax, edx - mov ebx, ecx + mov ebx, ecx call user_realloc ;in: eax = pointer, ebx = new size mov [esp+32], eax ret @@ -1304,6 +1286,27 @@ f68: mov [esp+32], eax ret + +align 4 +f68call: ; keep this table closer to main code + + dd f68.11 ; init_heap + dd f68.12 ; user_alloc + dd f68.13 ; user_free + dd f68.14 ; get_event_ex + dd f68.fail ; moved to f68.24 + dd f68.16 ; get_service + dd f68.17 ; call_service + dd f68.fail ; moved to f68.25 + dd f68.19 ; load_dll + dd f68.20 ; user_realloc + dd f68.21 ; load_driver + dd f68.22 ; shmem_open + dd f68.23 ; shmem_close + dd f68.24 + dd f68.25 + + align 4 proc load_pe_driver stdcall, file:dword