bitkeeper revision 1.5 (3deb3561debeVs9JS03j-s4TrTupDQ)

hypervisor.h, hypervisor-if.h:
  Rationalise shared headers
.del-network.h~8d81c314a6f640c7:
  Delete: xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor-ifs/network.h
.del-hypervisor-if.h~84873ad1c6355e9c:
  Delete: xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor-ifs/hypervisor-if.h
.del-block.h~60136f987cd3e137:
  Delete: xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor-ifs/block.h
This commit is contained in:
kaf24@plym.cl.cam.ac.uk committed 2002-12-02 10:26:41 +00:00
1 parent e4de52d4f5
commit 5e80fc2b6b
7 files changed
+129 -551

No files matched your search

-3
View File
@@ -316,9 +316,6 @@
3ddb79batzR40ZFY9dvgs5f1aM9I6g xenolinux-2.4.16-sparse/include/asm-xeno/hdreg.h
3ddb79b90xBgbeYgCcImS2ZxJakxBA xenolinux-2.4.16-sparse/include/asm-xeno/highmem.h
3ddb79baXLZV3dUKQI2gIYpAy67RuA xenolinux-2.4.16-sparse/include/asm-xeno/hw_irq.h
3ddb79b82xfEY3yBet-2FXY4p8b7yg xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor-ifs/block.h
3ddb79b8KUSolAgH19qEzo1Ey0f1Ng xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor-ifs/hypervisor-if.h
3ddb79b8J0Y2UA8NKoN5Ng71WFQRIg xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor-ifs/network.h
3ddb79bapQ9Z9ewa5O1pqAVaNBTazg xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor.h
3ddb79baL-pjPI8hg5xjPgd4__SlOA xenolinux-2.4.16-sparse/include/asm-xeno/i387.h
3ddb79ba66TwvG7HpbBo04fRhmj3KQ xenolinux-2.4.16-sparse/include/asm-xeno/ide.h
+1
View File
@@ -1,2 +1,3 @@
akw27@boulderdash.cl.cam.ac.uk
kaf24@plym.cl.cam.ac.uk
smh22@boulderdash.cl.cam.ac.uk
@@ -4,8 +4,8 @@
* Interface to Xeno hypervisor.
*/
#include <hypervisor-ifs/network.h>
#include <hypervisor-ifs/block.h>
#include "network.h"
#include "block.h"
#ifndef __HYPERVISOR_IF_H__
#define __HYPERVISOR_IF_H__
@@ -44,127 +44,6 @@ typedef struct
#define TRAP_INSTR "int $0x82"
static inline int HYPERVISOR_set_trap_table(trap_info_t *table)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_set_trap_table),
"b" (table) );
return ret;
}
static inline int HYPERVISOR_pt_update(page_update_request_t *req, int count)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_pt_update),
"b" (req), "c" (count) );
return ret;
}
static inline int HYPERVISOR_console_write(const char *str, int count)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_console_write),
"b" (str), "c" (count) );
return ret;
}
static inline int HYPERVISOR_set_pagetable(unsigned long ptr)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_set_pagetable),
"b" (ptr) );
return ret;
}
static inline int HYPERVISOR_set_guest_stack(
unsigned long ss, unsigned long esp)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_set_guest_stack),
"b" (ss), "c" (esp) );
return ret;
}
static inline int HYPERVISOR_net_update(void)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_net_update) );
return ret;
}
static inline int HYPERVISOR_fpu_taskswitch(void)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_fpu_taskswitch) );
return ret;
}
static inline int HYPERVISOR_yield(void)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_yield) );
return ret;
}
static inline int HYPERVISOR_exit(void)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_exit) );
return ret;
}
static inline int HYPERVISOR_dom0_op(void *dom0_op)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_dom0_op),
"b" (dom0_op) );
return ret;
}
static inline int HYPERVISOR_network_op(void *network_op)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_network_op),
"b" (network_op) );
return ret;
}
/* Events that a guest OS may receive from the hypervisor. */
#define EVENT_NET_TX 0x01 /* packets for transmission. */
#define EVENT_NET_RX 0x02 /* empty buffers for receive. */
@@ -1,40 +0,0 @@
/******************************************************************************
* block.h
*
* Block IO communication rings.
*
* These are the ring data structures for buffering messages between
* the hypervisor and guestos's.
*
* For now we'll start with our own rings for the block IO code instead
* of using the network rings. Hopefully, this will give us additional
* flexibility in the future should we choose to move away from a
* ring producer consumer communication model.
*/
#ifndef __BLOCK_H__
#define __BLOCK_H__
typedef struct blk_tx_entry_st {
unsigned long addr; /* virtual address */
unsigned long size; /* in bytes */
} blk_tx_entry_t;
typedef struct blk_rx_entry_st {
unsigned long addr; /* virtual address */
unsigned long size; /* in bytes */
} blk_rx_entry_t;
typedef struct blk_ring_st {
blk_tx_entry_t *tx_ring;
unsigned int tx_prod, tx_cons, tx_event;
unsigned int tx_ring_size;
blk_rx_entry_t *rx_ring;
unsigned int rx_prod, rx_cons, rx_event;
unsigned int rx_ring_size;
} blk_ring_t;
int blk_create_ring(int domain, unsigned long ptr);
#endif
@@ -1,272 +0,0 @@
/******************************************************************************
* hypervisor-if.h
*
* Interface to Xeno hypervisor.
*/
#include <asm/hypervisor-ifs/network.h>
#include <asm/hypervisor-ifs/block.h>
#ifndef __HYPERVISOR_IF_H__
#define __HYPERVISOR_IF_H__
typedef struct trap_info_st
{
unsigned char vector; /* exception/interrupt vector */
unsigned char dpl; /* privilege level */
unsigned short cs; /* code selector */
unsigned long address; /* code address */
} trap_info_t;
typedef struct
{
#define PGREQ_ADD_BASEPTR 0
#define PGREQ_REMOVE_BASEPTR 1
unsigned long ptr, val; /* *ptr = val */
} page_update_request_t;
/* EAX = vector; EBX, ECX, EDX, ESI, EDI = args 1, 2, 3, 4, 5. */
#define __HYPERVISOR_set_trap_table 0
#define __HYPERVISOR_pt_update 1
#define __HYPERVISOR_console_write 2
#define __HYPERVISOR_set_pagetable 3
#define __HYPERVISOR_set_guest_stack 4
#define __HYPERVISOR_net_update 5
#define __HYPERVISOR_fpu_taskswitch 6
#define __HYPERVISOR_yield 7
#define __HYPERVISOR_exit 8
#define __HYPERVISOR_dom0_op 9
#define __HYPERVISOR_network_op 10
#define TRAP_INSTR "int $0x82"
static inline int HYPERVISOR_set_trap_table(trap_info_t *table)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_set_trap_table),
"b" (table) );
return ret;
}
static inline int HYPERVISOR_pt_update(page_update_request_t *req, int count)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_pt_update),
"b" (req), "c" (count) );
return ret;
}
static inline int HYPERVISOR_console_write(const char *str, int count)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_console_write),
"b" (str), "c" (count) );
return ret;
}
static inline int HYPERVISOR_set_pagetable(unsigned long ptr)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_set_pagetable),
"b" (ptr) );
return ret;
}
static inline int HYPERVISOR_set_guest_stack(
unsigned long ss, unsigned long esp)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_set_guest_stack),
"b" (ss), "c" (esp) );
return ret;
}
static inline int HYPERVISOR_net_update(void)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_net_update) );
return ret;
}
static inline int HYPERVISOR_fpu_taskswitch(void)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_fpu_taskswitch) );
return ret;
}
static inline int HYPERVISOR_yield(void)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_yield) );
return ret;
}
static inline int HYPERVISOR_exit(void)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_exit) );
return ret;
}
static inline int HYPERVISOR_dom0_op(void *dom0_op)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_dom0_op),
"b" (dom0_op) );
return ret;
}
static inline int HYPERVISOR_network_op(void *network_op)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_network_op),
"b" (network_op) );
return ret;
}
/* Events that a guest OS may receive from the hypervisor. */
#define EVENT_NET_TX 0x01 /* packets for transmission. */
#define EVENT_NET_RX 0x02 /* empty buffers for receive. */
#define EVENT_TIMER 0x04 /* a timeout has been updated. */
#define EVENT_DIE 0x08 /* OS is about to be killed. Clean up please! */
#define EVENT_BLK_TX 0x10 /* packets for transmission. */
#define EVENT_BLK_RX 0x20 /* empty buffers for receive. */
/* Bit offsets, as opposed to the above masks. */
#define _EVENT_NET_TX 0
#define _EVENT_NET_RX 1
#define _EVENT_TIMER 2
#define _EVENT_DIE 3
#define _EVENT_BLK_TX 4
#define _EVENT_BLK_RX 5
/*
* NB. We expect that this struct is smaller than a page.
*/
typedef struct shared_info_st {
/* Bitmask of outstanding event notifications hypervisor -> guest OS. */
unsigned long events;
/*
* Hypervisor will only signal event delivery via the "callback
* exception" when this value is non-zero. Hypervisor clears this when
* notiying the guest OS -- thsi prevents unbounded reentrancy and
* stack overflow (in this way, acts as an interrupt-enable flag).
*/
unsigned long events_enable;
/*
* Address for callbacks hypervisor -> guest OS.
* Stack frame looks like that of an interrupt.
* Code segment is the default flat selector.
* This handler will only be called when events_enable is non-zero.
*/
unsigned long event_address;
/*
* Hypervisor uses this callback when it takes a fault on behalf of
* an application. This can happen when returning from interrupts for
* example: various faults can occur when reloading the segment
* registers, and executing 'iret'.
* This callback is provided with an extended stack frame, augmented
* with saved values for segment registers %ds and %es:
* %ds, %es, %eip, %cs, %eflags [, %oldesp, %oldss]
* Code segment is the default flat selector.
* FAULTS WHEN CALLING THIS HANDLER WILL TERMINATE THE DOMAIN!!!
*/
unsigned long failsafe_address;
/*
* CPU ticks since start of day.
* `wall_time' counts CPU ticks in real time.
* `domain_time' counts CPU ticks during which this domain has run.
*/
unsigned long ticks_per_ms; /* CPU ticks per millisecond */
/*
* Current wall_time can be found by rdtsc. Only possible use of
* variable below is that it provides a timestamp for last update
* of domain_time.
*/
unsigned long long wall_time;
unsigned long long domain_time;
/*
* Timeouts for points at which guest OS would like a callback.
* This will probably be backed up by a timer heap in the guest OS.
* In Linux we use timeouts to update 'jiffies'.
*/
unsigned long long wall_timeout;
unsigned long long domain_timeout;
/*
* Real-Time Clock. This shows time, in seconds, since 1.1.1980.
* The timestamp shows the CPU 'wall time' when RTC was last read.
* Thus it allows a mapping between 'real time' and 'wall time'.
*/
unsigned long rtc_time;
unsigned long long rtc_timestamp;
} shared_info_t;
/*
* NB. We expect that this struct is smaller than a page.
*/
typedef struct start_info_st {
unsigned long nr_pages; /* total pages allocated to this domain */
shared_info_t *shared_info; /* start address of shared info struct */
unsigned long pt_base; /* address of page directory */
unsigned long phys_base;
unsigned long mod_start; /* start address of pre-loaded module */
unsigned long mod_len; /* size (bytes) of pre-loaded module */
net_ring_t *net_rings;
int num_net_rings;
blk_ring_t *blk_ring; /* block io communication rings */
unsigned long frame_table; /* mapping of the frame_table for dom0 */
unsigned char cmd_line[1]; /* variable-length */
} start_info_t;
/* For use in guest OSes. */
extern shared_info_t *HYPERVISOR_shared_info;
#endif /* __HYPERVISOR_IF_H__ */
@@ -1,113 +0,0 @@
/******************************************************************************
* network.h
*
* ring data structures for buffering messages between hypervisor and
* guestos's. As it stands this is only used for network buffer exchange.
*
* This file also contains structures and interfaces for the per-domain
* routing/filtering tables in the hypervisor.
*
*/
#ifndef __RING_H__
#define __RING_H__
#include <linux/types.h>
typedef struct tx_entry_st {
unsigned long addr; /* virtual address */
unsigned long size; /* in bytes */
} tx_entry_t;
typedef struct rx_entry_st {
unsigned long addr; /* virtual address */
unsigned long size; /* in bytes */
} rx_entry_t;
#define TX_RING_SIZE 1024
#define RX_RING_SIZE 1024
typedef struct net_ring_st {
/*
* Guest OS places packets into ring at tx_prod.
* Hypervisor removes at tx_cons.
* Ring is empty when tx_prod == tx_cons.
* Guest OS receives a DOMAIN_EVENT_NET_TX when tx_cons passes tx_event.
* Hypervisor may be prodded whenever tx_prod is updated, but this is
* only necessary when tx_cons == old_tx_prod (ie. transmitter stalled).
*/
tx_entry_t *tx_ring;
unsigned int tx_prod, tx_cons, tx_event;
unsigned int tx_ring_size;
/*
* Guest OS places empty buffers into ring at rx_prod.
* Hypervisor fills buffers as rx_cons.
* Ring is empty when rx_prod == rx_cons.
* Guest OS receives a DOMAIN_EVENT_NET_RX when rx_cons passes rx_event.
* Hypervisor may be prodded whenever rx_prod is updated, but this is
* only necessary when rx_cons == old_rx_prod (ie. receiver stalled).
*/
rx_entry_t *rx_ring;
unsigned int rx_prod, rx_cons, rx_event;
unsigned int rx_ring_size;
} net_ring_t;
/* Specify base of per-domain array. Get returned free slot in the array. */
net_ring_t *create_net_vif(int domain);
/* Packet routing/filtering code follows:
*/
#define NETWORK_ACTION_ACCEPT 0
#define NETWORK_ACTION_COUNT 1
#define NETWORK_PROTO_IP 0
#define NETWORK_PROTO_TCP 1
#define NETWORK_PROTO_UDP 2
#define NETWORK_PROTO_ARP 3
typedef struct net_rule_st
{
u32 src_addr;
u32 dst_addr;
u16 src_port;
u16 dst_port;
u32 src_addr_mask;
u32 dst_addr_mask;
u16 src_port_mask;
u16 dst_port_mask;
u16 proto;
u16 src_interface;
u16 dst_interface;
u16 action;
} net_rule_t;
/* Network trap operations and associated structure.
* This presently just handles rule insertion and deletion, but will
* evenually have code to add and remove interfaces.
*/
#define NETWORK_OP_ADDRULE 0
#define NETWORK_OP_DELETERULE 1
#define NETWORK_OP_GETRULELIST 2
typedef struct network_op_st
{
unsigned long cmd;
union
{
net_rule_t net_rule;
}
u;
} network_op_t;
typedef struct net_rule_ent_st
{
net_rule_t r;
struct net_rule_ent_st *next;
} net_rule_ent_t;
/* Drop a new rule down to the network tables. */
int add_net_rule(net_rule_t *rule);
#endif
@@ -37,4 +37,130 @@ void queue_tlb_flush(void);
void queue_tlb_flush_one(unsigned long ptr);
void flush_page_update_queue(void);
/*
* Assembler stubs for hyper-calls.
*/
static inline int HYPERVISOR_set_trap_table(trap_info_t *table)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_set_trap_table),
"b" (table) );
return ret;
}
static inline int HYPERVISOR_pt_update(page_update_request_t *req, int count)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_pt_update),
"b" (req), "c" (count) );
return ret;
}
static inline int HYPERVISOR_console_write(const char *str, int count)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_console_write),
"b" (str), "c" (count) );
return ret;
}
static inline int HYPERVISOR_set_pagetable(unsigned long ptr)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_set_pagetable),
"b" (ptr) );
return ret;
}
static inline int HYPERVISOR_set_guest_stack(
unsigned long ss, unsigned long esp)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_set_guest_stack),
"b" (ss), "c" (esp) );
return ret;
}
static inline int HYPERVISOR_net_update(void)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_net_update) );
return ret;
}
static inline int HYPERVISOR_fpu_taskswitch(void)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_fpu_taskswitch) );
return ret;
}
static inline int HYPERVISOR_yield(void)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_yield) );
return ret;
}
static inline int HYPERVISOR_exit(void)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_exit) );
return ret;
}
static inline int HYPERVISOR_dom0_op(void *dom0_op)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_dom0_op),
"b" (dom0_op) : "memory" );
return ret;
}
static inline int HYPERVISOR_network_op(void *network_op)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_network_op),
"b" (network_op) );
return ret;
}
#endif /* __HYPERVISOR_H__ */
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.