Migrate to error constants in glacier
This commit is contained in:
parent
3ab9b4d818
commit
0b86a94f14
30 changed files with 171 additions and 114 deletions
|
|
@ -20,5 +20,5 @@ z_err_t AddressSpaceMap(ZAddressSpaceMapReq* req) {
|
|||
} else {
|
||||
*req->vaddr = vmas->MapInMemoryObject(vmmo);
|
||||
}
|
||||
return Z_OK;
|
||||
return glcr::OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
#include "syscall/capability.h"
|
||||
|
||||
#include <glacier/status/error.h>
|
||||
|
||||
#include "scheduler/scheduler.h"
|
||||
|
||||
z_err_t CapDuplicate(ZCapDuplicateReq* req) {
|
||||
auto& proc = gScheduler->CurrentProcess();
|
||||
auto cap = proc.GetCapability(req->cap_in);
|
||||
if (!cap) {
|
||||
return Z_ERR_CAP_NOT_FOUND;
|
||||
return glcr::CAP_NOT_FOUND;
|
||||
}
|
||||
*req->cap_out = proc.AddExistingCapability(cap);
|
||||
return Z_OK;
|
||||
return glcr::OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ z_err_t ChannelCreate(ZChannelCreateReq* req) {
|
|||
*req->channel1 = proc.AddNewCapability(chan_pair.first(), ZC_WRITE | ZC_READ);
|
||||
*req->channel2 =
|
||||
proc.AddNewCapability(chan_pair.second(), ZC_WRITE | ZC_READ);
|
||||
return Z_OK;
|
||||
return glcr::OK;
|
||||
}
|
||||
|
||||
z_err_t ChannelSend(ZChannelSendReq* req) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
#include "syscall/debug.h"
|
||||
|
||||
#include <glacier/status/error.h>
|
||||
|
||||
#include "debug/debug.h"
|
||||
|
||||
z_err_t Debug(ZDebugReq* req) {
|
||||
dbgln("[Debug] %s", req->message);
|
||||
return Z_OK;
|
||||
return glcr::OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ z_err_t MemoryObjectCreate(ZMemoryObjectCreateReq* req) {
|
|||
auto& curr_proc = gScheduler->CurrentProcess();
|
||||
*req->vmmo_cap = curr_proc.AddNewCapability(
|
||||
glcr::MakeRefCounted<MemoryObject>(req->size), ZC_WRITE);
|
||||
return Z_OK;
|
||||
return glcr::OK;
|
||||
}
|
||||
|
||||
z_err_t MemoryObjectCreatePhysical(ZMemoryObjectCreatePhysicalReq* req) {
|
||||
|
|
@ -17,7 +17,7 @@ z_err_t MemoryObjectCreatePhysical(ZMemoryObjectCreatePhysicalReq* req) {
|
|||
auto vmmo_ref = glcr::MakeRefCounted<FixedMemoryObject>(paddr, req->size);
|
||||
*req->vmmo_cap = curr_proc.AddNewCapability(
|
||||
StaticCastRefPtr<MemoryObject>(vmmo_ref), ZC_WRITE);
|
||||
return Z_OK;
|
||||
return glcr::OK;
|
||||
}
|
||||
|
||||
z_err_t MemoryObjectCreateContiguous(ZMemoryObjectCreateContiguousReq* req) {
|
||||
|
|
@ -27,7 +27,7 @@ z_err_t MemoryObjectCreateContiguous(ZMemoryObjectCreateContiguousReq* req) {
|
|||
*req->vmmo_cap = curr_proc.AddNewCapability(
|
||||
StaticCastRefPtr<MemoryObject>(vmmo_ref), ZC_WRITE);
|
||||
*req->paddr = paddr;
|
||||
return Z_OK;
|
||||
return glcr::OK;
|
||||
}
|
||||
|
||||
z_err_t TempPcieConfigObjectCreate(ZTempPcieConfigObjectCreateReq* req) {
|
||||
|
|
@ -38,5 +38,5 @@ z_err_t TempPcieConfigObjectCreate(ZTempPcieConfigObjectCreateReq* req) {
|
|||
*req->vmmo_cap = curr_proc.AddNewCapability(
|
||||
StaticCastRefPtr<MemoryObject>(vmmo_ref), ZC_WRITE);
|
||||
*req->vmmo_size = pci_size;
|
||||
return Z_OK;
|
||||
return glcr::OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "syscall/port.h"
|
||||
|
||||
#include <glacier/status/error.h>
|
||||
|
||||
#include "capability/capability.h"
|
||||
#include "interrupt/interrupt.h"
|
||||
#include "scheduler/scheduler.h"
|
||||
|
|
@ -8,7 +10,7 @@ z_err_t PortCreate(ZPortCreateReq* req) {
|
|||
auto& proc = gScheduler->CurrentProcess();
|
||||
auto port = glcr::MakeRefCounted<Port>();
|
||||
*req->port_cap = proc.AddNewCapability(port, ZC_WRITE | ZC_READ);
|
||||
return Z_OK;
|
||||
return glcr::OK;
|
||||
}
|
||||
|
||||
z_err_t PortSend(ZPortSendReq* req) {
|
||||
|
|
@ -44,7 +46,7 @@ z_err_t PortPoll(ZPortPollReq* req) {
|
|||
// FIXME: Race condition here where this call could block if the last message
|
||||
// is removed between this check and the port read.
|
||||
if (!port->HasMessages()) {
|
||||
return Z_ERR_EMPTY;
|
||||
return glcr::EMPTY;
|
||||
}
|
||||
return port->Read(req->num_bytes, req->data, req->num_caps, req->caps);
|
||||
}
|
||||
|
|
@ -53,10 +55,10 @@ z_err_t IrqRegister(ZIrqRegisterReq* req) {
|
|||
auto& proc = gScheduler->CurrentProcess();
|
||||
if (req->irq_num != Z_IRQ_PCI_BASE) {
|
||||
// FIXME: Don't hardcode this nonsense.
|
||||
return Z_ERR_UNIMPLEMENTED;
|
||||
return glcr::UNIMPLEMENTED;
|
||||
}
|
||||
glcr::RefPtr<Port> port = glcr::MakeRefCounted<Port>();
|
||||
*req->port_cap = proc.AddNewCapability(port, ZC_READ | ZC_WRITE);
|
||||
RegisterPciPort(port);
|
||||
return Z_OK;
|
||||
return glcr::OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ z_err_t ProcessExit(ZProcessExitReq* req) {
|
|||
// FIXME: kill process here.
|
||||
curr_thread->Exit();
|
||||
panic("Returned from thread exit");
|
||||
return Z_ERR_UNIMPLEMENTED;
|
||||
return glcr::UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
z_err_t ProcessSpawn(ZProcessSpawnReq* req) {
|
||||
|
|
@ -28,11 +28,11 @@ z_err_t ProcessSpawn(ZProcessSpawnReq* req) {
|
|||
if (req->bootstrap_cap != 0) {
|
||||
auto cap = curr_proc.ReleaseCapability(req->bootstrap_cap);
|
||||
if (!cap) {
|
||||
return Z_ERR_CAP_NOT_FOUND;
|
||||
return glcr::CAP_NOT_FOUND;
|
||||
}
|
||||
// FIXME: Check permissions.
|
||||
*req->new_bootstrap_cap = proc->AddExistingCapability(cap);
|
||||
}
|
||||
|
||||
return Z_OK;
|
||||
return glcr::OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ extern "C" z_err_t SyscallHandler(uint64_t call_id, void* req) {
|
|||
CASE(Debug);
|
||||
default:
|
||||
dbgln("Unhandled syscall number: %x", call_id);
|
||||
return Z_ERR_UNIMPLEMENTED;
|
||||
return glcr::UNIMPLEMENTED;
|
||||
}
|
||||
UNREACHABLE
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ z_err_t ThreadCreate(ZThreadCreateReq* req) {
|
|||
auto parent_proc = cap->obj<Process>();
|
||||
auto thread = parent_proc->CreateThread();
|
||||
*req->thread_cap = curr_proc.AddNewCapability(thread, ZC_WRITE);
|
||||
return Z_OK;
|
||||
return glcr::OK;
|
||||
}
|
||||
|
||||
z_err_t ThreadStart(ZThreadStartReq* req) {
|
||||
|
|
@ -22,7 +22,7 @@ z_err_t ThreadStart(ZThreadStartReq* req) {
|
|||
auto thread = cap->obj<Thread>();
|
||||
// FIXME: validate entry point is in user space.
|
||||
thread->Start(req->entry, req->arg1, req->arg2);
|
||||
return Z_OK;
|
||||
return glcr::OK;
|
||||
}
|
||||
|
||||
z_err_t ThreadExit(ZThreadExitReq*) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue