diff options
-rw-r--r-- | HACKING | 7 | ||||
-rw-r--r-- | exec.c | 14 | ||||
-rw-r--r-- | hw/acpi/core.c | 7 | ||||
-rw-r--r-- | hw/arm/spitz.c | 100 | ||||
-rw-r--r-- | include/qemu-common.h | 12 | ||||
-rw-r--r-- | include/qemu/osdep.h | 3 | ||||
-rw-r--r-- | include/qom/object.h | 4 | ||||
-rw-r--r-- | include/sysemu/kvm.h | 4 | ||||
-rw-r--r-- | kvm-all.c | 6 | ||||
-rw-r--r-- | qemu-char.c | 10 | ||||
-rw-r--r-- | qom/object.c | 40 | ||||
-rw-r--r-- | readline.c | 15 | ||||
-rw-r--r-- | target-s390x/kvm.c | 2 | ||||
-rw-r--r-- | trace-events | 3 | ||||
-rw-r--r-- | ui/gtk.c | 1 | ||||
-rw-r--r-- | util/oslib-posix.c | 12 | ||||
-rw-r--r-- | util/oslib-win32.c | 12 |
17 files changed, 164 insertions, 88 deletions
@@ -78,16 +78,15 @@ avoided. Use of the malloc/free/realloc/calloc/valloc/memalign/posix_memalign APIs is not allowed in the QEMU codebase. Instead of these routines, use the GLib memory allocation routines g_malloc/g_malloc0/g_new/ -g_new0/g_realloc/g_free or QEMU's qemu_vmalloc/qemu_memalign/qemu_vfree +g_new0/g_realloc/g_free or QEMU's qemu_memalign/qemu_blockalign/qemu_vfree APIs. Please note that g_malloc will exit on allocation failure, so there is no need to test for failure (as you would have to with malloc). Calling g_malloc with a zero size is valid and will return NULL. -Memory allocated by qemu_vmalloc or qemu_memalign must be freed with -qemu_vfree, since breaking this will cause problems on Win32 and user -emulators. +Memory allocated by qemu_memalign or qemu_blockalign must be freed with +qemu_vfree, since breaking this will cause problems on Win32. 4. String manipulation @@ -1062,7 +1062,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, #if defined (__linux__) && !defined(TARGET_S390X) new_block->host = file_ram_alloc(new_block, size, mem_path); if (!new_block->host) { - new_block->host = qemu_vmalloc(size); + new_block->host = qemu_anon_ram_alloc(size); memory_try_enable_merging(new_block->host, size); } #else @@ -1074,9 +1074,9 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, xen_ram_alloc(new_block->offset, size, mr); } else if (kvm_enabled()) { /* some s390/kvm configurations have special constraints */ - new_block->host = kvm_vmalloc(size); + new_block->host = kvm_ram_alloc(size); } else { - new_block->host = qemu_vmalloc(size); + new_block->host = qemu_anon_ram_alloc(size); } memory_try_enable_merging(new_block->host, size); } @@ -1156,21 +1156,17 @@ void qemu_ram_free(ram_addr_t addr) munmap(block->host, block->length); close(block->fd); } else { - qemu_vfree(block->host); + qemu_anon_ram_free(block->host, block->length); } #else abort(); #endif } else { -#if defined(TARGET_S390X) && defined(CONFIG_KVM) - munmap(block->host, block->length); -#else if (xen_enabled()) { xen_invalidate_map_cache_entry(block->host); } else { - qemu_vfree(block->host); + qemu_anon_ram_free(block->host, block->length); } -#endif } g_free(block); break; diff --git a/hw/acpi/core.c b/hw/acpi/core.c index 64b8718..42eeace 100644 --- a/hw/acpi/core.c +++ b/hw/acpi/core.c @@ -462,8 +462,15 @@ static uint64_t acpi_pm_tmr_read(void *opaque, hwaddr addr, unsigned width) return acpi_pm_tmr_get(opaque); } +static void acpi_pm_tmr_write(void *opaque, hwaddr addr, uint64_t val, + unsigned width) +{ + /* nothing */ +} + static const MemoryRegionOps acpi_pm_tmr_ops = { .read = acpi_pm_tmr_read, + .write = acpi_pm_tmr_write, .valid.min_access_size = 4, .valid.max_access_size = 4, .endianness = DEVICE_LITTLE_ENDIAN, diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c index c42668a..b5ed109 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -277,9 +277,9 @@ static void spitz_keyboard_keydown(SpitzKeyboardState *s, int keycode) spitz_keyboard_sense_update(s); } -#define SHIFT (1 << 7) -#define CTRL (1 << 8) -#define FN (1 << 9) +#define MOD_SHIFT (1 << 7) +#define MOD_CTRL (1 << 8) +#define MOD_FN (1 << 9) #define QUEUE_KEY(c) s->fifo[(s->fifopos + s->fifolen ++) & 0xf] = c @@ -316,20 +316,20 @@ static void spitz_keyboard_handler(void *opaque, int keycode) } code = s->pre_map[mapcode = ((s->modifiers & 3) ? - (keycode | SHIFT) : - (keycode & ~SHIFT))]; + (keycode | MOD_SHIFT) : + (keycode & ~MOD_SHIFT))]; if (code != mapcode) { #if 0 - if ((code & SHIFT) && !(s->modifiers & 1)) + if ((code & MOD_SHIFT) && !(s->modifiers & 1)) QUEUE_KEY(0x2a | (keycode & 0x80)); - if ((code & CTRL ) && !(s->modifiers & 4)) + if ((code & MOD_CTRL ) && !(s->modifiers & 4)) QUEUE_KEY(0x1d | (keycode & 0x80)); - if ((code & FN ) && !(s->modifiers & 8)) + if ((code & MOD_FN ) && !(s->modifiers & 8)) QUEUE_KEY(0x38 | (keycode & 0x80)); - if ((code & FN ) && (s->modifiers & 1)) + if ((code & MOD_FN ) && (s->modifiers & 1)) QUEUE_KEY(0x2a | (~keycode & 0x80)); - if ((code & FN ) && (s->modifiers & 2)) + if ((code & MOD_FN ) && (s->modifiers & 2)) QUEUE_KEY(0x36 | (~keycode & 0x80)); #else if (keycode & 0x80) { @@ -345,24 +345,24 @@ static void spitz_keyboard_handler(void *opaque, int keycode) QUEUE_KEY(0x36); s->imodifiers = 0; } else { - if ((code & SHIFT) && !((s->modifiers | s->imodifiers) & 1)) { + if ((code & MOD_SHIFT) && !((s->modifiers | s->imodifiers) & 1)) { QUEUE_KEY(0x2a); s->imodifiers |= 1; } - if ((code & CTRL ) && !((s->modifiers | s->imodifiers) & 4)) { + if ((code & MOD_CTRL ) && !((s->modifiers | s->imodifiers) & 4)) { QUEUE_KEY(0x1d); s->imodifiers |= 4; } - if ((code & FN ) && !((s->modifiers | s->imodifiers) & 8)) { + if ((code & MOD_FN ) && !((s->modifiers | s->imodifiers) & 8)) { QUEUE_KEY(0x38); s->imodifiers |= 8; } - if ((code & FN ) && (s->modifiers & 1) && + if ((code & MOD_FN ) && (s->modifiers & 1) && !(s->imodifiers & 0x10)) { QUEUE_KEY(0x2a | 0x80); s->imodifiers |= 0x10; } - if ((code & FN ) && (s->modifiers & 2) && + if ((code & MOD_FN ) && (s->modifiers & 2) && !(s->imodifiers & 0x20)) { QUEUE_KEY(0x36 | 0x80); s->imodifiers |= 0x20; @@ -394,38 +394,38 @@ static void spitz_keyboard_pre_map(SpitzKeyboardState *s) int i; for (i = 0; i < 0x100; i ++) s->pre_map[i] = i; - s->pre_map[0x02 | SHIFT ] = 0x02 | SHIFT; /* exclam */ - s->pre_map[0x28 | SHIFT ] = 0x03 | SHIFT; /* quotedbl */ - s->pre_map[0x04 | SHIFT ] = 0x04 | SHIFT; /* numbersign */ - s->pre_map[0x05 | SHIFT ] = 0x05 | SHIFT; /* dollar */ - s->pre_map[0x06 | SHIFT ] = 0x06 | SHIFT; /* percent */ - s->pre_map[0x08 | SHIFT ] = 0x07 | SHIFT; /* ampersand */ - s->pre_map[0x28 ] = 0x08 | SHIFT; /* apostrophe */ - s->pre_map[0x0a | SHIFT ] = 0x09 | SHIFT; /* parenleft */ - s->pre_map[0x0b | SHIFT ] = 0x0a | SHIFT; /* parenright */ - s->pre_map[0x29 | SHIFT ] = 0x0b | SHIFT; /* asciitilde */ - s->pre_map[0x03 | SHIFT ] = 0x0c | SHIFT; /* at */ - s->pre_map[0xd3 ] = 0x0e | FN; /* Delete */ - s->pre_map[0x3a ] = 0x0f | FN; /* Caps_Lock */ - s->pre_map[0x07 | SHIFT ] = 0x11 | FN; /* asciicircum */ - s->pre_map[0x0d ] = 0x12 | FN; /* equal */ - s->pre_map[0x0d | SHIFT ] = 0x13 | FN; /* plus */ - s->pre_map[0x1a ] = 0x14 | FN; /* bracketleft */ - s->pre_map[0x1b ] = 0x15 | FN; /* bracketright */ - s->pre_map[0x1a | SHIFT ] = 0x16 | FN; /* braceleft */ - s->pre_map[0x1b | SHIFT ] = 0x17 | FN; /* braceright */ - s->pre_map[0x27 ] = 0x22 | FN; /* semicolon */ - s->pre_map[0x27 | SHIFT ] = 0x23 | FN; /* colon */ - s->pre_map[0x09 | SHIFT ] = 0x24 | FN; /* asterisk */ - s->pre_map[0x2b ] = 0x25 | FN; /* backslash */ - s->pre_map[0x2b | SHIFT ] = 0x26 | FN; /* bar */ - s->pre_map[0x0c | SHIFT ] = 0x30 | FN; /* underscore */ - s->pre_map[0x33 | SHIFT ] = 0x33 | FN; /* less */ - s->pre_map[0x35 ] = 0x33 | SHIFT; /* slash */ - s->pre_map[0x34 | SHIFT ] = 0x34 | FN; /* greater */ - s->pre_map[0x35 | SHIFT ] = 0x34 | SHIFT; /* question */ - s->pre_map[0x49 ] = 0x48 | FN; /* Page_Up */ - s->pre_map[0x51 ] = 0x50 | FN; /* Page_Down */ + s->pre_map[0x02 | MOD_SHIFT ] = 0x02 | MOD_SHIFT; /* exclam */ + s->pre_map[0x28 | MOD_SHIFT ] = 0x03 | MOD_SHIFT; /* quotedbl */ + s->pre_map[0x04 | MOD_SHIFT ] = 0x04 | MOD_SHIFT; /* numbersign */ + s->pre_map[0x05 | MOD_SHIFT ] = 0x05 | MOD_SHIFT; /* dollar */ + s->pre_map[0x06 | MOD_SHIFT ] = 0x06 | MOD_SHIFT; /* percent */ + s->pre_map[0x08 | MOD_SHIFT ] = 0x07 | MOD_SHIFT; /* ampersand */ + s->pre_map[0x28 ] = 0x08 | MOD_SHIFT; /* apostrophe */ + s->pre_map[0x0a | MOD_SHIFT ] = 0x09 | MOD_SHIFT; /* parenleft */ + s->pre_map[0x0b | MOD_SHIFT ] = 0x0a | MOD_SHIFT; /* parenright */ + s->pre_map[0x29 | MOD_SHIFT ] = 0x0b | MOD_SHIFT; /* asciitilde */ + s->pre_map[0x03 | MOD_SHIFT ] = 0x0c | MOD_SHIFT; /* at */ + s->pre_map[0xd3 ] = 0x0e | MOD_FN; /* Delete */ + s->pre_map[0x3a ] = 0x0f | MOD_FN; /* Caps_Lock */ + s->pre_map[0x07 | MOD_SHIFT ] = 0x11 | MOD_FN; /* asciicircum */ + s->pre_map[0x0d ] = 0x12 | MOD_FN; /* equal */ + s->pre_map[0x0d | MOD_SHIFT ] = 0x13 | MOD_FN; /* plus */ + s->pre_map[0x1a ] = 0x14 | MOD_FN; /* bracketleft */ + s->pre_map[0x1b ] = 0x15 | MOD_FN; /* bracketright */ + s->pre_map[0x1a | MOD_SHIFT ] = 0x16 | MOD_FN; /* braceleft */ + s->pre_map[0x1b | MOD_SHIFT ] = 0x17 | MOD_FN; /* braceright */ + s->pre_map[0x27 ] = 0x22 | MOD_FN; /* semicolon */ + s->pre_map[0x27 | MOD_SHIFT ] = 0x23 | MOD_FN; /* colon */ + s->pre_map[0x09 | MOD_SHIFT ] = 0x24 | MOD_FN; /* asterisk */ + s->pre_map[0x2b ] = 0x25 | MOD_FN; /* backslash */ + s->pre_map[0x2b | MOD_SHIFT ] = 0x26 | MOD_FN; /* bar */ + s->pre_map[0x0c | MOD_SHIFT ] = 0x30 | MOD_FN; /* underscore */ + s->pre_map[0x33 | MOD_SHIFT ] = 0x33 | MOD_FN; /* less */ + s->pre_map[0x35 ] = 0x33 | MOD_SHIFT; /* slash */ + s->pre_map[0x34 | MOD_SHIFT ] = 0x34 | MOD_FN; /* greater */ + s->pre_map[0x35 | MOD_SHIFT ] = 0x34 | MOD_SHIFT; /* question */ + s->pre_map[0x49 ] = 0x48 | MOD_FN; /* Page_Up */ + s->pre_map[0x51 ] = 0x50 | MOD_FN; /* Page_Down */ s->modifiers = 0; s->imodifiers = 0; @@ -433,9 +433,9 @@ static void spitz_keyboard_pre_map(SpitzKeyboardState *s) s->fifolen = 0; } -#undef SHIFT -#undef CTRL -#undef FN +#undef MOD_SHIFT +#undef MOD_CTRL +#undef MOD_FN static int spitz_keyboard_post_load(void *opaque, int version_id) { diff --git a/include/qemu-common.h b/include/qemu-common.h index b399d85..af769f5 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -42,6 +42,18 @@ #include <signal.h> #include "glib-compat.h" +#if defined(__GLIBC__) +# include <pty.h> +#elif defined CONFIG_BSD +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +# include <libutil.h> +# else +# include <util.h> +# endif +#elif defined CONFIG_SOLARIS +# include <stropts.h> +#endif + #ifdef _WIN32 #include "sysemu/os-win32.h" #endif diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 3bcd4ab..57d7b1f 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -96,8 +96,9 @@ typedef signed int int_fast16_t; int qemu_daemon(int nochdir, int noclose); void *qemu_memalign(size_t alignment, size_t size); -void *qemu_vmalloc(size_t size); +void *qemu_anon_ram_alloc(size_t size); void qemu_vfree(void *ptr); +void qemu_anon_ram_free(void *ptr, size_t size); #define QEMU_MADV_INVALID -1 diff --git a/include/qom/object.h b/include/qom/object.h index 63e2a40..23fc048 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -344,6 +344,8 @@ typedef void (ObjectUnparent)(Object *obj); */ typedef void (ObjectFree)(void *obj); +#define OBJECT_CLASS_CAST_CACHE 4 + /** * ObjectClass: * @@ -356,6 +358,8 @@ struct ObjectClass Type type; GSList *interfaces; + const char *cast_cache[OBJECT_CLASS_CAST_CACHE]; + ObjectUnparent *unparent; }; diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 9735c1d..08284ef 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -142,8 +142,8 @@ int kvm_init_vcpu(CPUState *cpu); int kvm_cpu_exec(CPUArchState *env); #if !defined(CONFIG_USER_ONLY) -void *kvm_vmalloc(ram_addr_t size); -void *kvm_arch_vmalloc(ram_addr_t size); +void *kvm_ram_alloc(ram_addr_t size); +void *kvm_arch_ram_alloc(ram_addr_t size); #endif void kvm_setup_guest_memory(void *start, size_t size); @@ -1790,17 +1790,17 @@ int kvm_has_intx_set_mask(void) return kvm_state->intx_set_mask; } -void *kvm_vmalloc(ram_addr_t size) +void *kvm_ram_alloc(ram_addr_t size) { #ifdef TARGET_S390X void *mem; - mem = kvm_arch_vmalloc(size); + mem = kvm_arch_ram_alloc(size); if (mem) { return mem; } #endif - return qemu_vmalloc(size); + return qemu_anon_ram_alloc(size); } void kvm_setup_guest_memory(void *start, size_t size) diff --git a/qemu-char.c b/qemu-char.c index 64e824d..30a2ddf 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -53,13 +53,6 @@ #include <sys/select.h> #ifdef CONFIG_BSD #include <sys/stat.h> -#if defined(__GLIBC__) -#include <pty.h> -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) -#include <libutil.h> -#else -#include <util.h> -#endif #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #include <dev/ppbus/ppi.h> #include <dev/ppbus/ppbconf.h> @@ -69,8 +62,6 @@ #endif #else #ifdef __linux__ -#include <pty.h> - #include <linux/ppdev.h> #include <linux/parport.h> #endif @@ -87,7 +78,6 @@ #include <netinet/tcp.h> #include <net/if.h> #include <syslog.h> -#include <stropts.h> #endif #endif #endif diff --git a/qom/object.c b/qom/object.c index f5f416b..ec88231 100644 --- a/qom/object.c +++ b/qom/object.c @@ -439,7 +439,16 @@ Object *object_dynamic_cast_assert(Object *obj, const char *typename, typename, file, line, func); #ifdef CONFIG_QOM_CAST_DEBUG - Object *inst = object_dynamic_cast(obj, typename); + int i; + Object *inst; + + for (i = 0; i < OBJECT_CLASS_CAST_CACHE; i++) { + if (obj->class->cast_cache[i] == typename) { + goto out; + } + } + + inst = object_dynamic_cast(obj, typename); if (!inst && obj) { fprintf(stderr, "%s:%d:%s: Object %p is not an instance of type %s\n", @@ -448,6 +457,15 @@ Object *object_dynamic_cast_assert(Object *obj, const char *typename, } assert(obj == inst); + + if (obj == inst) { + for (i = 1; i < OBJECT_CLASS_CAST_CACHE; i++) { + obj->class->cast_cache[i - 1] = obj->class->cast_cache[i]; + } + obj->class->cast_cache[i - 1] = typename; + } + +out: #endif return obj; } @@ -510,7 +528,16 @@ ObjectClass *object_class_dynamic_cast_assert(ObjectClass *class, trace_object_class_dynamic_cast_assert(class ? class->type->name : "(null)", typename, file, line, func); -#ifndef CONFIG_QOM_CAST_DEBUG +#ifdef CONFIG_QOM_CAST_DEBUG + int i; + + for (i = 0; i < OBJECT_CLASS_CAST_CACHE; i++) { + if (class->cast_cache[i] == typename) { + ret = class; + goto out; + } + } +#else if (!class->interfaces) { return class; } @@ -523,6 +550,15 @@ ObjectClass *object_class_dynamic_cast_assert(ObjectClass *class, abort(); } +#ifdef CONFIG_QOM_CAST_DEBUG + if (ret == class) { + for (i = 1; i < OBJECT_CLASS_CAST_CACHE; i++) { + class->cast_cache[i - 1] = class->cast_cache[i]; + } + class->cast_cache[i - 1] = typename; + } +out: +#endif return ret; } @@ -27,6 +27,7 @@ #define IS_NORM 0 #define IS_ESC 1 #define IS_CSI 2 +#define IS_SS3 3 #undef printf #define printf do_not_use_printf @@ -397,6 +398,9 @@ void readline_handle_byte(ReadLineState *rs, int ch) if (ch == '[') { rs->esc_state = IS_CSI; rs->esc_param = 0; + } else if (ch == 'O') { + rs->esc_state = IS_SS3; + rs->esc_param = 0; } else { rs->esc_state = IS_NORM; } @@ -439,6 +443,17 @@ void readline_handle_byte(ReadLineState *rs, int ch) rs->esc_state = IS_NORM; the_end: break; + case IS_SS3: + switch(ch) { + case 'F': + readline_eol(rs); + break; + case 'H': + readline_bol(rs); + break; + } + rs->esc_state = IS_NORM; + break; } readline_update(rs); } diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index a585392..862fb12 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -332,7 +332,7 @@ static void *legacy_s390_alloc(ram_addr_t size) return mem; } -void *kvm_arch_vmalloc(ram_addr_t size) +void *kvm_arch_ram_alloc(ram_addr_t size) { /* Can we use the standard allocation ? */ if (kvm_check_extension(kvm_state, KVM_CAP_S390_GMAP) && diff --git a/trace-events b/trace-events index 4413beb..c03b9cb 100644 --- a/trace-events +++ b/trace-events @@ -32,8 +32,9 @@ g_free(void *ptr) "ptr %p" # osdep.c qemu_memalign(size_t alignment, size_t size, void *ptr) "alignment %zu size %zu ptr %p" -qemu_vmalloc(size_t size, void *ptr) "size %zu ptr %p" +qemu_anon_ram_alloc(size_t size, void *ptr) "size %zu ptr %p" qemu_vfree(void *ptr) "ptr %p" +qemu_anon_ram_free(void *ptr, size_t size) "size %zu ptr %p" # hw/virtio.c virtqueue_fill(void *vq, const void *elem, unsigned int len, unsigned int idx) "vq %p elem %p len %u idx %u" @@ -55,7 +55,6 @@ #include <sys/socket.h> #include <sys/un.h> #include <sys/wait.h> -#include <pty.h> #include <math.h> #include "ui/console.h" diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 3efc763..631a1de 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -101,7 +101,7 @@ void *qemu_memalign(size_t alignment, size_t size) } /* alloc shared memory pages */ -void *qemu_vmalloc(size_t size) +void *qemu_anon_ram_alloc(size_t size) { size_t align = QEMU_VMALLOC_ALIGN; size_t total = size + align - getpagesize(); @@ -125,7 +125,7 @@ void *qemu_vmalloc(size_t size) munmap(ptr + size, total - size); } - trace_qemu_vmalloc(size, ptr); + trace_qemu_anon_ram_alloc(size, ptr); return ptr; } @@ -135,6 +135,14 @@ void qemu_vfree(void *ptr) free(ptr); } +void qemu_anon_ram_free(void *ptr, size_t size) +{ + trace_qemu_anon_ram_free(ptr, size); + if (ptr) { + munmap(ptr, size); + } +} + void qemu_set_block(int fd) { int f; diff --git a/util/oslib-win32.c b/util/oslib-win32.c index dcfa0c2..df2ecbd 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -53,7 +53,7 @@ void *qemu_memalign(size_t alignment, size_t size) return ptr; } -void *qemu_vmalloc(size_t size) +void *qemu_anon_ram_alloc(size_t size) { void *ptr; @@ -64,7 +64,7 @@ void *qemu_vmalloc(size_t size) abort(); } ptr = qemu_oom_check(VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE)); - trace_qemu_vmalloc(size, ptr); + trace_qemu_anon_ram_alloc(size, ptr); return ptr; } @@ -76,6 +76,14 @@ void qemu_vfree(void *ptr) } } +void qemu_anon_ram_free(void *ptr, size_t size) +{ + trace_qemu_anon_ram_free(ptr, size); + if (ptr) { + VirtualFree(ptr, 0, MEM_RELEASE); + } +} + /* FIXME: add proper locking */ struct tm *gmtime_r(const time_t *timep, struct tm *result) { |