2023-05-29 00:32:54 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2023-06-07 08:50:08 -07:00
|
|
|
#include "zerrors.h"
|
|
|
|
|
2023-06-06 15:01:31 -07:00
|
|
|
#define Z_INVALID 0x0
|
2023-05-30 20:55:03 -07:00
|
|
|
|
2023-06-06 15:01:31 -07:00
|
|
|
#define ZC_WRITE 0x01
|
|
|
|
#define ZC_READ 0x02
|
2023-05-30 20:55:03 -07:00
|
|
|
|
2023-06-06 16:24:03 -07:00
|
|
|
// Process Calls.
|
2023-06-06 15:01:31 -07:00
|
|
|
#define Z_PROCESS_EXIT 0x01
|
|
|
|
#define Z_PROCESS_SPAWN 0x02
|
|
|
|
#define Z_PROCESS_START 0x03
|
|
|
|
|
|
|
|
#define ZC_PROC_SPAWN_PROC 0x100
|
2023-06-17 01:24:07 -07:00
|
|
|
#define ZC_PROC_SPAWN_THREAD 0x200
|
2023-06-06 15:01:31 -07:00
|
|
|
|
2023-06-06 16:24:03 -07:00
|
|
|
// Thread Calls.
|
2023-06-06 15:01:31 -07:00
|
|
|
#define Z_THREAD_CREATE 0x10
|
|
|
|
#define Z_THREAD_START 0x11
|
|
|
|
#define Z_THREAD_EXIT 0x12
|
|
|
|
|
2023-06-07 00:04:53 -07:00
|
|
|
// Memory Calls
|
|
|
|
#define Z_ADDRESS_SPACE_MAP 0x21
|
|
|
|
#define Z_ADDRESS_SPACE_UNMAP 0x22
|
|
|
|
|
|
|
|
#define Z_MEMORY_OBJECT_CREATE 0x30
|
2023-06-08 02:36:47 -07:00
|
|
|
#define Z_MEMORY_OBJECT_CREATE_PHYSICAL 0x31
|
2023-06-07 00:04:53 -07:00
|
|
|
|
2023-06-07 22:45:42 -07:00
|
|
|
#define Z_TEMP_PCIE_CONFIG_OBJECT_CREATE 0x3F
|
|
|
|
|
2023-06-07 08:24:10 -07:00
|
|
|
// IPC Calls
|
|
|
|
#define Z_CHANNEL_CREATE 0x40
|
|
|
|
#define Z_CHANNEL_SEND 0x41
|
|
|
|
#define Z_CHANNEL_RECV 0x42
|
|
|
|
#define Z_CHANNEL_SENDRECV 0x43
|
|
|
|
|
2023-06-12 19:20:51 -07:00
|
|
|
#define Z_PORT_CREATE 0x50
|
|
|
|
#define Z_PORT_SEND 0x51
|
|
|
|
#define Z_PORT_RECV 0x52
|
2023-06-16 23:15:28 -07:00
|
|
|
#define Z_PORT_POLL 0x53
|
2023-06-12 19:20:51 -07:00
|
|
|
|
|
|
|
#define Z_IRQ_REGISTER 0x58
|
|
|
|
|
|
|
|
#define Z_IRQ_PCI_BASE 0x30
|
|
|
|
|
2023-06-17 00:59:44 -07:00
|
|
|
// Capability Calls
|
|
|
|
#define Z_CAP_DUPLICATE 0x60
|
|
|
|
|
2023-06-06 16:24:03 -07:00
|
|
|
// Debugging Calls.
|
2023-06-06 15:01:31 -07:00
|
|
|
#define Z_DEBUG_PRINT 0x10000000
|
2023-05-29 00:32:54 -07:00
|
|
|
|
2023-06-07 00:04:53 -07:00
|
|
|
void ZProcessExit(uint64_t code);
|
2023-05-30 20:55:03 -07:00
|
|
|
|
2023-06-07 08:50:08 -07:00
|
|
|
[[nodiscard]] z_err_t ZProcessSpawn(uint64_t proc_cap, uint64_t bootstrap_cap,
|
|
|
|
uint64_t* new_proc_cap,
|
|
|
|
uint64_t* new_vmas_cap,
|
|
|
|
uint64_t* new_bootstrap_cap);
|
2023-05-30 20:55:03 -07:00
|
|
|
|
2023-06-07 00:04:53 -07:00
|
|
|
// UNUSED for now, I think we can get away with just starting a thread.
|
2023-06-07 08:50:08 -07:00
|
|
|
[[nodiscard]] z_err_t ZProcessStart(uint64_t proc_cap, uint64_t thread_cap,
|
|
|
|
uint64_t entry, uint64_t arg1,
|
|
|
|
uint64_t arg2);
|
2023-06-06 16:24:03 -07:00
|
|
|
|
2023-06-07 08:50:08 -07:00
|
|
|
[[nodiscard]] z_err_t ZThreadCreate(uint64_t proc_cap, uint64_t* thread_cap);
|
2023-06-06 16:24:03 -07:00
|
|
|
|
2023-06-07 08:50:08 -07:00
|
|
|
[[nodiscard]] z_err_t ZThreadStart(uint64_t thread_cap, uint64_t entry,
|
|
|
|
uint64_t arg1, uint64_t arg2);
|
2023-06-06 16:24:03 -07:00
|
|
|
|
2023-06-07 00:04:53 -07:00
|
|
|
void ZThreadExit();
|
2023-06-06 16:24:03 -07:00
|
|
|
|
2023-06-07 08:50:08 -07:00
|
|
|
[[nodiscard]] z_err_t ZAddressSpaceMap(uint64_t vmas_cap, uint64_t vmas_offset,
|
|
|
|
uint64_t vmmo_cap, uint64_t* vaddr);
|
|
|
|
[[nodiscard]] z_err_t ZMemoryObjectCreate(uint64_t size, uint64_t* vmmo_cap);
|
2023-06-08 02:36:47 -07:00
|
|
|
[[nodiscard]] z_err_t ZMemoryObjectCreatePhysical(uint64_t paddr, uint64_t size,
|
|
|
|
uint64_t* vmmo_cap);
|
2023-06-12 19:20:51 -07:00
|
|
|
[[nodiscard]] z_err_t ZMemoryObjectCreateContiguous(uint64_t size,
|
|
|
|
uint64_t* vmmo_cap,
|
|
|
|
uint64_t* paddr);
|
|
|
|
|
2023-06-07 22:45:42 -07:00
|
|
|
[[nodiscard]] z_err_t ZTempPcieConfigObjectCreate(uint64_t* vmmo_cap,
|
|
|
|
uint64_t* vmmo_size);
|
2023-06-07 08:50:08 -07:00
|
|
|
|
|
|
|
[[nodiscard]] z_err_t ZChannelCreate(uint64_t* channel1, uint64_t* channel2);
|
|
|
|
[[nodiscard]] z_err_t ZChannelSend(uint64_t chan_cap, uint64_t type,
|
|
|
|
uint64_t num_bytes, const uint8_t* bytes,
|
|
|
|
uint64_t num_caps, const uint64_t* caps);
|
|
|
|
[[nodiscard]] z_err_t ZChannelRecv(uint64_t chan_cap, uint64_t num_bytes,
|
|
|
|
uint8_t* bytes, uint64_t num_caps,
|
|
|
|
uint64_t* caps, uint64_t* type,
|
|
|
|
uint64_t* actual_bytes,
|
|
|
|
uint64_t* actual_caps);
|
|
|
|
|
2023-06-17 00:31:02 -07:00
|
|
|
[[nodiscard]] z_err_t ZPortCreate(uint64_t* port_cap);
|
2023-06-17 01:05:10 -07:00
|
|
|
[[nodiscard]] z_err_t ZPortSend(uint64_t port_cap, uint64_t num_bytes,
|
|
|
|
const uint8_t* bytes, uint64_t num_caps,
|
|
|
|
uint64_t* caps);
|
2023-06-12 19:20:51 -07:00
|
|
|
[[nodiscard]] z_err_t ZPortRecv(uint64_t port_cap, uint64_t num_bytes,
|
|
|
|
uint8_t* bytes, uint64_t num_caps,
|
|
|
|
uint64_t* caps, uint64_t* type,
|
|
|
|
uint64_t* actual_bytes, uint64_t* actual_caps);
|
2023-06-16 23:15:28 -07:00
|
|
|
[[nodiscard]] z_err_t ZPortPoll(uint64_t port_cap, uint64_t num_bytes,
|
|
|
|
uint8_t* bytes, uint64_t num_caps,
|
|
|
|
uint64_t* caps, uint64_t* type,
|
|
|
|
uint64_t* actual_bytes, uint64_t* actual_caps);
|
2023-06-12 19:20:51 -07:00
|
|
|
[[nodiscard]] z_err_t ZIrqRegister(uint64_t irq_num, uint64_t* port_cap);
|
|
|
|
|
2023-06-17 00:59:44 -07:00
|
|
|
[[nodiscard]] z_err_t ZCapDuplicate(uint64_t cap_in, uint64_t* cap_out);
|
|
|
|
|
2023-06-07 08:50:08 -07:00
|
|
|
[[nodiscard]] z_err_t ZDebug(const char* message);
|