Search
lxdream.org :: lxdream :: r110:83a33da5ed06
lxdream 0.9.1
released Jun 29
Download Now
changeset110:83a33da5ed06
parent109:cc84a653c781
child111:230243c2b520
authornkeynes
dateWed Mar 15 13:17:40 2006 +0000 (18 years ago)
Bring the bootloader in for ELF files as well
src/loader.c
1.1 --- a/src/loader.c Wed Mar 15 13:17:23 2006 +0000
1.2 +++ b/src/loader.c Wed Mar 15 13:17:40 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: loader.c,v 1.11 2006-03-14 11:44:29 nkeynes Exp $
1.6 + * $Id: loader.c,v 1.12 2006-03-15 13:17:40 nkeynes Exp $
1.7 *
1.8 * File loading routines, mostly for loading demos without going through the
1.9 * whole procedure of making a CD image for them.
1.10 @@ -107,9 +107,8 @@
1.11 return TRUE;
1.12 }
1.13
1.14 -int file_load_binary( const gchar *filename ) {
1.15 - /* Load the binary itself */
1.16 - mem_load_block( filename, BINARY_LOAD_ADDR, -1 );
1.17 +int file_load_postload( int pc )
1.18 +{
1.19 if( bootstrap_file != NULL ) {
1.20 /* Load in a bootstrap before the binary, to initialize everything
1.21 * correctly
1.22 @@ -117,10 +116,19 @@
1.23 mem_load_block( bootstrap_file, BOOTSTRAP_LOAD_ADDR, BOOTSTRAP_SIZE );
1.24 sh4_set_pc( BOOTSTRAP_LOAD_ADDR + 0x300 );
1.25 } else {
1.26 - sh4_set_pc( BINARY_LOAD_ADDR );
1.27 + sh4_set_pc( pc );
1.28 }
1.29 bios_install();
1.30 + dcload_install();
1.31 gtk_gui_update();
1.32 +}
1.33 +
1.34 +
1.35 +int file_load_binary( const gchar *filename )
1.36 +{
1.37 + /* Load the binary itself */
1.38 + mem_load_block( filename, BINARY_LOAD_ADDR, -1 );
1.39 + file_load_postload( BINARY_LOAD_ADDR );
1.40 }
1.41
1.42 int file_load_elf_fd( int fd )
1.43 @@ -155,9 +163,6 @@
1.44 INFO( "Loaded %d bytes to %08X", phdr.p_filesz, phdr.p_vaddr );
1.45 }
1.46 }
1.47 -
1.48 - sh4_set_pc( head.e_entry );
1.49 - bios_install();
1.50 - dcload_install();
1.51 - gtk_gui_update();
1.52 +
1.53 + file_load_postload( head.e_entry );
1.54 }
.