ftmemsim-valgrind/coregrind/pub_core_initimg.h
Mark Wielaard 461cc5c003 Cleanup GPL header address notices by using http://www.gnu.org/licenses/
Sync VEX/LICENSE.GPL with top-level COPYING file. We used 3 different
addresses for writing to the FSF to receive a copy of the GPL. Replace
all different variants with an URL <http://www.gnu.org/licenses/>.

The following files might still have some slightly different (L)GPL
copyright notice because they were derived from other programs:

- files under coregrind/m_demangle which come from libiberty:
  cplus-dem.c, d-demangle.c, demangle.h, rust-demangle.c,
  safe-ctype.c and safe-ctype.h
- coregrind/m_demangle/dyn-string.[hc] derived from GCC.
- coregrind/m_demangle/ansidecl.h derived from glibc.
- VEX files for FMA detived from glibc:
  host_generic_maddf.h and host_generic_maddf.c
- files under coregrin/m_debuginfo derived from LZO:
  lzoconf.h, lzodefs.h, minilzo-inl.c and minilzo.h
- files under coregrind/m_gdbserver detived from GDB:
  gdb/signals.h, inferiors.c, regcache.c, regcache.h,
  regdef.h, remote-utils.c, server.c, server.h, signals.c,
  target.c, target.h and utils.c

Plus the following test files:

- none/tests/ppc32/testVMX.c derived from testVMX.
- ppc tests derived from QEMU: jm-insns.c, ppc64_helpers.h
  and test_isa_3_0.c
- tests derived from bzip2 (with embedded GPL text in code):
  hackedbz2.c, origin5-bz2.c, varinfo6.c
- tests detived from glibc: str_tester.c, pth_atfork1.c
- test detived from GCC libgomp: tc17_sembar.c
- performance tests derived from bzip2 or tinycc (with embedded GPL
  text in code): bz2.c, test_input_for_tinycc.c and tinycc.c
2019-05-26 20:07:51 +02:00

157 lines
5.2 KiB
C

/*--------------------------------------------------------------------*/
/*--- Create initial process image on for the client ---*/
/*--- pub_core_initimg.h ---*/
/*--------------------------------------------------------------------*/
/*
This file is part of Valgrind, a dynamic binary instrumentation
framework.
Copyright (C) 2006-2017 OpenWorks LLP
info@open-works.co.uk
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 the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
The GNU General Public License is contained in the file COPYING.
*/
#ifndef __PUB_CORE_INITIMG_H
#define __PUB_CORE_INITIMG_H
#include "pub_core_basics.h" // Addr
#include "libvex.h"
//--------------------------------------------------------------------
// PURPOSE: Map the client executable into memory, then set up its
// stack, environment and data section, ready for execution. Quite a
// lot of work on Linux (ELF).
//--------------------------------------------------------------------
/* These are OS-specific and defined below. */
typedef struct _IICreateImageInfo IICreateImageInfo;
typedef struct _IIFinaliseImageInfo IIFinaliseImageInfo;
/* This is a two stage process. The first stage, which is most of the
work, creates the initial image in memory to the extent possible.
To do this it takes a bundle of information in an IICreateImageInfo
structure, which is gathered in an OS-specific way at startup.
This returns an IIFinaliseImageInfo structure: */
extern
IIFinaliseImageInfo VG_(ii_create_image)( IICreateImageInfo,
const VexArchInfo* vex_archinfo );
/* Just before starting the client, we may need to make final
adjustments to its initial image. Also we need to set up the VEX
guest state for thread 1 (the root thread) and copy in essential
starting values. This is handed the IIFinaliseImageInfo created by
VG_(ii_create_image). */
extern
void VG_(ii_finalise_image)( IIFinaliseImageInfo );
/* Note that both IICreateImageInfo and IIFinaliseImageInfo are
OS-specific. We now go on to give instantiations of them
for supported OSes. */
/* ------------------------- Linux ------------------------- */
#if defined(VGO_linux)
struct _IICreateImageInfo {
/* ------ Mandatory fields ------ */
const HChar* toolname;
Addr sp_at_startup;
Addr clstack_end; // Highest stack addressable byte
/* ------ Per-OS fields ------ */
HChar** argv;
HChar** envp;
};
struct _IIFinaliseImageInfo {
/* ------ Mandatory fields ------ */
SizeT clstack_max_size;
Addr initial_client_SP;
/* ------ Per-OS fields ------ */
Addr initial_client_IP;
Addr initial_client_TOC;
UInt* client_auxv;
/* ------ Arch-specific ELF loading state ------ */
struct vki_arch_elf_state arch_elf_state;
};
/* ------------------------- Darwin ------------------------- */
#elif defined(VGO_darwin)
struct _IICreateImageInfo {
/* ------ Mandatory fields ------ */
const HChar* toolname;
Addr sp_at_startup;
Addr clstack_end; // highest stack addressable byte
/* ------ Per-OS fields ------ */
HChar** argv;
HChar** envp;
Addr entry; /* &_start */
Addr init_ip; /* &__dyld_start, or copy of entry */
Addr stack_start; /* stack segment hot */
Addr stack_end; /* stack segment cold */
Addr text; /* executable's Mach header */
Bool dynamic; /* False iff executable is static */
HChar* executable_path; /* path passed to execve() */
};
struct _IIFinaliseImageInfo {
/* ------ Mandatory fields ------ */
SizeT clstack_max_size;
Addr initial_client_SP;
/* ------ Per-OS fields ------ */
Addr initial_client_IP;
};
/* ------------------------- Solaris ------------------------- */
#elif defined(VGO_solaris)
struct _IICreateImageInfo {
/* ------ Mandatory fields ------ */
const HChar* toolname;
Addr sp_at_startup;
Addr clstack_end; /* highest stack addressable byte */
/* ------ Per-OS fields ------ */
HChar** argv;
HChar** envp;
};
struct _IIFinaliseImageInfo {
/* ------ Mandatory fields ------ */
SizeT clstack_max_size;
Addr initial_client_SP;
/* ------ Per-OS fields ------ */
Addr initial_client_IP;
Addr initial_client_TOC;
UInt* client_auxv;
Addr initial_client_TP; /* thread pointer */
};
#else
# error "Unknown OS"
#endif
#endif // __PUB_CORE_INITIMG_H
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/