From 90b49b6f171108f272ff529f7546bd9625ca7d17 Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Tue, 20 Oct 2009 18:30:50 +0200 Subject: Implemented static syscalls, specific to a class and not an object. --- Source/Library/Interface/Process.iface.h | 4 ++++ Source/Library/Interface/Thread.iface.h | 4 ++++ Source/Library/Interface/VirtualTerminal.iface.h | 4 ++++ Source/Library/Userland/Binding/Process.class.h | 2 +- Source/Library/Userland/Binding/Thread.class.h | 2 +- Source/Library/Userland/Binding/VirtualTerminal.class.h | 2 +- Source/Library/Userland/Syscall/RessourceCaller.class.cpp | 4 ++-- Source/Library/Userland/Syscall/RessourceCaller.class.h | 5 ++++- 8 files changed, 21 insertions(+), 6 deletions(-) (limited to 'Source/Library') diff --git a/Source/Library/Interface/Process.iface.h b/Source/Library/Interface/Process.iface.h index fe70833..2126dc6 100644 --- a/Source/Library/Interface/Process.iface.h +++ b/Source/Library/Interface/Process.iface.h @@ -2,6 +2,10 @@ #define DEF_PROCESS_IFACE_H #define PRIF_OBJTYPE 0x20 + +//S = static, GET = get, C = current, PR = process +#define PRIF_SGETCPR 0 + #define PRIF_EXIT 0x01 #define PRIF_ALLOCPAGE 0x02 #define PRIF_FREEPAGE 0x03 diff --git a/Source/Library/Interface/Thread.iface.h b/Source/Library/Interface/Thread.iface.h index ac572b4..0dac2e1 100644 --- a/Source/Library/Interface/Thread.iface.h +++ b/Source/Library/Interface/Thread.iface.h @@ -2,6 +2,10 @@ #define DEF_THREAD_IFACE_H #define THIF_OBJTYPE 0x21 + +//S = static, GET = get, C = current, TH = thread +#define THIF_SGETCTH 0 + #define THIF_SLEEP 0x01 #define THIF_FINISH 0x02 diff --git a/Source/Library/Interface/VirtualTerminal.iface.h b/Source/Library/Interface/VirtualTerminal.iface.h index 528e9e5..412cf8f 100644 --- a/Source/Library/Interface/VirtualTerminal.iface.h +++ b/Source/Library/Interface/VirtualTerminal.iface.h @@ -2,6 +2,10 @@ #define DEF_VITRUALTERMINAL_IFACE_H #define VTIF_OBJTYPE 0x10 + +//S = static, GET = get, PR = process, VT = virtualterminal +#define VTIF_SGETPRVT 0 + #define VTIF_PUT 0x01 #define VTIF_WRITEHEX 0x02 #define VTIF_WRITEDEC 0x03 diff --git a/Source/Library/Userland/Binding/Process.class.h b/Source/Library/Userland/Binding/Process.class.h index e532ad3..00afe27 100644 --- a/Source/Library/Userland/Binding/Process.class.h +++ b/Source/Library/Userland/Binding/Process.class.h @@ -5,7 +5,7 @@ class Process : public RessourceCaller { public: static Process get() { - u32int id = RessourceCaller::getObjId(PRIF_OBJTYPE); + u32int id = RessourceCaller::sCall(PRIF_OBJTYPE, PRIF_SGETCPR); return Process(id); } Process(u32int id) : RessourceCaller(id, PRIF_OBJTYPE) {} diff --git a/Source/Library/Userland/Binding/Thread.class.h b/Source/Library/Userland/Binding/Thread.class.h index 1a354d3..a19c256 100644 --- a/Source/Library/Userland/Binding/Thread.class.h +++ b/Source/Library/Userland/Binding/Thread.class.h @@ -5,7 +5,7 @@ class Thread : public RessourceCaller { public: static Thread get() { - u32int id = RessourceCaller::getObjId(THIF_OBJTYPE); + u32int id = RessourceCaller::sCall(THIF_OBJTYPE, THIF_SGETCTH); return Thread(id); } Thread(u32int id) : RessourceCaller(id, THIF_OBJTYPE) {} diff --git a/Source/Library/Userland/Binding/VirtualTerminal.class.h b/Source/Library/Userland/Binding/VirtualTerminal.class.h index 4329c86..0da1be4 100644 --- a/Source/Library/Userland/Binding/VirtualTerminal.class.h +++ b/Source/Library/Userland/Binding/VirtualTerminal.class.h @@ -8,7 +8,7 @@ class VirtualTerminal : public RessourceCaller { public: static VirtualTerminal get() { - u32int id = RessourceCaller::getObjId(VTIF_OBJTYPE); + u32int id = RessourceCaller::sCall(VTIF_OBJTYPE, VTIF_SGETPRVT); return VirtualTerminal(id); } VirtualTerminal(u32int id) : RessourceCaller(id, VTIF_OBJTYPE) {} diff --git a/Source/Library/Userland/Syscall/RessourceCaller.class.cpp b/Source/Library/Userland/Syscall/RessourceCaller.class.cpp index 2d7b6ba..f3b61a8 100644 --- a/Source/Library/Userland/Syscall/RessourceCaller.class.cpp +++ b/Source/Library/Userland/Syscall/RessourceCaller.class.cpp @@ -7,8 +7,8 @@ RessourceCaller::RessourceCaller(u32int id, u32int type) { if (m_type != type) m_type = 0; } -u32int RessourceCaller::getObjId(u32int type) { - return syscall(0xFFFFFE00, type); +u32int RessourceCaller::sCall(u32int type, u8int wat, u32int a, u32int b, u32int c, u32int d) { + return syscall(0xFFFFFE00 | wat, type, a, b, c, d); } u32int RessourceCaller::doCall(u8int call, u32int a, u32int b, u32int c, u32int d, u32int e) { diff --git a/Source/Library/Userland/Syscall/RessourceCaller.class.h b/Source/Library/Userland/Syscall/RessourceCaller.class.h index 3602ef0..85beacf 100644 --- a/Source/Library/Userland/Syscall/RessourceCaller.class.h +++ b/Source/Library/Userland/Syscall/RessourceCaller.class.h @@ -21,7 +21,10 @@ class RessourceCaller { protected: RessourceCaller(u32int id, u32int type); - static u32int getObjId(u32int type); + + //Static call -- a call specific to a class and not an object + static u32int sCall(u32int type, u8int wat, u32int a = 0, u32int b = 0, u32int c = 0, u32int d = 0); + u32int doCall(u8int call, u32int a = 0, u32int b = 0, u32int c = 0, u32int d = 0, u32int e = 0); public: -- cgit v1.2.3