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
|
|
|
|
|
2019-10-13 10:04:47 +02:00
|
|
|
#include <common.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/base_service.h>
|
2019-09-24 22:54:27 +02:00
|
|
|
#include "KSyncObject.h"
|
|
|
|
|
|
|
|
namespace skyline::kernel::type {
|
|
|
|
/**
|
|
|
|
* @brief KService holds a reference to a service, this is equivalent to KClientSession
|
|
|
|
*/
|
|
|
|
class KSession : public KSyncObject {
|
|
|
|
public:
|
|
|
|
const std::shared_ptr<service::BaseService> serviceObject; //!< A shared pointer to the service class
|
2020-03-25 18:59:37 +01:00
|
|
|
std::unordered_map<KHandle, std::shared_ptr<service::BaseService>> domainTable; //!< This maps from a virtual handle to it's service
|
|
|
|
KHandle handleIndex{0x1}; //!< The currently allocated handle index
|
2019-09-24 22:54:27 +02:00
|
|
|
const service::Service serviceType; //!< The type of the service
|
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
|
|
|
enum class ServiceStatus { Open, Closed } serviceStatus{ServiceStatus::Open}; //!< If the session is open or closed
|
2019-09-24 22:54:27 +02:00
|
|
|
bool isDomain{}; //!< Holds if this is a domain session or not
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param state The state of the device
|
|
|
|
* @param serviceObject A shared pointer to the service class
|
|
|
|
*/
|
2019-10-16 22:23:35 +02:00
|
|
|
KSession(const DeviceState &state, std::shared_ptr<service::BaseService> &serviceObject) : serviceObject(serviceObject), serviceType(serviceObject->serviceType), KSyncObject(state, KType::KSession) {}
|
2019-09-24 22:54:27 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This converts this session into a domain session (https://switchbrew.org/wiki/IPC_Marshalling#Domains)
|
|
|
|
* @return The virtual handle of this service in the domain
|
|
|
|
*/
|
2020-03-25 18:59:37 +01:00
|
|
|
KHandle ConvertDomain() {
|
2019-09-24 22:54:27 +02:00
|
|
|
isDomain = true;
|
|
|
|
domainTable[handleIndex] = serviceObject;
|
|
|
|
return handleIndex++;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|