Merge remote-tracking branch 'unicorn-engine/master' into msvc_native

This commit is contained in:
xorstream
2017-01-20 22:37:51 +11:00
32 changed files with 7 additions and 1189 deletions

View File

@ -169,8 +169,6 @@ struct TranslationBlock {
uint32_t icount;
};
#include "exec/spinlock.h"
typedef struct TBContext TBContext;
struct TBContext {
@ -178,8 +176,6 @@ struct TBContext {
TranslationBlock *tbs;
TranslationBlock *tb_phys_hash[CODE_GEN_PHYS_HASH_SIZE];
int nb_tbs;
/* any access to the tbs or the page table must use this lock */
spinlock_t tb_lock;
/* statistics */
int tb_flush_count;

View File

@ -16,10 +16,8 @@
#ifndef CONFIG_USER_ONLY
#define DIRTY_MEMORY_VGA 0
#define DIRTY_MEMORY_CODE 1
#define DIRTY_MEMORY_MIGRATION 2
#define DIRTY_MEMORY_NUM 3 /* num of dirty bits */
#define DIRTY_MEMORY_CODE 0
#define DIRTY_MEMORY_NUM 1 /* num of dirty bits */
#include "platform.h"
#include "qemu-common.h"
@ -29,7 +27,6 @@
#endif
#include "qemu/queue.h"
#include "qemu/int128.h"
#include "qemu/notify.h"
#include "qapi/error.h"
#include "qom/object.h"
@ -167,7 +164,6 @@ struct MemoryRegion {
uint8_t dirty_log_mask;
unsigned ioeventfd_nb;
MemoryRegionIoeventfd *ioeventfds;
NotifierList iommu_notify;
struct uc_struct *uc;
uint32_t perms; //all perms, partially redundant with readonly
uint64_t end;
@ -498,25 +494,6 @@ bool memory_region_is_iommu(MemoryRegion *mr);
void memory_region_notify_iommu(MemoryRegion *mr,
IOMMUTLBEntry entry);
/**
* memory_region_register_iommu_notifier: register a notifier for changes to
* IOMMU translation entries.
*
* @mr: the memory region to observe
* @n: the notifier to be added; the notifier receives a pointer to an
* #IOMMUTLBEntry as the opaque value; the pointer ceases to be
* valid on exit from the notifier.
*/
void memory_region_register_iommu_notifier(MemoryRegion *mr, Notifier *n);
/**
* memory_region_unregister_iommu_notifier: unregister a notifier for
* changes to IOMMU translation entries.
*
* @n: the notifier to be removed.
*/
void memory_region_unregister_iommu_notifier(Notifier *n);
/**
* memory_region_name: get a memory region's name
*

View File

@ -70,21 +70,13 @@ static inline bool cpu_physical_memory_get_dirty_flag(struct uc_struct *uc, ram_
static inline bool cpu_physical_memory_is_clean(struct uc_struct *uc, ram_addr_t addr)
{
bool vga = cpu_physical_memory_get_dirty_flag(uc, addr, DIRTY_MEMORY_VGA);
bool code = cpu_physical_memory_get_dirty_flag(uc, addr, DIRTY_MEMORY_CODE);
bool migration =
cpu_physical_memory_get_dirty_flag(uc, addr, DIRTY_MEMORY_MIGRATION);
return !(vga && code && migration);
return !cpu_physical_memory_get_dirty_flag(uc, addr, DIRTY_MEMORY_CODE);
}
static inline bool cpu_physical_memory_range_includes_clean(struct uc_struct *uc, ram_addr_t start,
ram_addr_t length)
{
bool vga = cpu_physical_memory_get_clean(uc, start, length, DIRTY_MEMORY_VGA);
bool code = cpu_physical_memory_get_clean(uc, start, length, DIRTY_MEMORY_CODE);
bool migration =
cpu_physical_memory_get_clean(uc, start, length, DIRTY_MEMORY_MIGRATION);
return vga || code || migration;
return cpu_physical_memory_get_clean(uc, start, length, DIRTY_MEMORY_CODE);
}
static inline void cpu_physical_memory_set_dirty_flag(struct uc_struct *uc, ram_addr_t addr,
@ -94,17 +86,6 @@ static inline void cpu_physical_memory_set_dirty_flag(struct uc_struct *uc, ram_
set_bit(addr >> TARGET_PAGE_BITS, uc->ram_list.dirty_memory[client]);
}
static inline void cpu_physical_memory_set_dirty_range_nocode(struct uc_struct *uc, ram_addr_t start,
ram_addr_t length)
{
unsigned long end, page;
end = TARGET_PAGE_ALIGN(start + length) >> TARGET_PAGE_BITS;
page = start >> TARGET_PAGE_BITS;
bitmap_set(uc->ram_list.dirty_memory[DIRTY_MEMORY_MIGRATION], page, end - page);
bitmap_set(uc->ram_list.dirty_memory[DIRTY_MEMORY_VGA], page, end - page);
}
static inline void cpu_physical_memory_set_dirty_range(struct uc_struct *uc, ram_addr_t start,
ram_addr_t length)
{
@ -112,8 +93,6 @@ static inline void cpu_physical_memory_set_dirty_range(struct uc_struct *uc, ram
end = TARGET_PAGE_ALIGN(start + length) >> TARGET_PAGE_BITS;
page = start >> TARGET_PAGE_BITS;
bitmap_set(uc->ram_list.dirty_memory[DIRTY_MEMORY_MIGRATION], page, end - page);
bitmap_set(uc->ram_list.dirty_memory[DIRTY_MEMORY_VGA], page, end - page);
bitmap_set(uc->ram_list.dirty_memory[DIRTY_MEMORY_CODE], page, end - page);
}
@ -139,9 +118,6 @@ static inline void cpu_physical_memory_set_dirty_lebitmap(struct uc_struct *uc,
for (k = 0; k < nr; k++) {
if (bitmap[k]) {
unsigned long temp = leul_to_cpu(bitmap[k]);
uc->ram_list.dirty_memory[DIRTY_MEMORY_MIGRATION][page + k] |= temp;
uc->ram_list.dirty_memory[DIRTY_MEMORY_VGA][page + k] |= temp;
uc->ram_list.dirty_memory[DIRTY_MEMORY_CODE][page + k] |= temp;
}
}

View File

@ -1,53 +0,0 @@
/*
* Copyright (c) 2003 Fabrice Bellard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>
*/
/* configure guarantees us that we have pthreads on any host except
* mingw32, which doesn't support any of the user-only targets.
* So we can simply assume we have pthread mutexes here.
*/
#ifndef QEMU_EXEC_SPINLOCK_H
#define QEMU_EXEC_SPINLOCK_H
#if defined(CONFIG_USER_ONLY)
#include <pthread.h>
#define spin_lock pthread_mutex_lock
#define spin_unlock pthread_mutex_unlock
#define spinlock_t pthread_mutex_t
#define SPIN_LOCK_UNLOCKED PTHREAD_MUTEX_INITIALIZER
#else
/* Empty implementations, on the theory that system mode emulation
* is single-threaded. This means that these functions should only
* be used from code run in the TCG cpu thread, and cannot protect
* data structures which might also be accessed from the IO thread
* or from signal handlers.
*/
typedef int spinlock_t;
#define SPIN_LOCK_UNLOCKED 0
static inline void spin_lock(spinlock_t *lock)
{
}
static inline void spin_unlock(spinlock_t *lock)
{
}
#endif
#endif