baumgarb
baumgarb

Reputation: 2197

How to access x64 hardware directly without Hardware Abstraction Layers?

I have kind of a weird question but I am interested in this topic.

Is there any possiblity to access the hardware of a current x64 based computer directly without going with some sort of HAL (Hardware Abstraction Layer) or the pendant of other operating systems (udev, upower, ...)? And I am not talking about developing a certain device driver, instead of that I am talking about a simple "Hello World" programming with C or assembler or something like that.

I am aware of the fact that things like multiple cpu cores and multithreading and so on make this kind of programming some sort of senseless for the most common cases. However, I am interested in knowing if it is possible at all and if so, how you could do it?

My focus lies on Linux based operating systems. And as far as I know it's not possible on Microsoft based operating systems since 98 / ME

Many thanks for your effort in advance & best regards, B.

Upvotes: 3

Views: 1239

Answers (1)

SergeyA
SergeyA

Reputation: 62613

No, you wouldn't be able to do this in any language. The reason is rather simple - in any modern architecture user programms are running in so-called protected mode. What it means (among other things) is that you do not have access to real memory - instead, CPU together with OS translate memory addresses your program is using to something else.

In order to communicate with hardware you really need to access the memory region which is used by this hardware - and this is totally impossible in protected mode.

Upvotes: 2

Related Questions