Index: /trunk/softs/tsar_boot/Makefile
===================================================================
--- /trunk/softs/tsar_boot/Makefile	(revision 700)
+++ /trunk/softs/tsar_boot/Makefile	(revision 701)
@@ -65,4 +65,5 @@
               -ggdb                \
               -mlong-calls         \
+              -O2                  \
               -Werror
 
@@ -89,5 +90,5 @@
 all: $(TARGET)
 
- $(BUILD_DIR)/version.o: $(BUILD_DIR) $(OBJS) version version.sh
+$(BUILD_DIR)/version.o: $(BUILD_DIR) $(OBJS) version version.sh
 	$(ECHO) "[version.sh]"
 	./version.sh > $(BUILD_DIR)/version.c
Index: /trunk/softs/tsar_boot/include/defs.h
===================================================================
--- /trunk/softs/tsar_boot/include/defs.h	(revision 700)
+++ /trunk/softs/tsar_boot/include/defs.h	(revision 701)
@@ -5,4 +5,8 @@
 #define RESET_STACKS_SIZE   0x11000  /* 64 bytes * 1024 + 4 Kbytes (for P0) = 68 Kbytes */
 #define BOOT_LOADER_LBA     2
-#define PHDR_ARRAY_SIZE	    16
+#define PHDR_ARRAY_SIZE     16
 
+#define BLOCK_SIZE          512
+
+// vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
+
Index: /trunk/softs/tsar_boot/include/reset_utils.h
===================================================================
--- /trunk/softs/tsar_boot/include/reset_utils.h	(revision 700)
+++ /trunk/softs/tsar_boot/include/reset_utils.h	(revision 701)
@@ -10,25 +10,47 @@
 #include <elf-types.h>
 #include <reset_tty.h>
-#include <defs_platform.h>
+#include <reset_ioc.h>
+#include <defs.h>
 #include <mcc.h>
 #include <io.h>
 
+/********************************************************************
+ * Integer types definition
+ ********************************************************************/
+typedef unsigned int size_t;
+typedef unsigned int addr_t;
+
+/********************************************************************
+ * Other types definition
+ ********************************************************************/
+
+/*
+ * cache line aligned disk block (sector) buffer 
+ */
+struct aligned_blk
+{
+    char b[BLOCK_SIZE];
+} __attribute__((aligned(CACHE_LINE_SIZE)));
+
+/********************************************************************
+ * Utility functions definition
+ ********************************************************************/
+
 extern unsigned int proctime();
 
-extern void* memcpy(void *_dst, const void *_src, unsigned int size);
+extern int pread(size_t file_offset, void *buf, size_t nbyte, size_t offset);
 
-extern void* memset(void *_dst, const int value, unsigned int size);
+extern void* memcpy(void *_dst, const void *_src, size_t n);
+extern void* memset(void *_dst, int c, size_t len);
 
+extern void check_elf_header(Elf32_Ehdr *ehdr);
 extern void reset_print_elf_phdr(Elf32_Phdr * elf_phdr_ptr);
 
 #if USE_IOB
-void reset_mcc_invalidate ( const void * buffer,
-                            unsigned int size);
+void reset_mcc_invalidate (const void * buf, size_t size);
 #endif /* USE_IOB */
 
 #if (CACHE_COHERENCE == 0) || USE_IOB
-void reset_buf_invalidate ( const void * buffer,
-                            unsigned int line_size,
-                            unsigned int size);
+void reset_buf_invalidate (const void * buf, size_t line_size, size_t size);
 #endif /* (CACHE_COHERENCE == 0) || USE_IOB */
 #endif /* BOOT_UTILS_H */
Index: /trunk/softs/tsar_boot/src/reset_elf_loader.c
===================================================================
--- /trunk/softs/tsar_boot/src/reset_elf_loader.c	(revision 700)
+++ /trunk/softs/tsar_boot/src/reset_elf_loader.c	(revision 701)
@@ -16,62 +16,9 @@
 #include <defs.h>
 
-#if (RESET_DEBUG == 1)
-static char const * const init_state_str[] = 
+///////////////////////////////////////////////////////////////////////////////
+void * reset_elf_loader(size_t lba)
+///////////////////////////////////////////////////////////////////////////////
 {
-    "ELF_HEADER_STATE",
-    "ELF_PROGRAM_HEADER_STATE",
-    "ELF_OFFSET_STATE",
-    "ELF_SEGMENT_STATE",
-    "ELF_END_STATE"
-};
-#endif
-
-unsigned char reset_elf_loader_buffer[512] __attribute__((aligned(CACHE_LINE_SIZE)));
-
-/////////////////////////////////////////////////////////////////////////////////////
-void * reset_elf_loader(unsigned int lba)
-/////////////////////////////////////////////////////////////////////////////////////
-{
-    /*
-     * Temporary variables used by the loader
-     */
-    Elf32_Ehdr      elf_header;
-    Elf32_Phdr      elf_pht[PHDR_ARRAY_SIZE];
-
-    unsigned char * buffer_ptr = 0;
-    Elf32_Ehdr    * elf_ehdr_ptr;
-    Elf32_Phdr    * elf_phdr_ptr;
-
-    unsigned int nb_available;
-    unsigned int nb_rest;
-    unsigned int nb_read;
-    unsigned int nb_block;
-    unsigned int offset;
-
-    unsigned char * pseg_ptr;
-    unsigned int pseg_start;
-    unsigned int pseg_end;
-    unsigned int pseg_remainder;
-    unsigned int pseg;
-
-    /*
-     * Loader state machine definition
-     */
-    typedef enum
-    {
-        ELF_HEADER_STATE,
-        ELF_PROGRAM_HEADER_STATE,
-        ELF_OFFSET_STATE,
-        ELF_SEGMENT_STATE,
-        ELF_END_STATE
-    } elf_loader_t;
-
-    elf_loader_t init_state;
-    init_state = ELF_HEADER_STATE;
-
-#if (RESET_DEBUG == 1)
-    elf_loader_t init_state_debug;
-    init_state_debug = ELF_END_STATE;
-#endif
+    size_t file_offset = lba * BLOCK_SIZE;
 
     reset_puts("\n[RESET] Start reset_elf_loader at cycle ");
@@ -79,252 +26,60 @@
     reset_puts("\n");
 
-    nb_block     = lba;
-    nb_available = 0;
-    nb_rest      = sizeof(Elf32_Ehdr);
-    pseg         = 0;
-    offset       = 0;
-    elf_ehdr_ptr = (Elf32_Ehdr *) &elf_header;
-    elf_phdr_ptr = (Elf32_Phdr *) &elf_pht[0];
+    /*
+     * Load ELF HEADER
+     */
+    Elf32_Ehdr elf_header;
+    if (pread(file_offset, (void*)&elf_header, sizeof(Elf32_Ehdr), 0) < 0) {
+        goto error;
+    }
+    check_elf_header(&elf_header);
 
-    while(init_state != ELF_END_STATE)
+    /*
+     * Load ELF PROGRAM HEADER TABLE
+     */
+    Elf32_Phdr elf_pht[PHDR_ARRAY_SIZE];
+    size_t phdr_nbyte = sizeof(Elf32_Phdr) * elf_header.e_phnum;
+    size_t phdr_off = elf_header.e_phoff;
+    if (pread(file_offset, (void*)&elf_pht, phdr_nbyte, phdr_off) < 0) {
+        goto error;
+    }
+
+    /*
+     * Search for loadable segments in the ELF file
+     */
+    int pseg;
+    for (pseg = 0; pseg < elf_header.e_phnum; pseg++)
     {
-        if (nb_available == 0 )
-        {
-            buffer_ptr = &reset_elf_loader_buffer[0];
+        if(elf_pht[pseg].p_type != PT_LOAD) continue;
 
-            if (reset_ioc_read(nb_block , buffer_ptr, 1))
-            {
-                reset_puts ("[RESET ERROR] reset_ioc_read() failed\n");
-                reset_exit();
-            }
+#if (RESET_DEBUG == 1)
+        reset_puts("[RESET DEBUG] Loadable segment found:\n");
+        reset_print_elf_phdr(&elf_pht[pseg]);
+#endif
 
-            nb_block    += 1;
-            nb_available = 512;
+        addr_t p_paddr = elf_pht[pseg].p_paddr;
+        size_t p_filesz = elf_pht[pseg].p_filesz;
+        size_t p_memsz = elf_pht[pseg].p_memsz;
+        size_t p_offset = elf_pht[pseg].p_offset;
+
+        /*
+         * Copy program segment from ELF executable into corresponding physical
+         * address
+         */
+        if (pread(file_offset, (void*)p_paddr, p_filesz, p_offset) < 0) {
+            goto error;
         }
 
-        nb_read  = (nb_rest <= nb_available) ? nb_rest : nb_available;
-        offset  +=  nb_read;
+        /*
+         * Fill remaining bytes with zero (filesz < memsz)
+         */
+        char* pseg_ptr = (char*)p_paddr;
+        memset((void*)&pseg_ptr[p_filesz], 0, (p_memsz - p_filesz));
 
-#if (RESET_DEBUG == 1)
-        if (init_state != init_state_debug)
-        {
-            reset_puts("\ninit_state = ");
-            reset_puts(init_state_str[init_state]);
-            reset_puts("\n");
-            init_state_debug = init_state;
-        }
-#endif
-
-        switch(init_state)
-        {
-            /*
-             * Reading ELF executable header
-             */
-            case ELF_HEADER_STATE:
-                memcpy(elf_ehdr_ptr, buffer_ptr, nb_read);
-
-                nb_rest -= nb_read;
-
-                if(nb_rest == 0)
-                {
-                    nb_rest = elf_ehdr_ptr->e_phnum * elf_ehdr_ptr->e_phentsize;
-                    /*
-                     * Verification of ELF Magic Number
-                     */
-                    if ( (elf_ehdr_ptr->e_ident[EI_MAG0] != ELFMAG0) ||
-                         (elf_ehdr_ptr->e_ident[EI_MAG1] != ELFMAG1) ||
-                         (elf_ehdr_ptr->e_ident[EI_MAG2] != ELFMAG2) ||
-                         (elf_ehdr_ptr->e_ident[EI_MAG3] != ELFMAG3) )
-                    {
-                        reset_puts("[RESET ERROR] boot-loader file is not an ELF format\n");
-                        reset_exit();
-                    }
-
-                    /*
-                     * Verification of Program Headers table size. It must be
-                     * smaller than the work size allocated for the
-                     * elf_pht[PHDR_ARRAY_SIZE] array
-                     */
-                    if (elf_ehdr_ptr->e_phnum > PHDR_ARRAY_SIZE)
-                    {
-                        reset_puts("[RESET ERROR] ELF PHDR table size too large\n");
-                        reset_exit();
-                    }
-
-                    init_state = ELF_PROGRAM_HEADER_STATE;
-                }
-
-                break;
-
-            /*
-             * Reading ELF program headers
-             */
-            case ELF_PROGRAM_HEADER_STATE:
-                memcpy(elf_phdr_ptr, buffer_ptr, nb_read);
-
-                elf_phdr_ptr = 
-                    (Elf32_Phdr *)((unsigned char *) elf_phdr_ptr + nb_read);
-
-                nb_rest -= nb_read;
-
-                if(nb_rest == 0)
-                {
-                    elf_phdr_ptr = (Elf32_Phdr *) &elf_pht[0];
-
-                    /*
-                     * Search the first not NULL segment in the ELF file
-                     */
-                    for (pseg = 0; pseg < elf_ehdr_ptr->e_phnum; pseg++)
-                    {
-                        if(elf_phdr_ptr[pseg].p_type == PT_LOAD)
-                        {
-#if (RESET_DEBUG == 1)
-                            reset_puts("loadable segment found:\n");
-                            reset_print_elf_phdr(&elf_phdr_ptr[pseg]);
-#endif
-                            if (elf_phdr_ptr[pseg].p_offset < offset)
-                            {
-                                /* 
-                                 * Case where the segment to load includes the 
-                                 * elf and program headers 
-                                 */
-                                nb_rest = elf_phdr_ptr[pseg].p_filesz - offset;
-                                init_state = ELF_SEGMENT_STATE;
-                            }
-                            else
-                            {
-                                /* 
-                                 * Segment to load is further away in ELF file
-                                 */
-                                nb_rest = elf_phdr_ptr[pseg].p_offset - offset;
-                                init_state = ELF_OFFSET_STATE;
-                            }
-                            break;
-                        }
-                    }
-
-                    if (pseg == elf_ehdr_ptr->e_phnum)
-                    {
-                        reset_puts("[RESET ERROR] No PT_LOAD found\n");
-                        reset_exit();
-                    }
-
-                }
-
-                break;
-
-            /*
-             * Go to the offset of the first not null program segment in the
-             * ELF file
-             *
-             * TODO:
-             * No need to read from the disk the useless bytes. Try to compute
-             * the next usefull lba
-             */
-            case ELF_OFFSET_STATE:
-                nb_rest -= nb_read;
-
-                if (nb_rest == 0)
-                {
-                    nb_rest    = elf_phdr_ptr[pseg].p_filesz;
-                    init_state = ELF_SEGMENT_STATE;
-                }
-
-                break;
-
-            /*
-             * Reading ELF segments
-             *
-             * TODO:
-             * Do not pass by block buffer but write directly in target memory
-             * address
-             */
-            case ELF_SEGMENT_STATE:
-                /*
-                 * Verify that loadable segment does not conflict with
-                 * pre-loader memory space 
-                 */
-                pseg_start = elf_phdr_ptr[pseg].p_paddr;
-
-                pseg_end   = elf_phdr_ptr[pseg].p_paddr +
-                             elf_phdr_ptr[pseg].p_memsz;
-
-                if ((pseg_start >= 0xBFC00000 && pseg_start <= 0xBFC10000) ||
-                    (pseg_end   >= 0xBFC00000 && pseg_end   <= 0xBFC10000) ||
-                    (pseg_start <  0xBFC00000 && pseg_end   >  0xBFC10000))
-                {
-                    reset_puts("[RESET ERROR] conflict with pre-loader memory space\n");
-                    reset_exit();
-                }
-
-                /*
-                 * Copy the ELF segment data in memory using the
-                 * virtual address obtained from the ELF file
-                 */
-                pseg_ptr = (unsigned char *)
-                    elf_phdr_ptr[pseg].p_paddr  +
-                    elf_phdr_ptr[pseg].p_filesz -
-                    nb_rest;
-
-                memcpy(pseg_ptr, buffer_ptr, nb_read);
-
-                nb_rest -= nb_read;
-
-                if (nb_rest == 0)
-                {
-                    /*
-                     * Fill remaining bytes with zeros (filesz < memsz)
-                     */
-                    pseg_remainder =
-                        elf_phdr_ptr[pseg].p_memsz  -
-                        elf_phdr_ptr[pseg].p_filesz ;
-
-                    pseg_ptr = (unsigned char *)
-                        elf_phdr_ptr[pseg].p_paddr  +
-                        elf_phdr_ptr[pseg].p_filesz ;
-
-                    memset(pseg_ptr, 0, pseg_remainder);
-
-                    reset_puts("\n[RESET] Segment loaded : address = ");
-                    reset_putx(elf_phdr_ptr[pseg].p_paddr);
-                    reset_puts(" / size = ");
-                    reset_putx(elf_phdr_ptr[pseg].p_filesz);
-                    reset_puts("\n");
-
-                    /*
-                     * Search the next first not NULL segment in the ELF file
-                     */
-                    for (pseg += 1; pseg < elf_ehdr_ptr->e_phnum; pseg++)
-                    {
-                        if(elf_phdr_ptr[pseg].p_type == PT_LOAD)
-                        {
-#if (RESET_DEBUG == 1)
-                            reset_puts("loadable segment found:\n");
-                            reset_print_elf_phdr(&elf_phdr_ptr[pseg]);
-#endif
-                            nb_rest = elf_phdr_ptr[pseg].p_offset - offset;
-                            break;
-                        }
-                    }
-
-                    /*
-                     * Program loading finished
-                     */
-                    if(pseg == elf_ehdr_ptr->e_phnum)
-                    {
-                        init_state = ELF_END_STATE;
-                        break;
-                    }
-
-                    init_state = ELF_OFFSET_STATE;
-                }
-                break;
-
-            default:
-                break;
-        }
-
-        buffer_ptr   += nb_read;
-        nb_available -= nb_read;
+        reset_puts("\n[RESET] Segment loaded : address = ");
+        reset_putx(p_paddr);
+        reset_puts(" / size = ");
+        reset_putx(p_filesz);
+        reset_puts("\n");
     }
 
@@ -332,8 +87,13 @@
     reset_putd( proctime() );
     reset_puts(" / boot entry = ");
-    reset_putx( (unsigned int)(elf_ehdr_ptr->e_entry) );
+    reset_putx( (addr_t)(elf_header.e_entry) );
     reset_puts("\n");
 
-    return ((void *) elf_ehdr_ptr->e_entry);
+    return ((void *) elf_header.e_entry);
+
+error:
+    reset_puts("\n[RESET ERROR] Error while loading ELF file");
+    reset_exit();
+    return 0;
 }
 
Index: /trunk/softs/tsar_boot/src/reset_utils.c
===================================================================
--- /trunk/softs/tsar_boot/src/reset_utils.c	(revision 700)
+++ /trunk/softs/tsar_boot/src/reset_utils.c	(revision 701)
@@ -9,4 +9,89 @@
 #include <reset_utils.h>
 
+/*
+ * pread(size_t file_offset, void* buf, size_t nbyte, size_t offset)
+ *
+ * read from disk into buffer "nbyte" bytes from (file_offset + offset)
+ *
+ * \param file_offset: Disk relative offset of file
+ * \param buf: Destination buffer
+ * \param nbyte: Number of bytes to read
+ * \param offset: File relative offset
+ *
+ * \note Absolute disk offset (in bytes) is (file_offset + offset)
+ */
+int pread(size_t file_offset, void *buf, size_t nbyte, size_t offset) {
+    if (nbyte == 0) return 0;
+
+    /*
+     * Cache block data buffer and cached block index
+     */
+    static struct aligned_blk blk_buf;
+    static int blk_buf_idx = -1;
+
+    char *dst;
+    int offset_blk;
+    int unaligned_nbyte;
+    int read_nbyte;
+
+    dst = (char*) buf;
+
+    /*
+     * Offset parameter is relative to file, therefore compute disk relative
+     * offset (in bytes)
+     */
+    offset += file_offset;
+
+    /*
+     * Read unaligned bytes at start of segment passing by block cache
+     */
+    offset_blk = (offset / BLOCK_SIZE);
+    offset = (offset % BLOCK_SIZE);
+    unaligned_nbyte = BLOCK_SIZE - offset;
+    read_nbyte = 0;
+    if (offset) {
+        /*
+         * Check cache block hit: if miss, read new block else, use cache block
+         * data
+         */
+        if (offset_blk != blk_buf_idx) {
+            if (reset_ioc_read(offset_blk, (void*)&blk_buf, 1)) {
+                return -1; 
+            }
+        }
+        blk_buf_idx = offset_blk;
+        read_nbyte = (nbyte > unaligned_nbyte) ? unaligned_nbyte : nbyte; 
+        memcpy((void*)dst, (void*)&blk_buf.b[offset], read_nbyte);
+        nbyte -= read_nbyte;
+        offset_blk += 1;
+    }
+
+    /*
+     * Read aligned bytes directly to buffer
+     */
+    size_t nblk = nbyte / BLOCK_SIZE; 
+    if (nblk) {
+        if (reset_ioc_read(offset_blk, (void*)&dst[read_nbyte], nblk)) {
+            return -1;
+        }
+        read_nbyte += (nblk * BLOCK_SIZE);
+        nbyte -= read_nbyte;
+        offset_blk += nblk;
+    }
+
+    /*
+     * Read unaligned bytes at the end of segment passing by block cache
+     */
+    if (nbyte) {
+        if (reset_ioc_read(offset_blk, (void*)&blk_buf, 1)) {
+            return -1;
+        }
+        blk_buf_idx = offset_blk;
+        memcpy((void*)&dst[read_nbyte], (void*)&blk_buf, nbyte);
+        read_nbyte += nbyte;
+    }
+    return read_nbyte; 
+}
+
 /********************************************************************
  * proctime()
@@ -31,5 +116,5 @@
  *
  ********************************************************************/
-void * memcpy(void *_dst, const void *_src, unsigned int size)
+void* memcpy(void *_dst, const void *_src, size_t n)
 {
     unsigned int *dst = _dst;
@@ -37,8 +122,8 @@
     if ( !((unsigned int)dst & 3) && !((unsigned int)src & 3) )
     {
-        while (size > 3) 
+        while (n > 3) 
         {
             *dst++ = *src++;
-            size -= 4;
+            n -= 4;
         }
     }
@@ -46,6 +131,5 @@
     unsigned char *cdst = (unsigned char*) dst;
     unsigned char *csrc = (unsigned char*) src;
-
-    while (size--) 
+    while (n--) 
     {
         *cdst++ = *csrc++;
@@ -64,8 +148,10 @@
  *
  ********************************************************************/
-void * memset(void *_dst, const int value, unsigned int size)
-{
-    unsigned char val = (unsigned char) value;
-    int word = (val << 24) | (val << 16) | (val << 8 ) | val;
+void* memset(void *_dst, int c, size_t len)
+{
+    if (len == 0) return _dst;
+
+    unsigned char val = (unsigned char) c;
+    unsigned int word = (val << 24) | (val << 16) | (val << 8 ) | val;
 
     /*
@@ -76,8 +162,8 @@
     if ( !((unsigned int)dst & 3) )
     {
-        while (size > 3) 
+        while (len > 3) 
         {
             *dst++ = word;
-            size -= 4;
+            len -= 4;
         }
     }
@@ -87,11 +173,46 @@
      * or size is smaller than 4 
      */
-    char* cdst = (char*) _dst;
-    while(size--)
-    {
-        *cdst++ = (char) value;
+    unsigned char* cdst = (unsigned char*) _dst;
+    while(len--)
+    {
+        *cdst++ = (unsigned char) c;
     }
 
     return _dst;
+}
+
+/********************************************************************
+ * check_elf_header(Elf32_Ehdr*)
+ *
+ * Verify that ELF file is valid and that the number of program
+ * headers does not exceed the defined maximum
+ *
+ * \param ehdr : ELF header pointer
+ *
+ ********************************************************************/
+void check_elf_header(Elf32_Ehdr *ehdr)
+{
+    /*
+     * Verification of ELF Magic Number
+     */
+    if ((ehdr->e_ident[EI_MAG0] != ELFMAG0) ||
+        (ehdr->e_ident[EI_MAG1] != ELFMAG1) ||
+        (ehdr->e_ident[EI_MAG2] != ELFMAG2) ||
+        (ehdr->e_ident[EI_MAG3] != ELFMAG3))
+    {
+        reset_puts("[RESET ERROR] Unrecognized file format (not an ELF format)\n");
+        reset_exit();
+    }
+
+    /*
+     * Verification of Program Headers table size. It must be
+     * smaller than the work size allocated for the
+     * elf_pht[PHDR_ARRAY_SIZE] array
+     */
+    if (ehdr->e_phnum > PHDR_ARRAY_SIZE)
+    {
+        reset_puts("[RESET ERROR] ELF PHDR table size too large\n");
+        reset_exit();
+    }
 }
 
@@ -108,25 +229,19 @@
     reset_puts("- type   : ");
     reset_putx(elf_phdr_ptr->p_type);
-
     reset_puts("\n- offset : ");
     reset_putx(elf_phdr_ptr->p_offset);
-
     reset_puts("\n- vaddr  : ");
     reset_putx(elf_phdr_ptr->p_vaddr);
-
     reset_puts("\n- paddr  : ");
     reset_putx(elf_phdr_ptr->p_paddr);
-
     reset_puts("\n- filesz : ");
     reset_putx(elf_phdr_ptr->p_filesz);
-
     reset_puts("\n- memsz  : ");
     reset_putx(elf_phdr_ptr->p_memsz);
-
     reset_puts("\n- flags  : ");
     reset_putx(elf_phdr_ptr->p_flags);
-
     reset_puts("\n- align  : ");
     reset_putx(elf_phdr_ptr->p_align);
+    reset_puts("\n");
 }
 
@@ -139,8 +254,7 @@
  ********************************************************************/
 #if USE_IOB 
-void reset_mcc_invalidate ( const void * buffer,
-                            unsigned int size)
-{
-    unsigned int * mcc_address = (unsigned int *)MCC_PADDR_BASE;
+void reset_mcc_invalidate (const void * buffer, size_t size)
+{
+    addr_t *mcc_address = (addr_t*)MCC_PADDR_BASE;
 
     // get the hard lock assuring exclusive access to MEMC
@@ -167,7 +281,5 @@
  ********************************************************************/
 #if (CACHE_COHERENCE == 0) || USE_IOB
-void reset_buf_invalidate ( const void * buffer,
-                            unsigned int line_size,
-                            unsigned int size)
+void reset_buf_invalidate (const void * buffer, size_t line_size, size_t size)
 {
     unsigned int i;
