The GNU General Public License is contained in the file COPYING.
*/
-#if 0
#include "core_asm.h"
/* ------------------ SIMULATED CPU HELPERS ------------------ */
# We can point our sysinfo stuff here
.align 16
-syscall_start:
- int $0x80
+syscall_start:
+ /* Rerouted entry point for __NR_vgettimeofday */
+ movq $96 /*__NR_gettimeofday*/, %rax
+ syscall
ret
tramp_code_end:
/* Let the linker know we don't need an executable stack */
.section .note.GNU-stack,"",@progbits
-#endif
##--------------------------------------------------------------------##
##--- end ---##
// XXX: what architectures is this necessary for? x86 yes, PPC no, others ?
// Perhaps a per-arch VGA_NEEDS_TRAMPOLINE constant is necessary?
-#ifdef __x86__
+#if defined(__i386__) || defined(__amd64__)
/* --- trampoline page --- */
VG_(memcpy)( (void *)VG_(client_trampoline_code),
&VG_(trampoline_code_start), VG_(trampoline_code_length) );
// XXX: what architectures is this necessary for? x86 yes, PPC no, others ?
#ifdef __x86__
{
- Int *auxp;
+ Word *auxp;
for (auxp = client_auxv; auxp[0] != AT_NULL; auxp += 2) {
switch(auxp[0]) {
case AT_SYSINFO:
VG_(parse_procselfmaps) ( build_segment_map_callback ); /* everything */
sp_at_startup___global_arg = 0;
-#ifdef __i386__
+#if defined(__i386__) || defined(__amd64__)
//--------------------------------------------------------------
// Protect client trampoline page (which is also sysinfo stuff)
// p: segment stuff [otherwise get seg faults...]
Bool know_objname = VG_(get_objname)(eip, buf_obj, M_VG_ERRTXT);
Bool know_srcloc = VG_(get_filename_linenum)(eip, buf_srcloc, M_VG_ERRTXT,
&lineno);
- VG_(sprintf)(ibuf,"0x%x: ", eip);
+ VG_(sprintf)(ibuf,"0x%llx: ", (ULong)eip);
APPEND(ibuf);
if (know_fnname) {
APPEND(buf_fn);
}
}
-/* Redirect a lib/symbol reference to a function at lib/symbol */
+/* Redirect a lib/symbol reference to an addr */
static void add_redirect_addr(const Char *from_lib, const Char *from_sym,
Addr to_addr)
{
{
CodeRedirect *r = VG_(SkipList_Find)(&sk_resolved_redir, &a);
+#ifdef __amd64__
+ /* HACK. 0xFFFFFFFFFF600000 is the entry point for
+ __NR_vgettimeofday. Therefore the code at
+ VG_(client_trampoline_code)+VG_(tramp_syscall_offset)
+ must be the magic conversion code to turn it into a normal
+ __NR_gettimeofday call.
+ */
+ if (a == 0xFFFFFFFFFF600000ULL)
+ return VG_(client_trampoline_code)+VG_(tramp_syscall_offset);
+#endif
+
if (r == NULL || r->from_addr != a)
return a;
add_redirect_addr("soname:ld-linux.so.2", "_dl_sysinfo_int80",
VG_(client_trampoline_code)+VG_(tramp_syscall_offset));
#endif
-
+
/* Overenthusiastic use of PLT bypassing by the glibc people also
means we need to patch the following functions to our own
implementations of said, in mac_replace_strmem.c.