mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-24 23:36:56 +00:00
accel/tcg: allow to invalidate a write TLB entry immediately
Background: s390x implements Low-Address Protection (LAP). If LAP is enabled, writing to effective addresses (before any translation) 0-511 and 4096-4607 triggers a protection exception. So we have subpage protection on the first two pages of every address space (where the lowcore - the CPU private data resides). By immediately invalidating the write entry but allowing the caller to continue, we force every write access onto these first two pages into the slow path. we will get a tlb fault with the specific accessed addresses and can then evaluate if protection applies or not. We have to make sure to ignore the invalid bit if tlb_fill() succeeds. Backports commit f52bfb12143e29d7c8bd827bdb751aee47a9694e from qemu
This commit is contained in:
parent
d9d91c1db6
commit
de513617c8
|
@ -452,6 +452,9 @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr,
|
|||
} else {
|
||||
te->addr_write = address;
|
||||
}
|
||||
if (prot & PAGE_WRITE_INV) {
|
||||
te->addr_write |= TLB_INVALID_MASK;
|
||||
}
|
||||
if (wp_flags & BP_MEM_WRITE) {
|
||||
te->addr_write |= TLB_WATCHPOINT;
|
||||
}
|
||||
|
|
|
@ -249,6 +249,9 @@ void address_space_stq_cached(MemoryRegionCache *cache, hwaddr addr, uint64_t va
|
|||
/* original state of the write flag (used when tracking self-modifying
|
||||
code */
|
||||
#define PAGE_WRITE_ORG 0x0010
|
||||
/* Invalidate the TLB entry immediately, helpful for s390x
|
||||
* Low-Address-Protection. Used with PAGE_WRITE in tlb_set_page_with_attrs() */
|
||||
#define PAGE_WRITE_INV 0x0040
|
||||
#if defined(CONFIG_BSD) && defined(CONFIG_USER_ONLY)
|
||||
/* FIXME: Code that sets/uses this is broken and needs to go away. */
|
||||
#define PAGE_RESERVED 0x0020
|
||||
|
|
Loading…
Reference in a new issue