qemu-devel
[Top][All Lists]
Advanced

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

[RFC v17 08/14] i386: split smm helper (softmmu)


From: Claudio Fontana
Subject: [RFC v17 08/14] i386: split smm helper (softmmu)
Date: Wed, 10 Feb 2021 16:28:53 +0100

smm is only really useful for softmmu, split in two modules
around the CONFIG_USER_ONLY, in order to remove the ifdef
and use the build system instead.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
---
 target/i386/tcg/{ => softmmu}/smm_helper.c | 18 ++-----------
 target/i386/tcg/user/smm_helper_user.c     | 31 ++++++++++++++++++++++
 target/i386/tcg/meson.build                |  1 -
 target/i386/tcg/softmmu/meson.build        |  1 +
 target/i386/tcg/user/meson.build           |  1 +
 5 files changed, 35 insertions(+), 17 deletions(-)
 rename target/i386/tcg/{ => softmmu}/smm_helper.c (98%)
 create mode 100644 target/i386/tcg/user/smm_helper_user.c

diff --git a/target/i386/tcg/smm_helper.c b/target/i386/tcg/softmmu/smm_helper.c
similarity index 98%
rename from target/i386/tcg/smm_helper.c
rename to target/i386/tcg/softmmu/smm_helper.c
index 62d027abd3..107de2b63d 100644
--- a/target/i386/tcg/smm_helper.c
+++ b/target/i386/tcg/softmmu/smm_helper.c
@@ -1,5 +1,5 @@
 /*
- *  x86 SMM helpers
+ *  x86 SMM helpers (softmmu-only)
  *
  *  Copyright (c) 2003 Fabrice Bellard
  *
@@ -22,23 +22,11 @@
 #include "cpu.h"
 #include "exec/helper-proto.h"
 #include "exec/log.h"
-#include "helper-tcg.h"
+#include "tcg/helper-tcg.h"
 
 
 /* SMM support */
 
-#if defined(CONFIG_USER_ONLY)
-
-void do_smm_enter(X86CPU *cpu)
-{
-}
-
-void helper_rsm(CPUX86State *env)
-{
-}
-
-#else
-
 #ifdef TARGET_X86_64
 #define SMM_REVISION_ID 0x00020064
 #else
@@ -330,5 +318,3 @@ void helper_rsm(CPUX86State *env)
     qemu_log_mask(CPU_LOG_INT, "SMM: after RSM\n");
     log_cpu_state_mask(CPU_LOG_INT, CPU(cpu), CPU_DUMP_CCOP);
 }
-
-#endif /* !CONFIG_USER_ONLY */
diff --git a/target/i386/tcg/user/smm_helper_user.c 
b/target/i386/tcg/user/smm_helper_user.c
new file mode 100644
index 0000000000..50a1100e5e
--- /dev/null
+++ b/target/i386/tcg/user/smm_helper_user.c
@@ -0,0 +1,31 @@
+/*
+ *  x86 SMM helpers, user mode
+ *
+ *  Copyright (c) 2003 Fabrice Bellard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu/osdep.h"
+#include "cpu.h"
+#include "exec/helper-proto.h"
+#include "tcg/helper-tcg.h"
+
+void do_smm_enter(X86CPU *cpu)
+{
+}
+
+void helper_rsm(CPUX86State *env)
+{
+}
diff --git a/target/i386/tcg/meson.build b/target/i386/tcg/meson.build
index 68fa0c3187..ec5daa1edc 100644
--- a/target/i386/tcg/meson.build
+++ b/target/i386/tcg/meson.build
@@ -8,7 +8,6 @@ i386_ss.add(when: 'CONFIG_TCG', if_true: files(
   'misc_helper.c',
   'mpx_helper.c',
   'seg_helper.c',
-  'smm_helper.c',
   'svm_helper.c',
   'tcg-cpu.c',
   'translate.c'), if_false: files('tcg-stub.c'))
diff --git a/target/i386/tcg/softmmu/meson.build 
b/target/i386/tcg/softmmu/meson.build
index 77453740ad..cc29893758 100644
--- a/target/i386/tcg/softmmu/meson.build
+++ b/target/i386/tcg/softmmu/meson.build
@@ -1,3 +1,4 @@
 i386_softmmu_ss.add(when: ['CONFIG_TCG', 'CONFIG_SOFTMMU'], if_true: files(
   'tcg-cpu-softmmu.c',
+  'smm_helper.c',
 ))
diff --git a/target/i386/tcg/user/meson.build b/target/i386/tcg/user/meson.build
index b479c7dcdf..976415e35f 100644
--- a/target/i386/tcg/user/meson.build
+++ b/target/i386/tcg/user/meson.build
@@ -1,3 +1,4 @@
 i386_user_ss.add(when: ['CONFIG_TCG', 'CONFIG_USER_ONLY'], if_true: files(
   'tcg-cpu-user.c',
+  'smm_helper_user.c',
 ))
-- 
2.26.2




reply via email to

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