Ignore:
Timestamp:
Jun 25, 2014, 2:19:37 PM (10 years ago)
Author:
cfuguet
Message:

giet_vm optimizations:

  • Several modifications in GIET_VM in order to support compilation with GCC optimizations (-O2) activated.
  • Adding missing volatile in some global variables.
  • Using ioread and iowrite utility functions in peripheral drivers which prevent GCC to remove writes or reads in hardware memory mapped registers.
  • Code refactoring of stdio printf functions. Now, shr_printf and tty_printf function reuse the same function body. The only difference is that shr_printf wraps printf function call with TTY get lock and release lock.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_libs/mwmr_channel.c

    r258 r345  
    4343    register unsigned int delay = 100;
    4444    asm volatile (
    45             "mwmr_lock_try:                    \n"
     45            "1:                               \n"
    4646            "ll   $2,    0(%0)                \n" /* $2 <= lock current value */
    47             "bnez $2,    mwmr_lock_delay    \n" /* retry after delay if lock busy */
     47            "bnez $2,    2f                   \n" /* retry after delay if lock busy */
    4848            "li   $3,    1                    \n" /* $3 <= argument for sc */
    4949            "sc   $3,    0(%0)                \n" /* try to get lock */
    50             "bnez $3,    mwmr_lock_ok        \n" /* exit if atomic */
    51             "mwmr_lock_delay:                \n"
    52             "move $4,    %1                 \n" /* $4 <= delay */
    53             "mwmr_lock_loop:                \n"
    54             "beqz $4,    mwmr_lock_loop        \n" /* test end delay */
    55             "addi $4,    $4,  -1            \n" /* $4 <= $4 - 1 */
    56             "j           mwmr_lock_try        \n" /* retry ll */
    57             "nop                            \n"
    58             "mwmr_lock_ok:                    \n"
     50            "bnez $3,    3f                   \n" /* exit if atomic */
     51            "2:                               \n"
     52            "move $4,    %1                   \n" /* $4 <= delay */
     53            "4:                               \n"
     54            "beqz $4,    4b                   \n" /* test end delay */
     55            "addi $4,    $4,  -1              \n" /* $4 <= $4 - 1 */
     56            "j           1b                   \n" /* retry ll */
     57            "nop                              \n"
     58            "3:                               \n"
    5959            :
    6060            :"r"(plock), "r"(delay)
Note: See TracChangeset for help on using the changeset viewer.