Search
lxdream.org :: lxdream/src/mem.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/mem.c
changeset 180:e6dcf9b65658
prev156:3b93648a3b07
next422:61a0598e07ff
author nkeynes
date Sun Jul 02 04:59:00 2006 +0000 (15 years ago)
permissions -rw-r--r--
last change Merge changes made on the MILESTONE1 branch back into head (mostly
release touchups)
file annotate diff log raw
1.1 --- a/src/mem.c Thu Jun 15 10:25:45 2006 +0000
1.2 +++ b/src/mem.c Sun Jul 02 04:59:00 2006 +0000
1.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 memory
1.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.13
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.24
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 );
.