![]() |
Inline Assembler C++ -> Delphi
Habe mich an dieser Funktion festgebissen. Weis jemand, wie man diesen Code korrekt in Delphi übersetzt?
Code:
Hier mein Versuch, ist aber alles andere als funktionstüchtig, habe kaum Ahnung von asm:
ULONG bios32_call;
void bios32_scan_pci_entry(void) { ULONG cseg_size, offset, base_addr; /* call the BIOS32 BSD for the PCI address BSD calls terminate in RETF not RET */ /* eax is loaded with "$PCI" magic */ asm("movl $0x49435024, %%eax\n" "xorl %%ebx, %%ebx\n" "movl _bios32_call, %%ebp\n" "pushl %%cs\n" "call %%ebp\n" : "=c" (cseg_size), "=d" (offset), "=b" (base_addr) : : "eax", "ebx", "ecx", "edx", "ebp", "memory" ); /* setup two new selectors of pci_code32, pci_data32, etc. */ }
Delphi-Quellcode:
bios32_call ist ein Double Word Wert, der über eine andere Funktion ermittelt wird. Er stellt einen Zeiger auf eine BIOS-Funktion dar.
var
bios32_call: LongWord; function bios32_scan_pci_entry(serviceID : LongwORD) : Tbios32_scan_pci_entry_result; function bios32_scan_pci_entryHelper : Tbios32_scan_pci_entry_result; assembler; register; asm PUSH EBX {Save affected register} PUSH EDI MOV EDI,EAX {@Result} mov EAX,serviceID xor ebx,ebx mov ebp,bios32_call push cs call ebp STOSD {cseg_size} MOV EAX,EBX STOSD {offset} MOV EAX,ECX STOSD {base_addr} MOV EAX,EDX POP EDI {Restore registers} POP EBX end; begin result := bios32_scan_pci_entryHelper; end; Da stellt sich übrigens eine zweite Frage: Kann man unter NT (besonders WinXP SP2) überhaupt eine Funktion aus dem "Speicherbereich" 0x000E0000 bis 0x00100000 aufrufen/ausführen? Ach ja: ![]() |
Re: Inline Assembler C++ -> Delphi
Hello
can we also get PCI device capabilites? |
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:02 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz