Author: nieklinnenbank Date: Sun Jun 28 07:19:34 2009 New Revision: 162 Modified: trunk/include/API/VMCtl.h trunk/include/kernel/API.h trunk/kernel/API/VMCtl.cpp Log: Added an enum MemoryOperation for use in VMCtl(). Modified: trunk/include/API/VMCtl.h ============================================================================== --- trunk/include/API/VMCtl.h (original) +++ trunk/include/API/VMCtl.h Sun Jun 28 07:19:34 2009 @@ -33,18 +33,29 @@ #define VMCTL 5 /** + * Memory operations which may be used as an argument to VMCtl(). + */ +typedef enum MemoryOperation +{ + Map = 0, + Lookup = 1, + Access = 2, +} +MemoryOperation; + +/*** Prototype for user applications. Examines and modifies virtual memory pages.
- * @param action Determines which action to perform. + * @param op Determines which operation to perform. * @param proc Remote process. * @param paddr Physical address which we map. ZERO to pick a free paddr. * @param vaddr Virtual address to map paddr.* @param prot Protection bits. Set PAGE_PRESENT to allocate, ~PAGE_PRESENT to release.
* @return Zero on success or error code on failure. */ -inline Error VMCtl(Operation action, ProcessID proc, Address paddr, +inline Error VMCtl(MemoryOperation op, ProcessID proc, Address paddr, Address vaddr, ulong prot = PAGE_PRESENT|PAGE_USER|PAGE_RW) { - return trapKernel5(VMCTL, action, proc, paddr, vaddr, prot); + return trapKernel5(VMCTL, op, proc, paddr, vaddr, prot); } /** Modified: trunk/include/kernel/API.h ============================================================================== --- trunk/include/kernel/API.h (original) +++ trunk/include/kernel/API.h Sun Jun 28 07:19:34 2009 @@ -54,14 +54,11 @@ { Create = 0, Delete = 1, - Map = 2, - Send = 3, - Receive = 4, - SendReceive = 5, - Read = 6, - Write = 7, - Lookup = 8, - Access = 9, + Send = 2, + Receive = 3, + SendReceive = 4, + Read = 5, + Write = 6, } Operation; Modified: trunk/kernel/API/VMCtl.cpp ============================================================================== --- trunk/kernel/API/VMCtl.cpp (original) +++ trunk/kernel/API/VMCtl.cpp Sun Jun 28 07:19:34 2009 @@ -19,7 +19,7 @@ #include <Error.h> #include <Config.h> -Error VMCtlHandler(Operation action, ProcessID procID, Address paddr, +Error VMCtlHandler(MemoryOperation op, ProcessID procID, Address paddr, Address vaddr, ulong prot = PAGE_PRESENT|PAGE_USER|PAGE_RW) { ArchProcess *proc = ZERO; @@ -30,11 +30,10 @@ { return ESRCH; } - switch (action) + switch (op) { case Lookup: return ENOTSUP; - // TODO: return memory->lookupVirtual(proc, vaddr); case Map: /* Map the memory page. */