Domain controller cleanups.
pci_device_list = []; console_port = -1
auto_console = False
dontstart = False
+flags = 0
##### Determine location of defaults file
#####
rsp = { 'success': True }
xend.main.send_management_response(rsp, xend.blkif.pendaddr)
elif subtype == CMSG_BLKIF_BE_CONNECT:
- (dom,hnd,evtchn,frame,st) = struct.unpack("IIILI", msg.get_payload())
+ pl = msg.get_payload()
+ (dom, hnd, frame, evtchn, st) = (pl['domid'], pl['blkif_handle'],
+ pl['shmem_frame'], pl['evtchn'],
+ pl['status'])
blkif = interface.list[xend.main.port_from_dom(dom).local_port]
- msg = xend.utils.message(CMSG_BLKIF_FE, \
- CMSG_BLKIF_FE_INTERFACE_STATUS_CHANGED, 0)
- msg.append_payload(struct.pack("III",0,2,blkif.evtchn['port2']))
+ msg = xend.utils.message(CMSG_BLKIF_FE,
+ CMSG_BLKIF_FE_INTERFACE_STATUS_CHANGED, 0,
+ { 'handle' : 0, 'status' : 2,
+ 'evtchn' : blkif.evtchn['port2'] })
blkif.ctrlif_tx_req(xend.main.port_list[blkif.key], msg)
elif subtype == CMSG_BLKIF_BE_VBD_CREATE:
- (dom,hnd,vdev,ro,st) = struct.unpack("IIHII", msg.get_payload())
+ pl = msg.get_payload()
+ (dom, hnd, vdev, ro, st) = (pl['domid'], pl['blkif_handle'],
+ pl['vdevice'], pl['readonly'],
+ pl['status'])
blkif = interface.list[xend.main.port_from_dom(dom).local_port]
(pdev, start_sect, nr_sect, readonly) = blkif.devices[vdev]
- msg = xend.utils.message(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_GROW, 0)
- msg.append_payload(struct.pack("IIHHHQQI",dom,0,vdev,0, \
- pdev,start_sect,nr_sect,0))
+ msg = xend.utils.message(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_GROW, 0,
+ { 'domid' : dom, 'blkif_handle' : 0,
+ 'vdevice' : vdev,
+ 'extent.sector_start' : start_sect,
+ 'extent.sector.length' : nr_sect,
+ 'extent.device' : pdev })
backend_tx_req(msg)
elif subtype == CMSG_BLKIF_BE_VBD_GROW:
rsp = { 'success': True }
self.devices = {}
self.pendmsg = None
interface.list[key] = self
- msg = xend.utils.message(CMSG_BLKIF_BE, CMSG_BLKIF_BE_CREATE, 0)
- msg.append_payload(struct.pack("III",dom,0,0))
+ msg = xend.utils.message(CMSG_BLKIF_BE, CMSG_BLKIF_BE_CREATE, 0,
+ { 'domid' : dom, 'blkif_handle' : 0 })
xend.blkif.pendaddr = xend.main.mgmt_req_addr
backend_tx_req(msg)
if self.devices.has_key(vdev):
return False
self.devices[vdev] = (pdev, start_sect, nr_sect, readonly)
- msg = xend.utils.message(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_CREATE, 0)
- msg.append_payload(struct.pack("IIHII",self.dom,0,vdev,readonly,0))
+ msg = xend.utils.message(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_CREATE, 0,
+ { 'domid' : self.dom, 'blkif_handle' : 0,
+ 'vdevice' : vdev, 'readonly' : readonly })
xend.blkif.pendaddr = xend.main.mgmt_req_addr
backend_tx_req(msg)
return True
# Completely destroy this interface.
def destroy(self):
del interface.list[self.key]
- msg = xend.utils.message(CMSG_BLKIF_BE, CMSG_BLKIF_BE_DESTROY, 0)
- msg.append_payload(struct.pack("III",self.dom,0,0))
+ msg = xend.utils.message(CMSG_BLKIF_BE, CMSG_BLKIF_BE_DESTROY, 0,
+ { 'domid' : self.dom, 'blkif_handle' : 0 })
backend_tx_req(msg)
port.write_response(msg)
subtype = (msg.get_header())['subtype']
if subtype == CMSG_BLKIF_FE_DRIVER_STATUS_CHANGED:
- msg = xend.utils.message(CMSG_BLKIF_FE, \
- CMSG_BLKIF_FE_INTERFACE_STATUS_CHANGED, 0)
- msg.append_payload(struct.pack("III",0,1,0))
+ msg = xend.utils.message(CMSG_BLKIF_FE,
+ CMSG_BLKIF_FE_INTERFACE_STATUS_CHANGED,
+ 0,
+ { 'handle' : 0, 'status' : 1 })
self.ctrlif_tx_req(port, msg)
elif subtype == CMSG_BLKIF_FE_INTERFACE_CONNECT:
- (hnd,frame) = struct.unpack("IL", msg.get_payload())
+ pl = msg.get_payload()
+ (hnd, frame) = (pl['handle'], pl['shmem_frame'])
xc = Xc.new()
self.evtchn = xc.evtchn_bind_interdomain(dom1=0,dom2=self.dom)
- msg = xend.utils.message(CMSG_BLKIF_BE, \
- CMSG_BLKIF_BE_CONNECT, 0)
- msg.append_payload(struct.pack("IIILI",self.dom,0, \
- self.evtchn['port1'],frame,0))
+ msg = xend.utils.message(CMSG_BLKIF_BE,
+ CMSG_BLKIF_BE_CONNECT, 0,
+ { 'domid' : self.dom, 'blkif_handle' : 0,
+ 'shmem_frame' : frame,
+ 'evtchn' : self.evtchn['port1'] })
backend_tx_req(msg)
typedef struct {
BASIC_START_INFO;
- unsigned int domain_controller_evtchn;
-} extended_start_info_t;
+ u16 domain_controller_evtchn; /* 320 */
+} PACKED extended_start_info_t; /* 322 bytes */
+#define SIF_BLK_BE_DOMAIN (1<<4) /* Is this a block backend domain? */
+#define SIF_NET_BE_DOMAIN (1<<5) /* Is this a net backend domain? */
/*
*/
typedef struct {
- u8 type; /* echoed in response */
- u8 subtype; /* echoed in response */
- u8 id; /* echoed in response */
- u8 length; /* number of bytes in 'msg' */
- unsigned char msg[60]; /* type-specific message data */
-} control_msg_t;
+ u8 type; /* 0: echoed in response */
+ u8 subtype; /* 1: echoed in response */
+ u8 id; /* 2: echoed in response */
+ u8 length; /* 3: number of bytes in 'msg' */
+ u8 msg[60]; /* 4: type-specific message data */
+} PACKED control_msg_t; /* 64 bytes */
#define CONTROL_RING_SIZE 8
-typedef unsigned int CONTROL_RING_IDX;
+typedef u32 CONTROL_RING_IDX;
#define MASK_CONTROL_IDX(_i) ((_i)&(CONTROL_RING_SIZE-1))
typedef struct {
- control_msg_t tx_ring[CONTROL_RING_SIZE]; /* guest-OS -> controller */
- control_msg_t rx_ring[CONTROL_RING_SIZE]; /* controller -> guest-OS */
- CONTROL_RING_IDX tx_req_prod, tx_resp_prod;
- CONTROL_RING_IDX rx_req_prod, rx_resp_prod;
-} control_if_t;
+ control_msg_t tx_ring[CONTROL_RING_SIZE]; /* 0: guest -> controller */
+ control_msg_t rx_ring[CONTROL_RING_SIZE]; /* 512: controller -> guest */
+ CONTROL_RING_IDX tx_req_prod, tx_resp_prod; /* 1024, 1028 */
+ CONTROL_RING_IDX rx_req_prod, rx_resp_prod; /* 1032, 1036 */
+} PACKED control_if_t; /* 1040 bytes */
/*
* Top-level command types.
#define BLKIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
#define BLKIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */
typedef struct {
- unsigned int handle;
- unsigned int status;
- unsigned int evtchn; /* status == BLKIF_INTERFACE_STATUS_CONNECTED */
-} blkif_fe_interface_status_changed_t;
+ u32 handle; /* 0 */
+ u32 status; /* 4 */
+ u16 evtchn; /* 8: (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
+} PACKED blkif_fe_interface_status_changed_t; /* 10 bytes */
/*
* CMSG_BLKIF_FE_DRIVER_STATUS_CHANGED:
#define BLKIF_DRIVER_STATUS_UP 1
typedef struct {
/* IN */
- unsigned int status; /* BLKIF_DRIVER_STATUS_??? */
+ u32 status; /* 0: BLKIF_DRIVER_STATUS_??? */
/* OUT */
/*
* Tells driver how many interfaces it should expect to immediately
* receive notifications about.
*/
- unsigned int nr_interfaces;
-} blkif_fe_driver_status_changed_t;
+ u32 nr_interfaces; /* 4 */
+} PACKED blkif_fe_driver_status_changed_t; /* 8 bytes */
/*
* CMSG_BLKIF_FE_INTERFACE_CONNECT:
* STATUS_CONNECTED message.
*/
typedef struct {
- unsigned int handle;
- unsigned long shmem_frame;
-} blkif_fe_interface_connect_t;
+ u32 handle; /* 0 */
+ u32 __pad;
+ memory_t shmem_frame; /* 8 */
+ MEMORY_PADDING;
+} PACKED blkif_fe_interface_connect_t; /* 16 bytes */
/*
* CMSG_BLKIF_FE_INTERFACE_DISCONNECT:
* STATUS_DISCONNECTED message.
*/
typedef struct {
- unsigned int handle;
-} blkif_fe_interface_disconnect_t;
+ u32 handle; /* 0 */
+} PACKED blkif_fe_interface_disconnect_t; /* 4 bytes */
/******************************************************************************
*/
typedef struct {
- blkif_pdev_t device;
- blkif_sector_t sector_start;
- blkif_sector_t sector_length;
-} blkif_extent_t;
+ blkif_sector_t sector_start; /* 0 */
+ blkif_sector_t sector_length; /* 8 */
+ blkif_pdev_t device; /* 16 */
+ u16 __pad; /* 18 */
+} PACKED blkif_extent_t; /* 20 bytes */
/* Non-specific 'okay' return. */
#define BLKIF_BE_STATUS_OKAY 0
*/
typedef struct {
/* IN */
- domid_t domid; /* Domain attached to new interface. */
- unsigned int blkif_handle; /* Domain-specific interface handle. */
+ domid_t domid; /* 0: Domain attached to new interface. */
+ u32 blkif_handle; /* 4: Domain-specific interface handle. */
/* OUT */
- unsigned int status;
-} blkif_be_create_t;
+ u32 status; /* 8 */
+} PACKED blkif_be_create_t; /* 12 bytes */
/*
* CMSG_BLKIF_BE_DESTROY:
*/
typedef struct {
/* IN */
- domid_t domid; /* Identify interface to be destroyed. */
- unsigned int blkif_handle; /* ...ditto... */
+ domid_t domid; /* 0: Identify interface to be destroyed. */
+ u32 blkif_handle; /* 4: ...ditto... */
/* OUT */
- unsigned int status;
-} blkif_be_destroy_t;
+ u32 status; /* 8 */
+} PACKED blkif_be_destroy_t; /* 12 bytes */
/*
* CMSG_BLKIF_BE_CONNECT:
*/
typedef struct {
/* IN */
- domid_t domid; /* Domain attached to new interface. */
- unsigned int blkif_handle; /* Domain-specific interface handle. */
- unsigned int evtchn; /* Event channel for notifications. */
- unsigned long shmem_frame; /* Page cont. shared comms window. */
+ domid_t domid; /* 0: Domain attached to new interface. */
+ u32 blkif_handle; /* 4: Domain-specific interface handle. */
+ memory_t shmem_frame; /* 8: Page cont. shared comms window. */
+ MEMORY_PADDING;
+ u32 evtchn; /* 16: Event channel for notifications. */
/* OUT */
- unsigned int status;
-} blkif_be_connect_t;
+ u32 status; /* 20 */
+} PACKED blkif_be_connect_t; /* 24 bytes */
/*
* CMSG_BLKIF_BE_DISCONNECT:
*/
typedef struct {
/* IN */
- domid_t domid; /* Domain attached to new interface. */
- unsigned int blkif_handle; /* Domain-specific interface handle. */
+ domid_t domid; /* 0: Domain attached to new interface. */
+ u32 blkif_handle; /* 4: Domain-specific interface handle. */
/* OUT */
- unsigned int status;
-} blkif_be_disconnect_t;
+ u32 status; /* 8 */
+} PACKED blkif_be_disconnect_t; /* 12 bytes */
/* CMSG_BLKIF_BE_VBD_CREATE */
typedef struct {
/* IN */
- domid_t domid; /* Identify blkdev interface. */
- unsigned int blkif_handle; /* ...ditto... */
- blkif_vdev_t vdevice; /* Interface-specific id for this VBD. */
- int readonly; /* Non-zero -> VBD isn't writeable. */
+ domid_t domid; /* 0: Identify blkdev interface. */
+ u32 blkif_handle; /* 4: ...ditto... */
+ blkif_vdev_t vdevice; /* 8: Interface-specific id for this VBD. */
+ u16 readonly; /* 10: Non-zero -> VBD isn't writeable. */
/* OUT */
- unsigned int status;
-} blkif_be_vbd_create_t;
+ u32 status; /* 12 */
+} PACKED blkif_be_vbd_create_t; /* 16 bytes */
/* CMSG_BLKIF_BE_VBD_DESTROY */
typedef struct {
/* IN */
- domid_t domid; /* Identify blkdev interface. */
- unsigned int blkif_handle; /* ...ditto... */
- blkif_vdev_t vdevice; /* Interface-specific id of the VBD. */
+ domid_t domid; /* 0: Identify blkdev interface. */
+ u32 blkif_handle; /* 4: ...ditto... */
+ blkif_vdev_t vdevice; /* 8: Interface-specific id of the VBD. */
+ u16 __pad; /* 10 */
/* OUT */
- unsigned int status;
-} blkif_be_vbd_destroy_t;
+ u32 status; /* 12 */
+} PACKED blkif_be_vbd_destroy_t; /* 16 bytes */
/* CMSG_BLKIF_BE_VBD_GROW */
typedef struct {
/* IN */
- domid_t domid; /* Identify blkdev interface. */
- unsigned int blkif_handle; /* ...ditto... */
- blkif_vdev_t vdevice; /* Interface-specific id of the VBD. */
- blkif_extent_t extent; /* Physical extent to append to VBD. */
+ domid_t domid; /* 0: Identify blkdev interface. */
+ u32 blkif_handle; /* 4: ...ditto... */
+ blkif_extent_t extent; /* 8: Physical extent to append to VBD. */
+ blkif_vdev_t vdevice; /* 28: Interface-specific id of the VBD. */
+ u16 __pad; /* 30 */
/* OUT */
- unsigned int status;
-} blkif_be_vbd_grow_t;
+ u32 status; /* 32 */
+} PACKED blkif_be_vbd_grow_t; /* 36 bytes */
/* CMSG_BLKIF_BE_VBD_SHRINK */
typedef struct {
/* IN */
- domid_t domid; /* Identify blkdev interface. */
- unsigned int blkif_handle; /* ...ditto... */
- blkif_vdev_t vdevice; /* Interface-specific id of the VBD. */
+ domid_t domid; /* 0: Identify blkdev interface. */
+ u32 blkif_handle; /* 4: ...ditto... */
+ blkif_vdev_t vdevice; /* 8: Interface-specific id of the VBD. */
+ u16 __pad; /* 10 */
/* OUT */
- unsigned int status;
-} blkif_be_vbd_shrink_t;
+ u32 status; /* 12 */
+} PACKED blkif_be_vbd_shrink_t; /* 16 bytes */
/*
* CMSG_BLKIF_BE_DRIVER_STATUS_CHANGED:
* Notify the domain controller that the back-end driver is DOWN or UP.
- * If the driver goes DOWN while interfaces are still UP, the domain
+ * If the driver goes DOWN while interfaces are still UP, the controller
* will automatically send DOWN notifications.
*/
typedef struct {
- /* IN */
- unsigned int status; /* BLKIF_DRIVER_STATUS_??? */
- /* OUT */
- /*
- * Tells driver how many interfaces it should expect to immediately
- * receive notifications about.
- */
- unsigned int nr_interfaces;
-} blkif_be_driver_status_changed_t;
+ u32 status; /* 0: BLKIF_DRIVER_STATUS_??? */
+} PACKED blkif_be_driver_status_changed_t; /* 4 bytes */
/******************************************************************************
#define NETIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
#define NETIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */
typedef struct {
- unsigned int handle;
- unsigned int status;
- unsigned int evtchn; /* status == NETIF_INTERFACE_STATUS_CONNECTED */
- u8 mac[6]; /* status == NETIF_INTERFACE_STATUS_CONNECTED */
-} netif_fe_interface_status_changed_t;
+ u32 handle; /* 0 */
+ u32 status; /* 4 */
+ u16 evtchn; /* 8: status == NETIF_INTERFACE_STATUS_CONNECTED */
+ u8 mac[6]; /* 10: status == NETIF_INTERFACE_STATUS_CONNECTED */
+} PACKED netif_fe_interface_status_changed_t; /* 16 bytes */
/*
* CMSG_NETIF_FE_DRIVER_STATUS_CHANGED:
#define NETIF_DRIVER_STATUS_UP 1
typedef struct {
/* IN */
- unsigned int status; /* NETIF_DRIVER_STATUS_??? */
+ u32 status; /* 0: NETIF_DRIVER_STATUS_??? */
/* OUT */
/*
* Tells driver how many interfaces it should expect to immediately
* receive notifications about.
*/
- unsigned int nr_interfaces;
-} netif_fe_driver_status_changed_t;
+ u32 nr_interfaces; /* 4 */
+} PACKED netif_fe_driver_status_changed_t; /* 8 bytes */
/*
* CMSG_NETIF_FE_INTERFACE_CONNECT:
* STATUS_CONNECTED message.
*/
typedef struct {
- unsigned int handle;
- unsigned long tx_shmem_frame;
- unsigned long rx_shmem_frame;
-} netif_fe_interface_connect_t;
+ u32 handle; /* 0 */
+ u32 __pad; /* 4 */
+ memory_t tx_shmem_frame; /* 8 */
+ MEMORY_PADDING;
+ memory_t rx_shmem_frame; /* 16 */
+ MEMORY_PADDING;
+} PACKED netif_fe_interface_connect_t; /* 24 bytes */
/*
* CMSG_NETIF_FE_INTERFACE_DISCONNECT:
* STATUS_DISCONNECTED message.
*/
typedef struct {
- unsigned int handle;
-} netif_fe_interface_disconnect_t;
+ u32 handle; /* 0 */
+} PACKED netif_fe_interface_disconnect_t; /* 4 bytes */
/******************************************************************************
*/
typedef struct {
/* IN */
- domid_t domid; /* Domain attached to new interface. */
- unsigned int netif_handle; /* Domain-specific interface handle. */
- u8 mac[6];
+ domid_t domid; /* 0: Domain attached to new interface. */
+ u32 netif_handle; /* 4: Domain-specific interface handle. */
+ u8 mac[6]; /* 8 */
+ u16 __pad; /* 14 */
/* OUT */
- unsigned int status;
-} netif_be_create_t;
+ u32 status; /* 16 */
+} PACKED netif_be_create_t; /* 20 bytes */
/*
* CMSG_NETIF_BE_DESTROY:
*/
typedef struct {
/* IN */
- domid_t domid; /* Identify interface to be destroyed. */
- unsigned int netif_handle; /* ...ditto... */
+ domid_t domid; /* 0: Identify interface to be destroyed. */
+ u32 netif_handle; /* 4: ...ditto... */
/* OUT */
- unsigned int status;
-} netif_be_destroy_t;
+ u32 status; /* 8 */
+} PACKED netif_be_destroy_t; /* 12 bytes */
/*
* CMSG_NETIF_BE_CONNECT:
*/
typedef struct {
/* IN */
- domid_t domid; /* Domain attached to new interface. */
- unsigned int netif_handle; /* Domain-specific interface handle. */
- unsigned int evtchn; /* Event channel for notifications. */
- unsigned long tx_shmem_frame; /* Page cont. tx shared comms window. */
- unsigned long rx_shmem_frame; /* Page cont. rx shared comms window. */
+ domid_t domid; /* 0: Domain attached to new interface. */
+ u32 netif_handle; /* 4: Domain-specific interface handle. */
+ memory_t tx_shmem_frame; /* 8: Page cont. tx shared comms window. */
+ MEMORY_PADDING;
+ memory_t rx_shmem_frame; /* 16: Page cont. rx shared comms window. */
+ MEMORY_PADDING;
+ u16 evtchn; /* 24: Event channel for notifications. */
+ u16 __pad; /* 26 */
/* OUT */
- unsigned int status;
-} netif_be_connect_t;
+ u32 status; /* 28 */
+} PACKED netif_be_connect_t; /* 32 bytes */
/*
* CMSG_NETIF_BE_DISCONNECT:
*/
typedef struct {
/* IN */
- domid_t domid; /* Domain attached to new interface. */
- unsigned int netif_handle; /* Domain-specific interface handle. */
+ domid_t domid; /* 0: Domain attached to new interface. */
+ u32 netif_handle; /* 4: Domain-specific interface handle. */
/* OUT */
- unsigned int status;
-} netif_be_disconnect_t;
+ u32 status; /* 8 */
+} PACKED netif_be_disconnect_t; /* 12 bytes */
/*
* CMSG_NETIF_BE_DRIVER_STATUS_CHANGED:
* will automatically send DOWN notifications.
*/
typedef struct {
- /* IN */
- unsigned int status; /* NETIF_DRIVER_STATUS_??? */
- /* OUT */
- /*
- * Tells driver how many interfaces it should expect to immediately
- * receive notifications about.
- */
- unsigned int nr_interfaces;
-} netif_be_driver_status_changed_t;
+ u32 status; /* 0: NETIF_DRIVER_STATUS_??? */
+} PACKED netif_be_driver_status_changed_t; /* 4 bytes */
#endif /* __DOMAIN_CONTROLLER_H__ */
notifier.bind(dom0_port.local_port)
port_list[dom0_port.local_port] = dom0_port
+ xend.netif.be_port = dom0_port
+
##
## MAIN LOOP
##
## for the network will only be accepted from this domain.
##
def set_network_backend(dom):
- if xend.netif.be_port: xend.netif.recovery = True
+ if xend.netif.be_port.remote_dom != 0:
+ xend.netif.recovery = True
xend.netif.be_port = xend.main.port_from_dom(dom)
return { 'success' : True }
pendmsg = None
pendaddr = None
-recovery = False # Is a recovery in progress? (if so, we'll need to notify guests)
+recovery = False # Is a recovery in progress?
be_port = None # Port object for backend domain
def backend_tx_req(msg):
- if not xend.netif.be_port:
- print "BUG: attempt to transmit request to non-existant netif driver"
if xend.netif.be_port.space_to_write_request():
xend.netif.be_port.write_request(msg)
xend.netif.be_port.notify()
subtype = (msg.get_header())['subtype']
print "Received netif-be request, subtype %d" % subtype
if subtype == CMSG_NETIF_BE_DRIVER_STATUS_CHANGED:
- (status, dummy) = struct.unpack("II", msg.get_payload())
+ pl = msg.get_payload()
+ status = pl['status']
if status == NETIF_DRIVER_STATUS_UP:
if xend.netif.recovery:
print "New netif backend now UP, notifying guests:"
netif = interface.list[netif_key]
netif.create()
print " Notifying %d" % netif.dom
- msg = xend.utils.message(CMSG_NETIF_FE, \
- CMSG_NETIF_FE_INTERFACE_STATUS_CHANGED, 0)
- msg.append_payload(struct.pack("IIIBBBBBBBB", \
- 0,1,0,0,0,0,0,0,0,0,0))
- netif.ctrlif_tx_req(xend.main.port_from_dom(netif.dom), msg)
+ msg = xend.utils.message(
+ CMSG_NETIF_FE,
+ CMSG_NETIF_FE_INTERFACE_STATUS_CHANGED, 0,
+ { 'handle' : 0, 'status' : 1 })
+ netif.ctrlif_tx_req(xend.main.port_from_dom(netif.dom),msg)
print "Done notifying guests"
recovery = False
- else: # No recovery in progress.
- if xend.netif.be_port: # This should never be true! (remove later)
- print "BUG: unexpected netif backend UP message from %d" \
- % port.remote_dom
else:
print "Unexpected net backend driver status: %d" % status
rsp = { 'success': True }
xend.main.send_management_response(rsp, xend.netif.pendaddr)
elif subtype == CMSG_NETIF_BE_CONNECT:
- (dom,hnd,evtchn,tx_frame,rx_frame,st) = \
- struct.unpack("IIILLI", msg.get_payload())
+ pl = msg.get_payload()
+ (dom, hnd, evtchn, tx_frame, rx_frame, st) = (
+ pl['domid'], pl['netif_handle'], pl['evtchn'],
+ pl['tx_shmem_frame'], pl['rx_shmem_frame'], pl['status'])
netif = interface.list[xend.main.port_from_dom(dom).local_port]
- msg = xend.utils.message(CMSG_NETIF_FE, \
- CMSG_NETIF_FE_INTERFACE_STATUS_CHANGED, 0)
- msg.append_payload(struct.pack("IIIBBBBBBBB",0,2, \
- netif.evtchn['port2'], \
- netif.mac[0],netif.mac[1], \
- netif.mac[2],netif.mac[3], \
- netif.mac[4],netif.mac[5], \
- 0,0))
+ msg = xend.utils.message(CMSG_NETIF_FE,
+ CMSG_NETIF_FE_INTERFACE_STATUS_CHANGED, 0,
+ { 'handle' : 0, 'status' : 2,
+ 'evtchn' : netif.evtchn['port2'],
+ 'mac[0]' : netif.mac[0],
+ 'mac[1]' : netif.mac[1],
+ 'mac[2]' : netif.mac[2],
+ 'mac[3]' : netif.mac[3],
+ 'mac[4]' : netif.mac[4],
+ 'mac[5]' : netif.mac[5] })
netif.ctrlif_tx_req(xend.main.port_list[netif.key], msg)
def backend_do_work(port):
def create(self):
"""Notify the current network back end to create the virtual interface
represented by this object."""
- msg = xend.utils.message(CMSG_NETIF_BE, CMSG_NETIF_BE_CREATE, 0)
- msg.append_payload(struct.pack("IIBBBBBBBBI",self.dom,0, \
- self.mac[0],self.mac[1], \
- self.mac[2],self.mac[3], \
- self.mac[4],self.mac[5], \
- 0,0,0))
+ msg = xend.utils.message(CMSG_NETIF_BE, CMSG_NETIF_BE_CREATE, 0,
+ { 'domid' : self.dom, 'netif_handle' : 0,
+ 'mac[0]' : self.mac[0],
+ 'mac[1]' : self.mac[1],
+ 'mac[2]' : self.mac[2],
+ 'mac[3]' : self.mac[3],
+ 'mac[4]' : self.mac[4],
+ 'mac[5]' : self.mac[5] })
xend.netif.pendaddr = xend.main.mgmt_req_addr
backend_tx_req(msg)
# Completely destroy this interface.
def destroy(self):
del interface.list[self.key]
- msg = xend.utils.message(CMSG_NETIF_BE, CMSG_NETIF_BE_DESTROY, 0)
- msg.append_payload(struct.pack("III",self.dom,0,0))
+ msg = xend.utils.message(CMSG_NETIF_BE, CMSG_NETIF_BE_DESTROY, 0,
+ { 'domid' : self.dom, 'netif_handle' : 0 })
backend_tx_req(msg)
subtype = (msg.get_header())['subtype']
if subtype == CMSG_NETIF_FE_DRIVER_STATUS_CHANGED:
print "netif driver up message from %d" % port.remote_dom
- msg = xend.utils.message(CMSG_NETIF_FE, \
- CMSG_NETIF_FE_INTERFACE_STATUS_CHANGED, 0)
- msg.append_payload(struct.pack("IIIBBBBBBBB",0,1,0,self.mac[0], \
- self.mac[1],self.mac[2], \
- self.mac[3],self.mac[4], \
- self.mac[5],0,0))
+ msg = xend.utils.message(CMSG_NETIF_FE,
+ CMSG_NETIF_FE_INTERFACE_STATUS_CHANGED, 0,
+ { 'handle' : 0, 'status' : 1 })
self.ctrlif_tx_req(port, msg)
elif subtype == CMSG_NETIF_FE_INTERFACE_CONNECT:
print "netif connect request from %d" % port.remote_dom
- (hnd,tx_frame,rx_frame) = struct.unpack("ILL", msg.get_payload())
+ pl = msg.get_payload()
+ (hnd, tx_frame, rx_frame) = (pl['handle'], pl['tx_shmem_frame'],
+ pl['rx_shmem_frame'])
xc = Xc.new()
- self.evtchn = xc.evtchn_bind_interdomain( \
- dom1=xend.netif.be_port.remote_dom, \
+ self.evtchn = xc.evtchn_bind_interdomain(
+ dom1=xend.netif.be_port.remote_dom,
dom2=self.dom)
- msg = xend.utils.message(CMSG_NETIF_BE, \
- CMSG_NETIF_BE_CONNECT, 0)
- msg.append_payload(struct.pack("IIILLI",self.dom,0, \
- self.evtchn['port1'],tx_frame, \
- rx_frame,0))
+ msg = xend.utils.message(CMSG_NETIF_BE,
+ CMSG_NETIF_BE_CONNECT, 0,
+ { 'domid' : self.dom, 'netif_handle' : 0,
+ 'tx_shmem_frame' : tx_frame,
+ 'rx_shmem_frame' : rx_frame,
+ 'evtchn' : self.evtchn['port1'] })
backend_tx_req(msg)
* *********************** MESSAGE ***********************
*/
+#define TYPE(_x,_y) (((_x)<<8)|(_y))
+#define P2C(_struct, _field, _pytype, _ctype1, _ctype2) \
+ do { \
+ PyObject *obj; \
+ if ( ((obj = PyDict_GetItemString(payload, #_field)) != NULL) && \
+ Py ## _pytype ## _Check(obj) ) \
+ ((_struct *)&xum->msg.msg[0])->_field = \
+ (_ctype2)Py ## _pytype ## _As ## _ctype1(obj); \
+ xum->msg.length = sizeof(_struct); \
+ } while ( 0 )
+#define C2P(_struct, _field, _pytype, _ctype1, _ctype2) \
+ do { \
+ PyObject *obj = Py ## _pytype ## _From ## _ctype1 \
+ (((_struct *)&xum->msg.msg[0])->_field); \
+ PyDict_SetItemString(dict, #_field, obj); \
+ } while ( 0 )
+
typedef struct {
PyObject_HEAD;
control_msg_t msg;
return Py_None;
}
+static PyObject *xu_message_set_response_fields(PyObject *self, PyObject *args)
+{
+ xu_message_object *xum = (xu_message_object *)self;
+ PyObject *payload;
+
+ if ( !PyArg_ParseTuple(args, "O", &payload) )
+ return NULL;
+
+ switch ( TYPE(xum->msg.type, xum->msg.subtype) )
+ {
+ case TYPE(CMSG_BLKIF_FE, CMSG_BLKIF_FE_DRIVER_STATUS_CHANGED):
+ P2C(blkif_fe_driver_status_changed_t, nr_interfaces, Int, Long, u32);
+ break;
+ case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_DRIVER_STATUS_CHANGED):
+ P2C(netif_fe_driver_status_changed_t, nr_interfaces, Int, Long, u32);
+ break;
+ }
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
static PyObject *xu_message_get_payload(PyObject *self, PyObject *args)
{
xu_message_object *xum = (xu_message_object *)self;
+ PyObject *dict;
if ( !PyArg_ParseTuple(args, "") )
return NULL;
+ dict = PyDict_New();
+
+ switch ( TYPE(xum->msg.type, xum->msg.subtype) )
+ {
+ case TYPE(CMSG_BLKIF_FE, CMSG_BLKIF_FE_INTERFACE_STATUS_CHANGED):
+ C2P(blkif_fe_interface_status_changed_t, handle, Int, Long, u32);
+ C2P(blkif_fe_interface_status_changed_t, status, Int, Long, u32);
+ C2P(blkif_fe_interface_status_changed_t, evtchn, Int, Long, u16);
+ return dict;
+ case TYPE(CMSG_BLKIF_FE, CMSG_BLKIF_FE_DRIVER_STATUS_CHANGED):
+ C2P(blkif_fe_driver_status_changed_t, status, Int, Long, u32);
+ return dict;
+ case TYPE(CMSG_BLKIF_FE, CMSG_BLKIF_FE_INTERFACE_CONNECT):
+ C2P(blkif_fe_interface_connect_t, handle, Int, Long, u32);
+ C2P(blkif_fe_interface_connect_t, shmem_frame, Int, Long, memory_t);
+ return dict;
+ case TYPE(CMSG_BLKIF_FE, CMSG_BLKIF_FE_INTERFACE_DISCONNECT):
+ C2P(blkif_fe_interface_disconnect_t, handle, Int, Long, u32);
+ return dict;
+ case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_CREATE):
+ C2P(blkif_be_create_t, domid, Int, Long, u32);
+ C2P(blkif_be_create_t, blkif_handle, Int, Long, u32);
+ C2P(blkif_be_create_t, status, Int, Long, u32);
+ return dict;
+ case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_DESTROY):
+ C2P(blkif_be_destroy_t, domid, Int, Long, u32);
+ C2P(blkif_be_destroy_t, blkif_handle, Int, Long, u32);
+ C2P(blkif_be_destroy_t, status, Int, Long, u32);
+ return dict;
+ case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_CONNECT):
+ C2P(blkif_be_connect_t, domid, Int, Long, u32);
+ C2P(blkif_be_connect_t, blkif_handle, Int, Long, u32);
+ C2P(blkif_be_connect_t, shmem_frame, Int, Long, memory_t);
+ C2P(blkif_be_connect_t, evtchn, Int, Long, u16);
+ C2P(blkif_be_connect_t, status, Int, Long, u32);
+ return dict;
+ case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_DISCONNECT):
+ C2P(blkif_be_disconnect_t, domid, Int, Long, u32);
+ C2P(blkif_be_disconnect_t, blkif_handle, Int, Long, u32);
+ C2P(blkif_be_disconnect_t, status, Int, Long, u32);
+ return dict;
+ case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_CREATE):
+ C2P(blkif_be_vbd_create_t, domid, Int, Long, u32);
+ C2P(blkif_be_vbd_create_t, blkif_handle, Int, Long, u32);
+ C2P(blkif_be_vbd_create_t, vdevice, Int, Long, blkif_vdev_t);
+ C2P(blkif_be_vbd_create_t, readonly, Int, Long, u16);
+ C2P(blkif_be_vbd_create_t, status, Int, Long, u32);
+ return dict;
+ case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_DESTROY):
+ C2P(blkif_be_vbd_destroy_t, domid, Int, Long, u32);
+ C2P(blkif_be_vbd_destroy_t, blkif_handle, Int, Long, u32);
+ C2P(blkif_be_vbd_destroy_t, vdevice, Int, Long, blkif_vdev_t);
+ C2P(blkif_be_vbd_destroy_t, status, Int, Long, u32);
+ return dict;
+ case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_GROW):
+ C2P(blkif_be_vbd_grow_t, domid, Int, Long, u32);
+ C2P(blkif_be_vbd_grow_t, blkif_handle, Int, Long, u32);
+ C2P(blkif_be_vbd_grow_t, vdevice, Int, Long, blkif_vdev_t);
+ C2P(blkif_be_vbd_grow_t, extent.sector_start,
+ Long, UnsignedLongLong, blkif_sector_t);
+ C2P(blkif_be_vbd_grow_t, extent.sector_length,
+ Long, UnsignedLongLong, blkif_sector_t);
+ C2P(blkif_be_vbd_grow_t, extent.device,
+ Int, Long, blkif_pdev_t);
+ C2P(blkif_be_vbd_grow_t, status, Int, Long, u32);
+ return dict;
+ case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_SHRINK):
+ C2P(blkif_be_vbd_shrink_t, domid, Int, Long, u32);
+ C2P(blkif_be_vbd_shrink_t, blkif_handle, Int, Long, u32);
+ C2P(blkif_be_vbd_shrink_t, vdevice, Int, Long, blkif_vdev_t);
+ C2P(blkif_be_vbd_shrink_t, status, Int, Long, u32);
+ return dict;
+ case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_DRIVER_STATUS_CHANGED):
+ C2P(blkif_be_driver_status_changed_t, status, Int, Long, u32);
+ return dict;
+ case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_INTERFACE_STATUS_CHANGED):
+ C2P(netif_fe_interface_status_changed_t, handle, Int, Long, u32);
+ C2P(netif_fe_interface_status_changed_t, status, Int, Long, u32);
+ C2P(netif_fe_interface_status_changed_t, evtchn, Int, Long, u16);
+ return dict;
+ case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_DRIVER_STATUS_CHANGED):
+ C2P(netif_fe_driver_status_changed_t, status, Int, Long, u32);
+ return dict;
+ case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_INTERFACE_CONNECT):
+ C2P(netif_fe_interface_connect_t, handle, Int, Long, u32);
+ C2P(netif_fe_interface_connect_t, tx_shmem_frame, Int, Long, memory_t);
+ C2P(netif_fe_interface_connect_t, rx_shmem_frame, Int, Long, memory_t);
+ return dict;
+ case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_INTERFACE_DISCONNECT):
+ C2P(netif_fe_interface_disconnect_t, handle, Int, Long, u32);
+ return dict;
+ case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_CREATE):
+ C2P(netif_be_create_t, domid, Int, Long, u32);
+ C2P(netif_be_create_t, netif_handle, Int, Long, u32);
+ C2P(netif_be_create_t, status, Int, Long, u32);
+ return dict;
+ case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_DESTROY):
+ C2P(netif_be_destroy_t, domid, Int, Long, u32);
+ C2P(netif_be_destroy_t, netif_handle, Int, Long, u32);
+ C2P(netif_be_destroy_t, status, Int, Long, u32);
+ return dict;
+ case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_CONNECT):
+ C2P(netif_be_connect_t, domid, Int, Long, u32);
+ C2P(netif_be_connect_t, netif_handle, Int, Long, u32);
+ C2P(netif_be_connect_t, tx_shmem_frame, Int, Long, memory_t);
+ C2P(netif_be_connect_t, rx_shmem_frame, Int, Long, memory_t);
+ C2P(netif_be_connect_t, evtchn, Int, Long, u16);
+ C2P(netif_be_connect_t, status, Int, Long, u32);
+ return dict;
+ case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_DISCONNECT):
+ C2P(netif_be_disconnect_t, domid, Int, Long, u32);
+ C2P(netif_be_disconnect_t, netif_handle, Int, Long, u32);
+ C2P(netif_be_disconnect_t, status, Int, Long, u32);
+ return dict;
+ case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_DRIVER_STATUS_CHANGED):
+ C2P(netif_be_driver_status_changed_t, status, Int, Long, u32);
+ return dict;
+ }
+
+ PyObject_Del(dict); /* didn't use it after all */
+
return PyString_FromStringAndSize(xum->msg.msg, xum->msg.length);
}
METH_VARARGS,
"Append @str to the message payload.\n" },
+ { "set_response_fields",
+ (PyCFunction)xu_message_set_response_fields,
+ METH_VARARGS,
+ "Fill in the response fields in a message that was passed to us.\n" },
+
{ "get_payload",
(PyCFunction)xu_message_get_payload,
METH_VARARGS,
{
xu_message_object *xum;
int type, subtype, id;
+ PyObject *payload = NULL;
- if ( !PyArg_ParseTuple(args, "iii", &type, &subtype, &id) )
+ if ( !PyArg_ParseTuple(args, "iii|O", &type, &subtype, &id, &payload) )
return NULL;
xum = PyObject_New(xu_message_object, &xu_message_type);
xum->msg.id = id;
xum->msg.length = 0;
+ if ( payload == NULL )
+ return (PyObject *)xum;
+
+ if ( !PyDict_Check(payload) )
+ {
+ PyErr_SetString(PyExc_TypeError, "payload is not a dictionary");
+ goto fail;
+ }
+
+ switch ( TYPE(type, subtype) )
+ {
+ case TYPE(CMSG_BLKIF_FE, CMSG_BLKIF_FE_INTERFACE_STATUS_CHANGED):
+ P2C(blkif_fe_interface_status_changed_t, handle, Int, Long, u32);
+ P2C(blkif_fe_interface_status_changed_t, status, Int, Long, u32);
+ P2C(blkif_fe_interface_status_changed_t, evtchn, Int, Long, u16);
+ break;
+ case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_CREATE):
+ P2C(blkif_be_create_t, domid, Int, Long, u32);
+ P2C(blkif_be_create_t, blkif_handle, Int, Long, u32);
+ break;
+ case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_DESTROY):
+ P2C(blkif_be_destroy_t, domid, Int, Long, u32);
+ P2C(blkif_be_destroy_t, blkif_handle, Int, Long, u32);
+ break;
+ case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_CONNECT):
+ P2C(blkif_be_connect_t, domid, Int, Long, u32);
+ P2C(blkif_be_connect_t, blkif_handle, Int, Long, u32);
+ P2C(blkif_be_connect_t, shmem_frame, Int, Long, memory_t);
+ P2C(blkif_be_connect_t, evtchn, Int, Long, u16);
+ break;
+ case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_DISCONNECT):
+ P2C(blkif_be_disconnect_t, domid, Int, Long, u32);
+ P2C(blkif_be_disconnect_t, blkif_handle, Int, Long, u32);
+ break;
+ case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_CREATE):
+ P2C(blkif_be_vbd_create_t, domid, Int, Long, u32);
+ P2C(blkif_be_vbd_create_t, blkif_handle, Int, Long, u32);
+ P2C(blkif_be_vbd_create_t, vdevice, Int, Long, blkif_vdev_t);
+ P2C(blkif_be_vbd_create_t, readonly, Int, Long, u16);
+ break;
+ case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_DESTROY):
+ P2C(blkif_be_vbd_destroy_t, domid, Int, Long, u32);
+ P2C(blkif_be_vbd_destroy_t, blkif_handle, Int, Long, u32);
+ P2C(blkif_be_vbd_destroy_t, vdevice, Int, Long, blkif_vdev_t);
+ break;
+ case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_GROW):
+ P2C(blkif_be_vbd_grow_t, domid, Int, Long, u32);
+ P2C(blkif_be_vbd_grow_t, blkif_handle, Int, Long, u32);
+ P2C(blkif_be_vbd_grow_t, vdevice, Int, Long, blkif_vdev_t);
+ P2C(blkif_be_vbd_grow_t, extent.sector_start,
+ Long, UnsignedLongLong, blkif_sector_t);
+ P2C(blkif_be_vbd_grow_t, extent.sector_length,
+ Long, UnsignedLongLong, blkif_sector_t);
+ P2C(blkif_be_vbd_grow_t, extent.device,
+ Int, Long, blkif_pdev_t);
+ break;
+ case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_SHRINK):
+ P2C(blkif_be_vbd_shrink_t, domid, Int, Long, u32);
+ P2C(blkif_be_vbd_shrink_t, blkif_handle, Int, Long, u32);
+ P2C(blkif_be_vbd_shrink_t, vdevice, Int, Long, blkif_vdev_t);
+ break;
+ case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_INTERFACE_STATUS_CHANGED):
+ P2C(netif_fe_interface_status_changed_t, handle, Int, Long, u32);
+ P2C(netif_fe_interface_status_changed_t, status, Int, Long, u32);
+ P2C(netif_fe_interface_status_changed_t, evtchn, Int, Long, u16);
+ P2C(netif_fe_interface_status_changed_t, mac[0], Int, Long, u8);
+ P2C(netif_fe_interface_status_changed_t, mac[1], Int, Long, u8);
+ P2C(netif_fe_interface_status_changed_t, mac[2], Int, Long, u8);
+ P2C(netif_fe_interface_status_changed_t, mac[3], Int, Long, u8);
+ P2C(netif_fe_interface_status_changed_t, mac[4], Int, Long, u8);
+ P2C(netif_fe_interface_status_changed_t, mac[5], Int, Long, u8);
+ break;
+ case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_CREATE):
+ P2C(netif_be_create_t, domid, Int, Long, u32);
+ P2C(netif_be_create_t, netif_handle, Int, Long, u32);
+ P2C(netif_be_create_t, mac[0], Int, Long, u8);
+ P2C(netif_be_create_t, mac[1], Int, Long, u8);
+ P2C(netif_be_create_t, mac[2], Int, Long, u8);
+ P2C(netif_be_create_t, mac[3], Int, Long, u8);
+ P2C(netif_be_create_t, mac[4], Int, Long, u8);
+ P2C(netif_be_create_t, mac[5], Int, Long, u8);
+ break;
+ case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_DESTROY):
+ P2C(netif_be_destroy_t, domid, Int, Long, u32);
+ P2C(netif_be_destroy_t, netif_handle, Int, Long, u32);
+ break;
+ case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_CONNECT):
+ P2C(netif_be_connect_t, domid, Int, Long, u32);
+ P2C(netif_be_connect_t, netif_handle, Int, Long, u32);
+ P2C(netif_be_connect_t, tx_shmem_frame, Int, Long, memory_t);
+ P2C(netif_be_connect_t, rx_shmem_frame, Int, Long, memory_t);
+ P2C(netif_be_connect_t, evtchn, Int, Long, u16);
+ break;
+ case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_DISCONNECT):
+ P2C(netif_be_disconnect_t, domid, Int, Long, u32);
+ P2C(netif_be_disconnect_t, netif_handle, Int, Long, u32);
+ break;
+ }
+
return (PyObject *)xum;
+
+ fail:
+ PyObject_Del((PyObject *)xum);
+ return NULL;
}
static PyObject *xu_message_getattr(PyObject *obj, char *name)
#define MAX_CMDLINE 256
#define BASIC_START_INFO \
/* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME. */ \
- unsigned long nr_pages; /* total pages allocated to this domain. */ \
- unsigned long shared_info; /* MACHINE address of shared info struct.*/ \
- unsigned long flags; /* SIF_xxx flags. */ \
+ memory_t nr_pages; /* 0: Total pages allocated to this domain. */ \
+ _MEMORY_PADDING(A); \
+ memory_t shared_info; /* 8: MACHINE address of shared info struct.*/ \
+ _MEMORY_PADDING(B); \
+ u32 flags; /* 16: SIF_xxx flags. */ \
+ u32 __pad; \
/* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME). */ \
- unsigned long pt_base; /* VIRTUAL address of page directory. */ \
- unsigned long nr_pt_frames; /* Number of bootstrap p.t. frames. */ \
- unsigned long mfn_list; /* VIRTUAL address of page-frame list. */ \
- unsigned long mod_start; /* VIRTUAL address of pre-loaded module. */ \
- unsigned long mod_len; /* Size (bytes) of pre-loaded module. */ \
- unsigned char cmd_line[MAX_CMDLINE]
+ memory_t pt_base; /* 24: VIRTUAL address of page directory. */ \
+ _MEMORY_PADDING(C); \
+ memory_t nr_pt_frames; /* 32: Number of bootstrap p.t. frames. */ \
+ _MEMORY_PADDING(D); \
+ memory_t mfn_list; /* 40: VIRTUAL address of page-frame list. */ \
+ _MEMORY_PADDING(E); \
+ memory_t mod_start; /* 48: VIRTUAL address of pre-loaded module. */ \
+ _MEMORY_PADDING(F); \
+ memory_t mod_len; /* 56: Size (bytes) of pre-loaded module. */ \
+ _MEMORY_PADDING(G); \
+ u8 cmd_line[MAX_CMDLINE] /* 64 */
typedef struct {
BASIC_START_INFO;
-} start_info_t;
+} PACKED start_info_t; /* 320 bytes */
/* These flags are passed in the 'flags' field of start_info_t. */
-#define SIF_PRIVILEGED 1 /* Is the domain privileged? */
-#define SIF_INITDOMAIN 2 /* Is this the initial control domain? */
-#define SIF_BLK_BE_DOMAIN 4 /* Is this a block backend domain? */
-#define SIF_NET_BE_DOMAIN 8 /* Is this a net backend domain? */
+#define SIF_PRIVILEGED (1<<0) /* Is the domain privileged? */
+#define SIF_INITDOMAIN (1<<1) /* Is this the initial control domain? */
/* For use in guest OSes. */
extern shared_info_t *HYPERVISOR_shared_info;