Sorry, I should have just copy/pasted the text.
I would still get clarification from the instructor of the class. There are two possibilities:
A) You are supposed to write part of an Operating System that communicates with the PCI bus via memory or I/O instructions, or
B) You are supposed to write an application that will run in at least one existing Operating System (Linux or Windows), that asks the OS to provide information about the PCI bus.
There is actually a third option, C) you are supposed to write an application that bypasses the OS and talks directly to the PCI bus, but I think this is highly unlikely, unless this is a class on hacking.
But if I were you, I'd ask which of these is the actual assignment, rather than guess and get it wrong.
By the way, I'm pretty sure Windows isn't going to let a user application have direct access to either the PCI I/O ports or the corresponding memory addresses that you would need. So I think it's a moot point.
Enumerate PCI Buses
Re: Enumerate PCI Buses
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
-
- Member
- Posts: 1146
- Joined: Sat Mar 01, 2014 2:59 pm
Re: Enumerate PCI Buses
I gather that it is supposed to be a binary to run on an existing OS but which bypasses the OS. I gather that what they're trying to say is "write the part of the kernel which accesses the PCI bus, but wrap it up in a binary for an existing OS because we haven't got a kernel to put it in". Thus the code written should be designed to execute in kernel space, and really only needs to push the current OS out of the way as such OS is being used as little more than a program loader.
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Re: Enumerate PCI Buses
The assignment seems clear to me. You need to write an user mode program, which bypasses the OS. On linux you can use the iopl or ioperm system calls as root to accomplish this, and on Windows you'll need something like giveio.sys. If you are worried about being preempted in the middle of reading from PCI configuration space, I suggest that you retry at least once and verify that you get the same value both times. Later on, you will port it to kernel space and make it into a proper driver which your user mode layer will invoke.