diff options
author | Alexis211 <alexis211@gmail.com> | 2009-10-20 18:30:50 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-10-20 18:30:50 +0200 |
commit | 90b49b6f171108f272ff529f7546bd9625ca7d17 (patch) | |
tree | c32f714fc7936867decb3a359effbc1f5c07dc64 /Source/Kernel/SyscallManager | |
parent | 866580161b826443bed3862b8315cefd505de37c (diff) | |
download | Melon-90b49b6f171108f272ff529f7546bd9625ca7d17.tar.gz Melon-90b49b6f171108f272ff529f7546bd9625ca7d17.zip |
Implemented static syscalls, specific to a class and not an object.
Diffstat (limited to 'Source/Kernel/SyscallManager')
-rw-r--r-- | Source/Kernel/SyscallManager/Res.ns.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Source/Kernel/SyscallManager/Res.ns.cpp b/Source/Kernel/SyscallManager/Res.ns.cpp index 7902f2d..98d3ac3 100644 --- a/Source/Kernel/SyscallManager/Res.ns.cpp +++ b/Source/Kernel/SyscallManager/Res.ns.cpp @@ -7,6 +7,20 @@ namespace Res { +typedef u32int (*staticcall)(u8int, u32int, u32int, u32int, u32int); + +struct static_call_t { + u32int id; + staticcall call; +}; + +static_call_t staticCalls[] = { + {VTIF_OBJTYPE, VirtualTerminal::scall}, + {PRIF_OBJTYPE, Process::scall}, + {THIF_OBJTYPE, Thread::scall}, + {0, 0} +}; + Ressource** ressources = 0; u32int size = 0; @@ -43,9 +57,9 @@ void unregisterRes(u32int id) { u32int call(u32int ressource, u8int wat, u32int a, u32int b, u32int c, u32int d, u32int e) { if (ressource == 0xFFFFFE) { //TODO : return ressource id for some stuff for current process - if (a == VTIF_OBJTYPE) return Task::currProcess()->getVirtualTerminal()->resId(); - if (a == PRIF_OBJTYPE) return Task::currProcess()->resId(); - if (a == THIF_OBJTYPE) return Task::currThread()->resId(); + for (u32int i = 0; staticCalls[i].id != 0; i++) { + if (staticCalls[i].id == a) return staticCalls[i].call(wat, b, c, d, e); + } return 0; } else { if (ressource > size or ressources[ressource] == 0) { |