VBOX: add host/guest communication interface
This interface can be used by other system processes by means of the newly provided vbox API in libsys.
This commit is contained in:
@@ -17,9 +17,9 @@ INCS+= minix/acpi.h minix/audio_fw.h minix/bitmap.h \
|
||||
minix/rs.h minix/safecopies.h minix/sched.h minix/sef.h \
|
||||
minix/sound.h minix/spin.h minix/sys_config.h minix/sysinfo.h \
|
||||
minix/syslib.h minix/sysutil.h minix/timers.h minix/type.h \
|
||||
minix/tty.h minix/u64.h minix/usb.h minix/usb_ch9.h minix/vm.h \
|
||||
minix/vfsif.h minix/vtreefs.h minix/libminixfs.h \
|
||||
minix/netsock.h
|
||||
minix/tty.h minix/u64.h minix/usb.h minix/usb_ch9.h minix/vbox.h \
|
||||
minix/vboxif.h minix/vboxtype.h minix/vm.h \
|
||||
minix/vfsif.h minix/vtreefs.h minix/libminixfs.h minix/netsock.h
|
||||
|
||||
INCS+= net/gen/arp_io.h net/gen/dhcp.h net/gen/ether.h \
|
||||
net/gen/eth_hdr.h net/gen/eth_io.h net/gen/icmp.h \
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
* 0x1300 - 0x13FF TTY Input
|
||||
* 0x1400 - 0x14FF VFS-FS transaction IDs
|
||||
* 0x1500 - 0x15FF Block device requests and responses
|
||||
* 0x1600 - 0x16FF VirtualBox (VBOX) requests (see vboxif.h)
|
||||
*
|
||||
* Zero and negative values are widely used for OK and error responses.
|
||||
*/
|
||||
|
||||
27
include/minix/vbox.h
Normal file
27
include/minix/vbox.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef _MINIX_VBOX_H
|
||||
#define _MINIX_VBOX_H
|
||||
|
||||
#include <minix/vboxtype.h>
|
||||
|
||||
typedef int vbox_conn_t;
|
||||
|
||||
extern int vbox_init(void);
|
||||
|
||||
extern vbox_conn_t vbox_open(char *name);
|
||||
extern int vbox_close(vbox_conn_t conn);
|
||||
extern int vbox_call(vbox_conn_t conn, u32_t function, vbox_param_t *param,
|
||||
int count, int *code);
|
||||
|
||||
extern void vbox_set_u32(vbox_param_t *param, u32_t value);
|
||||
extern void vbox_set_u64(vbox_param_t *param, u64_t value);
|
||||
extern void vbox_set_ptr(vbox_param_t *param, void *ptr, size_t size,
|
||||
unsigned int dir);
|
||||
extern void vbox_set_grant(vbox_param_t *param, endpoint_t endpt,
|
||||
cp_grant_id_t grant, size_t off, size_t size, unsigned int dir);
|
||||
|
||||
extern u32_t vbox_get_u32(vbox_param_t *param);
|
||||
extern u64_t vbox_get_u64(vbox_param_t *param);
|
||||
|
||||
extern void vbox_put(vbox_param_t *param, int count);
|
||||
|
||||
#endif /* _MINIX_VBOX_H */
|
||||
33
include/minix/vboxif.h
Normal file
33
include/minix/vboxif.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef _MINIX_VBOXIF_H
|
||||
#define _MINIX_VBOXIF_H
|
||||
|
||||
/*===========================================================================*
|
||||
* Messages for VBOX device *
|
||||
*===========================================================================*/
|
||||
|
||||
/* Base type for VBOX requests and responses. */
|
||||
#define VBOX_RQ_BASE 0x1600
|
||||
#define VBOX_RS_BASE 0x1680
|
||||
|
||||
#define IS_VBOX_RQ(type) (((type) & ~0x7f) == VBOX_RQ_BASE)
|
||||
#define IS_VBOX_RS(type) (((type) & ~0x7f) == VBOX_RS_BASE)
|
||||
|
||||
/* Message types for VBOX requests. */
|
||||
#define VBOX_OPEN (VBOX_RQ_BASE + 0) /* open a connection */
|
||||
#define VBOX_CLOSE (VBOX_RQ_BASE + 1) /* close a connection */
|
||||
#define VBOX_CALL (VBOX_RQ_BASE + 2) /* perform a call */
|
||||
#define VBOX_CANCEL (VBOX_RQ_BASE + 3) /* cancel an ongoing call */
|
||||
|
||||
/* Message types for VBOX responses. */
|
||||
#define VBOX_REPLY (VBOX_RS_BASE + 0) /* general reply code */
|
||||
|
||||
/* Field names for VBOX messages. */
|
||||
#define VBOX_CONN m2_i1 /* connection identifier */
|
||||
#define VBOX_GRANT m2_i2 /* grant ID of buffer or name */
|
||||
#define VBOX_COUNT m2_i3 /* number of bytes or elements */
|
||||
#define VBOX_RESULT m2_i1 /* result or error code */
|
||||
#define VBOX_CODE m2_i2 /* VirtualBox result code */
|
||||
#define VBOX_FUNCTION m2_l1 /* function call number */
|
||||
#define VBOX_ID m2_l2 /* opaque request ID */
|
||||
|
||||
#endif /* _MINIX_VBOXIF_H */
|
||||
36
include/minix/vboxtype.h
Normal file
36
include/minix/vboxtype.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef _MINIX_VBOXTYPE_H
|
||||
#define _MINIX_VBOXTYPE_H
|
||||
|
||||
/* This header declares the type definitions shared between VBOX driver, the
|
||||
* interface in libsys, and any caller of those interface functions.
|
||||
*/
|
||||
|
||||
/* Call parameter type. */
|
||||
typedef enum {
|
||||
VBOX_TYPE_INVALID, /* invalid type */
|
||||
VBOX_TYPE_U32, /* 32-bit value */
|
||||
VBOX_TYPE_U64, /* 64-bit value */
|
||||
VBOX_TYPE_PTR /* pointer to granted memory area */
|
||||
} vbox_type_t;
|
||||
|
||||
/* Call parameter transfer direction. */
|
||||
#define VBOX_DIR_IN 0x01 /* from host to guest */
|
||||
#define VBOX_DIR_OUT 0x02 /* from guest to host */
|
||||
#define VBOX_DIR_INOUT (VBOX_DIR_IN | VBOX_DIR_OUT)
|
||||
|
||||
/* Call parameter. */
|
||||
typedef struct {
|
||||
vbox_type_t type;
|
||||
union {
|
||||
u32_t u32;
|
||||
u64_t u64;
|
||||
struct {
|
||||
cp_grant_id_t grant;
|
||||
size_t off;
|
||||
size_t size;
|
||||
unsigned int dir;
|
||||
} ptr;
|
||||
};
|
||||
} vbox_param_t;
|
||||
|
||||
#endif /*_MINIX_VBOXTYPE_H */
|
||||
Reference in New Issue
Block a user