/[gxemul]/trunk/src/file.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/file.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 27 by dpavlin, Mon Oct 8 16:19:56 2007 UTC revision 28 by dpavlin, Mon Oct 8 16:20:26 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: file.c,v 1.131 2006/03/30 19:36:03 debug Exp $   *  $Id: file.c,v 1.132 2006/07/09 05:51:28 debug Exp $
29   *   *
30   *  This file contains functions which load executable images into (emulated)   *  This file contains functions which load executable images into (emulated)
31   *  memory. File formats recognized so far are:   *  memory. File formats recognized so far are:
# Line 1164  static void file_load_raw(struct machine Line 1164  static void file_load_raw(struct machine
1164  {  {
1165          FILE *f;          FILE *f;
1166          int len;          int len;
1167          unsigned char buf[4096];          unsigned char buf[16384];
1168          uint64_t entry, loadaddr, vaddr, skip = 0;          uint64_t entry, loadaddr, vaddr, skip = 0;
1169          char *p, *p2;          char *p, *p2;
1170    
# Line 1201  static void file_load_raw(struct machine Line 1201  static void file_load_raw(struct machine
1201    
1202          /*  Load file contents:  */          /*  Load file contents:  */
1203          while (!feof(f)) {          while (!feof(f)) {
1204                  len = fread(buf, 1, sizeof(buf), f);                  size_t to_read = sizeof(buf);
1205    
1206                    /*  If vaddr isn't buf-size aligned, then start with a
1207                        smaller buffer:  */
1208                    if (vaddr & (sizeof(buf) - 1))
1209                            to_read = sizeof(buf) - (vaddr & (sizeof(buf)-1));
1210    
1211                    len = fread(buf, 1, to_read, f);
1212    
1213                  if (len > 0)                  if (len > 0)
1214                          m->cpus[0]->memory_rw(m->cpus[0], mem, vaddr, &buf[0],                          m->cpus[0]->memory_rw(m->cpus[0], mem, vaddr, &buf[0],

Legend:
Removed from v.27  
changed lines
  Added in v.28

  ViewVC Help
Powered by ViewVC 1.1.26