some psim bugs

Joshua LeVasseur jtl at bothan.net
Fri Apr 11 08:17:45 PDT 2003


In case any of you still use psim, I uncovered two more bugs (sorry if 
these are repeats) ...

The first concerns the allocation of Open Firmware's htab.  The bug 
exposes itself when you simulate with lots of memory, causing psim to 
complain that the htab location is incompatible with the htabmask.  The 
code calculates an incorrect htabmask.  In file gdb/sim/ppc/hw_htab.c, 
function htab_decode_hash_table(), look for:

     if ((htab_ra & INSERTED32(*htabmask, 7, 15)) != 0) {
         device_error(parent, "htaborg 0x%lx not aligned to htabmask 
0x%lx",
                 (unsigned long)*htaborg, (unsigned long)*htabmask);
     }

And change to:

     if ((htab_ra & (htab_nr_bytes-1)) != 0) {
         device_error(parent, "htaborg 0x%lx not aligned to htabmask 
0x%lx",
                 (unsigned long)*htaborg, (unsigned long)*htabmask);
     }

After fixing this problem, it is no longer necessary to manually 
configure OpenFirmware's layout in memory.


The second bug also concerns the emulated Open Firmware.  The client 
interface function "nextprop" never returns the first property.  In the 
file gdb/sim/ppc/emul_chirp.c, in chirp_emul_nextprop(), look for the 
statement:

     next_prop = device_next_property(prev_prop);

And change to:

     if( *previous == '\0' )
         next_prop = prev_prop;        /* Return the first property! */
     else
         next_prop = device_next_property(prev_prop);


-Josh



More information about the freebsd-ppc mailing list