kernel: re-implement sending handles via port messages
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
#ifndef MANGO_STATUS_H_
|
||||
#define MANGO_STATUS_H_
|
||||
|
||||
typedef unsigned int kern_status_t;
|
||||
|
||||
#define KERN_OK (0)
|
||||
#define KERN_UNIMPLEMENTED (1)
|
||||
#define KERN_NAME_EXISTS (2)
|
||||
|
||||
@@ -4,29 +4,24 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define VM_PROT_READ 0x01u
|
||||
#define VM_PROT_WRITE 0x02u
|
||||
#define VM_PROT_EXEC 0x04u
|
||||
#define VM_PROT_USER 0x08u
|
||||
#define VM_PROT_SVR 0x10u
|
||||
#define VM_PROT_NOCACHE 0x10u
|
||||
#define VM_PROT_MAP_SPECIFIC 0x40u
|
||||
#define VM_PROT_READ 0x01u
|
||||
#define VM_PROT_WRITE 0x02u
|
||||
#define VM_PROT_EXEC 0x04u
|
||||
#define VM_PROT_USER 0x08u
|
||||
#define VM_PROT_SVR 0x10u
|
||||
#define VM_PROT_NOCACHE 0x10u
|
||||
#define VM_PROT_MAP_SPECIFIC 0x40u
|
||||
|
||||
/* if this flag is set, other tasks can connect to this channel using
|
||||
* the port_connect_* syscalls.
|
||||
* if this flag is NOT set, only threads in the task that owns the channel
|
||||
* can create ports connecting to it. */
|
||||
#define CHANNEL_F_ALLOW_DIRECT_CONNECTIONS 0x01u
|
||||
#define VM_REGION_ANY_OFFSET ((off_t) - 1)
|
||||
#define KERN_HANDLE_INVALID ((kern_handle_t)0xFFFFFFFF)
|
||||
|
||||
/* msg_reply: once the reply has been sent, disconnect the port that sent the
|
||||
* original message */
|
||||
#define MSG_F_DISCONNECT_AFTER_REPLY 0x01u
|
||||
#define KERN_CFG_INVALID 0x00u
|
||||
#define KERN_CFG_PAGE_SIZE 0x01u
|
||||
|
||||
#define VM_REGION_ANY_OFFSET ((off_t) - 1)
|
||||
#define KERN_HANDLE_INVALID ((kern_handle_t)0xFFFFFFFF)
|
||||
|
||||
#define KERN_CFG_INVALID 0x00u
|
||||
#define KERN_CFG_PAGE_SIZE 0x01u
|
||||
#define KERN_MSG_MAX_HANDLES 64
|
||||
#define KERN_MSG_HANDLE_IGNORE 0
|
||||
#define KERN_MSG_HANDLE_MOVE 1
|
||||
#define KERN_MSG_HANDLE_COPY 2
|
||||
|
||||
#define IOVEC(p, len) \
|
||||
{ \
|
||||
@@ -47,15 +42,30 @@ typedef uint64_t msgid_t;
|
||||
typedef uint64_t off_t;
|
||||
typedef uint64_t koid_t;
|
||||
typedef unsigned int tid_t;
|
||||
typedef unsigned int kern_status_t;
|
||||
typedef uint32_t kern_handle_t;
|
||||
typedef uint32_t kern_config_key_t;
|
||||
typedef uint32_t vm_prot_t;
|
||||
|
||||
typedef unsigned int umode_t;
|
||||
|
||||
struct iovec {
|
||||
typedef struct {
|
||||
virt_addr_t io_base;
|
||||
size_t io_len;
|
||||
};
|
||||
} kern_iovec_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned int hnd_mode;
|
||||
kern_handle_t hnd_value;
|
||||
kern_status_t hnd_result;
|
||||
} kern_msg_handle_t;
|
||||
|
||||
typedef struct {
|
||||
msgid_t msg_id;
|
||||
kern_iovec_t *msg_data;
|
||||
size_t msg_data_count;
|
||||
kern_msg_handle_t *msg_handles;
|
||||
size_t msg_handles_count;
|
||||
} kern_msg_t;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user