mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-10 09:44:13 +00:00
m1n1.hv: Add a method to write memory
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
This commit is contained in:
parent
0a28817ce2
commit
6babf39184
1 changed files with 20 additions and 0 deletions
|
@ -249,6 +249,26 @@ class HV(Reloadable):
|
|||
|
||||
return buffer.getvalue()
|
||||
|
||||
def writemem(self, va, data):
|
||||
'''write to virtual memory'''
|
||||
written = 0
|
||||
while written < len(data):
|
||||
pa = self.p.hv_translate(va, False, True)
|
||||
if pa == 0:
|
||||
break
|
||||
|
||||
size_in_page = 4096 - (va % 4096)
|
||||
if len(data) - written < size_in_page:
|
||||
self.iface.writemem(pa, data[written:])
|
||||
written = len(data)
|
||||
break
|
||||
|
||||
self.iface.writemem(pa, data[written:written + size_in_page])
|
||||
va += size_in_page
|
||||
written += size_in_page
|
||||
|
||||
return written
|
||||
|
||||
def trace_irq(self, device, num, count, flags):
|
||||
for n in range(num, num + count):
|
||||
if flags & self.IRQTRACE_IRQ:
|
||||
|
|
Loading…
Reference in a new issue