The mechanics of switching between user/supervisor/hypervisor mode

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

The mechanics of switching between user/supervisor/hypervisor mode

Jump to solution
630 Views
mikelackey
Contributor I

I am looking for a P4080/e500mc document that describes the mechanics of writing code to switch between user/supervisor/hypervisor mode.  I'm new to this, and not sure how it works.  I've looked in the e500mc ref manual, the P4080 programmer's manual, google, and this community.  I'm probably not asking the right question.

My SWAG is that privilege is controlled by the MMU configuration.  Example, say three small-ish blocks of virtual memory, one configured with user only privs, one with supervisor privs, and one with hypervisor privs.  At startup the code (by default running in hypervisor space) configures the MMU to provide three blocks of memory, such that each block has differing privs.  When initialization is complete, jumping to the address space of another block automagically updates the MSR.  Stated differently, the MSR is changed to what is configured for that block.  So there really is no code to switch back and forth, just transferring control from one block to another causes the MSR to be updated with the privs assigned to that block.

Is there a doc that describes the mechanics of this?

Labels (1)
Tags (1)
0 Kudos
1 Solution
429 Views
r8070z
NXP Employee
NXP Employee


Have a great day,

Attempting to access hypervisor or supervisor resources or instructions causes privilege exceptions, which the operating system can handle appropriately. When core jumps to the privelege exception handler the MSR is changed as it required for the privilege level. There is System Call instruction to generate a system call or a hypervisor-level system call (hypercall) interrupt. It permits a program to call on the system to perform a service or an operating system to call on the hypervisor to perform a service. See section 3.4.5.6 System Linkage Instruction in the e500mc document. You also can look section 1.2.3 Privilege Model in the EREF: A Programmer’s Reference Manual for Freescale Power Architecture Processors https://www.nxp.com/files-static/32bit/doc/ref_manual/EREF_RM.pdf

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

2 Replies
430 Views
r8070z
NXP Employee
NXP Employee


Have a great day,

Attempting to access hypervisor or supervisor resources or instructions causes privilege exceptions, which the operating system can handle appropriately. When core jumps to the privelege exception handler the MSR is changed as it required for the privilege level. There is System Call instruction to generate a system call or a hypervisor-level system call (hypercall) interrupt. It permits a program to call on the system to perform a service or an operating system to call on the hypervisor to perform a service. See section 3.4.5.6 System Linkage Instruction in the e500mc document. You also can look section 1.2.3 Privilege Model in the EREF: A Programmer’s Reference Manual for Freescale Power Architecture Processors https://www.nxp.com/files-static/32bit/doc/ref_manual/EREF_RM.pdf

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

429 Views
mikelackey
Contributor I

Thank you.

0 Kudos