2020-04-19 23:04:05 +02:00
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
2020-03-27 20:36:02 +01:00
|
|
|
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
|
|
|
|
2019-09-24 22:54:27 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <thread>
|
2020-03-26 15:33:19 +01:00
|
|
|
#include <sys/mman.h>
|
2019-09-24 22:54:27 +02:00
|
|
|
#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"
|
|
|
|
#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:
|
2020-01-01 14:11:25 +01:00
|
|
|
std::shared_ptr<type::KProcess> process; //!< The KProcess object for the emulator, representing the guest process
|
2019-09-24 22:54:27 +02:00
|
|
|
service::ServiceManager serviceManager; //!< This manages all of the service functions
|
2020-01-21 08:16:57 +01:00
|
|
|
MemoryManager memory; //!< The MemoryManager object for this process
|
2019-09-24 22:54:27 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @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
|
|
|
*/
|
2020-01-11 05:52:25 +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
|
2020-01-07 03:36:08 +01:00
|
|
|
* @param entry The entry point for the new process
|
|
|
|
* @param argument The argument for the initial function
|
2019-09-24 22:54:27 +02:00
|
|
|
* @param stackSize The size of the main stack
|
|
|
|
* @return An instance of the KProcess of the created process
|
|
|
|
*/
|
2020-01-07 03:36:08 +01:00
|
|
|
std::shared_ptr<type::KProcess> CreateProcess(u64 entry, u64 argument, size_t stackSize);
|
2019-09-24 22:54:27 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Kill a particular thread
|
|
|
|
* @param pid The PID of the thread
|
|
|
|
*/
|
|
|
|
void KillThread(pid_t pid);
|
|
|
|
};
|
|
|
|
}
|