OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [gdb-5.0/] [bfd/] [nlmswap.h] - Diff between revs 579 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 579 Rev 1765
/* NLM (NetWare Loadable Module) swapping routines for BFD.
/* NLM (NetWare Loadable Module) swapping routines for BFD.
   Copyright (C) 1993 Free Software Foundation, Inc.
   Copyright (C) 1993 Free Software Foundation, Inc.
 
 
   Written by Fred Fish @ Cygnus Support, using ELF support as the
   Written by Fred Fish @ Cygnus Support, using ELF support as the
   template.
   template.
 
 
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
 
 
This program is free software; you can redistribute it and/or modify
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
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
(at your option) any later version.
 
 
This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
GNU General Public License for more details.
 
 
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 
/* Although this is a header file, it defines functions.  It is
/* Although this is a header file, it defines functions.  It is
   included by NLM backends to define swapping functions that vary
   included by NLM backends to define swapping functions that vary
   from one NLM to another.  The backend code must arrange for
   from one NLM to another.  The backend code must arrange for
   Nlm_External_xxxx to be defined appropriately, and can then include
   Nlm_External_xxxx to be defined appropriately, and can then include
   this file to get the swapping routines.
   this file to get the swapping routines.
 
 
   At the moment this is only needed for one structure, the fixed NLM
   At the moment this is only needed for one structure, the fixed NLM
   file header.  */
   file header.  */
 
 
static void nlm_swap_fixed_header_in PARAMS ((bfd *, PTR,
static void nlm_swap_fixed_header_in PARAMS ((bfd *, PTR,
                                              Nlm_Internal_Fixed_Header *));
                                              Nlm_Internal_Fixed_Header *));
static void nlm_swap_fixed_header_out PARAMS ((bfd *,
static void nlm_swap_fixed_header_out PARAMS ((bfd *,
                                               Nlm_Internal_Fixed_Header *,
                                               Nlm_Internal_Fixed_Header *,
                                               PTR));
                                               PTR));
 
 
/* Translate an NLM fixed length file header in external format into an NLM
/* Translate an NLM fixed length file header in external format into an NLM
   file header in internal format. */
   file header in internal format. */
 
 
static void
static void
nlm_swap_fixed_header_in (abfd, realsrc, dst)
nlm_swap_fixed_header_in (abfd, realsrc, dst)
     bfd *abfd;
     bfd *abfd;
     PTR realsrc;
     PTR realsrc;
     Nlm_Internal_Fixed_Header *dst;
     Nlm_Internal_Fixed_Header *dst;
{
{
  Nlm_External_Fixed_Header *src = (Nlm_External_Fixed_Header *) realsrc;
  Nlm_External_Fixed_Header *src = (Nlm_External_Fixed_Header *) realsrc;
  memcpy (dst->signature, src->signature, NLM_SIGNATURE_SIZE);
  memcpy (dst->signature, src->signature, NLM_SIGNATURE_SIZE);
  memcpy (dst->moduleName, src->moduleName, NLM_MODULE_NAME_SIZE);
  memcpy (dst->moduleName, src->moduleName, NLM_MODULE_NAME_SIZE);
  dst->version =
  dst->version =
    bfd_h_get_32 (abfd, (bfd_byte *) src->version);
    bfd_h_get_32 (abfd, (bfd_byte *) src->version);
  dst->codeImageOffset =
  dst->codeImageOffset =
    bfd_h_get_32 (abfd, (bfd_byte *) src->codeImageOffset);
    bfd_h_get_32 (abfd, (bfd_byte *) src->codeImageOffset);
  dst->codeImageSize =
  dst->codeImageSize =
    bfd_h_get_32 (abfd, (bfd_byte *) src->codeImageSize);
    bfd_h_get_32 (abfd, (bfd_byte *) src->codeImageSize);
  dst->dataImageOffset =
  dst->dataImageOffset =
    bfd_h_get_32 (abfd, (bfd_byte *) src->dataImageOffset);
    bfd_h_get_32 (abfd, (bfd_byte *) src->dataImageOffset);
  dst->dataImageSize =
  dst->dataImageSize =
    bfd_h_get_32 (abfd, (bfd_byte *) src->dataImageSize);
    bfd_h_get_32 (abfd, (bfd_byte *) src->dataImageSize);
  dst->uninitializedDataSize =
  dst->uninitializedDataSize =
    bfd_h_get_32 (abfd, (bfd_byte *) src->uninitializedDataSize);
    bfd_h_get_32 (abfd, (bfd_byte *) src->uninitializedDataSize);
  dst->customDataOffset =
  dst->customDataOffset =
    bfd_h_get_32 (abfd, (bfd_byte *) src->customDataOffset);
    bfd_h_get_32 (abfd, (bfd_byte *) src->customDataOffset);
  dst->customDataSize =
  dst->customDataSize =
    bfd_h_get_32 (abfd, (bfd_byte *) src->customDataSize);
    bfd_h_get_32 (abfd, (bfd_byte *) src->customDataSize);
  dst->moduleDependencyOffset =
  dst->moduleDependencyOffset =
    bfd_h_get_32 (abfd, (bfd_byte *) src->moduleDependencyOffset);
    bfd_h_get_32 (abfd, (bfd_byte *) src->moduleDependencyOffset);
  dst->numberOfModuleDependencies =
  dst->numberOfModuleDependencies =
    bfd_h_get_32 (abfd, (bfd_byte *) src->numberOfModuleDependencies);
    bfd_h_get_32 (abfd, (bfd_byte *) src->numberOfModuleDependencies);
  dst->relocationFixupOffset =
  dst->relocationFixupOffset =
    bfd_h_get_32 (abfd, (bfd_byte *) src->relocationFixupOffset);
    bfd_h_get_32 (abfd, (bfd_byte *) src->relocationFixupOffset);
  dst->numberOfRelocationFixups =
  dst->numberOfRelocationFixups =
    bfd_h_get_32 (abfd, (bfd_byte *) src->numberOfRelocationFixups);
    bfd_h_get_32 (abfd, (bfd_byte *) src->numberOfRelocationFixups);
  dst->externalReferencesOffset =
  dst->externalReferencesOffset =
    bfd_h_get_32 (abfd, (bfd_byte *) src->externalReferencesOffset);
    bfd_h_get_32 (abfd, (bfd_byte *) src->externalReferencesOffset);
  dst->numberOfExternalReferences =
  dst->numberOfExternalReferences =
    bfd_h_get_32 (abfd, (bfd_byte *) src->numberOfExternalReferences);
    bfd_h_get_32 (abfd, (bfd_byte *) src->numberOfExternalReferences);
  dst->publicsOffset =
  dst->publicsOffset =
    bfd_h_get_32 (abfd, (bfd_byte *) src->publicsOffset);
    bfd_h_get_32 (abfd, (bfd_byte *) src->publicsOffset);
  dst->numberOfPublics =
  dst->numberOfPublics =
    bfd_h_get_32 (abfd, (bfd_byte *) src->numberOfPublics);
    bfd_h_get_32 (abfd, (bfd_byte *) src->numberOfPublics);
  dst->debugInfoOffset =
  dst->debugInfoOffset =
    bfd_h_get_32 (abfd, (bfd_byte *) src->debugInfoOffset);
    bfd_h_get_32 (abfd, (bfd_byte *) src->debugInfoOffset);
  dst->numberOfDebugRecords =
  dst->numberOfDebugRecords =
    bfd_h_get_32 (abfd, (bfd_byte *) src->numberOfDebugRecords);
    bfd_h_get_32 (abfd, (bfd_byte *) src->numberOfDebugRecords);
  dst->codeStartOffset =
  dst->codeStartOffset =
    bfd_h_get_32 (abfd, (bfd_byte *) src->codeStartOffset);
    bfd_h_get_32 (abfd, (bfd_byte *) src->codeStartOffset);
  dst->exitProcedureOffset =
  dst->exitProcedureOffset =
    bfd_h_get_32 (abfd, (bfd_byte *) src->exitProcedureOffset);
    bfd_h_get_32 (abfd, (bfd_byte *) src->exitProcedureOffset);
  dst->checkUnloadProcedureOffset =
  dst->checkUnloadProcedureOffset =
    bfd_h_get_32 (abfd, (bfd_byte *) src->checkUnloadProcedureOffset);
    bfd_h_get_32 (abfd, (bfd_byte *) src->checkUnloadProcedureOffset);
  dst->moduleType =
  dst->moduleType =
    bfd_h_get_32 (abfd, (bfd_byte *) src->moduleType);
    bfd_h_get_32 (abfd, (bfd_byte *) src->moduleType);
  dst->flags =
  dst->flags =
    bfd_h_get_32 (abfd, (bfd_byte *) src->flags);
    bfd_h_get_32 (abfd, (bfd_byte *) src->flags);
}
}
 
 
/* Translate an NLM fixed length file header in internal format into
/* Translate an NLM fixed length file header in internal format into
   an NLM file header in external format. */
   an NLM file header in external format. */
 
 
static void
static void
nlm_swap_fixed_header_out (abfd, src, realdst)
nlm_swap_fixed_header_out (abfd, src, realdst)
     bfd *abfd;
     bfd *abfd;
     Nlm_Internal_Fixed_Header *src;
     Nlm_Internal_Fixed_Header *src;
     PTR realdst;
     PTR realdst;
{
{
  Nlm_External_Fixed_Header *dst = (Nlm_External_Fixed_Header *) realdst;
  Nlm_External_Fixed_Header *dst = (Nlm_External_Fixed_Header *) realdst;
  memset (dst, 0, sizeof *dst);
  memset (dst, 0, sizeof *dst);
  memcpy (dst->signature, src->signature, NLM_SIGNATURE_SIZE);
  memcpy (dst->signature, src->signature, NLM_SIGNATURE_SIZE);
  memcpy (dst->moduleName, src->moduleName, NLM_MODULE_NAME_SIZE);
  memcpy (dst->moduleName, src->moduleName, NLM_MODULE_NAME_SIZE);
  bfd_h_put_32 (abfd, (bfd_vma) src->version,
  bfd_h_put_32 (abfd, (bfd_vma) src->version,
                (bfd_byte *) dst->version);
                (bfd_byte *) dst->version);
  bfd_h_put_32 (abfd, (bfd_vma) src->codeImageOffset,
  bfd_h_put_32 (abfd, (bfd_vma) src->codeImageOffset,
                (bfd_byte *) dst->codeImageOffset);
                (bfd_byte *) dst->codeImageOffset);
  bfd_h_put_32 (abfd, (bfd_vma) src->codeImageSize,
  bfd_h_put_32 (abfd, (bfd_vma) src->codeImageSize,
                (bfd_byte *) dst->codeImageSize);
                (bfd_byte *) dst->codeImageSize);
  bfd_h_put_32 (abfd, (bfd_vma) src->dataImageOffset,
  bfd_h_put_32 (abfd, (bfd_vma) src->dataImageOffset,
                (bfd_byte *) dst->dataImageOffset);
                (bfd_byte *) dst->dataImageOffset);
  bfd_h_put_32 (abfd, (bfd_vma) src->dataImageSize,
  bfd_h_put_32 (abfd, (bfd_vma) src->dataImageSize,
                (bfd_byte *) dst->dataImageSize);
                (bfd_byte *) dst->dataImageSize);
  bfd_h_put_32 (abfd, (bfd_vma) src->uninitializedDataSize,
  bfd_h_put_32 (abfd, (bfd_vma) src->uninitializedDataSize,
                (bfd_byte *) dst->uninitializedDataSize);
                (bfd_byte *) dst->uninitializedDataSize);
  bfd_h_put_32 (abfd, (bfd_vma) src->customDataOffset,
  bfd_h_put_32 (abfd, (bfd_vma) src->customDataOffset,
                (bfd_byte *) dst->customDataOffset);
                (bfd_byte *) dst->customDataOffset);
  bfd_h_put_32 (abfd, (bfd_vma) src->customDataSize,
  bfd_h_put_32 (abfd, (bfd_vma) src->customDataSize,
                (bfd_byte *) dst->customDataSize);
                (bfd_byte *) dst->customDataSize);
  bfd_h_put_32 (abfd, (bfd_vma) src->moduleDependencyOffset,
  bfd_h_put_32 (abfd, (bfd_vma) src->moduleDependencyOffset,
                (bfd_byte *) dst->moduleDependencyOffset);
                (bfd_byte *) dst->moduleDependencyOffset);
  bfd_h_put_32 (abfd, (bfd_vma) src->numberOfModuleDependencies,
  bfd_h_put_32 (abfd, (bfd_vma) src->numberOfModuleDependencies,
                (bfd_byte *) dst->numberOfModuleDependencies);
                (bfd_byte *) dst->numberOfModuleDependencies);
  bfd_h_put_32 (abfd, (bfd_vma) src->relocationFixupOffset,
  bfd_h_put_32 (abfd, (bfd_vma) src->relocationFixupOffset,
                (bfd_byte *) dst->relocationFixupOffset);
                (bfd_byte *) dst->relocationFixupOffset);
  bfd_h_put_32 (abfd, (bfd_vma) src->numberOfRelocationFixups,
  bfd_h_put_32 (abfd, (bfd_vma) src->numberOfRelocationFixups,
                (bfd_byte *) dst->numberOfRelocationFixups);
                (bfd_byte *) dst->numberOfRelocationFixups);
  bfd_h_put_32 (abfd, (bfd_vma) src->externalReferencesOffset,
  bfd_h_put_32 (abfd, (bfd_vma) src->externalReferencesOffset,
                (bfd_byte *) dst->externalReferencesOffset);
                (bfd_byte *) dst->externalReferencesOffset);
  bfd_h_put_32 (abfd, (bfd_vma) src->numberOfExternalReferences,
  bfd_h_put_32 (abfd, (bfd_vma) src->numberOfExternalReferences,
                (bfd_byte *) dst->numberOfExternalReferences);
                (bfd_byte *) dst->numberOfExternalReferences);
  bfd_h_put_32 (abfd, (bfd_vma) src->publicsOffset,
  bfd_h_put_32 (abfd, (bfd_vma) src->publicsOffset,
                (bfd_byte *) dst->publicsOffset);
                (bfd_byte *) dst->publicsOffset);
  bfd_h_put_32 (abfd, (bfd_vma) src->numberOfPublics,
  bfd_h_put_32 (abfd, (bfd_vma) src->numberOfPublics,
                (bfd_byte *) dst->numberOfPublics);
                (bfd_byte *) dst->numberOfPublics);
  bfd_h_put_32 (abfd, (bfd_vma) src->debugInfoOffset,
  bfd_h_put_32 (abfd, (bfd_vma) src->debugInfoOffset,
                (bfd_byte *) dst->debugInfoOffset);
                (bfd_byte *) dst->debugInfoOffset);
  bfd_h_put_32 (abfd, (bfd_vma) src->numberOfDebugRecords,
  bfd_h_put_32 (abfd, (bfd_vma) src->numberOfDebugRecords,
                (bfd_byte *) dst->numberOfDebugRecords);
                (bfd_byte *) dst->numberOfDebugRecords);
  bfd_h_put_32 (abfd, (bfd_vma) src->codeStartOffset,
  bfd_h_put_32 (abfd, (bfd_vma) src->codeStartOffset,
                (bfd_byte *) dst->codeStartOffset);
                (bfd_byte *) dst->codeStartOffset);
  bfd_h_put_32 (abfd, (bfd_vma) src->exitProcedureOffset,
  bfd_h_put_32 (abfd, (bfd_vma) src->exitProcedureOffset,
                (bfd_byte *) dst->exitProcedureOffset);
                (bfd_byte *) dst->exitProcedureOffset);
  bfd_h_put_32 (abfd, (bfd_vma) src->checkUnloadProcedureOffset,
  bfd_h_put_32 (abfd, (bfd_vma) src->checkUnloadProcedureOffset,
                (bfd_byte *) dst->checkUnloadProcedureOffset);
                (bfd_byte *) dst->checkUnloadProcedureOffset);
  bfd_h_put_32 (abfd, (bfd_vma) src->moduleType,
  bfd_h_put_32 (abfd, (bfd_vma) src->moduleType,
                (bfd_byte *) dst->moduleType);
                (bfd_byte *) dst->moduleType);
  bfd_h_put_32 (abfd, (bfd_vma) src->flags,
  bfd_h_put_32 (abfd, (bfd_vma) src->flags,
                (bfd_byte *) dst->flags);
                (bfd_byte *) dst->flags);
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.