mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-17 06:38:28 +00:00
qemu-usb: use bounce buffer to access DMA memory
The former implemention assumed that the guest physical memory is mapped continously. This, however, is not true. Writing larger files to an USB stick with a Windows 10 guest would therefore lead to data corruption. The current implementation uses a bounce buffer to copy the data to and from the guest physical memory and leaves dealing with the memory mappings entirely up to the VMM. Fixes #4017.
This commit is contained in:
committed by
Norman Feske
parent
23620942bf
commit
b51ae104c2
@ -57,6 +57,8 @@ namespace Qemu {
|
||||
*/
|
||||
struct Pci_device
|
||||
{
|
||||
enum class Dma_direction { IN = 0, OUT = 1, };
|
||||
|
||||
/**
|
||||
* Raise interrupt
|
||||
*
|
||||
@ -65,8 +67,8 @@ namespace Qemu {
|
||||
virtual void raise_interrupt(int assert) = 0;
|
||||
virtual int read_dma(addr_t addr, void *buf, size_t size) = 0;
|
||||
virtual int write_dma(addr_t addr, void const *buf, size_t size) = 0;
|
||||
virtual void *map_dma(addr_t base, size_t size) = 0;
|
||||
virtual void unmap_dma(void *addr, size_t size) = 0;
|
||||
virtual void *map_dma(addr_t base, size_t size, Dma_direction dir) = 0;
|
||||
virtual void unmap_dma(void *addr, size_t size, Dma_direction dir) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user