#include <m/syscall.h>
#include <m/syscall_defs.h>
#include <stddef.h>
#include <stdint.h>

int m_proc_quit (void) { return m_syscall (SYS_PROC_QUIT, 0, 0, 0, 0, 0, 0); }

int m_proc_test (void) { return m_syscall (SYS_PROC_TEST, 0, 0, 0, 0, 0, 0); }

int m_proc_map (uintptr_t paddr, uintptr_t vaddr, size_t pages, uint32_t flags) {
  return m_syscall (SYS_PROC_MAP, paddr, vaddr, (uintptr_t)pages, (uintptr_t)flags, 0, 0);
}

int m_proc_unmap (uintptr_t vaddr, size_t pages) {
  return m_syscall (SYS_PROC_UNMAP, vaddr, (uintptr_t)pages, 0, 0, 0, 0);
}

int m_proc_create_resource_mem (size_t pages, int vis, uintptr_t* out_paddr) {
  return m_syscall (SYS_PROC_CREATE_RESOURCE_MEM, (uintptr_t)pages, (uintptr_t)vis,
                    (uintptr_t)out_paddr, 0, 0, 0);
}

int m_proc_drop_resource (int rid) {
  return m_syscall (SYS_PROC_DROP_RESOURCE, (uintptr_t)rid, 0, 0, 0, 0, 0);
}
