Ignore:
Timestamp:
Jan 27, 2015, 5:20:19 PM (10 years ago)
Author:
cfuguet
Message:

tsar_boot: using global variable for the block device block cache

  • Some GCC versions have a problem to align as indicated with the attribute(aligned()) macro the functions' local variables. Therefore, using a global variable instead of a static local variable for the block cache because this last must be aligned to a cache line.
Location:
trunk/softs/tsar_boot/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/softs/tsar_boot/src/reset_elf_loader.c

    r758 r930  
    1616#include <defs.h>
    1717
     18extern int blk_buf_idx;
     19
    1820///////////////////////////////////////////////////////////////////////////////
    1921void * reset_elf_loader(size_t lba)
     
    2527    reset_putd( proctime() );
    2628    reset_puts("\n");
     29
     30    /*
     31     * Init the cache block index
     32     */
     33    blk_buf_idx = -1;
    2734
    2835    /*
  • trunk/softs/tsar_boot/src/reset_utils.c

    r830 r930  
    1212#include <io.h>
    1313
     14/*
     15 * Cache block data buffer and cached block index
     16 */
     17struct aligned_blk blk_buf;
     18int blk_buf_idx;
     19
    1420/**
    1521 * \param file_offset: Disk relative offset of file
     
    2430int pread(size_t file_offset, void *buf, size_t nbyte, size_t offset) {
    2531    if (nbyte == 0) return 0;
    26 
    27     /*
    28      * Cache block data buffer and cached block index
    29      */
    30     static struct aligned_blk blk_buf;
    31     static int blk_buf_idx = -1;
    3232
    3333    char *dst;
Note: See TracChangeset for help on using the changeset viewer.