Reject late rom loading
rom_+add_file/rom_add_blob only work correctly if called before load_all_roms. Enforce this rather than silently accepting and putting the rom in the wrong place at reset. Signed-off-by: Paul Brook <paul@codesourcery.com>
This commit is contained in:
		
							parent
							
								
									f2d7497876
								
							
						
					
					
						commit
						97fe84f5ef
					
				@ -51,6 +51,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <zlib.h>
 | 
					#include <zlib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int roms_loaded;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* return the size or -1 if error */
 | 
					/* return the size or -1 if error */
 | 
				
			||||||
int get_image_size(const char *filename)
 | 
					int get_image_size(const char *filename)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -540,6 +542,10 @@ static void rom_insert(Rom *rom)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    Rom *item;
 | 
					    Rom *item;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (roms_loaded) {
 | 
				
			||||||
 | 
					        hw_error ("ROM images must be loaded at startup\n");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* list is ordered by load address */
 | 
					    /* list is ordered by load address */
 | 
				
			||||||
    QTAILQ_FOREACH(item, &roms, next) {
 | 
					    QTAILQ_FOREACH(item, &roms, next) {
 | 
				
			||||||
        if (rom->min >= item->min)
 | 
					        if (rom->min >= item->min)
 | 
				
			||||||
@ -682,6 +688,7 @@ int rom_load_all(void)
 | 
				
			|||||||
            rom->isrom = 1;
 | 
					            rom->isrom = 1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    qemu_register_reset(rom_reset, NULL);
 | 
					    qemu_register_reset(rom_reset, NULL);
 | 
				
			||||||
 | 
					    roms_loaded = 1;
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user