how to read and write to connected PCI devices in assembly languages?

390 views Asked by At

I was learning about hardware and driver programming. I tried to analyze the code that was programmed for menuetOS on PCI, Ethernet, and Ethernet Cards. I could understand the concepts and what each part does. I start to program PCI and Ethernet for my own Laptop but I couldn't get Vendor and Device ID in Kali Linux. actually, I got either a syntax error or segmentation fault. I was trying to use code that I use to get Vendor and Device ID in MS-DOS.The CODE:

eax: 80000000
ecx: 00000020

0100 : mov dx,0cf8
0103 : out dx,eax
0105 : mov dx,0cfc
0108 : mov ebp, eax
010B : in eax,dx
010D : cmp eax,FFFFFFFF
0113 : je 0130
0115 : mov ds:[ebx],eax
011A : add ebx,0004
011E : mov [ebx],ebp
0123 : add ebx,0004
0127 : mov eax,ebp
012A : add eax,00000800
0130 : loop 0100

and it writes:

ds: 0000 12378086 80000000
ds: 0008 80008086 80000800
ds: 0010 BEEF80EE 00001000
            .
            .
            .

Q1: How can I get these values in NASM then print them? (actually, I don't know the start address for write to or read from different devices and don't know how to find them in memory)

Q2: How The Operating Systems (Like Windows or Linux) Can Connect to the internet before we install the NIC's Driver?

Thank YOU

0

There are 0 answers