mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
bitkeeper revision 1.96 (3e5a5cd7-6YCRyx9vceH0j_ljuOe-Q)
hypervisor-ifs: new file Many files: Allow forced killing of domains with 'kill_domain -f'. task_structs now reference counted. .del-network.h~823d28e86ebe9d9b: Delete: xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/network.h .del-hypervisor-if.h~d1f6a7dd4307ddfe: Delete: xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/hypervisor-if.h .del-block.h~81aa08f4e2012da6: Delete: xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/block.h
This commit is contained in:
1 parent
704f9b0126
commit
2b1c361bee
15 files changed
+57
-448
No files matched your search
@@ -2,5 +2,7 @@
|
||||
set -e
|
||||
test -L old/xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor-ifs
|
||||
rm old/xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor-ifs
|
||||
test -L xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs
|
||||
rm xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs
|
||||
(find -depth -type d -print | xargs -r rmdir 2>/dev/null) || true
|
||||
exit 0
|
||||
@@ -5,5 +5,9 @@ mkdir -p old/xenolinux-2.4.16-sparse
|
||||
mkdir -p old/xenolinux-2.4.16-sparse/include
|
||||
mkdir -p old/xenolinux-2.4.16-sparse/include/asm-xeno
|
||||
ln -s ../../../xen-2.4.16/include/hypervisor-ifs old/xenolinux-2.4.16-sparse/include/asm-xeno/hypervisor-ifs
|
||||
mkdir -p xenolinux-2.4.21-pre4-sparse
|
||||
mkdir -p xenolinux-2.4.21-pre4-sparse/include
|
||||
mkdir -p xenolinux-2.4.21-pre4-sparse/include/asm-xeno
|
||||
ln -s ../../../xen/include/hypervisor-ifs/ xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs
|
||||
(find -depth -type d -print | xargs -r rmdir 2>/dev/null) || true
|
||||
exit 0
|
||||
@@ -544,9 +544,7 @@
|
||||
3e5a4e67P_6RRoCzUiQt_gyx6lmyWw xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hdreg.h
|
||||
3e5a4e67w_DWgjIJ17Tlossu1LGujQ xenolinux-2.4.21-pre4-sparse/include/asm-xeno/highmem.h
|
||||
3e5a4e67YtcyDLQsShhCfQwPSELfvA xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hw_irq.h
|
||||
3e5a4e67ASLV411RBbSd1tsCc1Dobg xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/block.h
|
||||
3e5a4e675NGZazUEJ9DDEbTzK3PuDQ xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/hypervisor-if.h
|
||||
3e5a4e67poqyxiAz_921VNzba90kmw xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/network.h
|
||||
3e5a5ccawqXeyC62v0oeh-KcabObgA xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs
|
||||
3e5a4e677VBavzM1UZIEcH1B-RlXMA xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor.h
|
||||
3e5a4e679TYbXAUiURvTeX4cFb1RlQ xenolinux-2.4.21-pre4-sparse/include/asm-xeno/i387.h
|
||||
3e5a4e672eNAzAKUZsefsPdmsH19hA xenolinux-2.4.21-pre4-sparse/include/asm-xeno/ide.h
|
||||
|
||||
@@ -27,6 +27,7 @@ typedef struct dom0_newdomain_st
|
||||
typedef struct dom0_killdomain_st
|
||||
{
|
||||
unsigned int domain;
|
||||
int force;
|
||||
} dom0_killdomain_t;
|
||||
|
||||
typedef struct dom0_getmemlist_st
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#define PERR_STRING "Xen Domain Killer"
|
||||
|
||||
static int do_kill_domain(int dom_id)
|
||||
static int do_kill_domain(int dom_id, int force)
|
||||
{
|
||||
char cmd_path[MAX_PATH];
|
||||
dom0_op_t dop;
|
||||
@@ -23,6 +23,7 @@ static int do_kill_domain(int dom_id)
|
||||
|
||||
dop.cmd = DOM0_KILLDOMAIN;
|
||||
dop.u.killdomain.domain = dom_id;
|
||||
dop.u.killdomain.force = force;
|
||||
|
||||
/* open the /proc command interface */
|
||||
sprintf(cmd_path, "%s%s%s%s", "/proc/", PROC_XENO_ROOT, "/", PROC_CMD);
|
||||
@@ -42,13 +43,18 @@ int main(int argc, char **argv)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if(argc < 2){
|
||||
printf("Usage: kill_domain <domain_id>\n");
|
||||
if ( (argc < 2) || (argc > 3) )
|
||||
{
|
||||
usage:
|
||||
printf("Usage: kill_domain [-f] <domain_id>\n");
|
||||
printf(" -f: Forces immediate destruction of specified domain\n");
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = do_kill_domain(atoi(argv[1]));
|
||||
if ( (argc == 3) && strcmp("-f", argv[1]) ) goto usage;
|
||||
|
||||
ret = do_kill_domain(atoi(argv[argc-1]), argc == 3);
|
||||
|
||||
out:
|
||||
return ret;
|
||||
|
||||
@@ -81,6 +81,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
|
||||
wake_up(p);
|
||||
reschedule(p);
|
||||
ret = p->domain;
|
||||
free_task_struct(p);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -113,13 +114,14 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
|
||||
case DOM0_KILLDOMAIN:
|
||||
{
|
||||
unsigned int dom = op.u.killdomain.domain;
|
||||
int force = op.u.killdomain.force;
|
||||
if ( dom == IDLE_DOMAIN_ID )
|
||||
{
|
||||
ret = -EPERM;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = kill_other_domain(dom);
|
||||
ret = kill_other_domain(dom, force);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
+19
-16
@@ -40,6 +40,8 @@ struct task_struct *do_newdomain(unsigned int dom_id, unsigned int cpu)
|
||||
if (!p) goto newdomain_out;
|
||||
memset(p, 0, sizeof(*p));
|
||||
|
||||
atomic_set(&p->refcnt, 1);
|
||||
|
||||
p->domain = dom_id;
|
||||
p->processor = cpu;
|
||||
|
||||
@@ -82,6 +84,7 @@ struct task_struct *find_domain_by_id(unsigned int dom)
|
||||
read_lock_irq(&tasklist_lock);
|
||||
do {
|
||||
if ( (p->domain == dom) ) {
|
||||
get_task_struct(p); /* increment the refcnt for caller */
|
||||
read_unlock_irq(&tasklist_lock);
|
||||
return (p);
|
||||
}
|
||||
@@ -117,27 +120,27 @@ void kill_domain(void)
|
||||
}
|
||||
|
||||
|
||||
long kill_other_domain(unsigned int dom)
|
||||
long kill_other_domain(unsigned int dom, int force)
|
||||
{
|
||||
struct task_struct *p = &idle0_task;
|
||||
struct task_struct *p;
|
||||
unsigned long cpu_mask = 0;
|
||||
long ret = -ESRCH;
|
||||
|
||||
read_lock_irq(&tasklist_lock);
|
||||
do {
|
||||
if ( p->domain == dom )
|
||||
{
|
||||
cpu_mask = mark_guest_event(p, _EVENT_DIE);
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
p = find_domain_by_id(dom);
|
||||
if ( p == NULL ) return -ESRCH;
|
||||
|
||||
if ( force )
|
||||
{
|
||||
cpu_mask = mark_hyp_event(p, _HYP_EVENT_DIE);
|
||||
hyp_event_notify(cpu_mask);
|
||||
}
|
||||
else
|
||||
{
|
||||
cpu_mask = mark_guest_event(p, _EVENT_DIE);
|
||||
guest_event_notify(cpu_mask);
|
||||
}
|
||||
while ( (p = p->next_task) != &idle0_task );
|
||||
read_unlock_irq(&tasklist_lock);
|
||||
|
||||
hyp_event_notify(cpu_mask);
|
||||
|
||||
return ret;
|
||||
free_task_struct(p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ net_vif_t *create_net_vif(int domain)
|
||||
new_vif->net_ring = new_ring;
|
||||
new_vif->shadow_ring = shadow_ring;
|
||||
|
||||
new_vif->domain = find_domain_by_id(domain);
|
||||
new_vif->domain = dom_task;
|
||||
|
||||
new_vif->list.next = NULL;
|
||||
|
||||
@@ -93,6 +93,7 @@ net_vif_t *create_net_vif(int domain)
|
||||
dom_task->net_vif_list[dom_task->num_net_vifs] = new_vif;
|
||||
dom_task->num_net_vifs++;
|
||||
|
||||
free_task_struct(dom_task);
|
||||
return new_vif;
|
||||
|
||||
fail:
|
||||
@@ -103,6 +104,8 @@ fail:
|
||||
if ( shadow_ring->tx_ring ) kfree(shadow_ring->tx_ring);
|
||||
kfree(shadow_ring);
|
||||
}
|
||||
|
||||
free_task_struct(dom_task);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -149,6 +152,7 @@ void vif_query(vif_query_t *vq)
|
||||
|
||||
copy_to_user(vq->buf, buf, strlen(buf) + 1);
|
||||
|
||||
free_task_struct(dom_task);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -440,9 +440,12 @@ unsigned long get_wchan(struct task_struct *p);
|
||||
#define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1022])
|
||||
|
||||
#define THREAD_SIZE (2*PAGE_SIZE)
|
||||
#define alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
|
||||
#define free_task_struct(p) free_pages((unsigned long) (p), 1)
|
||||
#define get_task_struct(tsk) atomic_inc(&virt_to_page(tsk)->count)
|
||||
#define alloc_task_struct() \
|
||||
((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
|
||||
#define free_task_struct(_p) \
|
||||
if ( atomic_dec_and_test(&(_p)->refcnt) ) free_pages((unsigned long)(_p), 1)
|
||||
#define get_task_struct(_p) \
|
||||
atomic_inc(&(_p)->refcnt)
|
||||
|
||||
#define idle0_task (idle0_task_union.task)
|
||||
#define idle0_stack (idle0_task_union.stack)
|
||||
|
||||
@@ -27,6 +27,7 @@ typedef struct dom0_newdomain_st
|
||||
typedef struct dom0_killdomain_st
|
||||
{
|
||||
unsigned int domain;
|
||||
int force;
|
||||
} dom0_killdomain_t;
|
||||
|
||||
typedef struct dom0_getmemlist_st
|
||||
|
||||
@@ -60,7 +60,7 @@ struct task_struct {
|
||||
|
||||
int processor;
|
||||
int state;
|
||||
int hyp_events;
|
||||
int hyp_events;
|
||||
unsigned int domain;
|
||||
|
||||
/* An unsafe pointer into a shared data area. */
|
||||
@@ -101,6 +101,8 @@ struct task_struct {
|
||||
struct task_struct *prev_task, *next_task;
|
||||
|
||||
unsigned long flags;
|
||||
|
||||
atomic_t refcnt;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -163,7 +165,7 @@ struct task_struct *find_domain_by_id(unsigned int dom);
|
||||
extern void release_task(struct task_struct *);
|
||||
extern void kill_domain(void);
|
||||
extern void kill_domain_with_errmsg(const char *err);
|
||||
extern long kill_other_domain(unsigned int dom);
|
||||
extern long kill_other_domain(unsigned int dom, int force);
|
||||
|
||||
/* arch/process.c */
|
||||
void new_thread(struct task_struct *p,
|
||||
|
||||
@@ -27,6 +27,7 @@ typedef struct dom0_newdomain_st
|
||||
typedef struct dom0_killdomain_st
|
||||
{
|
||||
unsigned int domain;
|
||||
int force;
|
||||
} dom0_killdomain_t;
|
||||
|
||||
typedef struct dom0_getmemlist_st
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/******************************************************************************
|
||||
* block.h
|
||||
*
|
||||
* Block IO communication rings.
|
||||
*
|
||||
* These are the ring data structures for buffering messages between
|
||||
* the hypervisor and guestos's.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __BLOCK_H__
|
||||
#define __BLOCK_H__
|
||||
|
||||
#include <linux/kdev_t.h>
|
||||
|
||||
/* the first four definitions match fs.h */
|
||||
#define XEN_BLOCK_READ 0
|
||||
#define XEN_BLOCK_WRITE 1
|
||||
#define XEN_BLOCK_READA 2 /* currently unused */
|
||||
#define XEN_BLOCK_SPECIAL 4 /* currently unused */
|
||||
#define XEN_BLOCK_PROBE 8 /* determine io configuration from hypervisor */
|
||||
#define XEN_BLOCK_DEBUG 16 /* debug */
|
||||
|
||||
#define BLK_RING_SIZE 128
|
||||
#define BLK_RING_MAX_ENTRIES (BLK_RING_SIZE - 2)
|
||||
#define BLK_RING_INC(_i) (((_i)+1) & (BLK_RING_SIZE-1))
|
||||
#define BLK_RING_ADD(_i,_j) (((_i)+(_j)) & (BLK_RING_SIZE-1))
|
||||
|
||||
typedef struct blk_ring_req_entry
|
||||
{
|
||||
void * id; /* for guest os use */
|
||||
int operation; /* XEN_BLOCK_READ or XEN_BLOCK_WRITE */
|
||||
char * buffer;
|
||||
unsigned long block_number; /* block number */
|
||||
unsigned short block_size; /* block size */
|
||||
kdev_t device;
|
||||
unsigned long sector_number; /* real buffer location on disk */
|
||||
} blk_ring_req_entry_t;
|
||||
|
||||
typedef struct blk_ring_resp_entry
|
||||
{
|
||||
void *id;
|
||||
unsigned long status;
|
||||
} blk_ring_resp_entry_t;
|
||||
|
||||
typedef struct blk_ring_st
|
||||
{
|
||||
unsigned int req_prod; /* Request producer. Updated by guest OS. */
|
||||
unsigned int resp_prod; /* Response producer. Updated by Xen. */
|
||||
union {
|
||||
blk_ring_req_entry_t req;
|
||||
blk_ring_resp_entry_t resp;
|
||||
} ring[BLK_RING_SIZE];
|
||||
} blk_ring_t;
|
||||
|
||||
#define MAX_XEN_DISK_COUNT 100
|
||||
|
||||
#define XEN_DISK_IDE 1
|
||||
#define XEN_DISK_SCSI 2
|
||||
|
||||
typedef struct xen_disk /* physical disk */
|
||||
{
|
||||
int type; /* disk type */
|
||||
unsigned long capacity;
|
||||
unsigned char heads; /* hdreg.h::hd_geometry */
|
||||
unsigned char sectors; /* hdreg.h::hd_geometry */
|
||||
unsigned int cylinders; /* hdreg.h::hd_big_geometry */
|
||||
unsigned long start; /* hdreg.h::hd_geometry */
|
||||
void * gendisk; /* struct gendisk ptr */
|
||||
} xen_disk_t;
|
||||
|
||||
typedef struct xen_disk_info
|
||||
{
|
||||
int count; /* number of subsequent xen_disk_t structures to follow */
|
||||
xen_disk_t disks[100];
|
||||
} xen_disk_info_t;
|
||||
|
||||
#endif
|
||||
@@ -1,209 +0,0 @@
|
||||
/******************************************************************************
|
||||
* hypervisor-if.h
|
||||
*
|
||||
* Interface to Xeno hypervisor.
|
||||
*/
|
||||
|
||||
#include "network.h"
|
||||
#include "block.h"
|
||||
|
||||
#ifndef __HYPERVISOR_IF_H__
|
||||
#define __HYPERVISOR_IF_H__
|
||||
|
||||
/*
|
||||
* Virtual addresses beyond this are not modifiable by guest OSes.
|
||||
* The machine->physical mapping table starts at this address, read-only
|
||||
* to all domains except DOM0.
|
||||
*/
|
||||
#define HYPERVISOR_VIRT_START (0xFC000000UL)
|
||||
#ifndef machine_to_phys_mapping
|
||||
#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
|
||||
#endif
|
||||
|
||||
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
|
||||
{
|
||||
/*
|
||||
* PGREQ_XXX: specified in least-significant bits of 'ptr' field.
|
||||
* All requests specify relevent PTE or PT address in 'ptr'.
|
||||
* Normal requests specify update value in 'value'.
|
||||
* Extended requests specify command in least 8 bits of 'value'.
|
||||
*/
|
||||
/* A normal page-table update request. */
|
||||
#define PGREQ_NORMAL 0
|
||||
/* Update an entry in the machine->physical mapping table. */
|
||||
#define PGREQ_MPT_UPDATE 1
|
||||
/* An extended command. */
|
||||
#define PGREQ_EXTENDED_COMMAND 2
|
||||
/* DOM0 can make entirely unchecked updates which do not affect refcnts. */
|
||||
#define PGREQ_UNCHECKED_UPDATE 3
|
||||
unsigned long ptr, val; /* *ptr = val */
|
||||
/* Announce a new top-level page table. */
|
||||
#define PGEXT_PIN_L1_TABLE 0
|
||||
#define PGEXT_PIN_L2_TABLE 1
|
||||
#define PGEXT_PIN_L3_TABLE 2
|
||||
#define PGEXT_PIN_L4_TABLE 3
|
||||
#define PGEXT_UNPIN_TABLE 4
|
||||
#define PGEXT_NEW_BASEPTR 5
|
||||
#define PGEXT_TLB_FLUSH 6
|
||||
#define PGEXT_INVLPG 7
|
||||
#define PGEXT_CMD_MASK 255
|
||||
#define PGEXT_CMD_SHIFT 8
|
||||
} page_update_request_t;
|
||||
|
||||
|
||||
/*
|
||||
* Segment descriptor tables.
|
||||
*/
|
||||
/* 8 entries, plus a TSS entry for each CPU (up to 32 CPUs). */
|
||||
#define FIRST_DOMAIN_GDT_ENTRY 40
|
||||
/* These are flat segments for domain bootstrap and fallback. */
|
||||
#define FLAT_RING1_CS 0x11
|
||||
#define FLAT_RING1_DS 0x19
|
||||
#define FLAT_RING3_CS 0x23
|
||||
#define FLAT_RING3_DS 0x2b
|
||||
|
||||
|
||||
/* 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_gdt 3
|
||||
#define __HYPERVISOR_stack_and_ldt_switch 4
|
||||
#define __HYPERVISOR_net_update 5
|
||||
#define __HYPERVISOR_fpu_taskswitch 6
|
||||
#define __HYPERVISOR_sched_op 7
|
||||
#define __HYPERVISOR_exit 8
|
||||
#define __HYPERVISOR_dom0_op 9
|
||||
#define __HYPERVISOR_network_op 10
|
||||
#define __HYPERVISOR_block_io_op 11
|
||||
#define __HYPERVISOR_set_debugreg 12
|
||||
#define __HYPERVISOR_get_debugreg 13
|
||||
#define __HYPERVISOR_update_descriptor 14
|
||||
#define __HYPERVISOR_set_fast_trap 15
|
||||
|
||||
#define TRAP_INSTR "int $0x82"
|
||||
|
||||
|
||||
/* Event message note:
|
||||
*
|
||||
* Here, as in the interrupts to the guestos, additional network interfaces
|
||||
* are defined. These definitions server as placeholders for the event bits,
|
||||
* however, in the code these events will allways be referred to as shifted
|
||||
* offsets from the base NET events.
|
||||
*/
|
||||
|
||||
/* Events that a guest OS may receive from the hypervisor. */
|
||||
#define EVENT_BLK_RESP 0x01 /* A block device response has been queued. */
|
||||
#define EVENT_TIMER 0x02 /* A timeout has been updated. */
|
||||
#define EVENT_DIE 0x04 /* OS is about to be killed. Clean up please! */
|
||||
#define EVENT_DEBUG 0x08 /* Request guest to dump debug info (gross!) */
|
||||
#define EVENT_NET_TX 0x10 /* There are packets for transmission. */
|
||||
#define EVENT_NET_RX 0x20 /* There are empty buffers for receive. */
|
||||
|
||||
/* Bit offsets, as opposed to the above masks. */
|
||||
#define _EVENT_BLK_RESP 0
|
||||
#define _EVENT_TIMER 1
|
||||
#define _EVENT_DIE 2
|
||||
#define _EVENT_NET_TX 3
|
||||
#define _EVENT_NET_RX 4
|
||||
#define _EVENT_DEBUG 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 -- this 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;
|
||||
|
||||
/*
|
||||
* Time:
|
||||
* The following abstractions are exposed: System Time, Wall Clock
|
||||
* Time, Domain Virtual Time. Domains can access Cycle counter time
|
||||
* directly.
|
||||
* XXX RN: Need something to pass NTP scaling to GuestOS.
|
||||
*/
|
||||
|
||||
u64 cpu_freq; /* to calculate ticks -> real time */
|
||||
|
||||
/* System Time */
|
||||
long long system_time; /* in ns */
|
||||
unsigned long st_timestamp; /* cyclecounter at last update */
|
||||
|
||||
/* Wall Clock Time */
|
||||
u32 wc_version; /* a version number for info below */
|
||||
long tv_sec; /* essentially a struct timeval */
|
||||
long tv_usec;
|
||||
long long wc_timestamp; /* system time at last update */
|
||||
|
||||
/* Domain Virtual Time */
|
||||
unsigned long long domain_time;
|
||||
|
||||
/*
|
||||
* Timeout values:
|
||||
* Allow a domain to specify a timeout value in system time and
|
||||
* domain virtual time.
|
||||
*/
|
||||
unsigned long long wall_timeout;
|
||||
unsigned long long domain_timeout;
|
||||
|
||||
} 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; /* VIRTUAL address of shared info struct */
|
||||
unsigned long pt_base; /* VIRTUAL address of page directory */
|
||||
unsigned long mod_start; /* VIRTUAL address of pre-loaded module */
|
||||
unsigned long mod_len; /* size (bytes) of pre-loaded module */
|
||||
net_ring_t *net_rings; /* network rings (VIRTUAL ADDRESS) */
|
||||
int num_net_rings;
|
||||
unsigned long blk_ring; /* block io ring (MACHINE ADDRESS) */
|
||||
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,131 +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 */
|
||||
int status; /* per descriptor status. */
|
||||
} tx_entry_t;
|
||||
|
||||
typedef struct rx_entry_st {
|
||||
unsigned long addr; /* virtual address */
|
||||
unsigned long size; /* in bytes */
|
||||
int status; /* per descriptor status. */
|
||||
} rx_entry_t;
|
||||
|
||||
#define TX_RING_SIZE 256
|
||||
#define RX_RING_SIZE 256
|
||||
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;
|
||||
|
||||
/*
|
||||
* 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;
|
||||
} 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_ANY 0
|
||||
#define NETWORK_PROTO_IP 1
|
||||
#define NETWORK_PROTO_TCP 2
|
||||
#define NETWORK_PROTO_UDP 3
|
||||
#define NETWORK_PROTO_ARP 4
|
||||
|
||||
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;
|
||||
|
||||
int src_interface;
|
||||
int dst_interface;
|
||||
u16 action;
|
||||
} net_rule_t;
|
||||
|
||||
typedef struct vif_query_st
|
||||
{
|
||||
unsigned int domain;
|
||||
char *buf; // where to put the reply -- guest virtual address
|
||||
} vif_query_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
|
||||
#define NETWORK_OP_VIFQUERY 3
|
||||
|
||||
typedef struct network_op_st
|
||||
{
|
||||
unsigned long cmd;
|
||||
union
|
||||
{
|
||||
net_rule_t net_rule;
|
||||
vif_query_t vif_query;
|
||||
}
|
||||
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);
|
||||
|
||||
|
||||
/* Descriptor status values:
|
||||
*/
|
||||
|
||||
#define RING_STATUS_OK 0 // Everything is gravy.
|
||||
#define RING_STATUS_ERR_CFU -1 // Copy from user problems.
|
||||
#define RING_STATUS_BAD_PAGE -2 // What they gave us was pure evil.
|
||||
|
||||
#endif
|
||||