target_base_arm(), target_base_ppc() and target_base_riscv() report
whether the selected target belongs to a CPU family. Add the same
predicate for i386 and x86_64, and target_not_base_i386() as its negation.

Signed-off-by: Yonggang Luo <[email protected]>
---
 include/qemu/target-info.h | 14 ++++++++++++++
 target-info.c              | 16 ++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h
index 4bc25789d8d..48206d01ba9 100644
--- a/include/qemu/target-info.h
+++ b/include/qemu/target-info.h
@@ -57,6 +57,20 @@ bool target_heterogeneous(void);
  */
 bool target_base_arm(void);
 
+/**
+ * target_base_i386:
+ *
+ * Returns whether the target architecture is i386 or x86_64.
+ */
+bool target_base_i386(void);
+
+/**
+ * target_not_base_i386:
+ *
+ * Returns whether the target architecture is not i386 or x86_64.
+ */
+bool target_not_base_i386(void);
+
 /**
  * target_arm:
  *
diff --git a/target-info.c b/target-info.c
index d9e15c939d6..32ba85691b7 100644
--- a/target-info.c
+++ b/target-info.c
@@ -59,6 +59,22 @@ bool target_base_arm(void)
     }
 }
 
+bool target_base_i386(void)
+{
+    switch (target_arch()) {
+    case SYS_EMU_TARGET_I386:
+    case SYS_EMU_TARGET_X86_64:
+        return true;
+    default:
+        return false;
+    }
+}
+
+bool target_not_base_i386(void)
+{
+    return !target_base_i386();
+}
+
 bool target_arm(void)
 {
     return target_arch() == SYS_EMU_TARGET_ARM;
-- 
2.55.0.windows.3


Reply via email to