Re: [Qemu-devel] [PATCH v2 5/7] mips/tcg: Call probe_write() for CONFIG_USER_ONLY as well

2019-08-29 Thread Aleksandar Markovic
26.08.2019. 09.52, "David Hildenbrand"  је написао/ла:
>
> Let's call it also for CONFIG_USER_ONLY. While at it, add a FIXME and get
> rid of one local variable.
>
> MIPS code probably needs a bigger refactoring in regards of
> ensure_writable_pages(), similar to s390x, so for example, watchpoints
> can be handled reliably later. The actually accessed addresses should
> be probed only, not full pages.
>
> Signed-off-by: David Hildenbrand 
> ---

Reviewed-by: Aleksandar Markovic 

>  target/mips/op_helper.c | 8 +++-
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/target/mips/op_helper.c b/target/mips/op_helper.c
> index 34bcc8d884..08d9a4f9f1 100644
> --- a/target/mips/op_helper.c
> +++ b/target/mips/op_helper.c
> @@ -4537,16 +4537,14 @@ static inline void
ensure_writable_pages(CPUMIPSState *env,
>   int mmu_idx,
>   uintptr_t retaddr)
>  {
> -#if !defined(CONFIG_USER_ONLY)
> -target_ulong page_addr;
> +/* FIXME: Probe the actual accesses (pass and use a size) */
>  if (unlikely(MSA_PAGESPAN(addr))) {
>  /* first page */
>  probe_write(env, addr, 0, mmu_idx, retaddr);
>  /* second page */
> -page_addr = (addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;
> -probe_write(env, page_addr, 0, mmu_idx, retaddr);
> +addr = (addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;
> +probe_write(env, addr, 0, mmu_idx, retaddr);
>  }
> -#endif
>  }
>
>  void helper_msa_st_b(CPUMIPSState *env, uint32_t wd,
> --
> 2.21.0
>
>


Re: [Qemu-devel] [PATCH v2 5/7] mips/tcg: Call probe_write() for CONFIG_USER_ONLY as well

2019-08-28 Thread Richard Henderson
Pinging the mips maintainers.

r~

On 8/26/19 12:51 AM, David Hildenbrand wrote:
> Let's call it also for CONFIG_USER_ONLY. While at it, add a FIXME and get
> rid of one local variable.
> 
> MIPS code probably needs a bigger refactoring in regards of
> ensure_writable_pages(), similar to s390x, so for example, watchpoints
> can be handled reliably later. The actually accessed addresses should
> be probed only, not full pages.
> 
> Signed-off-by: David Hildenbrand 
> ---
>  target/mips/op_helper.c | 8 +++-
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/target/mips/op_helper.c b/target/mips/op_helper.c
> index 34bcc8d884..08d9a4f9f1 100644
> --- a/target/mips/op_helper.c
> +++ b/target/mips/op_helper.c
> @@ -4537,16 +4537,14 @@ static inline void ensure_writable_pages(CPUMIPSState 
> *env,
>   int mmu_idx,
>   uintptr_t retaddr)
>  {
> -#if !defined(CONFIG_USER_ONLY)
> -target_ulong page_addr;
> +/* FIXME: Probe the actual accesses (pass and use a size) */
>  if (unlikely(MSA_PAGESPAN(addr))) {
>  /* first page */
>  probe_write(env, addr, 0, mmu_idx, retaddr);
>  /* second page */
> -page_addr = (addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;
> -probe_write(env, page_addr, 0, mmu_idx, retaddr);
> +addr = (addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;
> +probe_write(env, addr, 0, mmu_idx, retaddr);
>  }
> -#endif
>  }
>  
>  void helper_msa_st_b(CPUMIPSState *env, uint32_t wd,
> 




[Qemu-devel] [PATCH v2 5/7] mips/tcg: Call probe_write() for CONFIG_USER_ONLY as well

2019-08-26 Thread David Hildenbrand
Let's call it also for CONFIG_USER_ONLY. While at it, add a FIXME and get
rid of one local variable.

MIPS code probably needs a bigger refactoring in regards of
ensure_writable_pages(), similar to s390x, so for example, watchpoints
can be handled reliably later. The actually accessed addresses should
be probed only, not full pages.

Signed-off-by: David Hildenbrand 
---
 target/mips/op_helper.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/target/mips/op_helper.c b/target/mips/op_helper.c
index 34bcc8d884..08d9a4f9f1 100644
--- a/target/mips/op_helper.c
+++ b/target/mips/op_helper.c
@@ -4537,16 +4537,14 @@ static inline void ensure_writable_pages(CPUMIPSState 
*env,
  int mmu_idx,
  uintptr_t retaddr)
 {
-#if !defined(CONFIG_USER_ONLY)
-target_ulong page_addr;
+/* FIXME: Probe the actual accesses (pass and use a size) */
 if (unlikely(MSA_PAGESPAN(addr))) {
 /* first page */
 probe_write(env, addr, 0, mmu_idx, retaddr);
 /* second page */
-page_addr = (addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;
-probe_write(env, page_addr, 0, mmu_idx, retaddr);
+addr = (addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;
+probe_write(env, addr, 0, mmu_idx, retaddr);
 }
-#endif
 }
 
 void helper_msa_st_b(CPUMIPSState *env, uint32_t wd,
-- 
2.21.0