diff options
author | Patrick Williams <iawillia@us.ibm.com> | 2012-07-17 21:57:58 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-07-28 13:04:48 -0500 |
commit | b866f4173f605d8dcdf83b3239dd7fb9a5a8768b (patch) | |
tree | abb7ddef100518198c44202293d9042b8922ae50 /src/kernel/syscall.C | |
parent | ac9ad22f261cd391c0d5163e82ff02ae4929f820 (diff) | |
download | talos-hostboot-b866f4173f605d8dcdf83b3239dd7fb9a5a8768b.tar.gz talos-hostboot-b866f4173f605d8dcdf83b3239dd7fb9a5a8768b.zip |
Execute 'doze' in idle loop.
Change-Id: Ifd611129c2d7173b5e0dec36c870e06a4d851009
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1384
Tested-by: Jenkins Server
Reviewed-by: Douglas R. Gilbert <dgilbert@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/kernel/syscall.C')
-rw-r--r-- | src/kernel/syscall.C | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/kernel/syscall.C b/src/kernel/syscall.C index 061971f96..6dcbe0c25 100644 --- a/src/kernel/syscall.C +++ b/src/kernel/syscall.C @@ -98,6 +98,7 @@ namespace Systemcalls void CpuDDLevel(task_t *t); void CpuStartCore(task_t *t); void CpuSprValue(task_t *t); + void CpuDoze(task_t *t); void MmAllocBlock(task_t *t); void MmRemovePages(task_t *t); void MmSetPermission(task_t *t); @@ -133,6 +134,7 @@ namespace Systemcalls &CpuDDLevel, // MISC_CPUDDLEVEL &CpuStartCore, // MISC_CPUSTARTCORE &CpuSprValue, // MISC_CPUSPRVALUE + &CpuDoze, // MISC_CPUDOZE &MmAllocBlock, // MM_ALLOC_BLOCK &MmRemovePages, // MM_REMOVE_PAGES @@ -668,6 +670,34 @@ namespace Systemcalls }; /** + * Allow a task to request priviledge escalation to execute the 'doze' + * instruction. + * + * Verifies the instruction to execute is, in fact, doze and then sets + * an MSR mask in the task structure to allow escalation on next + * execution. + * + * When 'doze' is executed the processor will eventually issue an + * SRESET exception with flags in srr1 to indication that the + * decrementer caused the wake-up. The kernel will then need to + * advance the task to the instruction after the doze and remove + * priviledge escalation. + * + */ + void CpuDoze(task_t *t) + { + + uint32_t* instruction = static_cast<uint32_t*>(t->context.nip); + if (0x4c000324 == (*instruction)) // Verify 'doze' instruction, + // otherwise just return. + { + // Disable PR, IR, DR so 'doze' can be executed. + // (which means to stay in HV state) + t->context.msr_mask = 0x4030; + } + }; + + /** * Allocate a block of virtual memory within the base segment * @param[in] t: The task used to allocate a block in the base segment */ |