2019-09-24 22:54:27 +02:00
# include "svc.h"
2019-10-13 10:04:47 +02:00
# include <os.h>
2019-09-24 22:54:27 +02:00
namespace skyline : : kernel : : svc {
void SetHeapSize ( DeviceState & state ) {
2019-11-17 21:19:01 +01:00
const u32 size = state . nce - > GetRegister ( Wreg : : W1 ) ;
if ( size % constant : : HeapSizeDiv ! = 0 ) {
state . nce - > SetRegister ( Xreg : : X1 , 0 ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvSize ) ;
state . logger - > Warn ( " svcSetHeapSize: 'size' not divisible by 2MB: {} " , size ) ;
return ;
}
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
std : : shared_ptr < type : : KPrivateMemory > heap ;
try {
heap = state . thisProcess - > memoryRegionMap . at ( memory : : Region : : Heap ) ;
2019-11-17 21:19:01 +01:00
heap - > Resize ( size , true ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
} catch ( const exception & ) {
2019-11-17 21:19:01 +01:00
state . logger - > Warn ( " svcSetHeapSize: Falling back to recreating memory " ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
state . thisProcess - > UnmapPrivateRegion ( memory : : Region : : Heap ) ;
heap = state . thisProcess - > MapPrivateRegion ( constant : : HeapAddr , size , { true , true , false } , memory : : Type : : Heap , memory : : Region : : Heap ) . item ;
}
2019-09-24 22:54:27 +02:00
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
state . nce - > SetRegister ( Xreg : : X1 , heap - > address ) ;
2019-11-17 21:19:01 +01:00
state . logger - > Debug ( " svcSetHeapSize: Allocated at 0x{:X} for 0x{:X} bytes " , heap - > address , heap - > size ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
}
void SetMemoryAttribute ( DeviceState & state ) {
2019-11-17 21:19:01 +01:00
const u64 addr = state . nce - > GetRegister ( Xreg : : X0 ) ;
if ( ( addr & ( PAGE_SIZE - 1 ) ) ) {
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvAddress ) ;
state . logger - > Warn ( " svcSetMemoryAttribute: 'address' not page aligned: {} " , addr ) ;
return ;
}
const u64 size = state . nce - > GetRegister ( Xreg : : X1 ) ;
if ( ( size & ( PAGE_SIZE - 1 ) ) | | ! size ) {
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvSize ) ;
state . logger - > Warn ( " svcSetMemoryAttribute: 'size' {}: {} " , size ? " not page aligned " : " is zero " , size ) ;
return ;
}
u32 mask = state . nce - > GetRegister ( Wreg : : W2 ) ;
u32 value = state . nce - > GetRegister ( Wreg : : W3 ) ;
u32 maskedValue = mask | value ;
if ( maskedValue ! = mask ) {
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvCombination ) ;
state . logger - > Warn ( " svcSetMemoryAttribute: 'mask' invalid: 0x{:X}, 0x{:X} " , mask , value ) ;
return ;
}
memory : : MemoryAttribute attribute = * reinterpret_cast < memory : : MemoryAttribute * > ( & maskedValue ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
bool found = false ;
for ( const auto & [ address , region ] : state . thisProcess - > memoryMap ) {
if ( addr > = address & & addr < ( address + region - > size ) ) {
bool subFound = false ;
for ( auto & subregion : region - > regionInfoVec ) {
if ( ( address > = subregion . address ) & & ( address < ( subregion . address + subregion . size ) ) )
2019-11-17 21:19:01 +01:00
subregion . isUncached = attribute . isUncached ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
subFound = true ;
break ;
}
if ( ! subFound )
2019-11-17 21:19:01 +01:00
region - > regionInfoVec . emplace_back ( addr , size , static_cast < bool > ( attribute . isUncached ) ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
found = true ;
break ;
}
}
2019-11-17 21:19:01 +01:00
if ( ! found ) {
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvAddress ) ;
state . logger - > Warn ( " svcSetMemoryAttribute: Cannot find memory region: 0x{:X} " , addr ) ;
return ;
}
state . logger - > Debug ( " svcSetMemoryAttribute: Set caching to {} at 0x{:X} for 0x{:X} bytes " , ! attribute . isUncached , addr , size ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
2019-09-24 22:54:27 +02:00
}
void QueryMemory ( DeviceState & state ) {
memory : : MemoryInfo memInf ;
u64 addr = state . nce - > GetRegister ( Xreg : : X2 ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
bool found = false ;
for ( const auto & [ address , region ] : state . thisProcess - > memoryMap ) {
2019-10-13 10:04:47 +02:00
if ( addr > = address & & addr < ( address + region - > size ) ) {
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
memInf = region - > GetInfo ( addr ) ;
found = true ;
2019-10-13 10:04:47 +02:00
break ;
2019-09-24 22:54:27 +02:00
}
}
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
if ( ! found ) {
for ( const auto & object : state . thisProcess - > handleTable ) {
if ( object . second - > objectType = = type : : KType : : KSharedMemory ) {
const auto & mem = state . thisProcess - > GetHandle < type : : KSharedMemory > ( object . first ) ;
if ( mem - > procInfMap . count ( state . thisProcess - > mainThread ) ) {
const auto & map = mem - > procInfMap . at ( state . thisProcess - > mainThread ) ;
if ( addr > = map . address & & addr < ( map . address + map . size ) ) {
memInf = mem - > GetInfo ( state . thisProcess - > mainThread ) ;
found = true ;
break ;
}
}
} else if ( object . second - > objectType = = type : : KType : : KTransferMemory ) {
const auto & mem = state . thisProcess - > GetHandle < type : : KTransferMemory > ( object . first ) ;
if ( addr > = mem - > cAddress & & addr < ( mem - > cAddress + mem - > cSize ) ) {
memInf = mem - > GetInfo ( ) ;
found = true ;
break ;
}
}
}
if ( ! found ) {
memInf = {
. baseAddress = constant : : BaseEnd ,
. size = static_cast < u64 > ( - constant : : BaseEnd + 1 ) ,
. type = static_cast < u64 > ( memory : : Type : : Unmapped )
2019-10-13 10:04:47 +02:00
} ;
2019-11-17 21:19:01 +01:00
state . logger - > Debug ( " svcQueryMemory: Cannot find block of address: 0x{:X} " , addr ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
}
2019-09-24 22:54:27 +02:00
}
2019-11-17 21:19:01 +01:00
state . logger - > Debug ( " svcQueryMemory: Address: 0x{:X}, Size: 0x{:X}, Type: {}, Is Uncached: {}, Permissions: {}{}{} " , memInf . baseAddress , memInf . size , memInf . type , static_cast < bool > ( memInf . memoryAttribute . isUncached ) , memInf . perms . r ? " R " : " - " , memInf . perms . w ? " W " : " - " , memInf . perms . x ? " X " : " - " ) ;
2019-09-24 22:54:27 +02:00
state . thisProcess - > WriteMemory < memory : : MemoryInfo > ( memInf , state . nce - > GetRegister ( Xreg : : X0 ) ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
}
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
void ExitProcess ( DeviceState & state ) {
2019-11-17 21:19:01 +01:00
state . logger - > Debug ( " svcExitProcess: Exiting current process: {} " , state . thisProcess - > mainThread ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
state . os - > KillThread ( state . thisProcess - > mainThread ) ;
}
2019-09-24 22:54:27 +02:00
void CreateThread ( DeviceState & state ) {
2019-11-17 21:19:01 +01:00
u64 entryAddr = state . nce - > GetRegister ( Xreg : : X1 ) ;
u64 entryArg = state . nce - > GetRegister ( Xreg : : X2 ) ;
u64 stackTop = state . nce - > GetRegister ( Xreg : : X3 ) ;
u8 priority = static_cast < u8 > ( state . nce - > GetRegister ( Wreg : : W4 ) ) ;
if ( priority > = constant : : PriorityNin . first & & priority < = constant : : PriorityNin . second ) {
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvAddress ) ;
state . logger - > Warn ( " svcSetHeapSize: 'priority' invalid: {} " , priority ) ;
return ;
}
auto thread = state . thisProcess - > CreateThread ( entryAddr , entryArg , stackTop , priority ) ;
2019-09-24 22:54:27 +02:00
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
state . nce - > SetRegister ( Wreg : : W1 , thread - > handle ) ;
2019-11-17 21:19:01 +01:00
state . logger - > Info ( " svcCreateThread: Created thread with handle 0x{:X} " , thread - > handle ) ;
2019-09-24 22:54:27 +02:00
}
void StartThread ( DeviceState & state ) {
2019-11-17 21:19:01 +01:00
auto handle = state . nce - > GetRegister ( Wreg : : W0 ) ;
try {
auto thread = state . thisProcess - > GetHandle < type : : KThread > ( handle ) ;
state . logger - > Debug ( " svcStartThread: Starting thread: 0x{:X}, {} " , handle , thread - > pid ) ;
thread - > Start ( ) ;
} catch ( const std : : exception & ) {
state . logger - > Warn ( " svcStartThread: 'handle' invalid: 0x{:X} " , handle ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvHandle ) ;
}
2019-09-24 22:54:27 +02:00
}
void ExitThread ( DeviceState & state ) {
2019-11-17 21:19:01 +01:00
state . logger - > Debug ( " svcExitProcess: Exiting current thread: {} " , state . thisThread - > pid ) ;
2019-09-24 22:54:27 +02:00
state . os - > KillThread ( state . thisThread - > pid ) ;
}
2019-10-13 10:04:47 +02:00
void SleepThread ( DeviceState & state ) {
auto in = state . nce - > GetRegister ( Xreg : : X0 ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
switch ( in ) {
2019-10-13 10:04:47 +02:00
case 0 :
case 1 :
case 2 :
2019-11-17 21:19:01 +01:00
state . logger - > Debug ( " svcSleepThread: Yielding thread: {} " , in ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
state . thisThread - > status = type : : KThread : : Status : : Runnable ; // Will cause the application to awaken on the next iteration of the main loop
2019-11-17 21:19:01 +01:00
break ;
2019-10-13 10:04:47 +02:00
default :
2019-11-17 21:19:01 +01:00
state . logger - > Debug ( " svcSleepThread: Thread sleeping for {} ns " , in ) ;
2019-10-16 14:41:30 +02:00
state . thisThread - > timeout = GetCurrTimeNs ( ) + in ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
state . thisThread - > status = type : : KThread : : Status : : Sleeping ;
2019-10-13 10:04:47 +02:00
}
}
2019-09-24 22:54:27 +02:00
void GetThreadPriority ( DeviceState & state ) {
2019-11-17 21:19:01 +01:00
auto handle = state . nce - > GetRegister ( Wreg : : W0 ) ;
try {
auto priority = state . thisProcess - > GetHandle < type : : KThread > ( handle ) - > priority ;
state . nce - > SetRegister ( Wreg : : W1 , priority ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
state . logger - > Debug ( " svcGetThreadPriority: Writing thread priority {} " , priority ) ;
} catch ( const std : : exception & ) {
state . logger - > Warn ( " svcGetThreadPriority: 'handle' invalid: 0x{:X} " , handle ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvHandle ) ;
}
2019-09-24 22:54:27 +02:00
}
void SetThreadPriority ( DeviceState & state ) {
2019-11-17 21:19:01 +01:00
auto handle = state . nce - > GetRegister ( Wreg : : W0 ) ;
auto priority = state . nce - > GetRegister ( Wreg : : W1 ) ;
try {
state . thisProcess - > GetHandle < type : : KThread > ( handle ) - > UpdatePriority ( static_cast < u8 > ( priority ) ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
state . logger - > Debug ( " svcSetThreadPriority: Setting thread priority to {} " , priority ) ;
} catch ( const std : : exception & ) {
state . logger - > Warn ( " svcSetThreadPriority: 'handle' invalid: 0x{:X} " , handle ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvHandle ) ;
}
2019-09-24 22:54:27 +02:00
}
2019-10-13 10:04:47 +02:00
void MapSharedMemory ( DeviceState & state ) {
2019-11-17 21:19:01 +01:00
try {
auto object = state . thisProcess - > GetHandle < type : : KSharedMemory > ( state . nce - > GetRegister ( Wreg : : W0 ) ) ;
u64 addr = state . nce - > GetRegister ( Xreg : : X1 ) ;
if ( ( addr & ( PAGE_SIZE - 1U ) ) ) {
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvAddress ) ;
state . logger - > Warn ( " svcMapSharedMemory: 'address' not page aligned: 0x{:X} " , addr ) ;
return ;
}
const u64 size = state . nce - > GetRegister ( Xreg : : X2 ) ;
if ( ( size & ( PAGE_SIZE - 1U ) ) | | ! size ) {
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvSize ) ;
state . logger - > Warn ( " svcMapSharedMemory: 'size' {}: {} " , size ? " not page aligned " : " is zero " , size ) ;
return ;
}
u32 perm = state . nce - > GetRegister ( Wreg : : W3 ) ;
memory : : Permission permission = * reinterpret_cast < memory : : Permission * > ( & perm ) ;
if ( ( permission . w & & ! permission . r ) | | ( permission . x & & ! permission . r ) ) {
state . logger - > Warn ( " svcMapSharedMemory: 'permission' invalid: {}{}{} " , permission . r ? " R " : " - " , permission . w ? " W " : " - " , permission . x ? " X " : " - " ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvPermission ) ;
return ;
}
state . logger - > Debug ( " svcMapSharedMemory: Mapping shared memory at 0x{:X} for {} bytes ({}{}{}) " , addr , size , permission . r ? " R " : " - " , permission . w ? " W " : " - " , permission . x ? " X " : " - " ) ;
object - > Map ( addr , size , permission , state . thisProcess - > mainThread ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
} catch ( const std : : exception & ) {
state . logger - > Warn ( " svcMapSharedMemory: 'handle' invalid: 0x{:X} " , state . nce - > GetRegister ( Wreg : : W0 ) ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvHandle ) ;
2019-09-24 22:54:27 +02:00
}
}
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
void CreateTransferMemory ( DeviceState & state ) {
2019-11-17 21:19:01 +01:00
u64 addr = state . nce - > GetRegister ( Xreg : : X1 ) ;
if ( ( addr & ( PAGE_SIZE - 1U ) ) ) {
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvAddress ) ;
state . logger - > Warn ( " svcCreateTransferMemory: 'address' not page aligned: {} " , addr ) ;
return ;
}
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
u64 size = state . nce - > GetRegister ( Xreg : : X2 ) ;
2019-11-17 21:19:01 +01:00
if ( ( size & ( PAGE_SIZE - 1U ) ) | | ! size ) {
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvSize ) ;
state . logger - > Warn ( " svcCreateTransferMemory: 'size' {}: {} " , size ? " not page aligned " : " is zero " , size ) ;
return ;
}
u32 perm = state . nce - > GetRegister ( Wreg : : W3 ) ;
memory : : Permission permission = * reinterpret_cast < memory : : Permission * > ( & perm ) ;
if ( ( permission . w & & ! permission . r ) | | ( permission . x & & ! permission . r ) ) {
state . logger - > Warn ( " svcCreateTransferMemory: 'permission' invalid: {}{}{} " , permission . r ? " R " : " - " , permission . w ? " W " : " - " , permission . x ? " X " : " - " ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvPermission ) ;
return ;
}
state . logger - > Debug ( " svcCreateTransferMemory: Creating transfer memory at 0x{:X} for {} bytes ({}{}{}) " , addr , size , permission . r ? " R " : " - " , permission . w ? " W " : " - " , permission . x ? " X " : " - " ) ;
auto shmem = state . thisProcess - > NewHandle < type : : KTransferMemory > ( state . thisProcess - > mainThread , addr , size , permission ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
state . nce - > SetRegister ( Wreg : : W1 , shmem . handle ) ;
}
2019-11-17 21:19:01 +01:00
void CloseHandle ( DeviceState & state ) {
auto handle = static_cast < handle_t > ( state . nce - > GetRegister ( Wreg : : W0 ) ) ;
try {
auto & object = state . thisProcess - > handleTable . at ( handle ) ;
switch ( object - > objectType ) {
case ( type : : KType : : KThread ) :
state . os - > KillThread ( std : : static_pointer_cast < type : : KThread > ( object ) - > pid ) ;
break ;
case ( type : : KType : : KProcess ) :
state . os - > KillThread ( std : : static_pointer_cast < type : : KProcess > ( object ) - > mainThread ) ;
break ;
default :
state . thisProcess - > handleTable . erase ( handle ) ;
}
state . logger - > Debug ( " svcCloseHandle: Closing handle: 0x{:X} " , handle ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
} catch ( const std : : exception & ) {
state . logger - > Warn ( " svcCloseHandle: 'handle' invalid: 0x{:X} " , handle ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvHandle ) ;
}
}
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
void ResetSignal ( DeviceState & state ) {
2019-11-17 21:19:01 +01:00
auto handle = state . nce - > GetRegister ( Wreg : : W0 ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
try {
2019-11-17 21:19:01 +01:00
auto & object = state . thisProcess - > handleTable . at ( handle ) ;
switch ( object - > objectType ) {
case ( type : : KType : : KEvent ) :
std : : static_pointer_cast < type : : KEvent > ( object ) - > ResetSignal ( ) ;
break ;
case ( type : : KType : : KProcess ) :
std : : static_pointer_cast < type : : KProcess > ( object ) - > ResetSignal ( ) ;
break ;
default : {
state . logger - > Warn ( " svcResetSignal: 'handle' type invalid: 0x{:X} ({}) " , handle , object - > objectType ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvHandle ) ;
return ;
}
}
state . logger - > Debug ( " svcResetSignal: Resetting signal: 0x{:X} " , handle ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
} catch ( const std : : out_of_range & ) {
state . logger - > Warn ( " svcResetSignal: 'handle' invalid: 0x{:X} " , handle ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvHandle ) ;
return ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
}
}
2019-09-24 22:54:27 +02:00
void WaitSynchronization ( DeviceState & state ) {
auto numHandles = state . nce - > GetRegister ( Wreg : : W2 ) ;
if ( numHandles > constant : : MaxSyncHandles ) {
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : MaxHandles ) ;
return ;
}
2019-10-13 10:04:47 +02:00
std : : vector < handle_t > waitHandles ( numHandles ) ;
state . thisProcess - > ReadMemory ( waitHandles . data ( ) , state . nce - > GetRegister ( Xreg : : X1 ) , numHandles * sizeof ( handle_t ) ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
std : : string handleStr ;
2019-11-15 15:19:24 +01:00
uint index { } ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
for ( const auto & handle : waitHandles ) {
handleStr + = fmt : : format ( " * 0x{:X} \n " , handle ) ;
2019-10-13 10:04:47 +02:00
auto object = state . thisProcess - > handleTable . at ( handle ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
switch ( object - > objectType ) {
2019-10-13 10:04:47 +02:00
case type : : KType : : KProcess :
case type : : KType : : KThread :
case type : : KType : : KEvent :
case type : : KType : : KSession :
break ;
2019-11-15 15:19:24 +01:00
default : {
2019-10-13 10:04:47 +02:00
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvHandle ) ;
2019-11-15 15:19:24 +01:00
state . thisThread - > ClearWaitObjects ( ) ;
2019-10-13 10:04:47 +02:00
return ;
2019-11-15 15:19:24 +01:00
}
2019-10-13 10:04:47 +02:00
}
auto syncObject = std : : static_pointer_cast < type : : KSyncObject > ( object ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
if ( syncObject - > signalled ) {
2019-11-17 21:19:01 +01:00
state . logger - > Debug ( " svcWaitSynchronization: Signalled handle: 0x{:X} " , handle ) ;
2019-10-13 10:04:47 +02:00
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
2019-11-15 15:19:24 +01:00
state . nce - > SetRegister ( Wreg : : W1 , index ) ;
state . thisThread - > ClearWaitObjects ( ) ;
2019-10-13 10:04:47 +02:00
return ;
}
state . thisThread - > waitObjects . push_back ( syncObject ) ;
2019-11-15 15:19:24 +01:00
syncObject - > waitThreads . emplace_back ( state . thisThread - > pid , index ) ;
2019-10-13 10:04:47 +02:00
}
2019-11-17 21:19:01 +01:00
auto timeout = state . nce - > GetRegister ( Xreg : : X3 ) ;
state . logger - > Debug ( " svcWaitSynchronization: Waiting on handles: \n {}Timeout: 0x{:X} ns " , handleStr , timeout ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
if ( state . nce - > GetRegister ( Xreg : : X3 ) ! = std : : numeric_limits < u64 > : : max ( ) )
2019-11-17 21:19:01 +01:00
state . thisThread - > timeout = GetCurrTimeNs ( ) + timeout ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
else
state . thisThread - > timeout = 0 ;
state . thisThread - > status = type : : KThread : : Status : : WaitSync ;
}
2019-10-16 14:41:30 +02:00
void ArbitrateLock ( DeviceState & state ) {
2019-11-17 21:19:01 +01:00
auto addr = state . nce - > GetRegister ( Xreg : : X1 ) ;
if ( ( addr & ( ( 1UL < < WORD_BIT ) - 1U ) ) ) {
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvAddress ) ;
state . logger - > Warn ( " svcArbitrateLock: 'address' not word aligned: {} " , addr ) ;
return ;
}
auto handle = state . nce - > GetRegister ( Wreg : : W2 ) ;
if ( handle ! = state . thisThread - > handle )
throw exception ( " svcArbitrateLock: Called from another thread " ) ;
state . logger - > Debug ( " svcArbitrateLock: Locking mutex at 0x{:X} for thread 0x{:X} " , addr , handle ) ;
state . thisProcess - > MutexLock ( addr ) ;
2019-10-16 14:41:30 +02:00
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
}
void ArbitrateUnlock ( DeviceState & state ) {
2019-11-17 21:19:01 +01:00
auto addr = state . nce - > GetRegister ( Xreg : : X0 ) ;
if ( ( addr & ( ( 1UL < < WORD_BIT ) - 1U ) ) ) {
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvAddress ) ;
state . logger - > Warn ( " svcArbitrateUnlock: 'address' not word aligned: {} " , addr ) ;
return ;
}
state . logger - > Debug ( " svcArbitrateUnlock: Unlocking mutex at 0x{:X} " , addr ) ;
state . thisProcess - > MutexUnlock ( addr ) ;
2019-10-16 14:41:30 +02:00
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
}
void WaitProcessWideKeyAtomic ( DeviceState & state ) {
auto mtxAddr = state . nce - > GetRegister ( Xreg : : X0 ) ;
2019-11-17 21:19:01 +01:00
if ( ( mtxAddr & ( ( 1UL < < WORD_BIT ) - 1U ) ) ) {
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : InvAddress ) ;
state . logger - > Warn ( " svcWaitProcessWideKeyAtomic: mutex address not word aligned: {} " , mtxAddr ) ;
return ;
}
auto handle = state . nce - > GetRegister ( Wreg : : W2 ) ;
if ( handle ! = state . thisThread - > handle )
throw exception ( " svcWaitProcessWideKeyAtomic: Called from another thread " ) ;
2019-10-16 14:41:30 +02:00
state . thisProcess - > MutexUnlock ( mtxAddr ) ;
2019-11-17 21:19:01 +01:00
auto condAddr = state . nce - > GetRegister ( Xreg : : X1 ) ;
auto & cvarVec = state . thisProcess - > condVarMap [ condAddr ] ;
2019-10-16 14:41:30 +02:00
for ( auto thread = cvarVec . begin ( ) ; ; thread + + ) {
if ( ( * thread ) - > priority < state . thisThread - > priority ) {
cvarVec . insert ( thread , state . thisThread ) ;
break ;
} else if ( thread + 1 = = cvarVec . end ( ) ) {
cvarVec . push_back ( state . thisThread ) ;
break ;
}
}
2019-11-17 21:19:01 +01:00
auto timeout = state . nce - > GetRegister ( Xreg : : X3 ) ;
state . logger - > Debug ( " svcWaitProcessWideKeyAtomic: Mutex: 0x{:X}, Conditional-Variable: 0x:{:X}, Timeout: {} ns " , mtxAddr , condAddr , timeout ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
state . thisThread - > status = type : : KThread : : Status : : WaitCondVar ;
2019-11-17 21:19:01 +01:00
state . thisThread - > timeout = GetCurrTimeNs ( ) + timeout ;
2019-10-16 14:41:30 +02:00
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
}
void SignalProcessWideKey ( DeviceState & state ) {
auto address = state . nce - > GetRegister ( Xreg : : X0 ) ;
auto count = state . nce - > GetRegister ( Wreg : : W1 ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
2019-11-17 21:19:01 +01:00
if ( ! state . thisProcess - > condVarMap . count ( address ) ) {
state . logger - > Warn ( " svcSignalProcessWideKey: No Conditional-Variable at 0x{:X} " , address ) ;
return ;
}
auto & cvarVec = state . thisProcess - > condVarMap . at ( address ) ;
2019-10-16 14:41:30 +02:00
count = std : : min ( count , static_cast < u32 > ( cvarVec . size ( ) ) ) ;
for ( uint index = 0 ; index < count ; index + + )
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
cvarVec [ index ] - > status = type : : KThread : : Status : : Runnable ;
2019-10-16 14:41:30 +02:00
cvarVec . erase ( cvarVec . begin ( ) , cvarVec . begin ( ) + count ) ;
if ( cvarVec . empty ( ) )
state . thisProcess - > condVarMap . erase ( address ) ;
2019-11-17 21:19:01 +01:00
state . logger - > Debug ( " svcSignalProcessWideKey: Signalling Conditional-Variable at 0x{:X} for {} " , address , count ) ;
}
void GetSystemTick ( DeviceState & state ) {
u64 tick ;
asm ( " STR X1, [SP, #-16]! \n \t "
" MRS %0, CNTVCT_EL0 \n \t "
" MOV X1, #0xF800 \n \t "
" MOVK X1, #0x124, lsl #16 \n \t "
" MUL %0, %0, X1 \n \t "
" MRS X1, CNTFRQ_EL0 \n \t "
" UDIV %0, %0, X1 \n \t "
" LDR X1, [SP], #16 " : " =r " ( tick ) ) ;
state . nce - > SetRegister ( Xreg : : X0 , tick ) ;
2019-09-24 22:54:27 +02:00
}
void ConnectToNamedPort ( DeviceState & state ) {
2019-11-17 21:19:01 +01:00
char port [ constant : : PortSize + 1 ] { 0 } ;
2019-09-24 22:54:27 +02:00
state . os - > thisProcess - > ReadMemory ( port , state . nce - > GetRegister ( Xreg : : X1 ) , constant : : PortSize ) ;
2019-11-17 21:19:01 +01:00
handle_t handle { } ;
2019-09-24 22:54:27 +02:00
if ( std : : strcmp ( port , " sm: " ) = = 0 )
2019-11-17 21:19:01 +01:00
handle = state . os - > serviceManager . NewSession ( service : : Service : : sm ) ;
else {
state . logger - > Warn ( " svcConnectToNamedPort: Connecting to invalid port: '{}' " , port ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : NotFound ) ;
return ;
}
state . logger - > Debug ( " svcConnectToNamedPort: Connecting to port '{}' at 0x{:X} " , port , handle ) ;
state . nce - > SetRegister ( Wreg : : W1 , handle ) ;
2019-09-24 22:54:27 +02:00
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
}
void SendSyncRequest ( DeviceState & state ) {
state . os - > serviceManager . SyncRequestHandler ( static_cast < handle_t > ( state . nce - > GetRegister ( Xreg : : X0 ) ) ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
}
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
void GetThreadId ( DeviceState & state ) {
pid_t pid { } ;
2019-11-17 21:19:01 +01:00
auto handle = state . nce - > GetRegister ( Wreg : : W1 ) ;
if ( handle ! = constant : : ThreadSelf ) {
pid = state . thisProcess - > GetHandle < type : : KThread > ( handle ) - > pid ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
} else
pid = state . thisThread - > pid ;
2019-11-17 21:19:01 +01:00
state . logger - > Debug ( " svcGetThreadId: Handle: 0x{:X}, PID: {} " , handle , pid ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
state . nce - > SetRegister ( Xreg : : X1 , static_cast < u64 > ( pid ) ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
}
2019-09-24 22:54:27 +02:00
void OutputDebugString ( DeviceState & state ) {
std : : string debug ( state . nce - > GetRegister ( Xreg : : X1 ) , ' \0 ' ) ;
Framebuffer and NativeActivity
What was added:
* Framebuffer
* NativeActivity
* NV Services
* IOCTL Handler
* NV Devices:
* * /dev/nvmap - 0xC0080101, 0xC0080103, 0xC0200104, 0xC0180105, 0xC00C0109, 0xC008010E
* * /dev/nvhost-as-gpu
* * /dev/nvhost-channel - 0x40044801, 0xC0104809, 0xC010480B, 0xC018480C, 0x4004480D, 0xC020481A, 0x40084714
* * /dev/nvhost-ctrl
* * /dev/nvhost-ctrl-gpu - 0x80044701, 0x80284702, 0xC0184706, 0xC0B04705, 0x80084714
* SVCs:
* * SetMemoryAttribute
* * CreateTransferMemory
* * ResetSignal
* * GetSystemTick
* Addition of Compact Logger
What was fixed:
* SVCs:
* * SetHeapSize
* * SetMemoryAttribute
* * QueryMemory
* A release build would not set CMAKE_BUILD_TYPE to "RELEASE"
* The logger code was simplified
2019-11-13 21:09:31 +01:00
state . os - > thisProcess - > ReadMemory ( debug . data ( ) , state . nce - > GetRegister ( Xreg : : X0 ) , state . nce - > GetRegister ( Xreg : : X1 ) ) ;
state . logger - > Info ( " Debug Output: {} " , debug ) ;
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
2019-09-24 22:54:27 +02:00
}
void GetInfo ( DeviceState & state ) {
2019-11-17 21:19:01 +01:00
auto id0 = state . nce - > GetRegister ( Wreg : : W1 ) ;
auto handle = state . nce - > GetRegister ( Wreg : : W2 ) ;
auto id1 = state . nce - > GetRegister ( Xreg : : X3 ) ;
u64 out { } ;
switch ( id0 ) {
2019-09-24 22:54:27 +02:00
case constant : : infoState : : AllowedCpuIdBitmask :
case constant : : infoState : : AllowedThreadPriorityMask :
case constant : : infoState : : IsCurrentProcessBeingDebugged :
case constant : : infoState : : TitleId :
case constant : : infoState : : PrivilegedProcessId :
break ;
case constant : : infoState : : AliasRegionBaseAddr :
2019-11-17 21:19:01 +01:00
out = constant : : MapAddr ;
2019-09-24 22:54:27 +02:00
break ;
case constant : : infoState : : AliasRegionSize :
2019-11-17 21:19:01 +01:00
out = constant : : MapSize ;
2019-09-24 22:54:27 +02:00
break ;
case constant : : infoState : : HeapRegionBaseAddr :
2019-11-17 21:19:01 +01:00
out = state . os - > thisProcess - > memoryRegionMap . at ( memory : : Region : : Heap ) - > address ;
2019-09-24 22:54:27 +02:00
break ;
case constant : : infoState : : HeapRegionSize :
2019-11-17 21:19:01 +01:00
out = state . os - > thisProcess - > memoryRegionMap . at ( memory : : Region : : Heap ) - > size ;
2019-09-24 22:54:27 +02:00
break ;
case constant : : infoState : : TotalMemoryAvailable :
2019-11-17 21:19:01 +01:00
out = constant : : TotalPhyMem ;
2019-09-24 22:54:27 +02:00
break ;
case constant : : infoState : : TotalMemoryUsage :
2019-11-17 21:19:01 +01:00
out = state . os - > thisProcess - > memoryRegionMap . at ( memory : : Region : : Heap ) - > address + state . thisProcess - > mainThreadStackSz + state . thisProcess - > GetProgramSize ( ) ;
2019-09-24 22:54:27 +02:00
break ;
case constant : : infoState : : AddressSpaceBaseAddr :
2019-11-17 21:19:01 +01:00
out = constant : : BaseAddr ;
2019-09-24 22:54:27 +02:00
break ;
case constant : : infoState : : AddressSpaceSize :
2019-11-17 21:19:01 +01:00
out = constant : : BaseSize ;
2019-09-24 22:54:27 +02:00
break ;
case constant : : infoState : : StackRegionBaseAddr :
2019-11-17 21:19:01 +01:00
out = state . thisThread - > stackTop ;
2019-09-24 22:54:27 +02:00
break ;
case constant : : infoState : : StackRegionSize :
2019-11-17 21:19:01 +01:00
out = state . thisProcess - > mainThreadStackSz ;
2019-09-24 22:54:27 +02:00
break ;
case constant : : infoState : : PersonalMmHeapSize :
2019-11-17 21:19:01 +01:00
out = constant : : TotalPhyMem ;
2019-09-24 22:54:27 +02:00
break ;
case constant : : infoState : : PersonalMmHeapUsage :
2019-11-17 21:19:01 +01:00
out = state . os - > thisProcess - > memoryRegionMap . at ( memory : : Region : : Heap ) - > address + state . thisProcess - > mainThreadStackSz ;
2019-09-24 22:54:27 +02:00
break ;
case constant : : infoState : : TotalMemoryAvailableWithoutMmHeap :
2019-11-17 21:19:01 +01:00
out = constant : : TotalPhyMem ; // TODO: NPDM specifies SystemResourceSize, subtract that from this
2019-09-24 22:54:27 +02:00
break ;
case constant : : infoState : : TotalMemoryUsedWithoutMmHeap :
2019-11-17 21:19:01 +01:00
out = state . os - > thisProcess - > memoryRegionMap . at ( memory : : Region : : Heap ) - > address + state . thisProcess - > mainThreadStackSz ; // TODO: Same as above
2019-09-24 22:54:27 +02:00
break ;
case constant : : infoState : : UserExceptionContextAddr :
2019-11-17 21:19:01 +01:00
out = state . thisProcess - > tlsPages [ 0 ] - > Get ( 0 ) ;
2019-09-24 22:54:27 +02:00
break ;
default :
2019-11-17 21:19:01 +01:00
state . logger - > Warn ( " svcGetInfo: Unimplemented case ID0: {}, ID1: {} " , id0 , id1 ) ;
2019-09-24 22:54:27 +02:00
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Unimpl ) ;
return ;
}
2019-11-17 21:19:01 +01:00
state . logger - > Debug ( " svcGetInfo: ID0: {}, ID1: {}, Out: 0x{:X} " , id0 , id1 , out ) ;
state . nce - > SetRegister ( Xreg : : X1 , out ) ;
2019-09-24 22:54:27 +02:00
state . nce - > SetRegister ( Wreg : : W0 , constant : : status : : Success ) ;
}
}