sim: punt zfree()
[deliverable/binutils-gdb.git] / sim / ppc / hw_htab.c
index 50a7b6adfcc1a34cfcf053fcc27a3b5bfc71cc83..5234f0f2c637c9faf4be55b443cc44d8b3e8fa0a 100644 (file)
@@ -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, 2004 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);
   }
@@ -384,9 +391,8 @@ htab_sum_binary(bfd *abfd,
                PTR data)
 {
   htab_binary_sizes *sizes = (htab_binary_sizes*)data;
-  unsigned_word size = bfd_get_section_size_before_reloc (sec);
+  unsigned_word size = bfd_get_section_size (sec);
   unsigned_word vma = bfd_get_section_vma (abfd, sec);
-#define bfd_get_section_lma(abfd, sec) ((sec)->lma + 0)
   unsigned_word ra = bfd_get_section_lma (abfd, sec);
 
   /* skip the section if no memory to allocate */
@@ -430,7 +436,7 @@ htab_dma_binary(bfd *abfd,
     return;
 
   /* check/ignore any sections of size zero */
-  section_size = bfd_get_section_size_before_reloc(sec);
+  section_size = bfd_get_section_size (sec);
   if (section_size == 0)
     return;
 
@@ -480,7 +486,7 @@ htab_dma_binary(bfd *abfd,
                              1 /*violate_read_only*/)
       != section_size)
     device_error(me, "broken dma transfer");
-  zfree(section_init); /* only free if load */
+  free(section_init); /* only free if load */
 }
 
 /* create a memory map from a binaries virtual addresses to a copy of
This page took 0.035556 seconds and 4 git commands to generate.