Page 1 of 1
In / out assembly instructions and devices
Posted: Tue Aug 04, 2015 10:26 am
by AlexHully
Hi,
I am not sure about a thing.
Say I have a sata hdd, a ssd, a usb key, a pci-e graphic card, a usb keyboard and a x86_64 architecture.
Apparently, the devices are all memory mapped.
So, is it correct to assume that I will never use in/out instructions on hardware 2011+ old (except on boot with the a20 gate and other legacy things)?
Bye
Re: In / out assembly instructions and devices
Posted: Tue Aug 04, 2015 10:43 am
by onlyonemac
I believe that that is true, yes. But remember that you will need to write a driver; there is no simple way to do input and output via e.g. pci devices.
Re: In / out assembly instructions and devices
Posted: Tue Aug 04, 2015 6:00 pm
by SpyderTL
I wouldn't go that far. I'd be suprised if you can build a whole kernel with no in/out instructions. I think OHCI USB controllers are I/O based, at least partially, so avoiding it entirely may be out of the question.
Re: In / out assembly instructions and devices
Posted: Tue Aug 04, 2015 11:34 pm
by AlexHully
I really like to ask extreme questions
So, how may I know if and when I need those instructions?
Rule of thumb or something?
Re: In / out assembly instructions and devices
Posted: Wed Aug 05, 2015 12:32 am
by Octocontrabass
The hardware documentation will tell you when you need to use port-mapped I/O.
Re: In / out assembly instructions and devices
Posted: Wed Aug 05, 2015 1:21 am
by SpyderTL
In most cases, a flag in the PCI device's configuration space determines if the device uses memory addresses or I/O addresses.
Re: In / out assembly instructions and devices
Posted: Wed Aug 05, 2015 1:45 am
by AlexHully
Great,
Thanks !
Re: In / out assembly instructions and devices
Posted: Wed Aug 05, 2015 1:47 am
by iansjack
Unless everything is PCI-e you will still need to use I/O ports.
Re: In / out assembly instructions and devices
Posted: Wed Aug 05, 2015 3:53 am
by jnc100
As far as I recall the ACPI SMI_CMD port can only be an IO port, thus you'd need at least one out instruction to switch to ACPI mode.
Regards,
John.
Re: In / out assembly instructions and devices
Posted: Wed Aug 05, 2015 10:42 am
by BrightLight
Some DMA and NICs are based on I/O ports. ACPI is based on I/O ports. You will still need them in your kernel, even if they are rarely used.