From c5d99777f47042d8768900ace22eafae0d90a7e7 Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 24 Aug 2015 17:02:14 +0200 Subject: [PATCH] Use const in uc_mem_write and derivates --- include/uc_priv.h | 2 +- include/unicorn/unicorn.h | 2 +- qemu/unicorn_common.h | 2 +- regress/Makefile | 2 +- uc.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/uc_priv.h b/include/uc_priv.h index efff0e7e..c9e19f95 100644 --- a/include/uc_priv.h +++ b/include/uc_priv.h @@ -28,7 +28,7 @@ typedef int (*reg_access_t)(uch handle, unsigned int regid, void *value); typedef void (*reg_reset_t)(uch handle); -typedef bool (*uc_write_mem_t)(AddressSpace *as, hwaddr addr, uint8_t *buf, int len); +typedef bool (*uc_write_mem_t)(AddressSpace *as, hwaddr addr, const uint8_t *buf, int len); typedef bool (*uc_read_mem_t)(AddressSpace *as, hwaddr addr, uint8_t *buf, int len); diff --git a/include/unicorn/unicorn.h b/include/unicorn/unicorn.h index 0063ba5a..d5bb350a 100644 --- a/include/unicorn/unicorn.h +++ b/include/unicorn/unicorn.h @@ -303,7 +303,7 @@ uc_err uc_reg_read(uch handle, int regid, void *value); for detailed error). */ UNICORN_EXPORT -uc_err uc_mem_write(uch handle, uint64_t address, uint8_t *bytes, size_t size); +uc_err uc_mem_write(uch handle, uint64_t address, const uint8_t *bytes, size_t size); /* Read a range of bytes in memory. diff --git a/qemu/unicorn_common.h b/qemu/unicorn_common.h index 2a6a0668..93f1c5f4 100644 --- a/qemu/unicorn_common.h +++ b/qemu/unicorn_common.h @@ -14,7 +14,7 @@ static inline bool cpu_physical_mem_read(AddressSpace *as, hwaddr addr, } static inline bool cpu_physical_mem_write(AddressSpace *as, hwaddr addr, - uint8_t *buf, int len) + const uint8_t *buf, int len) { return !cpu_physical_memory_rw(as, addr, (void *)buf, len, 1); } diff --git a/regress/Makefile b/regress/Makefile index 4fcfac82..8f8d2556 100644 --- a/regress/Makefile +++ b/regress/Makefile @@ -1,7 +1,7 @@ CFLAGS += -I../include LDFLAGS = -L.. -lunicorn -TESTS = map_crash +TESTS = map_crash sigill all: $(TESTS) diff --git a/uc.c b/uc.c index ec337d36..cef74de1 100644 --- a/uc.c +++ b/uc.c @@ -356,7 +356,7 @@ uc_err uc_mem_read(uch handle, uint64_t address, uint8_t *bytes, size_t size) UNICORN_EXPORT -uc_err uc_mem_write(uch handle, uint64_t address, uint8_t *bytes, size_t size) +uc_err uc_mem_write(uch handle, uint64_t address, const uint8_t *bytes, size_t size) { struct uc_struct *uc = (struct uc_struct *)(uintptr_t)handle;