NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: Multit4sker on July 31, 2015, 08:07:04 PM

Title: Enumerate PCI Buses
Post by: Multit4sker on July 31, 2015, 08:07:04 PM
Hi All,

In the context of a school project on computers architecture, I have to make a PCI Bus Enumerator.
The code will be divided into two layers :
- An enumeration layer that handle enumeration of the differents buses and devices in each bus. It then must use a data structure to store all these informations (Tree maybe?) and other informations about the device (vendor id, device id, functions). It should generate a tree representing all the devices and buses.
This layer will then be ported to the kernel land (fictive of course).

- A display layer that take the data structure and display it (using dashes, colors, spaces etc... It must be fashion).

To make this program, I can use assembly languages or C language. I can't use any API. I must talk directly to the hardware and/or use BIOS routines.
I have to deliver a binary that runs on Linux or Win32.

Having only assembly concepts (Hello world :/), I don't see at all how can I start this project. I read some articles on OsDev and I more or less understood the operation (use two loops to browse the buses and devices and check for every device/bus if it exists and if it have functions). But I don't know how to code this.

It's why I ask for your help. Naturally, I don't want any pre-made code, I'm very motivated to learn.

Thanks.

(Sorry for my english, I'm french).
Title: Re: Enumerate PCI Buses
Post by: Cyrill Gorcunov on August 02, 2015, 10:29:05 PM
I would suggest to look into linux kernel source code but I fear it's too complex to start with. Maybe it worth to search for some simple and minimal operating system and take it as an example? Another option is to read pci specification to figure out how all this stuff work.