qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Roman Kiryanov <rkir@google.com>
To: qemu-devel@nongnu.org
Cc: jansene@google.com, Roman Kiryanov <rkir@google.com>
Subject: [PATCH] Make TARGET_PAGE_MASK typed as target_ulong
Date: Fri, 14 Jun 2024 12:29:38 -0700	[thread overview]
Message-ID: <20240614192938.1690188-1-rkir@google.com> (raw)

this fixes the build warnings like

accel/tcg/cputlb.c:416:13: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
    mask &= TARGET_PAGE_MASK | TLB_INVALID_MASK;
            ^~~~~~~~~~~~~~~~
include/exec/cpu-all.h:169:45: note: expanded from macro 'TARGET_PAGE_MASK'
                            ~~~~~~~~~~~~~~~ ^

also this fixes the inconsitency in the return
type of qemu_target_page_mask (int could be
shorter than target_long).

Signed-off-by: Roman Kiryanov <rkir@google.com>
---
 include/exec/cpu-all.h     | 4 ++--
 include/exec/target_page.h | 2 +-
 page-target.c              | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 6f09b86e7f..238a847eca 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -152,8 +152,8 @@ extern const TargetPageBits target_page;
 # define TARGET_PAGE_SIZE    (-(int)TARGET_PAGE_MASK)
 #else
 # define TARGET_PAGE_BITS_MIN TARGET_PAGE_BITS
-# define TARGET_PAGE_SIZE    (1 << TARGET_PAGE_BITS)
-# define TARGET_PAGE_MASK    ((target_long)-1 << TARGET_PAGE_BITS)
+# define TARGET_PAGE_SIZE    ((target_ulong)1 << TARGET_PAGE_BITS)
+# define TARGET_PAGE_MASK    ((target_ulong)-1 << TARGET_PAGE_BITS)
 #endif
 
 #define TARGET_PAGE_ALIGN(addr) ROUND_UP((addr), TARGET_PAGE_SIZE)
diff --git a/include/exec/target_page.h b/include/exec/target_page.h
index 98ffbb5c23..57d60f2b06 100644
--- a/include/exec/target_page.h
+++ b/include/exec/target_page.h
@@ -15,7 +15,7 @@
 #define EXEC_TARGET_PAGE_H
 
 size_t qemu_target_page_size(void);
-int qemu_target_page_mask(void);
+target_ulong qemu_target_page_mask(void);
 int qemu_target_page_bits(void);
 int qemu_target_page_bits_min(void);
 
diff --git a/page-target.c b/page-target.c
index 82211c8593..7176c29555 100644
--- a/page-target.c
+++ b/page-target.c
@@ -17,7 +17,7 @@ size_t qemu_target_page_size(void)
     return TARGET_PAGE_SIZE;
 }
 
-int qemu_target_page_mask(void)
+target_ulong qemu_target_page_mask(void)
 {
     return TARGET_PAGE_MASK;
 }
-- 
2.45.2.627.g7a2c4fd464-goog



             reply	other threads:[~2024-06-14 19:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14 19:29 Roman Kiryanov [this message]
2024-06-15 23:59 ` [PATCH] Make TARGET_PAGE_MASK typed as target_ulong Richard Henderson
2024-06-16 17:40   ` Roman Kiryanov
2024-06-16 18:10     ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240614192938.1690188-1-rkir@google.com \
    --to=rkir@google.com \
    --cc=jansene@google.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).