m1n1.fw.asc: Handle syslog/ioreporting buffer size properly

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2021-08-23 23:07:54 +09:00
parent 1666d86d43
commit c39fe2fbde
2 changed files with 8 additions and 8 deletions

View file

@ -7,7 +7,7 @@ class IOReportingMessage(Register64):
class IOReporting_GetBuf(IOReportingMessage):
TYPE = 63, 52, Constant(1)
BUFTYPE = 51, 44, Constant(4)
SIZE = 51, 44
DVA = 43, 0
class IOReporting_Start(IOReportingMessage):
@ -30,10 +30,10 @@ class ASCIOReportingEndpoint(ASCBaseEndpoint):
if self.iobuffer:
self.log("WARNING: trying to reset iobuffer!")
size = 0x4000
self.iobuffer, self.iobuffer_dva = self.asc.ioalloc(size)
self.bufsize = 0x1000 * msg.SIZE
self.iobuffer, self.iobuffer_dva = self.asc.ioalloc(self.bufsize)
self.log(f"buf {self.iobuffer:#x} / {self.iobuffer_dva:#x}")
self.send(IOReporting_GetBuf(DVA=self.iobuffer_dva))
self.send(IOReporting_GetBuf(DVA=self.iobuffer_dva, SIZE=msg.SIZE))
return True
@msg_handler(0xc, IOReporting_Start)
@ -44,7 +44,7 @@ class ASCIOReportingEndpoint(ASCBaseEndpoint):
@msg_handler(8, IOReporting_Report)
def Init(self, msg):
self.log("report!")
buf = self.asc.iface.readmem(self.iobuffer, 0x4000)
buf = self.asc.iface.readmem(self.iobuffer, self.bufsize)
#chexdump(buf)
self.send(IOReporting_Report())
return True

View file

@ -16,7 +16,7 @@ class Syslog_Init(SyslogMessage):
class Syslog_GetBuf(SyslogMessage):
TYPE = 59, 52, Constant(1)
UNK1 = 51, 44, Constant(3)
SIZE = 51, 44
DVA = 43, 0
class Syslog_Log(SyslogMessage):
@ -44,14 +44,14 @@ class ASCSysLogEndpoint(ASCBaseEndpoint):
@msg_handler(1, Syslog_GetBuf)
def GetBuf(self, msg):
size = 0x4000
size = 0x1000 * msg.SIZE
if self.iobuffer:
print("WARNING: trying to reset iobuffer!")
self.iobuffer, self.iobuffer_dva = self.asc.ioalloc(size)
self.log(f"buf {self.iobuffer:#x} / {self.iobuffer_dva:#x}")
self.send(Syslog_GetBuf(DVA=self.iobuffer_dva))
self.send(Syslog_GetBuf(DVA=self.iobuffer_dva, SIZE=msg.SIZE))
self.started = True
return True