diff options
author | Andrew Cagney <cagney@redhat.com> | 2003-06-22 13:03:40 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2003-06-22 13:03:40 +0000 |
commit | 911b23336b9915405797925025033429a9d458ff (patch) | |
tree | ca5b16dd87adb6be17952a99f3ef9cce1d97a7fa /sim/ppc | |
parent | b4177fca1357236a635e37a18c2e143e3eadbede (diff) | |
download | fsf-binutils-gdb-911b23336b9915405797925025033429a9d458ff.zip fsf-binutils-gdb-911b23336b9915405797925025033429a9d458ff.tar.gz fsf-binutils-gdb-911b23336b9915405797925025033429a9d458ff.tar.bz2 |
2003-06-22 Andrew Cagney <cagney@redhat.com>
Problems reported by Joshua LeVasseur.
* emul_chirp.c: Update copyright.
(chirp_emul_nextprop): Return the first property.
* hw_htab.c: Update copyright.
(htab_decode_hash_table): Fix check for htab size.
Diffstat (limited to 'sim/ppc')
-rw-r--r-- | sim/ppc/ChangeLog | 8 | ||||
-rw-r--r-- | sim/ppc/emul_chirp.c | 27 | ||||
-rw-r--r-- | sim/ppc/hw_htab.c | 11 |
3 files changed, 37 insertions, 9 deletions
diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index 1324f81..842f172 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,11 @@ +2003-06-22 Andrew Cagney <cagney@redhat.com> + + Problems reported by Joshua LeVasseur. + * emul_chirp.c: Update copyright. + (chirp_emul_nextprop): Return the first property. + * hw_htab.c: Update copyright. + (htab_decode_hash_table): Fix check for htab size. + 2003-06-21 Andrew Cagney <cagney@redhat.com> * interrupts.c: Update copyright. diff --git a/sim/ppc/emul_chirp.c b/sim/ppc/emul_chirp.c index c4deb18..976f766 100644 --- a/sim/ppc/emul_chirp.c +++ b/sim/ppc/emul_chirp.c @@ -1,6 +1,6 @@ /* This file is part of the program psim. - Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au> + Copyright 1994, 1995, 1996, 1997, 2003 Andrew Cagney This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -584,10 +584,15 @@ chirp_emul_nextprop(os_emul_data *data, if (chirp_read_t2h_args(&args, sizeof(args), 3, 1, data, processor, cia)) return -1; phandle = external_to_device(data->root, args.phandle); - emul_read_string(previous, - args.previous, - sizeof(previous), - processor, cia); + if (args.previous != 0) + emul_read_string(previous, + args.previous, + sizeof(previous), + processor, cia); + else + /* If previous is NULL, make it look like the empty string. The + next property after the empty string is the first property. */ + strcpy (previous, ""); TRACE(trace_os_emul, ("nextprop - in - phandle=0x%lx(0x%lx`%s') previous=`%s' buf=0x%lx\n", (unsigned long)args.phandle, (unsigned long)phandle, @@ -602,11 +607,19 @@ chirp_emul_nextprop(os_emul_data *data, else { const device_property *prev_prop = device_find_property(phandle, previous); if (prev_prop == NULL) { - args.flag = -1; /* name invalid */ + if (strcmp (previous, "") == 0) + args.flag = 0; /* No properties */ + else + args.flag = -1; /* name invalid */ } else { const device_property *next_prop; - next_prop = device_next_property(prev_prop); + if (strcmp (previous, "") == 0) { + next_prop = prev_prop; /* The first property. */ + } + else { + next_prop = device_next_property(prev_prop); + } if (next_prop == NULL) { args.flag = 0; /* last property */ } diff --git a/sim/ppc/hw_htab.c b/sim/ppc/hw_htab.c index 50a7b6a..d536068 100644 --- a/sim/ppc/hw_htab.c +++ b/sim/ppc/hw_htab.c @@ -1,6 +1,6 @@ /* This file is part of the program psim. - Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au> + Copyright 1994, 1995, 1996, 2003 Andrew Cagney This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -217,14 +217,21 @@ htab_decode_hash_table(device *me, device_error(parent, "must be a htab device"); htab_ra = device_find_integer_property(parent, "real-address"); htab_nr_bytes = device_find_integer_property(parent, "nr-bytes"); + if (htab_nr_bytes < 0x10000) { + device_error(parent, "htab size 0x%x less than 0x1000", + htab_nr_bytes); + } for (n = htab_nr_bytes; n > 1; n = n / 2) { if (n % 2 != 0) device_error(parent, "htab size 0x%x not a power of two", htab_nr_bytes); } *htaborg = htab_ra; + /* Position the HTABMASK ready for use against a hashed address and + not ready for insertion into SDR1.HTABMASK. */ *htabmask = MASKED32(htab_nr_bytes - 1, 7, 31-6); - if ((htab_ra & INSERTED32(*htabmask, 7, 15)) != 0) { + /* Check that the MASK and ADDRESS do not overlap. */ + if ((htab_ra & (*htabmask)) != 0) { device_error(parent, "htaborg 0x%lx not aligned to htabmask 0x%lx", (unsigned long)*htaborg, (unsigned long)*htabmask); } |