add svcMap/UnmapPhysicalMemory

This commit is contained in:
misson20000 2018-05-16 12:23:58 -07:00
parent 175186ddbe
commit b2b6a831f2
2 changed files with 15 additions and 0 deletions

13
Svc.cpp
View file

@ -105,6 +105,8 @@ Svc::Svc(Ctu *_ctu) : ctu(_ctu) {
registerSvc_ret_X0( 0x26, Break, IX0, IX1, IX2);
registerSvc_ret_X0( 0x27, OutputDebugString, IX0, IX1);
registerSvc_ret_X0_X1( 0x29, GetInfo, IX1, (ghandle) IX2, IX3);
registerSvc_ret_X0( 0x2C, MapPhysicalMemory, IX0, IX1);
registerSvc_ret_X0( 0x2D, UnmapPhysicalMemory, IX0, IX1);
registerSvc_ret_X0_X1_X2( 0x40, CreateSession, (ghandle) IX0, (ghandle) IX1, IX2);
registerSvc_ret_X0_X1( 0x41, AcceptSession, (ghandle) IX1);
registerSvc_ret_X0_X1( 0x43, ReplyAndReceive, IX1, IX2, (ghandle) IX3, IX4);
@ -539,6 +541,17 @@ tuple<guint, guint> Svc::GetInfo(guint id1, ghandle handle, guint id2) {
LOG_ERROR(Svc[0x29], "Unknown getinfo");
}
guint Svc::MapPhysicalMemory(gptr addr, guint size) {
LOG_DEBUG(Svc[0x2C], "MapPhysicalMemory(0x" LONGFMT ", 0x" LONGFMT ")", addr, size);
ctu->cpu.map(addr, size);
return 0;
}
guint Svc::UnmapPhysicalMemory(gptr addr, guint size) {
ctu->cpu.unmap(addr, size);
return 0;
}
tuple<guint, guint, guint> Svc::CreateSession(ghandle clientOut, ghandle serverOut, guint unk) {
LOG_DEBUG(Svc[0x40], "CreateSession");
auto pipe = make_shared<NPipe>(ctu, "Session");

2
Svc.h
View file

@ -58,6 +58,8 @@ private:
guint Break(guint X0, guint X1, guint info); // 0x26
guint OutputDebugString(guint ptr, guint size); // 0x27
tuple<guint, guint> GetInfo(guint id1, ghandle handle, guint id2); // 0x29
guint MapPhysicalMemory(gptr addr, guint size); // 0x2C
guint UnmapPhysicalMemory(gptr addr, guint size); // 0x2D
tuple<guint, guint, guint> CreateSession(ghandle clientOut, ghandle serverOut, guint unk); // 0x40
tuple<guint, guint> AcceptSession(ghandle port); // 0x41
tuple<guint, guint> ReplyAndReceive(gptr handles, guint numHandles, ghandle replySession, guint timeout); // 0x43