blob: cffc41b443a20cc68e26a6ab1cae158c25de4d4e [file] [log] [blame]
Lorenz Brun0de18932021-03-11 00:36:48 +01001Copyright 2020 The Monogon Project Authors.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14
15
Serge Bazanskifa997992021-03-23 17:29:42 +010016From 402ac3cc59ef115c41eee0f1dca3b1c4b30d6baa Mon Sep 17 00:00:00 2001
Lorenz Brun0de18932021-03-11 00:36:48 +010017From: Lorenz Brun <lorenz@brun.one>
18Date: Wed, 10 Mar 2021 17:55:55 +0100
Serge Bazanskifa997992021-03-23 17:29:42 +010019Subject: [PATCH] Fix QEMU code issues
20Company: nexantic GmbH
Lorenz Brun0de18932021-03-11 00:36:48 +010021
22---
Serge Bazanskifa997992021-03-23 17:29:42 +010023 qom/object.c | 2 +-
24 softmmu/physmem.c | 15 ++++++++++++++-
25 2 files changed, 15 insertions(+), 2 deletions(-)
Lorenz Brun0de18932021-03-11 00:36:48 +010026
27diff --git a/qom/object.c b/qom/object.c
28index 1065355233..f3aa56cc52 100644
29--- a/qom/object.c
30+++ b/qom/object.c
31@@ -692,7 +692,7 @@ static void object_finalize(void *data)
32
33 /* Find the minimum alignment guaranteed by the system malloc. */
34 #if __STDC_VERSION__ >= 201112L
35-typddef max_align_t qemu_max_align_t;
36+typedef max_align_t qemu_max_align_t;
37 #else
38 typedef union {
39 long l;
40diff --git a/softmmu/physmem.c b/softmmu/physmem.c
Serge Bazanskifa997992021-03-23 17:29:42 +010041index 3027747c03..f5bbdd7e2d 100644
Lorenz Brun0de18932021-03-11 00:36:48 +010042--- a/softmmu/physmem.c
43+++ b/softmmu/physmem.c
Serge Bazanskifa997992021-03-23 17:29:42 +010044@@ -2675,7 +2675,20 @@ static void invalidate_and_set_dirty(MemoryRegion *mr, hwaddr addr,
Lorenz Brun0de18932021-03-11 00:36:48 +010045 }
46 if (dirty_log_mask & (1 << DIRTY_MEMORY_CODE)) {
47 assert(tcg_enabled());
48- tb_invalidate_phys_range(addr, addr + length);
Serge Bazanskifa997992021-03-23 17:29:42 +010049+ // Metropolis does not link against TCG (Tiny Code Generator, qemu's
50+ // software recompilation backend), where tb_invalidate_phys_range is
51+ // implemented. Because we do not enable TCG at all, this branch should
52+ // never be taken, and even if it is taken, the assert above should
53+ // file aborting execution.
54+ // Ideally, all compilers would use the above data to elide the call to
55+ // tb_invalidate_phys_range and everything would be fine, but that's
56+ // unfortunately not the case, at least within Metropolis' build. Thus,
57+ // in order to prevent the compiler from spuriously linking against a
58+ // symbol that we do not compile, we comment the call out, and add
59+ // another assert that will always fire, to truly make sure that this
60+ // branch never gets taken in practice.
61+ assert(0);
Lorenz Brun0de18932021-03-11 00:36:48 +010062+ // tb_invalidate_phys_range(addr, addr + length);
63 dirty_log_mask &= ~(1 << DIRTY_MEMORY_CODE);
64 }
65 cpu_physical_memory_set_dirty_range(addr, length, dirty_log_mask);
66--
Serge Bazanskifa997992021-03-23 17:29:42 +0100672.26.3
Lorenz Brun0de18932021-03-11 00:36:48 +010068