filename | src/mem.c |
changeset | 180:e6dcf9b65658 |
prev | 156:3b93648a3b07 |
next | 422:61a0598e07ff |
author | nkeynes |
date | Wed Jan 31 11:02:50 2007 +0000 (17 years ago) |
permissions | -rw-r--r-- |
last change | Load textures into the right region Allow setting the backplane control word from the test data |
file | annotate | diff | log | raw |
1.1 --- a/src/mem.c Thu Jun 15 10:25:45 2006 +00001.2 +++ b/src/mem.c Wed Jan 31 11:02:50 2007 +00001.3 @@ -1,5 +1,5 @@1.4 /**1.5 - * $Id: mem.c,v 1.13 2006-06-15 10:25:42 nkeynes Exp $1.6 + * $Id: mem.c,v 1.14 2006-07-02 04:59:00 nkeynes Exp $1.7 * mem.c is responsible for creating and maintaining the overall system memory1.8 * map, as visible from the SH4 processor.1.9 *1.10 @@ -197,8 +197,10 @@1.11 struct stat st;1.12 FILE *f = fopen(file,"r");1.14 - if( f == NULL )1.15 - return errno;1.16 + if( f == NULL ) {1.17 + ERROR( "Unable to load file '%s': %s", file, strerror(errno) );1.18 + return -1;1.19 + }1.20 fstat( fileno(f), &st );1.21 if( length == 0 || length == -1 || length > st.st_size )1.22 length = st.st_size;1.23 @@ -266,13 +268,12 @@1.25 void *mem_load_rom( char *file, uint32_t base, uint32_t size, uint32_t crc )1.26 {1.27 - char buf[512], *mem;1.28 + char *mem;1.29 int fd;1.30 uint32_t calc_crc;1.31 - snprintf( buf, 512, "%s/%s",BIOS_PATH, file );1.32 - fd = open( buf, O_RDONLY );1.33 + fd = open( file, O_RDONLY );1.34 if( fd == -1 ) {1.35 - ERROR( "Bios file not found: %s", buf );1.36 + ERROR( "Bios file not found: %s", file );1.37 return NULL;1.38 }1.39 mem = mmap( NULL, size, PROT_READ, MAP_PRIVATE, fd, 0 );
.