Make ram-compress.c target independent. Signed-off-by: Lukas Straub <lukasstra...@web.de> --- migration/meson.build | 2 +- migration/ram-compress.c | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/migration/meson.build b/migration/meson.build index 262e3c9754..16f642031c 100644 --- a/migration/meson.build +++ b/migration/meson.build @@ -22,6 +22,7 @@ softmmu_ss.add(files( 'migration.c', 'multifd.c', 'multifd-zlib.c', + 'ram-compress.c', 'postcopy-ram.c', 'savevm.c', 'socket.c', @@ -38,5 +39,4 @@ softmmu_ss.add(when: zstd, if_true: files('multifd-zstd.c')) specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files('dirtyrate.c', 'ram.c', - 'ram-compress.c', 'target.c')) diff --git a/migration/ram-compress.c b/migration/ram-compress.c index b75a9d2b9a..a75c6e0573 100644 --- a/migration/ram-compress.c +++ b/migration/ram-compress.c @@ -34,7 +34,8 @@ #include "qemu/error-report.h" #include "migration.h" #include "io/channel-null.h" -#include "exec/ram_addr.h" +#include "exec/target_page.h" +#include "exec/ramblock.h" CompressionStats compression_counters; @@ -155,7 +156,7 @@ int compress_threads_save_setup(void) qemu_cond_init(&comp_done_cond); qemu_mutex_init(&comp_done_lock); for (i = 0; i < thread_count; i++) { - comp_param[i].originbuf = g_try_malloc(TARGET_PAGE_SIZE); + comp_param[i].originbuf = g_try_malloc(qemu_target_page_size()); if (!comp_param[i].originbuf) { goto exit; } @@ -195,7 +196,7 @@ static CompressResult do_compress_ram_page(QEMUFile *f, z_stream *stream, assert(qemu_file_buffer_empty(f)); - if (buffer_is_zero(p, TARGET_PAGE_SIZE)) { + if (buffer_is_zero(p, qemu_target_page_size())) { return RES_ZEROPAGE; } @@ -204,8 +205,8 @@ static CompressResult do_compress_ram_page(QEMUFile *f, z_stream *stream, * so that we can catch up the error during compression and * decompression */ - memcpy(source_buf, p, TARGET_PAGE_SIZE); - ret = qemu_put_compression_data(f, stream, source_buf, TARGET_PAGE_SIZE); + memcpy(source_buf, p, qemu_target_page_size()); + ret = qemu_put_compression_data(f, stream, source_buf, qemu_target_page_size()); if (ret < 0) { qemu_file_set_error(migrate_get_current()->to_dst_file, ret); error_report("compressed data failed!"); @@ -335,7 +336,7 @@ static void *do_data_decompress(void *opaque) param->des = 0; qemu_mutex_unlock(¶m->mutex); - pagesize = TARGET_PAGE_SIZE; + pagesize = qemu_target_page_size(); ret = qemu_uncompress_data(¶m->stream, des, pagesize, param->compbuf, len); @@ -438,7 +439,8 @@ int compress_threads_load_setup(QEMUFile *f) goto exit; } - decomp_param[i].compbuf = g_malloc0(compressBound(TARGET_PAGE_SIZE)); + size_t compbuf_size = compressBound(qemu_target_page_size()); + decomp_param[i].compbuf = g_malloc0(compbuf_size); qemu_mutex_init(&decomp_param[i].mutex); qemu_cond_init(&decomp_param[i].cond); decomp_param[i].done = true; -- 2.30.2
pgpN3eHeZWiy2.pgp
Description: OpenPGP digital signature