Commit b100fcfe authored by Anthony Liguori's avatar Anthony Liguori
Browse files

Merge remote-tracking branch 'sstabellini/xen-fixes-20120822' into staging

* sstabellini/xen-fixes-20120822:
  xen-all.c: fix multiply issue for int and uint types
  Fix invalidate if memory requested was not bucket aligned
parents a9b670b1 14d40183
......@@ -712,7 +712,8 @@ static void cpu_ioreq_pio(ioreq_t *req)
for (i = 0; i < req->count; i++) {
tmp = do_inp(req->addr, req->size);
cpu_physical_memory_write(req->data + (sign * i * req->size),
cpu_physical_memory_write(
req->data + (sign * i * (int64_t)req->size),
(uint8_t *) &tmp, req->size);
}
}
......@@ -723,7 +724,8 @@ static void cpu_ioreq_pio(ioreq_t *req)
for (i = 0; i < req->count; i++) {
uint32_t tmp = 0;
cpu_physical_memory_read(req->data + (sign * i * req->size),
cpu_physical_memory_read(
req->data + (sign * i * (int64_t)req->size),
(uint8_t*) &tmp, req->size);
do_outp(req->addr, req->size, tmp);
}
......@@ -740,12 +742,14 @@ static void cpu_ioreq_move(ioreq_t *req)
if (!req->data_is_ptr) {
if (req->dir == IOREQ_READ) {
for (i = 0; i < req->count; i++) {
cpu_physical_memory_read(req->addr + (sign * i * req->size),
cpu_physical_memory_read(
req->addr + (sign * i * (int64_t)req->size),
(uint8_t *) &req->data, req->size);
}
} else if (req->dir == IOREQ_WRITE) {
for (i = 0; i < req->count; i++) {
cpu_physical_memory_write(req->addr + (sign * i * req->size),
cpu_physical_memory_write(
req->addr + (sign * i * (int64_t)req->size),
(uint8_t *) &req->data, req->size);
}
}
......@@ -754,16 +758,20 @@ static void cpu_ioreq_move(ioreq_t *req)
if (req->dir == IOREQ_READ) {
for (i = 0; i < req->count; i++) {
cpu_physical_memory_read(req->addr + (sign * i * req->size),
cpu_physical_memory_read(
req->addr + (sign * i * (int64_t)req->size),
(uint8_t*) &tmp, req->size);
cpu_physical_memory_write(req->data + (sign * i * req->size),
cpu_physical_memory_write(
req->data + (sign * i * (int64_t)req->size),
(uint8_t*) &tmp, req->size);
}
} else if (req->dir == IOREQ_WRITE) {
for (i = 0; i < req->count; i++) {
cpu_physical_memory_read(req->data + (sign * i * req->size),
cpu_physical_memory_read(
req->data + (sign * i * (int64_t)req->size),
(uint8_t*) &tmp, req->size);
cpu_physical_memory_write(req->addr + (sign * i * req->size),
cpu_physical_memory_write(
req->addr + (sign * i * (int64_t)req->size),
(uint8_t*) &tmp, req->size);
}
}
......
......@@ -320,10 +320,6 @@ void xen_invalidate_map_cache_entry(uint8_t *buffer)
target_phys_addr_t size;
int found = 0;
if (mapcache->last_address_vaddr == buffer) {
mapcache->last_address_index = -1;
}
QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) {
if (reventry->vaddr_req == buffer) {
paddr_index = reventry->paddr_index;
......@@ -342,6 +338,11 @@ void xen_invalidate_map_cache_entry(uint8_t *buffer)
QTAILQ_REMOVE(&mapcache->locked_entries, reventry, next);
g_free(reventry);
if (mapcache->last_address_index == paddr_index) {
mapcache->last_address_index = -1;
mapcache->last_address_vaddr = NULL;
}
entry = &mapcache->entry[paddr_index % mapcache->nr_buckets];
while (entry && (entry->paddr_index != paddr_index || entry->size != size)) {
pentry = entry;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment