I should've made sure to run the tool, sorry. Thanks for spotting and fixing
this issue.
Reviewed-by: Kohei Tokunaga
Hi all,
Kinldy ping on this patch series. I would appreciate any feedback or
comments.
Patchew URL:
https://patchew.org/QEMU/cover.1747922170.git.ktokunaga.m...@gmail.com/
Kohei
x27;-append', 'earlyprintk=ttyS0 console=ttyS0 root=/dev/vda loglevel=7',
];
The sample repository[1] provides a complete setup, including an HTML file
that implements a terminal UI.
[1] https://github.com/ktock/qemu-wasm-sample
# Additional references
- A talk at FOSDEM 202
ATOMIC_REG_SIZE value for the wasm build to ensure
assertions pass.
Signed-off-by: Kohei Tokunaga
---
accel/tcg/cputlb.c| 8
include/exec/tlb-common.h | 18 +-
include/qemu/atomic.h | 4
3 files changed, 21 insertions(+), 9 deletions(-)
diff --git a
This commit defines vaddr based on TCG_VADDR_BITS. For non-wasm hosts,
TCG_VADDR_BITS maches the pointer size, so this change preserves the
original behaviour.
Signed-off-by: Kohei Tokunaga
---
include/exec/helper-head.h.inc | 9 +
include/exec/vaddr.h | 28
o this change ensures
TCI retrieves the data using the correct type consistent with how it was
stored using the pool feature.
Signed-off-by: Kohei Tokunaga
---
tcg/tci.c | 6 --
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tcg/tci.c b/tcg/tci.c
index 700e672616..cee65bce
64bit guests.
Signed-off-by: Kohei Tokunaga
---
meson.build | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index ad2053f968..185ec96149 100644
--- a/meson.build
+++ b/meson.build
@@ -3229,6 +3229,9 @@ endif
# Detect host pointer size for the t
This commit defines TCG_TARGET_REG_BITS based on the value of
TCG_VADDR_BITS. For non-wasm hosts, TCG_VADDR_BITS matches the pointer size,
so this change preserves the original behaviour. For the wasm host, this
change enables support for 64bit guests.
Signed-off-by: Kohei Tokunaga
---
tcg/tci
Hi Paolo,
> On 5/20/25 14:51, Kohei Tokunaga wrote:
> > target_kconfig = []
> > foreach sym: accelerators
> > -# Disallow 64-bit on 32-bit emulation and virtualization
> > -if host_long_bits < config_target['TARGET_LONG_BITS'].to_int()
&
WebAssembly.
[1]
https://emscripten.org/docs/optimizing/Optimizing-Code.html#how-emscripten-optimizes
Signed-off-by: Kohei Tokunaga
---
meson.build | 4
1 file changed, 4 insertions(+)
diff --git a/meson.build b/meson.build
index f6ed867819..91e182092d 100644
--- a/meson.build
+++ b
.
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32.h| 10 ++
tcg/wasm32/tcg-target.c.inc | 17 +
2 files changed, 27 insertions(+)
diff --git a/tcg/wasm32.h b/tcg/wasm32.h
index 1944249891..ab23e26eca 100644
--- a/tcg/wasm32.h
+++ b/tcg/wasm32.h
@@ -22,6 +22,16
This commit enables to Wasm backend to run as a 64bit backend with removing
TCG_TARGET_REG_BITS = 32 macros.
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32.c | 5 ++-
tcg/wasm32/tcg-target-reg-bits.h | 8 +---
tcg/wasm32/tcg-target.c.inc | 69
n.org/docs/api_reference/fiber.h.html
[2] https://kripken.github.io/blog/wasm/2019/07/16/asyncify.html#new-asyncify
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32.c| 3 ++
tcg/wasm32.h| 11
tcg/wasm32/tcg-target.c.inc | 56 ++
This commit implements load and store operations using Wasm memory
instructions. Since Wasm's load/store instructions don't support negative
offset, address calculations are performed separately before the memory
access.
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32/tcg-target.c
This commit implements rem and div operations using Wasm's rem/div
instructions.
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32/tcg-target.c.inc | 120
1 file changed, 120 insertions(+)
diff --git a/tcg/wasm32/tcg-target.c.inc b/tcg/wasm32/tcg-target.
ps://github.com/WebAssembly/threads/blob/b2567bff61ee6fbe731934f0ed17a5d48dc9ab01/proposals/threads/Overview.md
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32.h| 26 +++
tcg/wasm32/tcg-target.c.inc | 390
2 files changed, 416 insertions(+)
diff --git a/tcg/wasm32.h b/tcg/wasm32.h
i
This commit implements setcond and movcond operations using Wasm's if/else
instructions. Support for TCG_COND_TSTEQ and TCG_COND_TSTNE is not yet
implemented, so TCG_TARGET_HAS_tst is set to 0.
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32/tcg-target-has.h | 2 +-
tcg/wasm32/tcg-target.
two code buffers must be merged into the final code
buffer before tcg_gen_code returns.
[1] https://webassembly.github.io/spec/core/binary/index.html
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32/tcg-target.c.inc | 137 +++-
1 file changed, 136 insertions(+), 1
tly via
pointer parameters and returned via a prepended pointer argument, as
described in [1].
[1]
https://github.com/WebAssembly/tool-conventions/blob/060cf4073e46931160c2e9ecd43177ee1fe93866/BasicCABI.md#function-arguments-and-return-values
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32.h
This commit implements the bswap operation using Wasm instructions.
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32/tcg-target.c.inc | 136
1 file changed, 136 insertions(+)
diff --git a/tcg/wasm32/tcg-target.c.inc b/tcg/wasm32/tcg-target.c.inc
index
x27;s
removeFunction function. Once the removal of the instance is detected via
FinalizationRegistry API[1], instances_global is decremented, which allows
instantiation of new modules again.
[1]
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
This commit implements neg, not and ctpop operations using Wasm
instructions.
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32/tcg-target.c.inc | 39 +++--
1 file changed, 37 insertions(+), 2 deletions(-)
diff --git a/tcg/wasm32/tcg-target.c.inc b/tcg/wasm32/tcg
WebAssembly instructions vary in size, including single-byte
instructions. This commit sets TCG_TARGET_INSN_UNIT_SIZE to 1 and updates
the TCI fork to use "tcg_insn_unit_tci" (a uint32_t) for 4-byte operations.
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32/tcg-target.
Now that there is a backend for WebAssembly build (/tcg/wasm32/), the
requirement of --enable-tcg-interpreter in meson.build can be removed.
Signed-off-by: Kohei Tokunaga
---
meson.build | 4
1 file changed, 4 deletions(-)
diff --git a/meson.build b/meson.build
index ad2053f968
Interacting-with-code.html#calling-javascript-functions-as-function-pointers-from-c
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=1965217
[3] https://github.com/ktock/qemu-wasm/pull/25
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32.c | 24
1 file changed, 24 insertions(+)
d
) when compiling with
Emscripten. While this serves as a temporary workaround, a long-term
solution could involve adopting Wasm's 64-bit memory model once it gains
broader support, as it is currently not widely adopted (e.g. unsupported by
Safari and libffi).
Signed-off-by: Kohei Tokunaga
---
Add, sub and mul operations are implemented using the corresponding
instructions in Wasm.
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32/tcg-target.c.inc | 18 ++
1 file changed, 18 insertions(+)
diff --git a/tcg/wasm32/tcg-target.c.inc b/tcg/wasm32/tcg-target.c.inc
index
Check if wasm backend can be built in CI.
Signed-off-by: Kohei Tokunaga
---
.gitlab-ci.d/buildtest.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
index 248aaed137..fc42de231a 100644
--- a/.gitlab-ci.d/buildtest.yml
s the current TB itself, there is no need to
return control to the caller. Instead, execution can jump directly to
the top of the loop within the TB.
The exit_tb operation sets the pointer in wasmContext to 0, indicating that
there is no destination TB.
Signed-off-by: Kohei Tokunaga
---
MAINTA
ded as
LEB128) is emitted instead. These placeholders are tracked in
BlockPlaceholder and resolved later.
Signed-off-by: Kohei Tokunaga
---
tcg/aarch64/tcg-target.c.inc | 11 ++
tcg/arm/tcg-target.c.inc | 11 ++
tcg/i386/tcg-target.c.inc| 11 ++
tcg/loongarch64/tcg-target.c
This commit adds qemu_ld and qemu_st by calling the helper functions
corresponding to MemOp.
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32/tcg-target.c.inc | 108
1 file changed, 108 insertions(+)
diff --git a/tcg/wasm32/tcg-target.c.inc b/tcg/wasm32/tcg
This commit implements rot, clz and ctz operations using Wasm instructions.
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32/tcg-target.c.inc | 155
1 file changed, 155 insertions(+)
diff --git a/tcg/wasm32/tcg-target.c.inc b/tcg/wasm32/tcg-target.c.inc
index
, this commit introduces an encoder function implemented
following [1].
[1] https://en.wikipedia.org/wiki/LEB128
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32/tcg-target.c.inc | 107
1 file changed, 107 insertions(+)
diff --git a/tcg/wasm32/tcg-target.c.inc b/tcg
These operations have no direct equivalents in Wasm, so they are left
unimplemented and delegated to helper functions.
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32/tcg-target.c.inc | 38 ++---
1 file changed, 2 insertions(+), 36 deletions(-)
diff --git a/tcg
followed by a if branch: if the lookup succeeds, the memory is accessed
directly; otherwise, a fallback helper function is invoked. Support for
MO_BSWAP is not yet implemented, so has_memory_bswap is set to false.
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32/tcg-target.c.inc | 223
This commit implements mov/movi instructions. The tcg_out_mov[i] functions
are used by several other functions and are intended to emit TCI code. So
they have been renamed to tcg_tci_out_mov[i].
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32/tcg-target.c.inc | 85
This commit implements addc and subb operations using Wasm instructions. A
carry flag is introduced as the 16th variable in the module following other
15 variables that represent TCG variables.
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32/tcg-target.c.inc | 151
This implements deposit, sextract and extract operations. The
tcg_out_[s]extract functions are used by several other functions
(e.g. tcg_out_ext*) and are intended to emit TCI code. So they have been
renamed to tcg_tci_out_[s]extract.
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32/tcg
Wasm backend is implemented based on the TCI backend and utilizes a forked
TCI to execute TBs.
Signed-off-by: Kohei Tokunaga
---
MAINTAINERS |6 +
include/accel/tcg/getpc.h|2 +-
include/tcg/helper-info.h|4 +-
include/tcg/tcg.h
This commit implements the ext operations using Wasm's extend instructions.
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32/tcg-target.c.inc | 79 -
1 file changed, 78 insertions(+), 1 deletion(-)
diff --git a/tcg/wasm32/tcg-target.c.inc b/tcg/wasm3
This commit implements andc, orc, eqv, nand and nor operations using Wasm
instructions.
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32/tcg-target.c.inc | 55 +
1 file changed, 55 insertions(+)
diff --git a/tcg/wasm32/tcg-target.c.inc b/tcg/wasm32/tcg
Wasm backend should implement its own disassember for Wasm
instructions.
Signed-off-by: Kohei Tokunaga
---
tcg/wasm32.c | 243 +--
1 file changed, 1 insertion(+), 242 deletions(-)
diff --git a/tcg/wasm32.c b/tcg/wasm32.c
index 6de9b26b76
at implements a terminal UI.
[1] https://github.com/ktock/qemu-wasm-sample
# Additional references
- A talk at FOSDEM 2025:
https://fosdem.org/2025/schedule/event/fosdem-2025-6290-running-qemu-inside-browser/
- Demo page on GitHub Pages: https://ktock.github.io/qemu-wasm-demo/
Kohei Tokunaga
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
Reviewed-by: Thomas Huth
---
include/glib-compat.h | 7 +++
1 file changed, 7 insertions(+)
V3:
- Fixed the multiline comment to ensure it starts with "/*&
uring compilation.
To fix this error, this commit updates the stub implementation in
file-posix.c to exactly match the declaration in Emscripten's headers. The
manpage also aligns with this signature.
Signed-off-by: Kohei Tokunaga
Reviewed-by: Philippe Mathieu-Daudé
Reviewed-by: Stefa
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
Reviewed-by: Thomas Huth
---
target/s390x/cpu_models.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/s390x/cpu_models.c b/target/s390x
The added Dockerfile is based on the emsdk image, which includes the
Emscripten toolchain. It also cross-compiles the necessary dependencies
(glib, libffi, pixman, and zlib) for the Emscripten target environment.
Signed-off-by: Kohei Tokunaga
---
MAINTAINERS
Emscripten does not support couroutine methods currently used by QEMU but
provides a coroutine implementation called "fiber". This commit introduces a
coroutine backend using fiber. Note that fiber does not support submitting
coroutines to other threads.
Signed-off-by: Kohei Tokunaga
Add GitLab CI job that builds QEMU using emscripten. The build runs in the
container defined in tests/docker/dockerfiles/emsdk-wasm32-cross.docker.
Signed-off-by: Kohei Tokunaga
---
.gitlab-ci.d/buildtest-template.yml | 27 +++
.gitlab-ci.d/buildtest.yml | 9
has_int128_type is set to false on emscripten as of now to avoid errors by
libffi. Tests are disabled on emscripten because they rely on host
features that aren't supported by emscripten (e.g. fork and unix
socket).
Signed-off-by: Kohei Tokunaga
---
MAINTAINERS | 1 +
co
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
Reviewed-by: Philippe Mathieu-Daudé
---
system/vl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
V3:
- This commit is included in this series sololy to
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
Reviewed-by: Philippe Mathieu-Daudé
---
hw/core/loader.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
V3:
- This commit is included in this series sololy
On emscripten, some implementations in os-posix.c can't be used such as
daemonizing and changing user. This commit introduces os-wasm.c and
os-wasm.h which are forked from os-posix.c and os-posix.h and patched for
targetting Emscripten.
Signed-off-by: Kohei Tokunaga
---
MAINTA
/lib/libc/emscripten_mmap.c#L61
Signed-off-by: Kohei Tokunaga
---
backends/meson.build | 6 --
system/memory.c | 2 +-
system/physmem.c | 9 +
util/meson.build | 4 +++-
util/oslib-posix.c | 28
5 files changed, 41 insertions(+), 8
Daemonizing and run-with aren't supported on Emscripten so disable these
flags.
Signed-off-by: Kohei Tokunaga
Reviewed-by: Philippe Mathieu-Daudé
---
qemu-options.hx | 4 ++--
system/vl.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/qemu-options.hx b
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
---
target/arm/helper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
V3:
- Fixed the argument type of cpreg_key_compare to use gpointer instead of
void
Including is still required on Emscripten, just like on other
platforms, to make the ioctl function available.
Signed-off-by: Kohei Tokunaga
Reviewed-by: Philippe Mathieu-Daudé
Reviewed-by: Stefan Hajnoczi
---
block/file-posix.c | 4
1 file changed, 4 insertions(+)
diff --git a/block
ror: error in backend: llvm.clear_cache is not supported on wasm
To resolve this, this commit removes the call to __builtin___clear_cache for
Emscripten build.
Signed-off-by: Kohei Tokunaga
Reviewed-by: Philippe Mathieu-Daudé
---
include/qemu/cacheflush.h | 7 +++
util/cacheflush.c
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
---
target/i386/cpu.c | 11 ---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 1f970aa4da..fedc47ea84
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
Reviewed-by: Philippe Mathieu-Daudé
---
qom/object.c | 7 ---
1 file changed, 4 insertions(+), 3 deletions(-)
V3:
- This commit is included in this series sololy to
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
---
target/ppc/cpu_init.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index fde7d71fc6
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
Reviewed-by: Philippe Mathieu-Daudé
Acked-by: Francisco Iglesias
---
hw/net/can/xlnx-versal-canfd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
V3
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
Reviewed-by: Philippe Mathieu-Daudé
---
contrib/plugins/cache.c | 12 ++--
contrib/plugins/cflow.c | 10 +-
contrib/plugins/hotblocks.c | 4
l.img',
'-append', 'console=ttyAMA0 root=/dev/vda loglevel=7',
];
The sample repository[1] provides a complete setup, including an HTML file
that implements a terminal UI.
[1] https://github.com/ktock/qemu-wasm-sample/tree/tcidev
# Additional references
- Original
Hi Thomas,
> Cosmetic nit: Multiline comments in QEMU should start with "/*" on their
own
> line.
Thank you for the feedback. I'll fix this in the next version of the series.
Hi Philippe,
> Why not use a gpointer for @d like in other patches?
Thank you for the feedback. I'll fix this to use a gpointer in the next
version of the series.
Hi Philippe,
>On 22/4/25 07:27, Kohei Tokunaga wrote:
>> Although __builtin___clear_cache is used to flush the instruction cache
for
>> a specified memory region[1], this operation doesn't apply to wasm, as
its
>> memory isn't executable. Moreover, Emscripten does
Including is still required on Emscripten, just like on other
platforms, to make the ioctl function available.
Signed-off-by: Kohei Tokunaga
---
block/file-posix.c | 4
1 file changed, 4 insertions(+)
V2:
- Split this from the previous 12th patch into a separate commit and revised
the
/lib/libc/emscripten_mmap.c#L61
Signed-off-by: Kohei Tokunaga
---
backends/meson.build | 6 --
system/memory.c | 2 +-
system/physmem.c | 9 +
util/meson.build | 4 +++-
util/oslib-posix.c | 28
5 files changed, 41 insertions(+), 8
On emscripten, some implementations in os-posix.c can't be used such as
daemonizing and changing user. This commit introduces os-wasm.c and
os-wasm.h which are forked from os-posix.c and os-posix.h and patched for
targetting Emscripten.
Signed-off-by: Kohei Tokunaga
---
MAINTA
Emscripten does not support couroutine methods currently used by QEMU but
provides a coroutine implementation called "fiber". This commit introduces a
coroutine backend using fiber. Note that fiber does not support submitting
coroutines to other threads.
Signed-off-by: Kohe
The added Dockerfile is based on the emsdk image, which includes the
Emscripten toolchain. It also cross-compiles the necessary dependencies
(glib, libffi, pixman, and zlib) for the Emscripten target environment.
Signed-off-by: Kohei Tokunaga
---
MAINTAINERS
has_int128_type is set to false on emscripten as of now to avoid errors by
libffi. Tests are disabled on emscripten because they rely on host
features that aren't supported by emscripten (e.g. fork and unix
socket).
Signed-off-by: Kohei Tokunaga
---
MAINTAINERS | 1 +
co
Daemonizing and run-with aren't supported on Emscripten so disable these
flags.
Signed-off-by: Kohei Tokunaga
---
qemu-options.hx | 4 ++--
system/vl.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
V2:
- Unified two consecutive #ifndef macros into a single condition in
Add GitLab CI job that builds QEMU using emscripten. The build runs in the
container defined in tests/docker/dockerfiles/emsdk-wasm32-cross.docker.
Signed-off-by: Kohei Tokunaga
---
.gitlab-ci.d/buildtest-template.yml | 27 +++
.gitlab-ci.d/buildtest.yml | 9
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
---
contrib/plugins/cache.c | 12 ++--
contrib/plugins/cflow.c | 10 +-
contrib/plugins/hotblocks.c | 4 ++--
contrib/plugins/hotpages.c | 4
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
---
hw/net/can/xlnx-versal-canfd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
V2:
- Updated the commit message to explicitly explain that function pointer
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
---
hw/core/loader.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
V2:
- Updated the commit message to explicitly explain that function pointer
casts are
uring compilation.
To fix this error, this commit updates the stub implementation in
file-posix.c to exactly match the declaration in Emscripten's headers. The
manpage also aligns with this signature.
Signed-off-by: Kohei Tokunaga
---
block/file-posix.c | 4 ++--
1 file changed, 2 insert
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
---
include/glib-compat.h | 6 ++
1 file changed, 6 insertions(+)
V2:
- Fixed typo in the comment: s/insted/instead/
- Updated the commit message to explicitly
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
---
system/vl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
V2:
- Updated the commit message to explicitly explain that function pointer
casts are
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
---
target/s390x/cpu_models.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
V2:
- Updated the commit message to explicitly explain that function pointer
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
---
target/i386/cpu.c | 11 ---
1 file changed, 8 insertions(+), 3 deletions(-)
V2:
- Updated the commit message to explicitly explain that function pointer
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
---
target/arm/helper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
V2:
- Updated the commit message to explicitly explain that function pointer
casts
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
---
target/ppc/cpu_init.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
V2:
- Updated the commit message to explicitly explain that function pointer
casts
error: error in backend: llvm.clear_cache is not supported on wasm
To resolve this, this commit removes the call to __builtin___clear_cache for
Emscripten build.
[1]
https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005f_005f_005fclear_005fcache
Signed-
v
# Additional references
- Original patch series "Enable QEMU to run on browsers":
https://patchew.org/QEMU/cover.1744032780.git.ktokunaga.m...@gmail.com/
- A talk at FOSDEM 2025:
https://fosdem.org/2025/schedule/event/fosdem-2025-6290-running-qemu-inside-browser/
Kohei Tokunaga (2
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga
---
qom/object.c | 7 ---
1 file changed, 4 insertions(+), 3 deletions(-)
V2:
- Updated the commit message to explicitly explain that function pointer
casts are
Hi Philippe,
While working on mmap-alloc.c, I found that Emscripten does not support
partial unmapping of memory regions [1]. This limitation prevents correct
implementation of qemu_ram_mmap and qemu_ram_munmap, which rely on partial
unmap behavior.
[1]
https://github.com/emscripten-core/emscript
Hi Daniel and Philippe,
>>> On emscripten, function pointer casts can cause function call failure.
>>> This commit fixes the function definition to match to the type of the
>>> function call using g_list_sort_with_data.
>>>
>>> Signed-off-by: Kohei
Hi Daniel, Paolo and Thomas,
> > > I suggested this solution to Kohei because it's easy to check that
we're
> > > converting all users and not introducing new ones in the future (see
> > > poisoning in patch 10).
> >
> > It is easy to check this /one/ example, but this pattern of bad casts
> > is
Hi Philippe,
> You shouldn't have to modify this file, likely a rebase typo.
Thank you for pointing this out. I'll fix this in the next version of the
series.
Hi Philippe,
> If meson fails to link, it won't define HAVE_COPY_FILE_RANGE,
Yes, meson correctly detects the link failure when checking for
copy_file_range, as shown in meson-log.txt:
> wasm-ld: error: /tmp/emscripten_temp_oqvz296m/testfile_0.o: undefined
symbol: copy_file_range
and reflects t
Hi Philippe,
> I'd include in this patch this hunk from patch 17:
>
> -- >8 --
> diff --git a/stubs/meson.build b/stubs/meson.build
> index 63392f5e78..4fd4d362f9 100644
> --- a/stubs/meson.build
> +++ b/stubs/meson.build
> @@ -89,3 +89,7 @@ if have_system or have_user
> stub_ss.add(files('hot
Hi Philippe,
> Just "WebAssembly target"? (I'd add the future
> tcg/wasm/ files in another MAINTAINERS section).
>
> Maybe better to squash with patch 17? Or start adding
> the section when you add a new file, then update for
> each new file added?
Sure, I'll update the patch to follow this appro
Hi Philippe,
> Probably nitpicking, I'd add the Dockerfile first, then the GitLab job
> in another patch.
Thank you for the suggestion. I'll split the patch in the next version.
Hi Philippe,
> Does wasm depend on TCI at this point (no TCG backend)? If so, should
> we check TCI is enabled? (I wonder if configuring with the
> --disable-tcg-interpreter option succeed).
Yes, it depends on TCI at this point. Configuring with the
--disable-tcg-interpreter succeeds but leads to
Hi Philippe,
> Can we keep this code generic? I.e. with something in the lines
> of (only build-tested):
Thank you for the suggestion. I'll try this approach.
Hi Philippe,
> > #ifndef _WIN32
> > +#ifndef EMSCRIPTEN
>
> #if !defined(_WIN32) && !defined(EMSCRIPTEN)
>
> ?
Thank you for the sueggestion. I'll apply this in the next version of the
series.
Hi Philippe and Richard, thank you for the feedback.
> Actually what about checking the symbol presence in meson?
> Something like (untested):
>
> -- >8 --
> diff --git a/meson.build b/meson.build
> index b18c46d16a2..33185fdf315 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -2654,3 +2654,2
1 - 100 of 149 matches
Mail list logo