qemu-s390x
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 07/10] tcg: implement bulletproof JIT


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 07/10] tcg: implement bulletproof JIT
Date: Tue, 13 Oct 2020 10:22:33 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1

Hi Joelle,

On 10/13/20 1:29 AM, Joelle van Dyne wrote:
From: osy <osy86@users.noreply.github.com>

On iOS, we cannot allocate RWX pages without special entitlements. As a
workaround, we can a RX region and then mirror map it to a separate RX
region. Then we can write to one region and execute from the other one.

To better keep track of pointers to RW/RX memory, we mark any tcg_insn_unit
pointers as `const` if they will never be written to. We also define a new
macro `TCG_CODE_PTR_RW` that returns a pointer to RW memory. Only the
difference between the two regions is stored in the TCG context.

^ one change,

v another change. Consider splitting in 2 patches to ease review.


To ensure cache coherency, we flush the data cache in the RW mapping and
then invalidate the instruction cache in the RX mapping (where applicable).
Because data cache flush is OS defined on some architectures, we do not
provide implementations for non iOS platforms (ARM/x86).

Signed-off-by: Joelle van Dyne <j@getutm.app>
---
  accel/tcg/cpu-exec.c         |  7 +++-
  accel/tcg/translate-all.c    | 78 ++++++++++++++++++++++++++++++++++--
  configure                    |  1 +
  docs/devel/ios.rst           | 40 ++++++++++++++++++
  include/exec/exec-all.h      |  8 ++++
  include/tcg/tcg.h            | 18 +++++++--
  tcg/aarch64/tcg-target.c.inc | 48 +++++++++++++---------
  tcg/aarch64/tcg-target.h     | 13 +++++-
  tcg/arm/tcg-target.c.inc     | 33 ++++++++-------
  tcg/arm/tcg-target.h         |  9 ++++-
  tcg/i386/tcg-target.c.inc    | 28 ++++++-------
  tcg/i386/tcg-target.h        | 24 ++++++++++-
  tcg/mips/tcg-target.c.inc    | 64 +++++++++++++++++------------
  tcg/mips/tcg-target.h        |  8 +++-
  tcg/ppc/tcg-target.c.inc     | 55 ++++++++++++++++---------
  tcg/ppc/tcg-target.h         |  8 +++-
  tcg/riscv/tcg-target.c.inc   | 51 +++++++++++++----------
  tcg/riscv/tcg-target.h       |  9 ++++-
  tcg/s390/tcg-target.c.inc    | 25 ++++++------
  tcg/s390/tcg-target.h        | 13 +++++-
  tcg/sparc/tcg-target.c.inc   | 33 +++++++++------
  tcg/sparc/tcg-target.h       |  8 +++-
  tcg/tcg-ldst.c.inc           |  2 +-
  tcg/tcg-pool.c.inc           |  9 +++--
  tcg/tcg.c                    | 60 +++++++++++++++++----------
  tcg/tci/tcg-target.c.inc     |  8 ++--
  tcg/tci/tcg-target.h         |  9 ++++-
  27 files changed, 481 insertions(+), 188 deletions(-)
  create mode 100644 docs/devel/ios.rst

When posting big series, consider using scripts/git.orderfile.

Regards,

Phil.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]