1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-13 23:46:40 +00:00

kern: session mapping getters are on the hotpath

This commit is contained in:
Michael Scire 2020-12-02 03:52:08 -08:00
parent 60ea4a1b1c
commit eccadf2958

View file

@ -45,10 +45,10 @@ namespace ams::kern {
this->state = st; this->state = st;
} }
constexpr KProcessAddress GetClientAddress() const { return this->client_address; } constexpr ALWAYS_INLINE KProcessAddress GetClientAddress() const { return this->client_address; }
constexpr KProcessAddress GetServerAddress() const { return this->server_address; } constexpr ALWAYS_INLINE KProcessAddress GetServerAddress() const { return this->server_address; }
constexpr size_t GetSize() const { return this->size; } constexpr ALWAYS_INLINE size_t GetSize() const { return this->size; }
constexpr KMemoryState GetMemoryState() const { return this->state; } constexpr ALWAYS_INLINE KMemoryState GetMemoryState() const { return this->state; }
}; };
private: private:
Mapping static_mappings[NumStaticMappings]; Mapping static_mappings[NumStaticMappings];
@ -62,32 +62,32 @@ namespace ams::kern {
void Initialize() { /* ... */ } void Initialize() { /* ... */ }
void Finalize(); void Finalize();
constexpr size_t GetSendCount() const { return this->num_send; } constexpr ALWAYS_INLINE size_t GetSendCount() const { return this->num_send; }
constexpr size_t GetReceiveCount() const { return this->num_recv; } constexpr ALWAYS_INLINE size_t GetReceiveCount() const { return this->num_recv; }
constexpr size_t GetExchangeCount() const { return this->num_exch; } constexpr ALWAYS_INLINE size_t GetExchangeCount() const { return this->num_exch; }
Result PushSend(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state); Result PushSend(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state);
Result PushReceive(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state); Result PushReceive(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state);
Result PushExchange(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state); Result PushExchange(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state);
constexpr KProcessAddress GetSendClientAddress(size_t i) const { return GetSendMapping(i).GetClientAddress(); } constexpr ALWAYS_INLINE KProcessAddress GetSendClientAddress(size_t i) const { return GetSendMapping(i).GetClientAddress(); }
constexpr KProcessAddress GetSendServerAddress(size_t i) const { return GetSendMapping(i).GetServerAddress(); } constexpr ALWAYS_INLINE KProcessAddress GetSendServerAddress(size_t i) const { return GetSendMapping(i).GetServerAddress(); }
constexpr size_t GetSendSize(size_t i) const { return GetSendMapping(i).GetSize(); } constexpr ALWAYS_INLINE size_t GetSendSize(size_t i) const { return GetSendMapping(i).GetSize(); }
constexpr KMemoryState GetSendMemoryState(size_t i) const { return GetSendMapping(i).GetMemoryState(); } constexpr ALWAYS_INLINE KMemoryState GetSendMemoryState(size_t i) const { return GetSendMapping(i).GetMemoryState(); }
constexpr KProcessAddress GetReceiveClientAddress(size_t i) const { return GetReceiveMapping(i).GetClientAddress(); } constexpr ALWAYS_INLINE KProcessAddress GetReceiveClientAddress(size_t i) const { return GetReceiveMapping(i).GetClientAddress(); }
constexpr KProcessAddress GetReceiveServerAddress(size_t i) const { return GetReceiveMapping(i).GetServerAddress(); } constexpr ALWAYS_INLINE KProcessAddress GetReceiveServerAddress(size_t i) const { return GetReceiveMapping(i).GetServerAddress(); }
constexpr size_t GetReceiveSize(size_t i) const { return GetReceiveMapping(i).GetSize(); } constexpr ALWAYS_INLINE size_t GetReceiveSize(size_t i) const { return GetReceiveMapping(i).GetSize(); }
constexpr KMemoryState GetReceiveMemoryState(size_t i) const { return GetReceiveMapping(i).GetMemoryState(); } constexpr ALWAYS_INLINE KMemoryState GetReceiveMemoryState(size_t i) const { return GetReceiveMapping(i).GetMemoryState(); }
constexpr KProcessAddress GetExchangeClientAddress(size_t i) const { return GetExchangeMapping(i).GetClientAddress(); } constexpr ALWAYS_INLINE KProcessAddress GetExchangeClientAddress(size_t i) const { return GetExchangeMapping(i).GetClientAddress(); }
constexpr KProcessAddress GetExchangeServerAddress(size_t i) const { return GetExchangeMapping(i).GetServerAddress(); } constexpr ALWAYS_INLINE KProcessAddress GetExchangeServerAddress(size_t i) const { return GetExchangeMapping(i).GetServerAddress(); }
constexpr size_t GetExchangeSize(size_t i) const { return GetExchangeMapping(i).GetSize(); } constexpr ALWAYS_INLINE size_t GetExchangeSize(size_t i) const { return GetExchangeMapping(i).GetSize(); }
constexpr KMemoryState GetExchangeMemoryState(size_t i) const { return GetExchangeMapping(i).GetMemoryState(); } constexpr ALWAYS_INLINE KMemoryState GetExchangeMemoryState(size_t i) const { return GetExchangeMapping(i).GetMemoryState(); }
private: private:
Result PushMap(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state, size_t index); Result PushMap(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state, size_t index);
constexpr const Mapping &GetSendMapping(size_t i) const { constexpr ALWAYS_INLINE const Mapping &GetSendMapping(size_t i) const {
MESOSPHERE_ASSERT(i < this->num_send); MESOSPHERE_ASSERT(i < this->num_send);
const size_t index = i; const size_t index = i;
@ -98,7 +98,7 @@ namespace ams::kern {
} }
} }
constexpr const Mapping &GetReceiveMapping(size_t i) const { constexpr ALWAYS_INLINE const Mapping &GetReceiveMapping(size_t i) const {
MESOSPHERE_ASSERT(i < this->num_recv); MESOSPHERE_ASSERT(i < this->num_recv);
const size_t index = this->num_send + i; const size_t index = this->num_send + i;
@ -109,7 +109,7 @@ namespace ams::kern {
} }
} }
constexpr const Mapping &GetExchangeMapping(size_t i) const { constexpr ALWAYS_INLINE const Mapping &GetExchangeMapping(size_t i) const {
MESOSPHERE_ASSERT(i < this->num_exch); MESOSPHERE_ASSERT(i < this->num_exch);
const size_t index = this->num_send + this->num_recv + i; const size_t index = this->num_send + this->num_recv + i;
@ -176,50 +176,50 @@ namespace ams::kern {
static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ } static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ }
constexpr KThread *GetThread() const { return this->thread; } constexpr ALWAYS_INLINE KThread *GetThread() const { return this->thread; }
constexpr KWritableEvent *GetEvent() const { return this->event; } constexpr ALWAYS_INLINE KWritableEvent *GetEvent() const { return this->event; }
constexpr uintptr_t GetAddress() const { return this->address; } constexpr ALWAYS_INLINE uintptr_t GetAddress() const { return this->address; }
constexpr size_t GetSize() const { return this->size; } constexpr ALWAYS_INLINE size_t GetSize() const { return this->size; }
constexpr KProcess *GetServerProcess() const { return this->server; } constexpr ALWAYS_INLINE KProcess *GetServerProcess() const { return this->server; }
void SetServerProcess(KProcess *process) { void ALWAYS_INLINE SetServerProcess(KProcess *process) {
this->server = process; this->server = process;
this->server->Open(); this->server->Open();
} }
constexpr void ClearThread() { this->thread = nullptr; } constexpr ALWAYS_INLINE void ClearThread() { this->thread = nullptr; }
constexpr void ClearEvent() { this->event = nullptr; } constexpr ALWAYS_INLINE void ClearEvent() { this->event = nullptr; }
constexpr size_t GetSendCount() const { return this->mappings.GetSendCount(); } constexpr ALWAYS_INLINE size_t GetSendCount() const { return this->mappings.GetSendCount(); }
constexpr size_t GetReceiveCount() const { return this->mappings.GetReceiveCount(); } constexpr ALWAYS_INLINE size_t GetReceiveCount() const { return this->mappings.GetReceiveCount(); }
constexpr size_t GetExchangeCount() const { return this->mappings.GetExchangeCount(); } constexpr ALWAYS_INLINE size_t GetExchangeCount() const { return this->mappings.GetExchangeCount(); }
Result PushSend(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) { ALWAYS_INLINE Result PushSend(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) {
return this->mappings.PushSend(client, server, size, state); return this->mappings.PushSend(client, server, size, state);
} }
Result PushReceive(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) { ALWAYS_INLINE Result PushReceive(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) {
return this->mappings.PushReceive(client, server, size, state); return this->mappings.PushReceive(client, server, size, state);
} }
Result PushExchange(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) { ALWAYS_INLINE Result PushExchange(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) {
return this->mappings.PushExchange(client, server, size, state); return this->mappings.PushExchange(client, server, size, state);
} }
constexpr KProcessAddress GetSendClientAddress(size_t i) const { return this->mappings.GetSendClientAddress(i); } constexpr ALWAYS_INLINE KProcessAddress GetSendClientAddress(size_t i) const { return this->mappings.GetSendClientAddress(i); }
constexpr KProcessAddress GetSendServerAddress(size_t i) const { return this->mappings.GetSendServerAddress(i); } constexpr ALWAYS_INLINE KProcessAddress GetSendServerAddress(size_t i) const { return this->mappings.GetSendServerAddress(i); }
constexpr size_t GetSendSize(size_t i) const { return this->mappings.GetSendSize(i); } constexpr ALWAYS_INLINE size_t GetSendSize(size_t i) const { return this->mappings.GetSendSize(i); }
constexpr KMemoryState GetSendMemoryState(size_t i) const { return this->mappings.GetSendMemoryState(i); } constexpr ALWAYS_INLINE KMemoryState GetSendMemoryState(size_t i) const { return this->mappings.GetSendMemoryState(i); }
constexpr KProcessAddress GetReceiveClientAddress(size_t i) const { return this->mappings.GetReceiveClientAddress(i); } constexpr ALWAYS_INLINE KProcessAddress GetReceiveClientAddress(size_t i) const { return this->mappings.GetReceiveClientAddress(i); }
constexpr KProcessAddress GetReceiveServerAddress(size_t i) const { return this->mappings.GetReceiveServerAddress(i); } constexpr ALWAYS_INLINE KProcessAddress GetReceiveServerAddress(size_t i) const { return this->mappings.GetReceiveServerAddress(i); }
constexpr size_t GetReceiveSize(size_t i) const { return this->mappings.GetReceiveSize(i); } constexpr ALWAYS_INLINE size_t GetReceiveSize(size_t i) const { return this->mappings.GetReceiveSize(i); }
constexpr KMemoryState GetReceiveMemoryState(size_t i) const { return this->mappings.GetReceiveMemoryState(i); } constexpr ALWAYS_INLINE KMemoryState GetReceiveMemoryState(size_t i) const { return this->mappings.GetReceiveMemoryState(i); }
constexpr KProcessAddress GetExchangeClientAddress(size_t i) const { return this->mappings.GetExchangeClientAddress(i); } constexpr ALWAYS_INLINE KProcessAddress GetExchangeClientAddress(size_t i) const { return this->mappings.GetExchangeClientAddress(i); }
constexpr KProcessAddress GetExchangeServerAddress(size_t i) const { return this->mappings.GetExchangeServerAddress(i); } constexpr ALWAYS_INLINE KProcessAddress GetExchangeServerAddress(size_t i) const { return this->mappings.GetExchangeServerAddress(i); }
constexpr size_t GetExchangeSize(size_t i) const { return this->mappings.GetExchangeSize(i); } constexpr ALWAYS_INLINE size_t GetExchangeSize(size_t i) const { return this->mappings.GetExchangeSize(i); }
constexpr KMemoryState GetExchangeMemoryState(size_t i) const { return this->mappings.GetExchangeMemoryState(i); } constexpr ALWAYS_INLINE KMemoryState GetExchangeMemoryState(size_t i) const { return this->mappings.GetExchangeMemoryState(i); }
}; };
} }