Skip to content

Commit

Permalink
fix JIT code
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisBrunner committed Oct 19, 2024
1 parent c79b5d4 commit 3ef7b9b
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 34 deletions.
2 changes: 0 additions & 2 deletions .github/macos-12-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ memcheck/tests/varinfo4 (stderr)
memcheck/tests/varinfo5 (stderr)
memcheck/tests/varinfo6 (stderr)
memcheck/tests/varinforestrict (stderr)
memcheck/tests/vbit-test/vbit-test (stderr)
memcheck/tests/wcpncpy (stderr)
memcheck/tests/wrap1 (stdout)
memcheck/tests/wrap2 (stdout)
Expand Down Expand Up @@ -392,7 +391,6 @@ none/tests/amd64/avx-vmovq (stdout)
none/tests/async-sigs (stderr)
none/tests/bug234814 (stdout)
none/tests/bug234814 (stderr)
none/tests/cmd-with-special (stderr)
none/tests/coolo_sigaction (stdout)
none/tests/darwin/apple-main-arg (stderr)
none/tests/darwin/rlimit (stderr)
Expand Down
2 changes: 0 additions & 2 deletions .github/macos-13-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ memcheck/tests/varinfo3 (stderr)
memcheck/tests/varinfo4 (stderr)
memcheck/tests/varinfo5 (stderr)
memcheck/tests/varinfo6 (stderr)
memcheck/tests/vbit-test/vbit-test (stderr)
memcheck/tests/wcpncpy (stderr)
memcheck/tests/wrap5 (stdout)
memcheck/tests/wrap6 (stdout)
Expand Down Expand Up @@ -327,7 +326,6 @@ none/tests/bigcode (stdout)
none/tests/bigcode (stderr)
none/tests/bug234814 (stdout)
none/tests/bug234814 (stderr)
none/tests/cmd-with-special (stderr)
none/tests/coolo_sigaction (stdout)
none/tests/darwin/apple-main-arg (stderr)
none/tests/darwin/rlimit (stderr)
Expand Down
5 changes: 0 additions & 5 deletions .github/macos-14-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ memcheck/tests/noisy_child (stderr)
memcheck/tests/origin1-yes (stderr)
memcheck/tests/origin2-not-quite (stderr)
memcheck/tests/origin3-no (stderr)
memcheck/tests/origin5-bz2 (stdout)
memcheck/tests/origin5-bz2 (stderr)
memcheck/tests/origin6-fp (stderr)
memcheck/tests/overlap (stderr)
Expand Down Expand Up @@ -116,11 +115,8 @@ memcheck/tests/varinfo1 (stderr)
memcheck/tests/varinfo2 (stderr)
memcheck/tests/varinfo3 (stderr)
memcheck/tests/varinfo4 (stderr)
memcheck/tests/varinfo6 (stdout)
memcheck/tests/varinfo6 (stderr)
memcheck/tests/vbit-test/vbit-test (stderr)
memcheck/tests/vcpu_bz2 (stdout)
memcheck/tests/vcpu_bz2 (stderr)
memcheck/tests/wcpncpy (stderr)
memcheck/tests/wrap1 (stdout)
memcheck/tests/wrap1 (stderr)
Expand Down Expand Up @@ -375,7 +371,6 @@ none/tests/bigcode (stdout)
none/tests/bigcode (stderr)
none/tests/bug234814 (stdout)
none/tests/bug234814 (stderr)
none/tests/cmd-with-special (stderr)
none/tests/darwin/access_extended (stderr)
none/tests/darwin/apple-main-arg (stderr)
none/tests/darwin/bug228343 (stdout)
Expand Down
6 changes: 0 additions & 6 deletions coregrind/m_aspacemgr/aspacemgr-linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -2774,12 +2774,6 @@ SysRes VG_(am_mmap_anon_float_valgrind)( SizeT length )
if (!ok)
return VG_(mk_SysRes_Error)( VKI_EINVAL );

// On Darwin, for anonymous maps you can pass in a tag which is used by
// programs like vmmap for statistical purposes.
#ifndef VM_TAG_VALGRIND
# define VM_TAG_VALGRIND 0
#endif

/* We have been advised that the mapping is allowable at the
specified address. So hand it off to the kernel, and propagate
any resulting failure immediately. */
Expand Down
6 changes: 2 additions & 4 deletions coregrind/m_dispatch/dispatch-arm64-darwin.S
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ VG_(disp_run_translations):
stp x25, x26, [sp, #-16]!
stp x23, x24, [sp, #-16]!
stp x21, x22, [sp, #-16]!
stp x19, x20, [sp, #-16]!
stp x0, xzr, [sp, #-16]!
stp x0, x20, [sp, #-16]!

/* set FPSCR to vex-required default value */
// FIXME
Expand Down Expand Up @@ -118,8 +117,7 @@ postamble:
remove_frame:
/* Restore int regs, including importantly x0 (two_words),
but not x1 */
ldp x0, xzr, [sp], #16
ldp x19, x20, [sp], #16
ldp x0, x20, [sp], #16
ldp x21, x22, [sp], #16
ldp x23, x24, [sp], #16
ldp x25, x26, [sp], #16
Expand Down
7 changes: 4 additions & 3 deletions coregrind/m_gdbserver/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1329,8 +1329,7 @@ static
void handle_j_requests (char *arg_own_buf, Bool* skip_reply)
{
#if defined(VGO_darwin)
// We limit to vgdb=full because it can be quite slow to get all the images
if (VG_(clo_vgdb) == Vg_VgdbFull && strncmp("jGetLoadedDynamicLibrariesInfos:", arg_own_buf, 32) == 0) {
if (strncmp("jGetLoadedDynamicLibrariesInfos:", arg_own_buf, 32) == 0) {
HChar *p = arg_own_buf + 32;
unsigned char csum = 0;
Int counter = 0;
Expand Down Expand Up @@ -1362,7 +1361,9 @@ void handle_j_requests (char *arg_own_buf, Bool* skip_reply)
*skip_reply = True;
}
return;
} else if (VG_(strncmp)(p, "{\"solib_addresses\":[", 20) == 0) {

// We limit to vgdb=full because lldb takes forever to load the images
} else if (VG_(strncmp)(p, "{\"solib_addresses\":[", 20) == 0 && VG_(clo_vgdb) == Vg_VgdbFull) {
// assumption: we are getting {"solib_addresses":[1234,5678]}
// we might get a lot of images at once (easily in the 100s) which might be bigger than PBUFSIZ
// so we stream it in chunks (1 image per chunk)
Expand Down
22 changes: 10 additions & 12 deletions coregrind/m_libcsetjmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,33 +387,31 @@ __asm__(
".globl _VG_MINIMAL_SETJMP" "\n"
"_VG_MINIMAL_SETJMP:" "\n" // x0 = jmp_buf
" mov x1, sp\n" /* can't STP from sp */
" stp x19, x20, [x0, #0x00]\n"
" stp x1, x20, [x0, #0x00]\n"
" stp x21, x22, [x0, #0x10]\n"
" stp x23, x24, [x0, #0x20]\n"
" stp x25, x26, [x0, #0x30]\n"
" stp x27, x28, [x0, #0x40]\n"
" stp x29, x30, [x0, #0x50]\n"
" stp x1, xzr, [x0, #0x60]\n"
" stp d8, d9, [x0, #0x70]\n"
" stp d10, d11, [x0, #0x80]\n"
" stp d12, d13, [x0, #0x90]\n"
" stp d14, d15, [x0, #0xA0]\n"
" stp d8, d9, [x0, #0x60]\n"
" stp d10, d11, [x0, #0x70]\n"
" stp d12, d13, [x0, #0x80]\n"
" stp d14, d15, [x0, #0x90]\n"
" mov x0, #0\n" // return 0 on the first return
" ret\n"

".globl _VG_MINIMAL_LONGJMP" "\n"
"_VG_MINIMAL_LONGJMP:" "\n" // x0 = jmp_buf
" ldp x19, x20, [x0, #0x00]\n"
" ldp x1, x20, [x0, #0x00]\n"
" ldp x21, x22, [x0, #0x10]\n"
" ldp x23, x24, [x0, #0x20]\n"
" ldp x25, x26, [x0, #0x30]\n"
" ldp x27, x28, [x0, #0x40]\n"
" ldp x29, x30, [x0, #0x50]\n"
" ldp x1, xzr, [x0, #0x60]\n"
" ldp d8, d9, [x0, #0x70]\n"
" ldp d10, d11, [x0, #0x80]\n"
" ldp d12, d13, [x0, #0x90]\n"
" ldp d14, d15, [x0, #0xA0]\n"
" ldp d8, d9, [x0, #0x60]\n"
" ldp d10, d11, [x0, #0x70]\n"
" ldp d12, d13, [x0, #0x80]\n"
" ldp d14, d15, [x0, #0x90]\n"
" mov sp, x1\n"
" mov x0, #1\n" // return non-zero on the second return
" br lr\n"
Expand Down
2 changes: 2 additions & 0 deletions coregrind/m_transtab.c
Original file line number Diff line number Diff line change
Expand Up @@ -2451,10 +2451,12 @@ void VG_(add_to_unredir_transtab)( const VexGuestExtents* vge,
if (i > unredir_tt_highwater)
unredir_tt_highwater = i;

ALLOW_RWX_WRITE((Addr) unredir_tc, N_UNREDIR_TT * UNREDIR_SZB);
dstP = (HChar*)&unredir_tc[unredir_tc_used];
srcP = (HChar*)code;
for (j = 0; j < code_len; j++)
dstP[j] = srcP[j];
ALLOW_RWX_EXECUTE((Addr) unredir_tc, N_UNREDIR_TT * UNREDIR_SZB);

VG_(invalidate_icache)( dstP, code_len );

Expand Down
1 change: 1 addition & 0 deletions memcheck/mc_machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,7 @@ static Int get_otrack_shadow_offset_wrk ( Int offset, Int szB )

if (o == GOF(CMSTART) && sz == 8) return -1; // untracked
if (o == GOF(CMLEN) && sz == 8) return -1; // untracked
if (o == GOF(NRADDR) && sz == 8) return -1; // untracked

if (o == GOF(LLSC_SIZE) && sz == 8) return -1; // untracked
if (o == GOF(LLSC_ADDR) && sz == 8) return o;
Expand Down

0 comments on commit 3ef7b9b

Please sign in to comment.