diff options
author | Patrick Williams <iawillia@us.ibm.com> | 2014-02-17 13:32:15 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-02-27 11:20:44 -0600 |
commit | 850f884974dac7973f22341920fbb7277cf80245 (patch) | |
tree | 4a870919aa2b2e8dcfce16ebddbc5cc3cba0dcf8 /src/kernel | |
parent | 19cd4e5ddb80c98365612590cc58e7d0de49f69c (diff) | |
download | talos-hostboot-850f884974dac7973f22341920fbb7277cf80245.tar.gz talos-hostboot-850f884974dac7973f22341920fbb7277cf80245.zip |
Clean up TODOs in Kernel.
* Ensure that unhandled SRESET will trigger TI.
Change-Id: I34807bc357ba6908327ede975afc9c6b6b17c098
RTC: 92848
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/8933
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')
-rw-r--r-- | src/kernel/block.C | 4 | ||||
-rw-r--r-- | src/kernel/futexmgr.C | 51 | ||||
-rw-r--r-- | src/kernel/ptmgr.C | 72 | ||||
-rw-r--r-- | src/kernel/start.S | 27 |
4 files changed, 81 insertions, 73 deletions
diff --git a/src/kernel/block.C b/src/kernel/block.C index 5b35fb56e..514af2994 100644 --- a/src/kernel/block.C +++ b/src/kernel/block.C @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2013 */ +/* COPYRIGHT International Business Machines Corp. 2011,2014 */ /* */ /* p1 */ /* */ @@ -174,7 +174,7 @@ bool Block::handlePageFault(task_t* i_task, uint64_t i_addr, bool i_store) } else { - return false; //TODO - Swap kernel base block pages for user pages + return false; } } diff --git a/src/kernel/futexmgr.C b/src/kernel/futexmgr.C index f66452543..b88bcf370 100644 --- a/src/kernel/futexmgr.C +++ b/src/kernel/futexmgr.C @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/kernel/futexmgr.C $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2011 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/kernel/futexmgr.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ /** * @file futexmgr.C * @brief Definition for kernel side futex management @@ -94,7 +94,7 @@ uint64_t FutexManager::_wake(uint64_t * i_futex1, uint64_t i_count1, uint64_t started = 0; iv_lock.lock(); - + // First start up to i_count1 task(s) while(started < i_count1) { @@ -123,8 +123,9 @@ uint64_t FutexManager::_wake(uint64_t * i_futex1, uint64_t i_count1, // Move up to i_count2 tasks to futex2 while(moved < i_count2) { - // What if *i_futex2 got modified !!!! TODO - // Do we need a safety check here (another val param) ???? + // Note: i_futex2 could be modified by this point due to tasks + // released from i_count1. Userspace has to handle this + // appropriately (currently only in sync_cond_wait). _FutexWait_t * waiter = iv_list.find(i_futex1); if(waiter == NULL) { diff --git a/src/kernel/ptmgr.C b/src/kernel/ptmgr.C index 878dea807..6b6436d71 100644 --- a/src/kernel/ptmgr.C +++ b/src/kernel/ptmgr.C @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2013 */ +/* COPYRIGHT International Business Machines Corp. 2011,2014 */ /* */ /* p1 */ /* */ @@ -879,49 +879,49 @@ void PageTableManager::setAccessBits( PageTableEntry* o_pte, { o_pte->dword1 &= ~PTE_ACCESS_BITS; -/* Description of the WIMG bits. - W1,3 0 - not Write Through Required - 1 - Write Through Required - I3 0 - not Caching Inhibited - 1 - Caching Inhibited - M2 0 - not Memory Coherence Required - 1 - Memory Coherence Required - G 0 - not Guarded - 1 - Guarded -*/ + /* Description of the WIMG bits. + W1,3 0 - not Write Through Required + 1 - Write Through Required + I3 0 - not Caching Inhibited + 1 - Caching Inhibited + M2 0 - not Memory Coherence Required + 1 - Memory Coherence Required + G 0 - not Guarded + 1 - Guarded + */ if( SegmentManager::CI_ACCESS == i_accessType ) { - o_pte->WIMG = 0b0101; // Cache Inhibited, Guarded - o_pte->pp1_2 = 0b10; // PP=010 - o_pte->N = 0b1; // No Execute + o_pte->WIMG = 0b0101; // Cache Inhibited, Guarded + o_pte->pp1_2 = 0b10; // PP=010 + o_pte->N = 0b1; // No Execute } else { - // Only setting that changes WIMG is CI_ACCESSS - // All others are set to 0b0010 - o_pte->WIMG = 0b0010; // Memory Coherency Required + // Only setting that changes WIMG is CI_ACCESSS + // All others are set to 0b0010 + o_pte->WIMG = 0b0010; // Memory Coherency Required - if (i_accessType & READ_ONLY) - { - o_pte->pp1_2 = 0b01; // PP=001 - o_pte->N = 0b1; // No Execute - } + if (i_accessType & READ_ONLY) + { + o_pte->pp1_2 = 0b01; // PP=001 + o_pte->N = 0b1; // No Execute + } // if writable (implied readable) - else if (i_accessType & WRITABLE) - { - o_pte->pp1_2 = 0b10; // PP=010 - o_pte->N = 0b1; // No Execute - } + else if (i_accessType & WRITABLE) + { + o_pte->pp1_2 = 0b10; // PP=010 + o_pte->N = 0b1; // No Execute + } // if executable (implied readable) - else if (i_accessType & EXECUTABLE) - { - o_pte->pp1_2 = 0b01; // PP=001 - o_pte->N = 0b0; // Execute - } - else { - //@fixme - add RO_EXE_ACCESS - Eprintk( "** unrecognized access=%ld\n", i_accessType ); - } + else if (i_accessType & EXECUTABLE) + { + o_pte->pp1_2 = 0b01; // PP=001 + o_pte->N = 0b0; // Execute + } + else + { + Eprintk( "** unrecognized access=%ld\n", i_accessType ); + } } } diff --git a/src/kernel/start.S b/src/kernel/start.S index c9f2663ed..790281305 100644 --- a/src/kernel/start.S +++ b/src/kernel/start.S @@ -5,7 +5,7 @@ # # IBM CONFIDENTIAL # -# COPYRIGHT International Business Machines Corp. 2010,2013 +# COPYRIGHT International Business Machines Corp. 2010,2014 # # p1 # @@ -172,13 +172,7 @@ STD_INTERRUPT_STUB(system_reset, 0x100) intvect_inst_start: b _start - /* TODO: Eventually we likely need specific code for machine check - * interrupts because they can happen at any time, including - * while we're already in an interrupt path. (Don't want to - * save kernel state over top of a user-space task structure). - */ STD_INTERRUPT(machine_check, 0x200) - STD_INTERRUPT(data_storage, 0x300) STD_INTERRUPT(data_segment, 0x380) STD_INTERRUPT(inst_storage, 0x400) @@ -628,9 +622,22 @@ intvect_system_reset: beq+ intvect_system_reset_external ;// Check for HMI (bits = 101). cmpi cr0, r2, 0x5 - beq+ 1f ;// TODO: need to handle HMIs? -1: ;// Unknown reason. - b 1b + beq+ 1f ;// Unable to handle HMI, jump to 'unknown reason'. + +1: ;// Unknown reason, call as unhandled_exception. + sldi r1, r2, 32 ;// Save 42:44 of SRR1 and + ori r1, r1, 0x100 ;// SRESET address to + mtsprg2 r1 ;// SPRG2 for unhandled_exception. + ;/* Restore R2 and R1 */ + mfsprg1 r2 + mfsprg0 r1 + ;/* Need to load unhandled_exception into SPRG0 for kernel_save_task */ + mtsprg1 r1 ;/* Save off R1 again. */ + lis r1, intvect_unhandled_finish_save@h + ori r1, r1, intvect_unhandled_finish_save@l + mtsprg0 r1; + mfsprg1 r1; /* Restore GPR1 */ + b kernel_save_task ; /* Save current task, call unhandled_exception */ ;// @fn intvect_system_reset_inactive ;// Handle SRESET on an inactive processor. |