2019-09-24 22:54:27 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#include <thread>
|
|
|
|
#include "common.h"
|
|
|
|
#include "kernel/ipc.h"
|
|
|
|
#include "kernel/types/KProcess.h"
|
|
|
|
#include "kernel/types/KThread.h"
|
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
|
|
|
#include "services/serviceman.h"
|
2019-09-24 22:54:27 +02:00
|
|
|
#include "nce.h"
|
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
|
|
|
#include "gpu.h"
|
2019-09-24 22:54:27 +02:00
|
|
|
|
|
|
|
namespace skyline::kernel {
|
|
|
|
/**
|
|
|
|
* @brief The OS class manages the interaction between Skyline components and the underlying OS in NCE
|
|
|
|
*/
|
|
|
|
class OS {
|
|
|
|
private:
|
|
|
|
DeviceState state; //!< The state of the device
|
|
|
|
|
|
|
|
public:
|
2019-10-13 10:04:47 +02:00
|
|
|
std::unordered_map<pid_t, std::shared_ptr<type::KProcess>> processMap; //!< A mapping from a threat's PID to it's KProcess object
|
2019-09-24 22:54:27 +02:00
|
|
|
std::vector<pid_t> processVec; //!< A vector of all processes by their main thread's PID
|
|
|
|
std::shared_ptr<type::KProcess> thisProcess; //!< The corresponding KProcess object of the process that's called an SVC
|
|
|
|
std::shared_ptr<type::KThread> thisThread; //!< The corresponding KThread object of the thread that's called an SVC
|
|
|
|
service::ServiceManager serviceManager; //!< This manages all of the service functions
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param logger An instance of the Logger class
|
|
|
|
* @param settings An instance of the Settings class
|
2019-11-22 15:59:50 +01:00
|
|
|
* @param window The ANativeWindow object to draw the screen to
|
2019-09-24 22:54:27 +02:00
|
|
|
*/
|
2019-12-02 18:40:53 +01:00
|
|
|
OS(std::shared_ptr<JvmManager>& jvmManager, std::shared_ptr<Logger> &logger, std::shared_ptr<Settings> &settings);
|
2019-09-24 22:54:27 +02:00
|
|
|
|
|
|
|
/**
|
2019-11-22 15:59:50 +01:00
|
|
|
* @brief Execute a particular ROM file. This launches the main process and calls the NCE class to handle execution.
|
2019-12-02 18:40:53 +01:00
|
|
|
* @param romFd A FD to the ROM file to execute
|
|
|
|
* @param romType The type of the ROM file
|
2019-09-24 22:54:27 +02:00
|
|
|
*/
|
2019-12-02 18:40:53 +01:00
|
|
|
void Execute(const int romFd, const TitleFormat romType);
|
2019-09-24 22:54:27 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Creates a new process
|
|
|
|
* @param address The address of the initial function
|
|
|
|
* @param stackSize The size of the main stack
|
|
|
|
* @return An instance of the KProcess of the created process
|
|
|
|
*/
|
|
|
|
std::shared_ptr<type::KProcess> CreateProcess(u64 address, size_t stackSize);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Kill a particular thread
|
|
|
|
* @param pid The PID of the thread
|
|
|
|
*/
|
|
|
|
void KillThread(pid_t pid);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Handles a particular SuperVisor Call
|
|
|
|
* @param svc The ID of the SVC to be called
|
|
|
|
*/
|
2019-11-17 21:19:01 +01:00
|
|
|
void SvcHandler(const u16 svc);
|
2019-09-24 22:54:27 +02:00
|
|
|
};
|
|
|
|
}
|