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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [bfd/] [nlmswap.h] - Diff between revs 827 and 840

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

Rev 827 Rev 840
/* NLM (NetWare Loadable Module) swapping routines for BFD.
/* NLM (NetWare Loadable Module) swapping routines for BFD.
   Copyright 1993, 2000, 2001, 2005, 2007 Free Software Foundation, Inc.
   Copyright 1993, 2000, 2001, 2005, 2007 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 3 of the License, or
   the Free Software Foundation; either version 3 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., 51 Franklin Street - Fifth Floor, Boston,
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
   MA 02110-1301, USA.  */
   MA 02110-1301, 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.  */
 
 
/* 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 (bfd *abfd,
nlm_swap_fixed_header_in (bfd *abfd,
                          void * realsrc,
                          void * 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 =
    H_GET_32 (abfd, src->version);
    H_GET_32 (abfd, src->version);
  dst->codeImageOffset =
  dst->codeImageOffset =
    H_GET_32 (abfd, src->codeImageOffset);
    H_GET_32 (abfd, src->codeImageOffset);
  dst->codeImageSize =
  dst->codeImageSize =
    H_GET_32 (abfd, src->codeImageSize);
    H_GET_32 (abfd, src->codeImageSize);
  dst->dataImageOffset =
  dst->dataImageOffset =
    H_GET_32 (abfd, src->dataImageOffset);
    H_GET_32 (abfd, src->dataImageOffset);
  dst->dataImageSize =
  dst->dataImageSize =
    H_GET_32 (abfd, src->dataImageSize);
    H_GET_32 (abfd, src->dataImageSize);
  dst->uninitializedDataSize =
  dst->uninitializedDataSize =
    H_GET_32 (abfd, src->uninitializedDataSize);
    H_GET_32 (abfd, src->uninitializedDataSize);
  dst->customDataOffset =
  dst->customDataOffset =
    H_GET_32 (abfd, src->customDataOffset);
    H_GET_32 (abfd, src->customDataOffset);
  dst->customDataSize =
  dst->customDataSize =
    H_GET_32 (abfd, src->customDataSize);
    H_GET_32 (abfd, src->customDataSize);
  dst->moduleDependencyOffset =
  dst->moduleDependencyOffset =
    H_GET_32 (abfd, src->moduleDependencyOffset);
    H_GET_32 (abfd, src->moduleDependencyOffset);
  dst->numberOfModuleDependencies =
  dst->numberOfModuleDependencies =
    H_GET_32 (abfd, src->numberOfModuleDependencies);
    H_GET_32 (abfd, src->numberOfModuleDependencies);
  dst->relocationFixupOffset =
  dst->relocationFixupOffset =
    H_GET_32 (abfd, src->relocationFixupOffset);
    H_GET_32 (abfd, src->relocationFixupOffset);
  dst->numberOfRelocationFixups =
  dst->numberOfRelocationFixups =
    H_GET_32 (abfd, src->numberOfRelocationFixups);
    H_GET_32 (abfd, src->numberOfRelocationFixups);
  dst->externalReferencesOffset =
  dst->externalReferencesOffset =
    H_GET_32 (abfd, src->externalReferencesOffset);
    H_GET_32 (abfd, src->externalReferencesOffset);
  dst->numberOfExternalReferences =
  dst->numberOfExternalReferences =
    H_GET_32 (abfd, src->numberOfExternalReferences);
    H_GET_32 (abfd, src->numberOfExternalReferences);
  dst->publicsOffset =
  dst->publicsOffset =
    H_GET_32 (abfd, src->publicsOffset);
    H_GET_32 (abfd, src->publicsOffset);
  dst->numberOfPublics =
  dst->numberOfPublics =
    H_GET_32 (abfd, src->numberOfPublics);
    H_GET_32 (abfd, src->numberOfPublics);
  dst->debugInfoOffset =
  dst->debugInfoOffset =
    H_GET_32 (abfd, src->debugInfoOffset);
    H_GET_32 (abfd, src->debugInfoOffset);
  dst->numberOfDebugRecords =
  dst->numberOfDebugRecords =
    H_GET_32 (abfd, src->numberOfDebugRecords);
    H_GET_32 (abfd, src->numberOfDebugRecords);
  dst->codeStartOffset =
  dst->codeStartOffset =
    H_GET_32 (abfd, src->codeStartOffset);
    H_GET_32 (abfd, src->codeStartOffset);
  dst->exitProcedureOffset =
  dst->exitProcedureOffset =
    H_GET_32 (abfd, src->exitProcedureOffset);
    H_GET_32 (abfd, src->exitProcedureOffset);
  dst->checkUnloadProcedureOffset =
  dst->checkUnloadProcedureOffset =
    H_GET_32 (abfd, src->checkUnloadProcedureOffset);
    H_GET_32 (abfd, src->checkUnloadProcedureOffset);
  dst->moduleType =
  dst->moduleType =
    H_GET_32 (abfd, src->moduleType);
    H_GET_32 (abfd, src->moduleType);
  dst->flags =
  dst->flags =
    H_GET_32 (abfd, src->flags);
    H_GET_32 (abfd, 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 (bfd *abfd,
nlm_swap_fixed_header_out (bfd *abfd,
                           Nlm_Internal_Fixed_Header *src,
                           Nlm_Internal_Fixed_Header *src,
                           void * realdst)
                           void * 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);
  H_PUT_32 (abfd, src->version,
  H_PUT_32 (abfd, src->version,
            dst->version);
            dst->version);
  H_PUT_32 (abfd, src->codeImageOffset,
  H_PUT_32 (abfd, src->codeImageOffset,
            dst->codeImageOffset);
            dst->codeImageOffset);
  H_PUT_32 (abfd, src->codeImageSize,
  H_PUT_32 (abfd, src->codeImageSize,
            dst->codeImageSize);
            dst->codeImageSize);
  H_PUT_32 (abfd, src->dataImageOffset,
  H_PUT_32 (abfd, src->dataImageOffset,
            dst->dataImageOffset);
            dst->dataImageOffset);
  H_PUT_32 (abfd, src->dataImageSize,
  H_PUT_32 (abfd, src->dataImageSize,
            dst->dataImageSize);
            dst->dataImageSize);
  H_PUT_32 (abfd, src->uninitializedDataSize,
  H_PUT_32 (abfd, src->uninitializedDataSize,
            dst->uninitializedDataSize);
            dst->uninitializedDataSize);
  H_PUT_32 (abfd, src->customDataOffset,
  H_PUT_32 (abfd, src->customDataOffset,
            dst->customDataOffset);
            dst->customDataOffset);
  H_PUT_32 (abfd, src->customDataSize,
  H_PUT_32 (abfd, src->customDataSize,
            dst->customDataSize);
            dst->customDataSize);
  H_PUT_32 (abfd, src->moduleDependencyOffset,
  H_PUT_32 (abfd, src->moduleDependencyOffset,
            dst->moduleDependencyOffset);
            dst->moduleDependencyOffset);
  H_PUT_32 (abfd, src->numberOfModuleDependencies,
  H_PUT_32 (abfd, src->numberOfModuleDependencies,
            dst->numberOfModuleDependencies);
            dst->numberOfModuleDependencies);
  H_PUT_32 (abfd, src->relocationFixupOffset,
  H_PUT_32 (abfd, src->relocationFixupOffset,
            dst->relocationFixupOffset);
            dst->relocationFixupOffset);
  H_PUT_32 (abfd, src->numberOfRelocationFixups,
  H_PUT_32 (abfd, src->numberOfRelocationFixups,
            dst->numberOfRelocationFixups);
            dst->numberOfRelocationFixups);
  H_PUT_32 (abfd, src->externalReferencesOffset,
  H_PUT_32 (abfd, src->externalReferencesOffset,
            dst->externalReferencesOffset);
            dst->externalReferencesOffset);
  H_PUT_32 (abfd, src->numberOfExternalReferences,
  H_PUT_32 (abfd, src->numberOfExternalReferences,
            dst->numberOfExternalReferences);
            dst->numberOfExternalReferences);
  H_PUT_32 (abfd, src->publicsOffset,
  H_PUT_32 (abfd, src->publicsOffset,
            dst->publicsOffset);
            dst->publicsOffset);
  H_PUT_32 (abfd, src->numberOfPublics,
  H_PUT_32 (abfd, src->numberOfPublics,
            dst->numberOfPublics);
            dst->numberOfPublics);
  H_PUT_32 (abfd, src->debugInfoOffset,
  H_PUT_32 (abfd, src->debugInfoOffset,
            dst->debugInfoOffset);
            dst->debugInfoOffset);
  H_PUT_32 (abfd, src->numberOfDebugRecords,
  H_PUT_32 (abfd, src->numberOfDebugRecords,
            dst->numberOfDebugRecords);
            dst->numberOfDebugRecords);
  H_PUT_32 (abfd, src->codeStartOffset,
  H_PUT_32 (abfd, src->codeStartOffset,
            dst->codeStartOffset);
            dst->codeStartOffset);
  H_PUT_32 (abfd, src->exitProcedureOffset,
  H_PUT_32 (abfd, src->exitProcedureOffset,
            dst->exitProcedureOffset);
            dst->exitProcedureOffset);
  H_PUT_32 (abfd, src->checkUnloadProcedureOffset,
  H_PUT_32 (abfd, src->checkUnloadProcedureOffset,
            dst->checkUnloadProcedureOffset);
            dst->checkUnloadProcedureOffset);
  H_PUT_32 (abfd, src->moduleType,
  H_PUT_32 (abfd, src->moduleType,
            dst->moduleType);
            dst->moduleType);
  H_PUT_32 (abfd, src->flags,
  H_PUT_32 (abfd, src->flags,
            dst->flags);
            dst->flags);
}
}
 
 

powered by: WebSVN 2.1.0

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