proxyclient: add ops for writeread{8,16,32,64}

Signed-off-by: Sven Peter <sven@svenpeter.dev>
This commit is contained in:
Sven Peter 2021-02-17 21:34:25 +01:00 committed by Hector Martin
parent 1ccf2e2af5
commit 870fead39c
3 changed files with 34 additions and 0 deletions

View file

@ -308,6 +308,10 @@ class M1N1Proxy:
P_MASK32 = 0x111 P_MASK32 = 0x111
P_MASK16 = 0x112 P_MASK16 = 0x112
P_MASK8 = 0x113 P_MASK8 = 0x113
P_WRITEREAD64 = 0x114
P_WRITEREAD32 = 0x115
P_WRITEREAD16 = 0x116
P_WRITEREAD8 = 0x117
P_MEMCPY64 = 0x200 P_MEMCPY64 = 0x200
P_MEMCPY32 = 0x201 P_MEMCPY32 = 0x201
@ -487,6 +491,15 @@ class M1N1Proxy:
def mask8(self, addr, clear, set): def mask8(self, addr, clear, set):
self.request(self.P_MASK8, addr, clear, set) self.request(self.P_MASK8, addr, clear, set)
def writeread64(self, addr, data):
return self.request(self.P_WRITEREAD64, addr, data)
def writeread32(self, addr, data):
return self.request(self.P_WRITEREAD32, addr, data)
def writeread16(self, addr, data):
return self.request(self.P_WRITEREAD16, addr, data)
def writeread8(self, addr, data):
return self.request(self.P_WRITEREAD8, addr, data)
def memcpy64(self, dst, src, size): def memcpy64(self, dst, src, size):
if src & 7 or dst & 7: if src & 7 or dst & 7:
raise AlignmentError() raise AlignmentError()

View file

@ -149,6 +149,23 @@ int proxy_process(ProxyRequest *request, ProxyReply *reply)
reply->retval = mask8(request->args[0], request->args[1], request->args[2]); reply->retval = mask8(request->args[0], request->args[1], request->args[2]);
break; break;
case P_WRITEREAD64:
exc_guard = GUARD_MARK;
reply->retval = writeread64(request->args[0], request->args[1]);
break;
case P_WRITEREAD32:
exc_guard = GUARD_MARK;
reply->retval = writeread32(request->args[0], request->args[1]);
break;
case P_WRITEREAD16:
exc_guard = GUARD_MARK;
reply->retval = writeread16(request->args[0], request->args[1]);
break;
case P_WRITEREAD8:
exc_guard = GUARD_MARK;
reply->retval = writeread8(request->args[0], request->args[1]);
break;
case P_MEMCPY64: case P_MEMCPY64:
exc_guard = GUARD_RETURN; exc_guard = GUARD_RETURN;
memcpy64((void *)request->args[0], (void *)request->args[1], request->args[2]); memcpy64((void *)request->args[0], (void *)request->args[1], request->args[2]);

View file

@ -36,6 +36,10 @@ typedef enum {
P_MASK32, P_MASK32,
P_MASK16, P_MASK16,
P_MASK8, P_MASK8,
P_WRITEREAD64,
P_WRITEREAD32,
P_WRITEREAD16,
P_WRITEREAD8,
P_MEMCPY64 = 0x200, // Memory block transfer functions P_MEMCPY64 = 0x200, // Memory block transfer functions
P_MEMCPY32, P_MEMCPY32,