Software Archive
Read-only legacy content
17061 Discussions

Kernel Registers in IPF

awbeale
Beginner
478 Views
The Itanium Architecture for Software Developers talks about the Kernel Registers. It states:
The eight kernel registers, labeled Kr0 through Kr7, are used to convey information from the operating system to the application program. For instance, the operating system can put read-only, semi-static information such as processor ID into one of the Kernel registers.
Question, If it is read only, how does the OS put information into the register? Is it read only to an application but not to the OS? I am not running under Windows or Linux or anything other OS. I am running in a standalone environment. Am I free to read and write these kernel registers as I see fit and be guaranteed that the compilers won't use them for "normal" code? I want some registers where I can put information that I MUST have extremely fast access to and a dedicated register would be perfect. How can I leverage these or any other register inside the Itanium and be guaranteed that the compilers won't allocate them for use behind my back?
0 Kudos
3 Replies
Intel_Software_Netw1
478 Views
Greetings from Intel Developer Services Support.
We're forwarding this question to our Application Engineering team. We'll let you know how they respond.
Regards,

Lexi S.

IntelSoftware NetworkSupport

http://www.intel.com/software

Contact us


Message Edited by intel.software.network.support on 11-30-2005 04:05 PM

0 Kudos
Intel_Software_Netw1
478 Views
Here is the response we received from our Application Engineers:
The phrasing of the paragraph in the Itanium Architecture Manual is not completely clear, but the essence is that the data that the OS places there is read-only for all user-level processes. The OS (because it runs at ring 0) has the necessary privileges to write to these registers. That is not clear in this paragraph. Volume 3 of the Software Developer's Manual (SDM) clearly explains how to use the special instructions that reference these registers and what privilege levels are required.

KR0 through KR7 are kernel registers, but kernel registers are a subset of the Application Registers. You read and write them using the "Move Application Register" Instruction. If you look at the instruction "Move Application Register" in Volume 3 of the SDM, the pseudo code shows that when you move data to (write) a Kernel Register, you must be at Privilege Level 0. Otherwise the instruction will be interrupted with a Privileged Register Fault. This protection mechanism makes these registers Read/Write for the Operating System code at Privilege Level 0, but Read-Only for Application code at Privilege Level 3.

In this fashion, applications (user level processes) cannot write to the kernel registers, but the OS can, placing semi-static information such as processor ID for use by user-level processes. The user-level processes can freely read these registers with the appropriate "Move Application Register" instruction in order to quickly reference the data that they hold without having to execute a system-level call.
We hope this is helpful.
Regards,

Lexi S.

IntelSoftware NetworkSupport

http://www.intel.com/software

Contact us

Message Edited by intel.software.network.support on 11-30-2005 04:05 PM

0 Kudos
awbeale
Beginner
478 Views
Thank you very much! Worked great! I am now accessing the kernel registers for my critical state! Thank you again!
0 Kudos
Reply