Difference between revisions of "KThreadContext"

From 3dbrew
Jump to navigation Jump to search
(Undo revision 18002 by Neobrain (talk))
Line 10: Line 10:
 
!  Description
 
!  Description
 
|-
 
|-
| 0xF38
+
| 0xF38 (page_end - 0xC8)
 
| u32[4]
 
| u32[4]
 
| SVC access control data copied from KThread's owner process
 
| SVC access control data copied from KThread's owner process
 
|-
 
|-
| 0xF50
+
| 0xF50 (page_end - 0xB0)
 
| u32[10]
 
| u32[10]
 
| SVC mode registers, r4-r11, r13, r14
 
| SVC mode registers, r4-r11, r13, r14

Revision as of 17:24, 29 August 2016


Size : 0x1000 bytes (1 page)


Offset Type Description
0xF38 (page_end - 0xC8) u32[4] SVC access control data copied from KThread's owner process
0xF50 (page_end - 0xB0) u32[10] SVC mode registers, r4-r11, r13, r14
0xFF8 u32 FPEXC, floating point exception register for thread- stored and loaded on context switches

When switching thread contexts the kernel does, in order:

  • Load FPEXC
  • Save the LR to r1- this LR is the return back to the main scheduling and context switching function
  • Load r4-r11, SP, LR
  • Branch back to r1, preserving the LR which was just reloaded, back to the main scheduling function, but in the context of the newly switched-to thread
  • Disable Interrupts
  • Check if that core's KScheduler object indicates that it needs switching again and exit if it does not
  • Otherwise, run the thread scheduler again and repeat all the steps to switch contexts again