[PATCH] ppc simulator fix

Glen Nakamura gen@lava.net
Wed Mar 7 13:06:00 GMT 2001


Aloha,

Here is a short patch to fix a problem with the PPC simulator.
The dma_file function does not load the last section of the file
since feof(image) returns true and breaks out of the loop
before device_dma_write_buffer is called.

 - Glen Nakamura


Index: ChangeLog
Wed Mar  7 10:45:12 HST 2001  Glen Nakamura  <gen@lava.net>
	* hw_init.c (dma_file): Fixed problem with loading last 1KB of file.

Index: hw_init.c
===================================================================
diff -Nrc3p gdb-5.0.orig/sim/ppc/hw_init.c gdb-5.0/sim/ppc/hw_init.c
*** gdb-5.0.orig/sim/ppc/hw_init.c	Thu Apr 15 15:35:09 1999
--- gdb-5.0/sim/ppc/hw_init.c	Fri Mar  2 18:46:00 2001
*************** dma_file(device *me,
*** 47,53 ****
    count = 0;
    while (1) {
      inc = fread(buf, 1, sizeof(buf), image);
!     if (feof(image) || ferror(image))
        break;
      if (device_dma_write_buffer(device_parent(me),
  				buf,
--- 47,53 ----
    count = 0;
    while (1) {
      inc = fread(buf, 1, sizeof(buf), image);
!     if (inc == 0)
        break;
      if (device_dma_write_buffer(device_parent(me),
  				buf,



More information about the Gdb-patches mailing list