Changeset 17 for trunk/hal


Ignore:
Timestamp:
May 11, 2017, 7:49:17 PM (8 years ago)
Author:
max@…
Message:

Typos, and cosmetic.

Location:
trunk/hal/generic
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/generic/hal_atomic.h

    r16 r17  
    11/*
    22 * hal_atomic.h - Generic Atomic Operations API definition.
    3  * 
     3 *
    44 * Authors   Alain Greiner    (2016)
    55 *
    66 * Copyright (c)  UPMC Sorbonne Universites
    7  * 
     7 *
    88 * This file is part of ALMOS-MKH.
    99 *
     
    2929
    3030//////////////////////////////////////////////////////////////////////////////////////////
    31 //            Generic Atomic Operations API (implementation in hal_atomic.c) 
     31//            Generic Atomic Operations API (implementation in hal_atomic.c)
    3232//
    33 // Atomic read-then-write operations depends on the CPU instruction set.
     33// Atomic read-then-write operations depend on the CPU instruction set.
    3434// ALMOS-MKH uses the following generic API.
    3535//////////////////////////////////////////////////////////////////////////////////////////
     
    4040 *****************************************************************************************
    4141 * @ ptr     : pointer on the shared variable
    42  * @ val     : mask value 
     42 * @ val     : mask value
    4343 ****************************************************************************************/
    4444void hal_atomic_and( uint32_t * ptr,
     
    8585
    8686/*****************************************************************************************
    87  * This NON blocking function makes an atomic Compare-And-Swap on a 32 bits unsigned int 
     87 * This NON blocking function makes an atomic Compare-And-Swap on a 32 bits unsigned int
    8888 * shared variable, returning a Boolean to indicate both success and atomicity.
    8989 *****************************************************************************************
     
    9898
    9999/*****************************************************************************************
    100  * This non blocking function makes an atomic Test-if-zero-And-Set on a 32 bits unsigned 
     100 * This non blocking function makes an atomic Test-if-zero-And-Set on a 32 bits unsigned
    101101 * int shared variable, returning a Boolean to indicate both success and atomicity.
    102102 *****************************************************************************************
     
    105105 * @ return true if (current == 0) and (access is atomic)
    106106 ****************************************************************************************/
    107 bool_t hal_atomic_test_set( uint32_t * ptr, 
     107bool_t hal_atomic_test_set( uint32_t * ptr,
    108108                            uint32_t   val );
    109109
  • trunk/hal/generic/hal_context.h

    r16 r17  
    2929//
    3030// A thread context is defined by the two (core specific) structures hal_context_t
    31 // and hal_uzone_t, defined  in hal_context.c file, that are accessed with generic
     31// and hal_uzone_t, defined in hal_context.c file, that are accessed with generic
    3232// void* pointers stored in the thread descriptor.
    3333// - the "hal_context_t" structure is used to store the CPU registers values that
     
    8787/****************************************************************************************
    8888 * This function allocates, from the local cluster, the physical memory required for
    89  * the thread CPU context, initialises it, and link the context to the thread.
     89 * the thread CPU context, initialises it, and links the context to the thread.
    9090 * Seven registers are initialised:
    9191 * - sp_29 / fp_30 / ra_31
     
    101101 * This function allocates, from the local cluster, the physical memory required for
    102102 * a thread CPU context, initialises it from values contained in "src" thread context,
    103  * and link the context to the "dst" thread.
     103 * and links the context to the "dst" thread.
    104104 ****************************************************************************************
    105105 * @ dst  : pointer on the destination thread descriptor.
     
    118118
    119119/****************************************************************************************
    120  * This function save in the thread context the CPU registers values that have not
     120 * This function saves in the thread context the CPU registers values that have not
    121121 * been saved in the thread stack by the exception handler:
    122122 * - GRs : s0 to S7 , sp , fp, ra
     
    129129
    130130/****************************************************************************************
    131  * This function restore from the thread context the CPU registers values that have not
     131 * This function restores from the thread context the CPU registers values that have not
    132132 * been saved in the thread stack by the exception handler.
    133133 * - GRs : s0 to S7 , sp , fp, ra
     
    140140
    141141/****************************************************************************************
    142  * This function load the relevant CPU registers from values contained in
     142 * This function loads the relevant CPU registers from values contained in
    143143 * the thread context. It should be called for a thread that has not been executed yet.
    144144 * - GRs : sp , fp , a0
     
    182182
    183183/****************************************************************************************
    184  * This function save in the thread uzone the FPU registers values.
     184 * This function saves in the thread uzone the FPU registers values.
    185185 ****************************************************************************************
    186186 * @ thread  : pointer on the thread descriptor.
     
    189189
    190190/****************************************************************************************
    191  * This function restore from the thread uzone the FPU registers values.
     191 * This function restores from the thread uzone the FPU registers values.
    192192 ****************************************************************************************
    193193 * @ thread  : pointer on the thread descriptor.
  • trunk/hal/generic/hal_exception.h

    r16 r17  
    3232// ALMOS-MKH defines three classes of exceptions:
    3333//
    34 // - NON_FATAL : exceptions such as "page fault" or FPU unusable" are non fatal.
    35 //   and the calling thread resume execution when the exception has been handled.
     34// - NON_FATAL : exceptions such as "page fault" or "FPU unusable" are non fatal.
     35//   The calling thread resumes execution when the exception has been handled.
    3636//
    3737// - USER_ERROR : these exceptions such a "illegal vaddr" or "illegal write access"
     
    4040//
    4141// - KERNEL_PANIC : events such as "no memory" or "kernel mistakes" are considered
    42 //   abnormal events. The calling core goes to sleep, after after a "panic" message
     42//   abnormal events. The calling core goes to sleep, after a "panic" message
    4343//   on the kernel terminal.
    4444//
     
    6666
    6767/*****************************************************************************************
    68  * This function print on the kernel terminal the saved context (core registers)
     68 * This function prints on the kernel terminal the saved context (core registers)
    6969 * and the thread state of a faulty thread.
    7070 *****************************************************************************************
  • trunk/hal/generic/hal_gpt.h

    r16 r17  
    3030//           Generic Page Table Definition (implementation in hal_gpt.c)
    3131//
    32 // It is specified as a simple (one dimensionnal) array indexed by the VPN (vpn_t type),
    33 // even if implementations can use a more sophisticated organistion (two-levels or more).
    34 // - The number of entries (number of pages in a virtual space) is architecture 
    35 //   dependant, and is defined as (CONFIG_USER_SPACE_SIZE / CONFIG_PPM_PAGE_SIZE).
    36 // - Each entry contains a Physical Page Number (ppn_t type),  and a set of attributes,
     32// It is specified as a simple (one dimensional) array indexed by the VPN (vpn_t type),
     33// even if implementations can use a more sophisticated organisation (two-levels or more).
     34// - The number of entries (number of pages in a virtual space) is architecture
     35//   dependent, and is defined as (CONFIG_USER_SPACE_SIZE / CONFIG_PPM_PAGE_SIZE).
     36// - Each entry contains a Physical Page Number (ppn_t type), and a set of attributes,
    3737//   defined as masks on a 32 bits-vector.
    3838//
    39 // Any arch-specific implementation must implement this API. 
     39// Any arch-specific implementation must implement this API.
    4040/////////////////////////////////////////////////////////////////////////////////////////
    4141
     
    7171        void           * ptr;    /*! pointer on GPT root (must be page aligned)            */
    7272        ppn_t            ppn;    /*! PPN of GPT root                                       */
    73     struct page_s  * page;   /*! pointer on page descriptor for GPT root               */
     73        struct page_s  * page;   /*! pointer on page descriptor for GPT root               */
    7474}
    7575gpt_t;
     
    7878/****************************************************************************************
    7979 * This function allocates physical memory for  first level page table (PT1),
    80  * and initialize the page table descriptor.
     80 * and initializes the page table descriptor.
    8181 ****************************************************************************************
    8282 * @ gpt     : pointer on generic page table descriptor.
     
    8888 * This function releases all memory dynamically allocated for a generic page table.
    8989 * For a multi-levels radix tree implementation, it includes all nodes in the tree.
    90  * If the calling thread is running in the reference cluster, it checks that user PTE 
     90 * If the calling thread is running in the reference cluster, it checks that user PTE
    9191 * entries are unmapped, and release the mapped physical pages.
    9292 * The kernel pages are not released.
     
    104104
    105105/****************************************************************************************
    106  * This blocking fonction get a lock on a PTE (page Table Entry) identified
     106 * This blocking function gets a lock on a PTE (page Table Entry) identified
    107107 * by its VPN, and returns only when the PTE has been successfully locked.
    108  * If the target PTE is not present, it allocates and map a physical page.
     108 * If the target PTE is not present, it allocates and maps a physical page.
    109109 * A big page cannot be locked.
    110110 ****************************************************************************************
    111  * @ gpt     : pointer on the generic page table 
     111 * @ gpt     : pointer on the generic page table
    112112 * @ vpn     : virtual page number of the target PTE.
    113  * @ returns 0 if success / return ENOMEM or EINVAL if error. 
     113 * @ returns 0 if success / return ENOMEM or EINVAL if error.
    114114 ***************************************************************************************/
    115115error_t hal_gpt_lock_pte( gpt_t * gpt,
     
    119119 * This function releases the lock on a PTE identified by its VPN.
    120120 ****************************************************************************************
    121  * @ gpt     : pointer on the generic page table 
     121 * @ gpt     : pointer on the generic page table
    122122 * @ vpn     : virtual page number of the target PTE.
    123  * @ returns 0 if success / returns EINVAL if error. 
     123 * @ returns 0 if success / returns EINVAL if error.
    124124 ***************************************************************************************/
    125 error_t hal_gpt_unlock_pte( gpt_t * gpt, 
    126                             vpn_t   vpn ); 
     125error_t hal_gpt_unlock_pte( gpt_t * gpt,
     126                            vpn_t   vpn );
    127127
    128128/****************************************************************************************
    129  * This function map a page table entry identified by its VPN, from values defined
     129 * This function maps a page table entry identified by its VPN, from values defined
    130130 * by the ppn and attr arguments. It allocates physical memory for the local generic
    131131 * page table itself if required.
     
    133133 * @ gpt       : [in] pointer on the page table
    134134 * @ vpn       : [in] virtual page number
    135  * @ ppn       : [in] physical page number 
     135 * @ ppn       : [in] physical page number
    136136 * @ attr      : [in] generic attributes
    137137 * @ returns 0 if success / returns ENOMEM if error
     
    143143
    144144/****************************************************************************************
    145  * This function unmap a page table entry identified by its VPN.
    146  * If the calling thread is running in the reference cluster, it send a broadcast RPC
    147  * to update all others page table copies.
     145 * This function unmaps a page table entry identified by its VPN.
     146 * If the calling thread is running in the reference cluster, it sends a broadcast RPC
     147 * to update all other page table copies.
    148148 ****************************************************************************************
    149149 * @ gpt       : [in] pointer on the page table
     
    160160 * @ vpn       : [in]  virtual page number
    161161 * @ attr      : [out] generic attributes
    162  * @ ppn       : [out] physical page number 
     162 * @ ppn       : [out] physical page number
    163163 ***************************************************************************************/
    164164void hal_gpt_get_pte( gpt_t    * gpt,
     
    166166                      uint32_t * attr,
    167167                      ppn_t    * ppn );
    168  
     168
    169169
    170170#endif  /* _GPT_H_ */
  • trunk/hal/generic/hal_interrupt.h

    r16 r17  
    11/*
    22 * hal_interrupt.h - Architecture specific interrupt handler API definition.
    3  * 
     3 *
    44 * Author   Alain Greiner (2016,2017)
    55 *
     
    3232// The interrupted thread context (core registers) has been saved by the hal_kentry
    3333// function, in the cpu_uzone array stored in the user thread descriptor (for a core in
    34 // user mode), or in the kernel stack (for a core in kernel mode). 
     34// user mode), or in the kernel stack (for a core in kernel mode).
    3535// This array can be used (or not) by the specific interrupt handler.
    3636//
     
    4343
    4444/******************************************************************************************
    45  * This function implement the TSAR_MIPS32 specific interrupt handler.
     45 * This function implements the TSAR_MIPS32 specific interrupt handler.
    4646 ******************************************************************************************
    4747 * @ this     : pointer on the interrupted thread.
    4848 * @ regs_tbl : array containing the core registers values, saved by hal_kentry.
    4949 *****************************************************************************************/
    50 void hal_do_interrupt( struct thread_s * this, 
     50void hal_do_interrupt( struct thread_s * this,
    5151                               reg_t           * regs_tbl );
    5252
  • trunk/hal/generic/hal_irqmask.h

    r16 r17  
    11/*
    22 * hal_irqmask.h - Generic Interrupt Masking API definition
    3  * 
     3 *
    44 * Authors   Ghassan Almaless (2008,2009,2010,2011,2012)
    55 *           Alain Greiner    (2016)
    66 *
    77 * Copyright (c)  UPMC Sorbonne Universites
    8  * 
     8 *
    99 * This file is part of ALMOS-MKH.
    1010 *
  • trunk/hal/generic/hal_remote.h

    r16 r17  
    11/*
    22 * hal_remote.h - Generic Remote Access API definition.
    3  * 
     3 *
    44 * Authors   Mohamed Karaoui  (2015)
    55 *           Alain Greiner    (2016)
    66 *
    77 * Copyright (c)  UPMC Sorbonne Universites
    8  * 
     8 *
    99 * This file is part of ALMOS-MKH.
    1010 *
     
    2929
    3030//////////////////////////////////////////////////////////////////////////////////////////
    31 //          Generic Remote Access API(implementation in hal_remote.c)
     31//          Generic Remote Access API (implementation in hal_remote.c)
    3232//
    3333// Kernel accesses to local memory bank and peripherals can use normal C pointers.
     
    7676 *****************************************************************************************
    7777 * @ xp      : extended pointer to remote data
    78  * @ return read value 
     78 * @ return read value
    7979 ****************************************************************************************/
    8080char hal_remote_lb( xptr_t  xp );
     
    118118 * @ old     : expected value
    119119 * @ new     : new value to be written
    120  * @ return true if success / return false if failure 
     120 * @ return true if success / return false if failure
    121121 ****************************************************************************************/
    122122bool_t hal_remote_atomic_cas( xptr_t   xp,
     
    132132 * @ return old value (before increment) of the remote integer
    133133 ****************************************************************************************/
    134 uint32_t hal_remote_atomic_add( xptr_t    xp, 
     134uint32_t hal_remote_atomic_add( xptr_t    xp,
    135135                                uint32_t  incr );
    136136
     
    143143 * @ return old value (before increment) of the remote integer
    144144 ****************************************************************************************/
    145 uint32_t hal_remote_atomic_and( xptr_t    xp, 
     145uint32_t hal_remote_atomic_and( xptr_t    xp,
    146146                                uint32_t  mask );
    147147
     
    154154 * @ return old value (before increment) of the remote integer
    155155 ****************************************************************************************/
    156 uint32_t hal_remote_atomic_or( xptr_t    xp, 
     156uint32_t hal_remote_atomic_or( xptr_t    xp,
    157157                               uint32_t  mask );
    158158
     
    164164 * @ incr    : increment value.
    165165 * @ old     : local buffer address for the read value (before increment)
    166  * @ return 0 if atomic / return non-zero if failure 
     166 * @ return 0 if atomic / return non-zero if failure
    167167 ****************************************************************************************/
    168168error_t hal_remote_atomic_try_add( xptr_t     xp,
     
    179179 ****************************************************************************************/
    180180void hal_remote_memcpy( xptr_t   dst,
    181                         xptr_t   src, 
     181                        xptr_t   src,
    182182                        uint32_t size );
    183183
  • trunk/hal/generic/hal_special.h

    r16 r17  
    11/*
    22 * hal_special.h - Generic Special Registers Access API definition.
    3  * 
     3 *
    44 * Authors   Ghassan Almaless (2008,2009,2010,2011,2012)
    55 *           Alain Greiner    (2016)
    66 *
    77 * Copyright (c)  UPMC Sorbonne Universites
    8  * 
     8 *
    99 * This file is part of ALMOS-MKH.
    1010 *
     
    3434///////////////////////////////////////////////////////////////////////////////////////////
    3535//      Generic Special Registers Access API (implementation in hal_special.c)
    36 // 
     36//
    3737// ALMOS-MKH uses the following API to access the MMU and other core protected registers.
    3838///////////////////////////////////////////////////////////////////////////////////////////
     
    112112
    113113/*****************************************************************************************
    114  * This function returns after a fixed delay of  (4 * delay) cycles.
     114 * This function returns after a fixed delay of (4 * delay) cycles.
    115115 ****************************************************************************************/
    116116void hal_fixed_delay();
    117117
    118118/*****************************************************************************************
    119  * This function returns informations on MMU exceptions :
     119 * This function returns information on MMU exceptions :
    120120 * @ mmu_ins_excp_code : [out] instruction fetch exception code
    121121 * @ mmu_ins_bad_vaddr : [out] instruction fetch faulty virtual address
  • trunk/hal/generic/hal_syscall.h

    r16 r17  
    11/*
    22 * hal_syscall.h - Architecture specific syscall handler API definition.
    3  * 
     3 *
    44 * Author      Alain Greiner (2016,2017)
    55 *
     
    2828
    2929//////////////////////////////////////////////////////////////////////////////////////////
    30 //     ARchitecture specific syscall handler  API
     30//     ARchitecture specific syscall handler API
    3131//
    32 // The calling thread context has been saved in the cpu_uzone array, 
     32// The calling thread context has been saved in the cpu_uzone array,
    3333// stored in the user thread descriptor by the hal_kentry function.
    3434// The architecture specific handler must use this array to get the syscall
  • trunk/hal/generic/hal_uspace.h

    r16 r17  
    11/*
    22 * hal_uspace.h - Generic User Space Access API definition
    3  * 
     3 *
    44 * Authors   Mohamed Karaoui  (2015)
    55 *           Alain Greiner    (2016)
    66 *
    77 * Copyright (c)  UPMC Sorbonne Universites
    8  * 
     8 *
    99 * This file is part of ALMOS-MKH.
    1010 *
     
    3030//////////////////////////////////////////////////////////////////////////////////////////
    3131//           User space access API (implementation in hal_uspace.c)
    32 // 
     32//
    3333// When moving data between user space and kernel space, the user address is always
    3434// a virtual address, but the kernel address can be a physical address, on some
     
    6464
    6565/*****************************************************************************************
    66  * This function activates the MMU to computes the length of a string in user space,
     66 * This function activates the MMU to compute the length of a string in user space,
    6767 * and returns it to a kernel buffer.
    6868 *****************************************************************************************
Note: See TracChangeset for help on using the changeset viewer.