htc: skeleton constructors for htcmisc

This commit is contained in:
Michael Scire 2021-02-09 20:43:40 -08:00 committed by SciresM
parent b925344c3b
commit 1f03b11dbc
12 changed files with 310 additions and 6 deletions

View file

@ -0,0 +1,40 @@
/*
* Copyright (c) 2018-2020 Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
#include "htc_htcmisc_rpc_server.hpp"
namespace ams::htc::server::rpc {
namespace {
constexpr inline size_t ReceiveThreadStackSize = os::MemoryPageSize;
alignas(os::ThreadStackAlignment) constinit u8 g_receive_thread_stack[ReceiveThreadStackSize];
}
HtcmiscRpcServer::HtcmiscRpcServer(driver::IDriver *driver, htclow::ChannelId channel)
: m_00(0),
m_driver(driver),
m_channel_id(channel),
m_receive_thread_stack(g_receive_thread_stack),
m_cancelled(false),
m_thread_running(false)
{
/* ... */
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright (c) 2018-2020 Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
#include "htc_rpc_client.hpp"
namespace ams::htc::server::rpc {
namespace {
constexpr inline size_t ThreadStackSize = os::MemoryPageSize;
alignas(os::ThreadStackAlignment) constinit u8 g_receive_thread_stack[ThreadStackSize];
alignas(os::ThreadStackAlignment) constinit u8 g_send_thread_stack[ThreadStackSize];
constinit os::SdkMutex g_rpc_mutex;
}
RpcClient::RpcClient(driver::IDriver *driver, htclow::ChannelId channel)
: m_00(0),
m_driver(driver),
m_channel_id(channel),
m_receive_thread_stack(g_receive_thread_stack),
m_send_thread_stack(g_send_thread_stack),
m_mutex(g_rpc_mutex),
m_cancelled(false),
m_thread_running(false)
{
/* Initialize all events. */
/* TODO: MaxTaskCount? */
for (size_t i = 0; i < util::size(m_5F8_events); ++i) {
os::InitializeEvent(std::addressof(m_5F8_events[i]), false, os::EventClearMode_AutoClear);
os::InitializeEvent(std::addressof(m_1138_events[i]), false, os::EventClearMode_AutoClear);
}
/* TODO: Clear all of m_3C0 array to zero. */
}
}

View file

@ -28,7 +28,7 @@ namespace ams::htc::server::rpc {
void *m_send_thread_stack;
os::ThreadType m_receive_thread;
os::ThreadType m_send_thread;
os::SdkMutex *m_p_mutex;
os::SdkMutex &m_mutex;
/* TODO: m_task_id_free_list */
/* TODO: m_task_table */
/* TODO: m_3C0[0x48] */