This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RedBoot - minor 'fis free' fix


-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates
Index: redboot/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.156
diff -u -5 -p -r1.156 ChangeLog
--- redboot/current/ChangeLog	1 Nov 2003 09:08:34 -0000	1.156
+++ redboot/current/ChangeLog	4 Nov 2003 14:05:58 -0000
@@ -1,5 +1,10 @@
+2003-11-04  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/flash.c (find_free): Better handling of end address - otherwise
+	list of free blocks could be incorrect.  Thanks to Chris Garry.
+
 2003-11-01  Gary Thomas  <gary@mlbassoc.com>
 
 	* cdl/redboot.cdl: Reorg to allow disk operations on other than
 	IDE drives.
 
Index: redboot/current/src/flash.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/src/flash.c,v
retrieving revision 1.58
diff -u -5 -p -r1.58 flash.c
--- redboot/current/src/flash.c	15 Oct 2003 15:52:03 -0000	1.58
+++ redboot/current/src/flash.c	4 Nov 2003 14:01:34 -0000
@@ -521,13 +521,13 @@ find_free(struct free_chunk *chunks)
     int i, idx;
     int num_chunks = 1;
 
     // Do not search the area reserved for pre-RedBoot systems:
     fis_ptr = (CYG_ADDRESS *)((CYG_ADDRESS)flash_start + 
-                                CYGNUM_REDBOOT_FLASH_RESERVED_BASE + 
-                                CYGBLD_REDBOOT_MIN_IMAGE_SIZE);
-    fis_end = (CYG_ADDRESS *)(CYG_ADDRESS)flash_end;
+                              CYGNUM_REDBOOT_FLASH_RESERVED_BASE + 
+                              CYGBLD_REDBOOT_MIN_IMAGE_SIZE);
+    fis_end = (CYG_ADDRESS *)flash_end;
     chunks[num_chunks-1].start = (CYG_ADDRESS)fis_ptr;
     chunks[num_chunks-1].end = (CYG_ADDRESS)fis_end;
     flash_read(fis_addr, fis_work_block, fisdir_size, (void **)&err_addr);
     img = (struct fis_image_desc *) fis_work_block;
     for (i = 0;  i < fisdir_size/sizeof(*img);  i++, img++) {
@@ -536,11 +536,11 @@ find_free(struct free_chunk *chunks)
             for (idx = 0;  idx < num_chunks;  idx++) {
                 if ((img->flash_base >= chunks[idx].start) && 
                     (img->flash_base <= chunks[idx].end)) {
                     if (img->flash_base == chunks[idx].start) {
                         chunks[idx].start += img->size;
-                        if (chunks[idx].start == chunks[idx].end) {
+                        if (chunks[idx].start >= chunks[idx].end) {
                             // This free chunk has collapsed
                             while (idx < (num_chunks-1)) {
                                 chunks[idx] = chunks[idx+1];
                             }
                             num_chunks--;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]