Nicholas Nethercote 4399d9700f Added beginnings of an ARM port, to the point where it compiles. It does not
run, though.  There are lots of stubs to be filled in.  (The asm ones currently
just have "swi" in them, which seems to cause seg faults.) 

Also, some of the macros are decided dubious, especially:

  ARCH_* are bogus
  SYSCALL_RET is bogus
  PLATFORM_SET_SYSCALL_RESULT is bogus
  not sure about SET_SYSCALL_RETVAL
  FIRST_STACK_FRAME et al -- bogus?
  VG_MAX_JUMPS ?

And in stage2.lds, the 0x8048000 is almost certainly wrong


This required some tweakings of the core:
- some of the vki_*.h kernel types were fixed up

- had to disable the AM_PROG_CC_C_O macro in configure.in, because automake
  (autoconf?) didn't like it...

- some "#ifdef __x86__" guards were introduced, for nasty x86 things I don't
  yet know how to factor out (trampoline page muck, sysinfo page muck).

- fixed a minor stupidity in vg_proxylwp.c.

- moved the ptrace wrapper into the x86-linux part

- had to change the intercept mangling scheme, to use 'J' instead of '$' as the
  escape char because GCC didn't like '$'.  This is all very dubious, and only
  works because none of our intercepted symbols contains a 'J'.  To be fixed up
  ASAP.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3120
2004-11-26 19:34:36 +00:00

87 lines
3.4 KiB
C

/*--------------------------------------------------------------------*/
/*--- ARM-Linux-specific stuff for the core. ---*/
/*--- arm-linux/core_platform.h ---*/
/*--------------------------------------------------------------------*/
/*
This file is part of Valgrind, an extensible x86 protected-mode
emulator for monitoring program execution on x86-Unixes.
Copyright (C) 2000-2004 Nicholas Nethercote
njn25@cam.ac.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, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307, USA.
The GNU General Public License is contained in the file COPYING.
*/
#ifndef __ARM_LINUX_CORE_PLATFORM_H
#define __ARM_LINUX_CORE_PLATFORM_H
//#include "core_platform_asm.h" // platform-specific asm stuff
//#include "platform_arch.h" // platform-specific tool stuff
/* ---------------------------------------------------------------------
Dealing with registers
------------------------------------------------------------------ */
// Accessors for the ThreadArchState
#define PLATFORM_SYSCALL_NUM guest_SYSCALLNO
#define PLATFORM_SYSCALL_ARG1 guest_R0
#define PLATFORM_SYSCALL_ARG2 guest_R1
#define PLATFORM_SYSCALL_ARG3 guest_R2
#define PLATFORM_SYSCALL_ARG4 guest_R3
#define PLATFORM_SYSCALL_ARG5 guest_R4
#define PLATFORM_SYSCALL_ARG6 guest_R5
#define PLATFORM_SYSCALL_RET guest_R0 // ToDo XXX ????????
#define PLATFORM_SET_SYSCALL_RESULT(regs, val) \
((regs).vex.guest_R0 = (val)) // ToDo XXX ????????
// Setting thread regs and shadow regs from within the core
// XXX ToDo: not sure about this
#define SET_SYSCALL_RETVAL(zztid, zzval) \
SET_THREAD_REG(zztid, zzval, SYSCALL_RET, post_reg_write, \
Vg_CoreSysCall, zztid, O_SYSCALL_RET, sizeof(UWord))
/* ---------------------------------------------------------------------
ucontext stuff
------------------------------------------------------------------ */
#define UCONTEXT_INSTR_PTR(uc) ((uc)->uc_mcontext.arm_pc)
#define UCONTEXT_STACK_PTR(uc) ((uc)->uc_mcontext.arm_sp)
#define UCONTEXT_FRAME_PTR(uc) ((uc)->uc_mcontext.arm_fp)
#define UCONTEXT_SYSCALL_NUM(uc) ((uc)->uc_mcontext.arm_r0)
/* ---------------------------------------------------------------------
mmap() stuff
------------------------------------------------------------------ */
#define PLATFORM_DO_MMAP(ret, start, length, prot, flags, fd, offset) { \
I_die_here; \
}
#define PLATFORM_GET_MMAP_ARGS(tst, a1, a2, a3, a4, a5, a6) do { \
I_die_here; \
} while (0)
#endif // __ARM_LINUX_CORE_PLATFORM_H
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/