mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 20:31:14 +00:00
Add KInterruptEvent skeleton; remove useless funcs
This commit is contained in:
parent
2949d08eb2
commit
5222b429c5
8 changed files with 83 additions and 19 deletions
|
@ -19,6 +19,10 @@ namespace mesosphere
|
|||
class KProcess;
|
||||
class KResourceLimit;
|
||||
class KThread;
|
||||
class KEvent;
|
||||
class KReadableEvent;
|
||||
class KWritableEvent;
|
||||
class KInterruptEvent;
|
||||
|
||||
void intrusive_ptr_add_ref(KProcess *obj);
|
||||
void intrusive_ptr_release(KProcess *obj);
|
||||
|
@ -26,6 +30,18 @@ void intrusive_ptr_release(KProcess *obj);
|
|||
void intrusive_ptr_add_ref(KResourceLimit *obj);
|
||||
void intrusive_ptr_release(KResourceLimit *obj);
|
||||
|
||||
void intrusive_ptr_add_ref(KEvent *obj);
|
||||
void intrusive_ptr_release(KEvent *obj);
|
||||
|
||||
void intrusive_ptr_add_ref(KReadableEvent *obj);
|
||||
void intrusive_ptr_release(KReadableEvent *obj);
|
||||
|
||||
void intrusive_ptr_add_ref(KWritableEvent *obj);
|
||||
void intrusive_ptr_release(KWritableEvent *obj);
|
||||
|
||||
void intrusive_ptr_add_ref(KInterruptEvent *obj);
|
||||
void intrusive_ptr_release(KInterruptEvent *obj);
|
||||
|
||||
class KAutoObject {
|
||||
public:
|
||||
|
||||
|
|
|
@ -21,11 +21,6 @@ class IClient : public IClientTag {
|
|||
void *operator new(size_t sz) noexcept = delete;
|
||||
void operator delete(void *ptr) noexcept {}
|
||||
|
||||
~IClient()
|
||||
{
|
||||
parent->HandleClientDestroyed();
|
||||
}
|
||||
|
||||
const SharedPtr<Parent>& GetParent() const { return parent; }
|
||||
|
||||
void SetParent(SharedPtr<Parent> parent)
|
||||
|
|
|
@ -21,11 +21,6 @@ class IServer : public IServerTag {
|
|||
void *operator new(size_t sz) noexcept = delete;
|
||||
void operator delete(void *ptr) noexcept {};
|
||||
|
||||
~IServer()
|
||||
{
|
||||
parent->HandleServerDestroyed();
|
||||
}
|
||||
|
||||
const SharedPtr<Parent> &GetParent() const { return parent; }
|
||||
|
||||
void SetParentAndClient(SharedPtr<Parent> parent, SharedPtr<Client> client)
|
||||
|
|
38
mesosphere/include/mesosphere/interrupts/KInterruptEvent.hpp
Normal file
38
mesosphere/include/mesosphere/interrupts/KInterruptEvent.hpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
#pragma once
|
||||
|
||||
#include <mesosphere/processes/KReadableEvent.hpp>
|
||||
#include <mesosphere/interfaces/ISetAllocated.hpp>
|
||||
|
||||
namespace mesosphere
|
||||
{
|
||||
|
||||
class KInterruptEvent final : public KReadableEvent, public ISetAllocated<KInterruptEvent> {
|
||||
public:
|
||||
MESOSPHERE_AUTO_OBJECT_TRAITS(ReadableEvent, InterruptEvent);
|
||||
|
||||
void *operator new(size_t sz) noexcept { return ISetAllocated<KInterruptEvent>::operator new(sz); }
|
||||
void operator delete(void *ptr) noexcept { ISetAllocated<KInterruptEvent>::operator delete(ptr); }
|
||||
|
||||
virtual ~KInterruptEvent();
|
||||
Result Initialize(int irqId, u32 flags);
|
||||
|
||||
// KAutoObject
|
||||
virtual bool IsAlive() const override;
|
||||
|
||||
private:
|
||||
// TODO: receiver
|
||||
int irqId = -1;
|
||||
bool isInitialized = false;
|
||||
};
|
||||
|
||||
inline void intrusive_ptr_add_ref(KInterruptEvent *obj)
|
||||
{
|
||||
intrusive_ptr_add_ref((KAutoObject *)obj);
|
||||
}
|
||||
|
||||
inline void intrusive_ptr_release(KInterruptEvent *obj)
|
||||
{
|
||||
intrusive_ptr_release((KAutoObject *)obj);
|
||||
}
|
||||
|
||||
}
|
|
@ -31,10 +31,6 @@ class KEvent final :
|
|||
/* KAutoObject */
|
||||
virtual bool IsAlive() const override;
|
||||
|
||||
/* IClientServerParent */
|
||||
void HandleServerDestroyed() { }
|
||||
void HandleClientDestroyed() { }
|
||||
|
||||
private:
|
||||
bool isInitialized = false;
|
||||
};
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <mesosphere/core/Result.hpp>
|
||||
#include <mesosphere/core/KAutoObject.hpp>
|
||||
#include <mesosphere/core/KSynchronizationObject.hpp>
|
||||
#include <mesosphere/interfaces/ISetAllocated.hpp>
|
||||
#include <mesosphere/interfaces/IClient.hpp>
|
||||
|
||||
namespace mesosphere
|
||||
|
|
25
mesosphere/source/interrupts/KInterruptEvent.cpp
Normal file
25
mesosphere/source/interrupts/KInterruptEvent.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
#include <mesosphere/interrupts/KInterruptEvent.hpp>
|
||||
|
||||
namespace mesosphere
|
||||
{
|
||||
|
||||
KInterruptEvent::~KInterruptEvent()
|
||||
{
|
||||
// delete receiver?
|
||||
}
|
||||
|
||||
Result KInterruptEvent::Initialize(int irqId, u32 flags)
|
||||
{
|
||||
// TODO implement
|
||||
(void)flags;
|
||||
this->irqId = irqId;
|
||||
isInitialized = true;
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
bool KInterruptEvent::IsAlive() const
|
||||
{
|
||||
return isInitialized;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
#include <mesosphere/core/make_object.hpp>
|
||||
#include <mesosphere/processes/KEvent.hpp>
|
||||
#include <mesosphere/interrupts/KInterruptEvent.hpp>
|
||||
|
||||
using namespace mesosphere;
|
||||
|
||||
int main(void) {
|
||||
auto [res, h1, h2] = MakeObjectWithHandle<KEvent>();
|
||||
(void)res; (void)h1; (void)h2;
|
||||
auto [res, h1] = MakeObjectWithHandle<KInterruptEvent>(3, -1);
|
||||
(void)res; (void)h1; //(void)h2;
|
||||
for(;;);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue