ia64/xen-unstable

changeset 1423:7e6b26d1ec0a

bitkeeper revision 1.927 (40bdde5d1ZXH3mH4b7gbCihjzISvAg)

Interface cleanups.
author kaf24@scramble.cl.cam.ac.uk
date Wed Jun 02 14:04:13 2004 +0000 (2004-06-02)
parents 44389f729723
children 26483a083da1
files xen/include/hypervisor-ifs/arch-i386/hypervisor-if.h xen/include/hypervisor-ifs/arch-x86_64/hypervisor-if.h xen/include/hypervisor-ifs/dom0_ops.h xen/include/hypervisor-ifs/event_channel.h xen/include/hypervisor-ifs/hypervisor-if.h xen/include/hypervisor-ifs/physdev.h xen/include/hypervisor-ifs/sched_ctl.h xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/blkif.h xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/main.c xenolinux-2.4.26-sparse/arch/xen/drivers/netif/netif.h
line diff
     1.1 --- a/xen/include/hypervisor-ifs/arch-i386/hypervisor-if.h	Wed Jun 02 09:23:55 2004 +0000
     1.2 +++ b/xen/include/hypervisor-ifs/arch-i386/hypervisor-if.h	Wed Jun 02 14:04:13 2004 +0000
     1.3 @@ -8,6 +8,16 @@
     1.4  #define __HYPERVISOR_IF_I386_H__
     1.5  
     1.6  /*
     1.7 + * Pointers and other address fields inside interface structures are padded to
     1.8 + * 64 bits. This means that field alignments aren't different between 32- and
     1.9 + * 64-bit architectures. 
    1.10 + */
    1.11 +/* NB. Multi-level macro ensures __LINE__ is expanded before concatenation. */
    1.12 +#define __MEMORY_PADDING(_X) u32 __pad_ ## _X
    1.13 +#define _MEMORY_PADDING(_X)  __MEMORY_PADDING(_X)
    1.14 +#define MEMORY_PADDING       _MEMORY_PADDING(__LINE__)
    1.15 +
    1.16 +/*
    1.17   * SEGMENT DESCRIPTOR TABLES
    1.18   */
    1.19  /*
    1.20 @@ -55,6 +65,10 @@
    1.21  
    1.22  #ifndef __ASSEMBLY__
    1.23  
    1.24 +/* NB. Both the following are 32 bits each. */
    1.25 +typedef unsigned long memory_t;   /* Full-sized pointer/address/memory-size. */
    1.26 +typedef unsigned long cpureg_t;   /* Full-sized register.                    */
    1.27 +
    1.28  /*
    1.29   * Send an array of these to HYPERVISOR_set_trap_table()
    1.30   */
    1.31 @@ -62,13 +76,12 @@
    1.32  #define TI_GET_IF(_ti)       ((_ti)->flags & 4)
    1.33  #define TI_SET_DPL(_ti,_dpl) ((_ti)->flags |= (_dpl))
    1.34  #define TI_SET_IF(_ti,_if)   ((_ti)->flags |= ((!!(_if))<<2))
    1.35 -typedef struct trap_info_st
    1.36 -{
    1.37 -    unsigned char  vector;  /* exception vector                              */
    1.38 -    unsigned char  flags;   /* 0-3: privilege level; 4: clear event enable?  */
    1.39 -    unsigned short cs;      /* code selector                                 */
    1.40 -    unsigned long  address; /* code address                                  */
    1.41 -} trap_info_t;
    1.42 +typedef struct {
    1.43 +    u8       vector;  /* 0: exception vector                              */
    1.44 +    u8       flags;   /* 1: 0-3: privilege level; 4: clear event enable?  */
    1.45 +    u16      cs;      /* 2: code selector                                 */
    1.46 +    memory_t address; /* 4: code address                                  */
    1.47 +} PACKED trap_info_t; /* 8 bytes */
    1.48  
    1.49  typedef struct
    1.50  {
    1.51 @@ -89,19 +102,18 @@ typedef struct
    1.52      unsigned long eflags;
    1.53      unsigned long esp;
    1.54      unsigned long ss;
    1.55 -} execution_context_t;
    1.56 +} PACKED execution_context_t;
    1.57  
    1.58  typedef struct {
    1.59 -    unsigned long  tsc_bits;      /* 32 bits read from the CPU's TSC. */
    1.60 -    unsigned int   tsc_bitshift;  /* 'tsc_bits' uses N:N+31 of TSC.   */
    1.61 -} tsc_timestamp_t;
    1.62 +    u32  tsc_bits;      /* 0: 32 bits read from the CPU's TSC. */
    1.63 +    u32  tsc_bitshift;  /* 4: 'tsc_bits' uses N:N+31 of TSC.   */
    1.64 +} PACKED tsc_timestamp_t; /* 8 bytes */
    1.65  
    1.66  /*
    1.67   * The following is all CPU context. Note that the i387_ctxt block is filled 
    1.68   * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
    1.69   */
    1.70 -typedef struct full_execution_context_st
    1.71 -{
    1.72 +typedef struct {
    1.73  #define ECF_I387_VALID (1<<0)
    1.74      unsigned long flags;
    1.75      execution_context_t cpu_ctxt;           /* User-level CPU registers     */
    1.76 @@ -117,7 +129,7 @@ typedef struct full_execution_context_st
    1.77      unsigned long event_callback_eip;
    1.78      unsigned long failsafe_callback_cs;     /* CS:EIP of failsafe callback  */
    1.79      unsigned long failsafe_callback_eip;
    1.80 -} full_execution_context_t;
    1.81 +} PACKED full_execution_context_t;
    1.82  
    1.83  #define ARCH_HAS_FAST_TRAP
    1.84  
     2.1 --- a/xen/include/hypervisor-ifs/arch-x86_64/hypervisor-if.h	Wed Jun 02 09:23:55 2004 +0000
     2.2 +++ b/xen/include/hypervisor-ifs/arch-x86_64/hypervisor-if.h	Wed Jun 02 14:04:13 2004 +0000
     2.3 @@ -7,6 +7,9 @@
     2.4  #ifndef __HYPERVISOR_IF_X86_64_H__
     2.5  #define __HYPERVISOR_IF_X86_64_H__
     2.6  
     2.7 +/* Pointers are naturally 64 bits in this architecture; no padding needed. */
     2.8 +#define MEMORY_PADDING()    ((void)0)
     2.9 +
    2.10  /*
    2.11   * SEGMENT DESCRIPTOR TABLES
    2.12   */
    2.13 @@ -53,6 +56,10 @@
    2.14  
    2.15  #ifndef __ASSEMBLY__
    2.16  
    2.17 +/* NB. Both the following are 64 bits each. */
    2.18 +typedef unsigned long memory_t;   /* Full-sized pointer/address/memory-size. */
    2.19 +typedef unsigned long cpureg_t;   /* Full-sized register.                    */
    2.20 +
    2.21  /*
    2.22   * Send an array of these to HYPERVISOR_set_trap_table()
    2.23   */
    2.24 @@ -60,13 +67,13 @@
    2.25  #define TI_GET_IF(_ti)       ((_ti)->flags & 4)
    2.26  #define TI_SET_DPL(_ti,_dpl) ((_ti)->flags |= (_dpl))
    2.27  #define TI_SET_IF(_ti,_if)   ((_ti)->flags |= ((!!(_if))<<2))
    2.28 -typedef struct trap_info_st
    2.29 -{
    2.30 -    unsigned char  vector;  /* exception vector                              */
    2.31 -    unsigned char  flags;   /* 0-3: privilege level; 4: clear event enable?  */
    2.32 -    unsigned short cs;      /* code selector                                 */
    2.33 -    unsigned long  address; /* code address                                  */
    2.34 -} trap_info_t;
    2.35 +typedef struct {
    2.36 +    u8       vector;  /* 0: exception vector                              */
    2.37 +    u8       flags;   /* 1: 0-3: privilege level; 4: clear event enable?  */
    2.38 +    u16      cs;      /* 2: code selector                                 */
    2.39 +    u32      __pad;   /* 4 */
    2.40 +    memory_t address; /* 8: code address                                  */
    2.41 +} PACKED trap_info_t; /* 16 bytes */
    2.42  
    2.43  typedef struct
    2.44  {
    2.45 @@ -90,19 +97,22 @@ typedef struct
    2.46      unsigned long eflags;
    2.47      unsigned long rsp;
    2.48      unsigned long ss;
    2.49 -} execution_context_t;
    2.50 +} PACKED execution_context_t;
    2.51  
    2.52 +/*
    2.53 + * NB. This may become a 64-bit count with no shift. If this happens then the 
    2.54 + * structure size will still be 8 bytes, so no other alignments will change.
    2.55 + */
    2.56  typedef struct {
    2.57 -    unsigned long  tsc_bits;      /* 32 bits read from the CPU's TSC. */
    2.58 -    unsigned int   tsc_bitshift;  /* 'tsc_bits' uses N:N+31 of TSC.   */
    2.59 -} tsc_timestamp_t;
    2.60 +    u32  tsc_bits;      /* 0: 32 bits read from the CPU's TSC. */
    2.61 +    u32  tsc_bitshift;  /* 4: 'tsc_bits' uses N:N+31 of TSC.   */
    2.62 +} PACKED tsc_timestamp_t; /* 8 bytes */
    2.63  
    2.64  /*
    2.65   * The following is all CPU context. Note that the i387_ctxt block is filled 
    2.66   * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
    2.67   */
    2.68 -typedef struct full_execution_context_st
    2.69 -{
    2.70 +typedef struct {
    2.71  #define ECF_I387_VALID (1<<0)
    2.72      unsigned long flags;
    2.73      execution_context_t cpu_ctxt;           /* User-level CPU registers     */
    2.74 @@ -117,7 +127,7 @@ typedef struct full_execution_context_st
    2.75      unsigned long event_callback_eip;
    2.76      unsigned long failsafe_callback_cs;     /* CS:EIP of failsafe callback  */
    2.77      unsigned long failsafe_callback_eip;
    2.78 -} full_execution_context_t;
    2.79 +} PACKED full_execution_context_t;
    2.80  
    2.81  #endif /* !__ASSEMBLY__ */
    2.82  
     3.1 --- a/xen/include/hypervisor-ifs/dom0_ops.h	Wed Jun 02 09:23:55 2004 +0000
     3.2 +++ b/xen/include/hypervisor-ifs/dom0_ops.h	Wed Jun 02 14:04:13 2004 +0000
     3.3 @@ -3,7 +3,8 @@
     3.4   * 
     3.5   * Process command requests from domain-0 guest OS.
     3.6   * 
     3.7 - * Copyright (c) 2002-2003, K A Fraser, B Dragovic
     3.8 + * Copyright (c) 2002-2003, B Dragovic
     3.9 + * Copyright (c) 2002-2004, K Fraser
    3.10   */
    3.11  
    3.12  
    3.13 @@ -18,22 +19,24 @@
    3.14   * This makes sure that old versions of dom0 tools will stop working in a
    3.15   * well-defined way (rather than crashing the machine, for instance).
    3.16   */
    3.17 -#define DOM0_INTERFACE_VERSION   0xAAAA000C
    3.18 +#define DOM0_INTERFACE_VERSION   0xAAAA000D
    3.19  
    3.20  #define MAX_DOMAIN_NAME    16
    3.21  
    3.22  /************************************************************************/
    3.23  
    3.24  #define DOM0_GETMEMLIST        2
    3.25 -typedef struct dom0_getmemlist_st
    3.26 -{
    3.27 +typedef struct {
    3.28      /* IN variables. */
    3.29 -    domid_t       domain;
    3.30 -    unsigned long max_pfns;
    3.31 -    void         *buffer;
    3.32 +    domid_t       domain;             /*  0 */
    3.33 +    memory_t      max_pfns;           /*  8 */
    3.34 +    MEMORY_PADDING;
    3.35 +    void         *buffer;             /* 16 */
    3.36 +    MEMORY_PADDING;
    3.37      /* OUT variables. */
    3.38 -    unsigned long num_pfns;
    3.39 -} dom0_getmemlist_t;
    3.40 +    memory_t      num_pfns;           /* 24 */
    3.41 +    MEMORY_PADDING;
    3.42 +} PACKED dom0_getmemlist_t; /* 32 bytes */
    3.43  
    3.44  #define DOM0_SCHEDCTL          6
    3.45   /* struct sched_ctl_cmd is from sched-ctl.h   */
    3.46 @@ -44,110 +47,117 @@ typedef struct sched_ctl_cmd dom0_schedc
    3.47  typedef struct sched_adjdom_cmd dom0_adjustdom_t;
    3.48  
    3.49  #define DOM0_CREATEDOMAIN      8
    3.50 -typedef struct dom0_createdomain_st 
    3.51 -{
    3.52 +typedef struct {
    3.53      /* IN parameters. */
    3.54 -    unsigned int memory_kb; 
    3.55 -    char         name[MAX_DOMAIN_NAME];
    3.56 -    int          cpu;
    3.57 +    memory_t     memory_kb;           /*  0 */
    3.58 +    MEMORY_PADDING;
    3.59 +    u8           name[MAX_DOMAIN_NAME]; /*  8 */
    3.60 +    u32          cpu;                 /* 24 */
    3.61 +    u32          __pad;               /* 28 */
    3.62      /* OUT parameters. */
    3.63 -    domid_t      domain; 
    3.64 -} dom0_createdomain_t;
    3.65 +    domid_t      domain;              /* 32 */
    3.66 +} PACKED dom0_createdomain_t; /* 40 bytes */
    3.67  
    3.68  #define DOM0_DESTROYDOMAIN     9
    3.69 -typedef struct dom0_destroydomain_st
    3.70 -{
    3.71 +typedef struct {
    3.72      /* IN variables. */
    3.73 -    domid_t      domain;
    3.74 -    int          force;
    3.75 -} dom0_destroydomain_t;
    3.76 +    domid_t      domain;              /*  0 */
    3.77 +    u32          force;               /*  8 */
    3.78 +} PACKED dom0_destroydomain_t; /* 12 bytes */
    3.79  
    3.80  #define DOM0_STARTDOMAIN      10
    3.81 -typedef struct dom0_startdomain_st
    3.82 -{
    3.83 +typedef struct {
    3.84      /* IN parameters. */
    3.85 -    domid_t domain;
    3.86 -} dom0_startdomain_t;
    3.87 +    domid_t domain;                   /*  0 */
    3.88 +} PACKED dom0_startdomain_t; /* 8 bytes */
    3.89  
    3.90  #define DOM0_STOPDOMAIN       11
    3.91 -typedef struct dom0_stopdomain_st
    3.92 -{
    3.93 +typedef struct {
    3.94      /* IN parameters. */
    3.95 -    domid_t domain;
    3.96 +    domid_t domain;                   /*  0 */
    3.97      /* hack to indicate that you want to wait for other domain -- replace
    3.98         with proper sychronous stop soon! */
    3.99 -    int     sync;  
   3.100 -} dom0_stopdomain_t;
   3.101 +    u32     sync;                     /*  8 */
   3.102 +} PACKED dom0_stopdomain_t; /* 12 bytes */
   3.103  
   3.104  #define DOM0_GETDOMAININFO    12
   3.105 -typedef struct dom0_getdomaininfo_st
   3.106 -{
   3.107 +typedef struct {
   3.108      /* IN variables. */
   3.109 -    domid_t domain;
   3.110 -    full_execution_context_t *ctxt;
   3.111 +    domid_t domain;                   /*  0 */
   3.112 +    full_execution_context_t *ctxt;   /*  8 */
   3.113 +    MEMORY_PADDING;
   3.114      /* OUT variables. */
   3.115 -    char name[MAX_DOMAIN_NAME];
   3.116 -    int processor;
   3.117 -    int has_cpu;
   3.118 +    char name[MAX_DOMAIN_NAME];       /* 16 */
   3.119 +    u32 processor;                    /* 32 */
   3.120 +    u32 has_cpu;                      /* 36 */
   3.121  #define DOMSTATE_ACTIVE              0
   3.122  #define DOMSTATE_STOPPED             1
   3.123 -    int state;
   3.124 -    int hyp_events;
   3.125 -    unsigned int tot_pages, max_pages;
   3.126 -    long long cpu_time;
   3.127 -    unsigned long shared_info_frame;  /* MFN of shared_info struct */
   3.128 -} dom0_getdomaininfo_t;
   3.129 +    u32 state;                        /* 40 */
   3.130 +    u32 hyp_events;                   /* 44 */
   3.131 +    u32 tot_pages;                    /* 48 */
   3.132 +    u32 max_pages;                    /* 52 */
   3.133 +    u64 cpu_time;                     /* 56 */
   3.134 +    memory_t shared_info_frame;       /* 64: MFN of shared_info struct */
   3.135 +    MEMORY_PADDING;
   3.136 +} PACKED dom0_getdomaininfo_t; /* 72 bytes */
   3.137  
   3.138  #define DOM0_BUILDDOMAIN      13
   3.139 -typedef struct dom0_builddomain_st
   3.140 -{
   3.141 +typedef struct {
   3.142      /* IN variables. */
   3.143 -    domid_t                  domain;
   3.144 -    unsigned int             num_vifs;
   3.145 +    domid_t                  domain;  /*  0 */
   3.146 +    u32                      num_vifs;/*  8 */
   3.147 +    u32                      __pad;   /* 12 */
   3.148      /* IN/OUT parameters */
   3.149 -    full_execution_context_t *ctxt;
   3.150 -} dom0_builddomain_t;
   3.151 +    full_execution_context_t *ctxt;   /* 16 */
   3.152 +    MEMORY_PADDING;
   3.153 +} PACKED dom0_builddomain_t; /* 24 bytes */
   3.154  
   3.155  #define DOM0_IOPL             14
   3.156 -typedef struct dom0_iopl_st
   3.157 -{
   3.158 -    domid_t domain;
   3.159 -    unsigned int iopl;
   3.160 -} dom0_iopl_t;
   3.161 +typedef struct {
   3.162 +    domid_t domain;                   /*  0 */
   3.163 +    u32     iopl;                     /*  8 */
   3.164 +} PACKED dom0_iopl_t; /* 12 bytes */
   3.165  
   3.166  #define DOM0_MSR              15
   3.167 -typedef struct dom0_msr_st
   3.168 -{
   3.169 +typedef struct {
   3.170      /* IN variables. */
   3.171 -    int write, cpu_mask, msr;
   3.172 -    unsigned int in1, in2;
   3.173 +    u32 write;                        /*  0 */
   3.174 +    u32 cpu_mask;                     /*  4 */
   3.175 +    u32 msr;                          /*  8 */
   3.176 +    u32 in1;                          /* 12 */
   3.177 +    u32 in2;                          /* 16 */
   3.178      /* OUT variables. */
   3.179 -    unsigned int out1, out2;
   3.180 -} dom0_msr_t;
   3.181 +    u32 out1;                         /* 20 */
   3.182 +    u32 out2;                         /* 24 */
   3.183 +} PACKED dom0_msr_t; /* 28 bytes */
   3.184  
   3.185  #define DOM0_DEBUG            16
   3.186 -typedef struct dom0_debug_st
   3.187 -{
   3.188 +typedef struct {
   3.189      /* IN variables. */
   3.190 -    char opcode;
   3.191 -    domid_t domain;
   3.192 -    int in1, in2, in3, in4;
   3.193 +    domid_t domain;                   /*  0 */
   3.194 +    u8  opcode;                       /*  8 */
   3.195 +    u8  __pad0, __pad1, __pad2;
   3.196 +    u32 in1;                          /* 12 */
   3.197 +    u32 in2;                          /* 16 */
   3.198 +    u32 in3;                          /* 20 */
   3.199 +    u32 in4;                          /* 24 */
   3.200      /* OUT variables. */
   3.201 -    unsigned int status;
   3.202 -    int out1, out2;
   3.203 -} dom0_debug_t;
   3.204 +    u32 status;                       /* 28 */
   3.205 +    u32 out1;                         /* 32 */
   3.206 +    u32 out2;                         /* 36 */
   3.207 +} PACKED dom0_debug_t; /* 40 bytes */
   3.208  
   3.209  /*
   3.210   * Set clock such that it would read <secs,usecs> after 00:00:00 UTC,
   3.211   * 1 January, 1970 if the current system time was <system_time>.
   3.212   */
   3.213  #define DOM0_SETTIME          17
   3.214 -typedef struct dom0_settime_st
   3.215 -{
   3.216 +typedef struct {
   3.217      /* IN variables. */
   3.218 -    unsigned long secs, usecs;
   3.219 -    u64 system_time;
   3.220 -} dom0_settime_t;
   3.221 +    u32 secs;                         /*  0 */
   3.222 +    u32 usecs;                        /*  4 */
   3.223 +    u64 system_time;                  /*  8 */
   3.224 +} PACKED dom0_settime_t; /* 16 bytes */
   3.225  
   3.226  #define DOM0_GETPAGEFRAMEINFO 18
   3.227  #define NOTAB 0         /* normal page */
   3.228 @@ -157,85 +167,82 @@ typedef struct dom0_settime_st
   3.229  #define L4TAB (4<<28)
   3.230  #define XTAB  (0xf<<28) /* invalid page */
   3.231  #define LTAB_MASK XTAB
   3.232 -typedef struct dom0_getpageframeinfo_st
   3.233 -{
   3.234 +typedef struct {
   3.235      /* IN variables. */
   3.236 -    unsigned long pfn;     /* Machine page frame number to query.       */
   3.237 -    domid_t domain;        /* To which domain does the frame belong?    */
   3.238 +    memory_t pfn;          /*  0: Machine page frame number to query.       */
   3.239 +    MEMORY_PADDING;
   3.240 +    domid_t domain;        /*  8: To which domain does the frame belong?    */
   3.241      /* OUT variables. */
   3.242      /* Is the page PINNED to a type? */
   3.243 -    unsigned long type;    /* see above type defs */
   3.244 -} dom0_getpageframeinfo_t;
   3.245 -
   3.246 +    u32 type;              /* 16: see above type defs */
   3.247 +} PACKED dom0_getpageframeinfo_t; /* 20 bytes */
   3.248  
   3.249  /*
   3.250   * Read console content from Xen buffer ring.
   3.251   */
   3.252 -
   3.253  #define DOM0_READCONSOLE      19
   3.254 -typedef struct dom0_readconsole_st
   3.255 -{
   3.256 -    unsigned long str;
   3.257 -    unsigned int count;
   3.258 -    unsigned int cmd;
   3.259 -} dom0_readconsole_t;
   3.260 +typedef struct {
   3.261 +    memory_t str;                     /*  0 */
   3.262 +    MEMORY_PADDING;
   3.263 +    u32      count;                   /*  8 */
   3.264 +    u32      cmd;                     /* 12 */
   3.265 +} PACKED dom0_readconsole_t; /* 16 bytes */
   3.266  
   3.267  /* 
   3.268   * Pin Domain to a particular CPU  (use -1 to unpin)
   3.269   */
   3.270  #define DOM0_PINCPUDOMAIN     20
   3.271 -typedef struct dom0_pincpudomain_st
   3.272 -{
   3.273 +typedef struct {
   3.274      /* IN variables. */
   3.275 -    domid_t      domain;
   3.276 -    int          cpu;  /* -1 implies unpin */
   3.277 -} dom0_pincpudomain_t;
   3.278 +    domid_t      domain;              /*  0 */
   3.279 +    s32          cpu;                 /*  8: -1 implies unpin */
   3.280 +} PACKED dom0_pincpudomain_t; /* 12 bytes */
   3.281  
   3.282  /* Get trace buffers physical base pointer */
   3.283  #define DOM0_GETTBUFS         21
   3.284 -typedef struct dom0_gettbufs_st
   3.285 -{
   3.286 -  /* OUT variables */
   3.287 -  unsigned long phys_addr; /* location of the trace buffers       */
   3.288 -  unsigned long size;      /* size of each trace buffer, in bytes */
   3.289 -} dom0_gettbufs_t;
   3.290 +typedef struct {
   3.291 +    /* OUT variables */
   3.292 +    memory_t phys_addr;   /*  0: location of the trace buffers       */
   3.293 +    MEMORY_PADDING;
   3.294 +    u32      size;        /*  8: size of each trace buffer, in bytes */
   3.295 +} PACKED dom0_gettbufs_t; /* 12 bytes */
   3.296  
   3.297  /*
   3.298   * Get physical information about the host machine
   3.299   */
   3.300  #define DOM0_PHYSINFO         22
   3.301 -typedef struct dom0_physinfo_st
   3.302 -{
   3.303 -    int ht_per_core;
   3.304 -    int cores;
   3.305 -    unsigned long cpu_khz;
   3.306 -    unsigned long total_pages;
   3.307 -    unsigned long free_pages;
   3.308 -} dom0_physinfo_t;
   3.309 +typedef struct {
   3.310 +    u32      ht_per_core;             /*  0 */
   3.311 +    u32      cores;                   /*  4 */
   3.312 +    u32      cpu_khz;                 /*  8 */
   3.313 +    u32      __pad;                   /* 12 */
   3.314 +    memory_t total_pages;             /* 16 */
   3.315 +    MEMORY_PADDING;
   3.316 +    memory_t free_pages;              /* 24 */
   3.317 +    MEMORY_PADDING;
   3.318 +} PACKED dom0_physinfo_t; /* 32 bytes */
   3.319  
   3.320  /* 
   3.321   * Allow a domain access to a physical PCI device
   3.322   */
   3.323  #define DOM0_PCIDEV_ACCESS    23
   3.324 -typedef struct dom0_pcidev_access_st
   3.325 -{
   3.326 +typedef struct {
   3.327      /* IN variables. */
   3.328 -    domid_t      domain;
   3.329 -    int          bus; 
   3.330 -    int          dev;
   3.331 -    int          func; 
   3.332 -    int          enable;
   3.333 -} dom0_pcidev_access_t;
   3.334 +    domid_t      domain;              /*  0 */
   3.335 +    u32          bus;                 /*  8 */
   3.336 +    u32          dev;                 /* 12 */
   3.337 +    u32          func;                /* 16 */
   3.338 +    u32          enable;              /* 20 */
   3.339 +} PACKED dom0_pcidev_access_t; /* 24 bytes */
   3.340  
   3.341  /*
   3.342   * Get the ID of the current scheduler.
   3.343   */
   3.344  #define DOM0_SCHED_ID        24
   3.345 -typedef struct dom0_sched_id_st
   3.346 -{
   3.347 +typedef struct {
   3.348      /* OUT variable */
   3.349 -    int sched_id;
   3.350 -} dom0_sched_id_t;
   3.351 +    u32 sched_id;                     /*  0 */
   3.352 +} PACKED dom0_sched_id_t; /* 4 bytes */
   3.353  
   3.354  /* 
   3.355   * Control shadow pagetables operation
   3.356 @@ -249,87 +256,88 @@ typedef struct dom0_sched_id_st
   3.357  #define DOM0_SHADOW_CONTROL_OP_CLEAN       11
   3.358  #define DOM0_SHADOW_CONTROL_OP_PEEK        12
   3.359  #define DOM0_SHADOW_CONTROL_OP_CLEAN2      13
   3.360 -typedef struct dom0_shadow_control_st
   3.361 -{
   3.362 +typedef struct {
   3.363      /* IN variables. */
   3.364 -    domid_t      domain;
   3.365 -    int          op;
   3.366 -    unsigned long  *dirty_bitmap; // pointe to mlocked buffer
   3.367 -    /* IN/OUT variables */
   3.368 -    unsigned long  pages;  // size of buffer, updated with actual size
   3.369 -    /* OUT varaibles */
   3.370 -    unsigned long fault_count;
   3.371 -    unsigned long dirty_count;
   3.372 -} dom0_shadow_control_t;
   3.373 +    domid_t        domain;            /*  0 */
   3.374 +    u32            op;                /*  8 */
   3.375 +    u32            __pad;             /* 12 */
   3.376 +    unsigned long *dirty_bitmap;      /* 16: pointer to locked buffer */
   3.377 +    MEMORY_PADDING;
   3.378 +    /* IN/OUT variables. */
   3.379 +    memory_t       pages;  /* 24: size of buffer, updated with actual size */
   3.380 +    MEMORY_PADDING;
   3.381 +    /* OUT variables. */
   3.382 +    memory_t       fault_count;       /* 32 */
   3.383 +    MEMORY_PADDING;
   3.384 +    memory_t       dirty_count;       /* 40 */
   3.385 +    MEMORY_PADDING;
   3.386 +} PACKED dom0_shadow_control_t; /* 48 bytes */
   3.387  
   3.388  #define DOM0_SETDOMAINNAME     26
   3.389 -typedef struct dom0_setdomainname_st
   3.390 -{
   3.391 +typedef struct {
   3.392      /* IN variables. */
   3.393 -    domid_t      domain;
   3.394 -    char         name[MAX_DOMAIN_NAME];    
   3.395 -} dom0_setdomainname_t;
   3.396 +    domid_t  domain;                  /*  0 */
   3.397 +    char     name[MAX_DOMAIN_NAME];   /*  8 */
   3.398 +} PACKED dom0_setdomainname_t; /* 24 bytes */
   3.399  
   3.400  #define DOM0_SETDOMAININITIALMEM   27
   3.401 -typedef struct dom0_setdomaininitialmem_st
   3.402 -{
   3.403 +typedef struct {
   3.404      /* IN variables. */
   3.405 -    domid_t      domain;
   3.406 -    unsigned int initial_memkb;  /* use before domain is built */
   3.407 -} dom0_setdomaininitialmem_t;
   3.408 +    domid_t     domain;               /*  0 */
   3.409 +    memory_t    initial_memkb;        /*  8 */
   3.410 +    MEMORY_PADDING;
   3.411 +} PACKED dom0_setdomaininitialmem_t; /* 16 bytes */
   3.412  
   3.413  #define DOM0_SETDOMAINMAXMEM   28
   3.414 -typedef struct dom0_setdomainmaxmem_st
   3.415 -{
   3.416 +typedef struct {
   3.417      /* IN variables. */
   3.418 -    domid_t      domain;
   3.419 -    unsigned int max_memkb;
   3.420 -} dom0_setdomainmaxmem_t;
   3.421 +    domid_t     domain;               /*  0 */
   3.422 +    memory_t    max_memkb;            /*  8 */
   3.423 +    MEMORY_PADDING;
   3.424 +} PACKED dom0_setdomainmaxmem_t; /* 16 bytes */
   3.425  
   3.426  #define DOM0_GETPAGEFRAMEINFO2 29   /* batched interface */
   3.427 -typedef struct dom0_getpageframeinfo2_st
   3.428 -{
   3.429 +typedef struct {
   3.430      /* IN variables. */
   3.431 -    domid_t domain;        /* To which domain do frames belong?    */    
   3.432 -    int num;
   3.433 +    domid_t  domain;                  /*  0 */
   3.434 +    memory_t num;                     /*  8 */
   3.435 +    MEMORY_PADDING;
   3.436      /* IN/OUT variables. */
   3.437 -    unsigned long *array;
   3.438 -} dom0_getpageframeinfo2_t;
   3.439 -
   3.440 +    unsigned long *array;             /* 16 */
   3.441 +    MEMORY_PADDING;
   3.442 +} PACKED dom0_getpageframeinfo2_t; /* 24 bytes */
   3.443  
   3.444 -typedef struct dom0_op_st
   3.445 -{
   3.446 -    unsigned long cmd;
   3.447 -    unsigned long interface_version; /* DOM0_INTERFACE_VERSION */
   3.448 -    union
   3.449 -    {
   3.450 -	unsigned long           dummy[4];
   3.451 -        dom0_createdomain_t     createdomain;
   3.452 -        dom0_startdomain_t      startdomain;
   3.453 -        dom0_stopdomain_t       stopdomain;
   3.454 -        dom0_destroydomain_t    destroydomain;
   3.455 -        dom0_getmemlist_t       getmemlist;
   3.456 -        dom0_schedctl_t         schedctl;
   3.457 -        dom0_adjustdom_t        adjustdom;
   3.458 -        dom0_builddomain_t      builddomain;
   3.459 -        dom0_getdomaininfo_t    getdomaininfo;
   3.460 -        dom0_getpageframeinfo_t getpageframeinfo;
   3.461 -        dom0_iopl_t             iopl;
   3.462 -	dom0_msr_t              msr;
   3.463 -	dom0_debug_t            debug;
   3.464 -	dom0_settime_t          settime;
   3.465 -	dom0_readconsole_t	readconsole;
   3.466 -	dom0_pincpudomain_t     pincpudomain;
   3.467 -        dom0_gettbufs_t         gettbufs;
   3.468 -        dom0_physinfo_t         physinfo;
   3.469 -        dom0_pcidev_access_t    pcidev_access;
   3.470 -        dom0_sched_id_t         sched_id;
   3.471 -	dom0_shadow_control_t   shadow_control;
   3.472 -	dom0_setdomainname_t    setdomainname;
   3.473 +typedef struct {
   3.474 +    u32 cmd;                          /* 0 */
   3.475 +    u32 interface_version;            /* 4 */ /* DOM0_INTERFACE_VERSION */
   3.476 +    union {                           /* 8 */
   3.477 +	u32                      dummy[14]; /* 56 bytes */
   3.478 +        dom0_createdomain_t      createdomain;
   3.479 +        dom0_startdomain_t       startdomain;
   3.480 +        dom0_stopdomain_t        stopdomain;
   3.481 +        dom0_destroydomain_t     destroydomain;
   3.482 +        dom0_getmemlist_t        getmemlist;
   3.483 +        dom0_schedctl_t          schedctl;
   3.484 +        dom0_adjustdom_t         adjustdom;
   3.485 +        dom0_builddomain_t       builddomain;
   3.486 +        dom0_getdomaininfo_t     getdomaininfo;
   3.487 +        dom0_getpageframeinfo_t  getpageframeinfo;
   3.488 +        dom0_iopl_t              iopl;
   3.489 +	dom0_msr_t               msr;
   3.490 +	dom0_debug_t             debug;
   3.491 +	dom0_settime_t           settime;
   3.492 +	dom0_readconsole_t	 readconsole;
   3.493 +	dom0_pincpudomain_t      pincpudomain;
   3.494 +        dom0_gettbufs_t          gettbufs;
   3.495 +        dom0_physinfo_t          physinfo;
   3.496 +        dom0_pcidev_access_t     pcidev_access;
   3.497 +        dom0_sched_id_t          sched_id;
   3.498 +	dom0_shadow_control_t    shadow_control;
   3.499 +	dom0_setdomainname_t     setdomainname;
   3.500  	dom0_setdomaininitialmem_t setdomaininitialmem;
   3.501 -	dom0_setdomainmaxmem_t  setdomainmaxmem;
   3.502 +	dom0_setdomainmaxmem_t   setdomainmaxmem;
   3.503  	dom0_getpageframeinfo2_t getpageframeinfo2;
   3.504 -    } u;
   3.505 -} dom0_op_t;
   3.506 +    } PACKED u;
   3.507 +} PACKED dom0_op_t; /* 64 bytes */
   3.508  
   3.509  #endif /* __DOM0_OPS_H__ */
     4.1 --- a/xen/include/hypervisor-ifs/event_channel.h	Wed Jun 02 09:23:55 2004 +0000
     4.2 +++ b/xen/include/hypervisor-ifs/event_channel.h	Wed Jun 02 14:04:13 2004 +0000
     4.3 @@ -17,13 +17,12 @@
     4.4   *  3. <port1> and <port2> are only supplied if the op succeeds.
     4.5   */
     4.6  #define EVTCHNOP_bind_interdomain 0
     4.7 -typedef struct evtchn_bind_interdomain
     4.8 -{
     4.9 +typedef struct {
    4.10      /* IN parameters. */
    4.11 -    domid_t dom1, dom2;
    4.12 +    domid_t dom1, dom2;               /*  0,  8 */
    4.13      /* OUT parameters. */
    4.14 -    int     port1, port2;
    4.15 -} evtchn_bind_interdomain_t;
    4.16 +    u32     port1, port2;             /* 16, 20 */
    4.17 +} PACKED evtchn_bind_interdomain_t; /* 24 bytes */
    4.18  
    4.19  /*
    4.20   * EVTCHNOP_bind_virq: Bind a local event channel to IRQ <irq>.
    4.21 @@ -31,13 +30,12 @@ typedef struct evtchn_bind_interdomain
    4.22   *  1. A virtual IRQ may be bound to at most one event channel per domain.
    4.23   */
    4.24  #define EVTCHNOP_bind_virq        1
    4.25 -typedef struct evtchn_bind_virq
    4.26 -{
    4.27 +typedef struct {
    4.28      /* IN parameters. */
    4.29 -    int virq;
    4.30 +    u32 virq;                         /*  0 */
    4.31      /* OUT parameters. */
    4.32 -    int port;
    4.33 -} evtchn_bind_virq_t;
    4.34 +    u32 port;                         /*  4 */
    4.35 +} PACKED evtchn_bind_virq_t; /* 8 bytes */
    4.36  
    4.37  /*
    4.38   * EVTCHNOP_bind_pirq: Bind a local event channel to IRQ <irq>.
    4.39 @@ -46,15 +44,14 @@ typedef struct evtchn_bind_virq
    4.40   *  2. Only a sufficiently-privileged domain may bind to a physical IRQ.
    4.41   */
    4.42  #define EVTCHNOP_bind_pirq        2
    4.43 -typedef struct evtchn_bind_pirq
    4.44 -{
    4.45 +typedef struct {
    4.46      /* IN parameters. */
    4.47 -    int pirq;
    4.48 +    u32 pirq;                         /*  0 */
    4.49  #define BIND_PIRQ__WILL_SHARE 1
    4.50 -    unsigned int flags; /* BIND_PIRQ__* */
    4.51 +    u32 flags; /* BIND_PIRQ__* */     /*  4 */
    4.52      /* OUT parameters. */
    4.53 -    int port;
    4.54 -} evtchn_bind_pirq_t;
    4.55 +    u32 port;                         /*  8 */
    4.56 +} PACKED evtchn_bind_pirq_t; /* 12 bytes */
    4.57  
    4.58  /*
    4.59   * EVTCHNOP_close: Close the communication channel which has an endpoint at
    4.60 @@ -65,25 +62,23 @@ typedef struct evtchn_bind_pirq
    4.61   *     for which <dom> is not DOMID_SELF.
    4.62   */
    4.63  #define EVTCHNOP_close            3
    4.64 -typedef struct evtchn_close
    4.65 -{
    4.66 +typedef struct {
    4.67      /* IN parameters. */
    4.68 -    domid_t dom;
    4.69 -    int     port;
    4.70 +    domid_t dom;                      /*  0 */
    4.71 +    u32     port;                     /*  8 */
    4.72      /* No OUT parameters. */
    4.73 -} evtchn_close_t;
    4.74 +} PACKED evtchn_close_t; /* 12 bytes */
    4.75  
    4.76  /*
    4.77   * EVTCHNOP_send: Send an event to the remote end of the channel whose local
    4.78   * endpoint is <DOMID_SELF, local_port>.
    4.79   */
    4.80  #define EVTCHNOP_send             4
    4.81 -typedef struct evtchn_send
    4.82 -{
    4.83 +typedef struct {
    4.84      /* IN parameters. */
    4.85 -    int     local_port;
    4.86 +    u32     local_port;               /*  0 */
    4.87      /* No OUT parameters. */
    4.88 -} evtchn_send_t;
    4.89 +} PACKED evtchn_send_t; /* 4 bytes */
    4.90  
    4.91  /*
    4.92   * EVTCHNOP_status: Get the current status of the communication channel which
    4.93 @@ -94,40 +89,39 @@ typedef struct evtchn_send
    4.94   *     channel for which <dom> is not DOMID_SELF.
    4.95   */
    4.96  #define EVTCHNOP_status           5
    4.97 -typedef struct evtchn_status
    4.98 -{
    4.99 +typedef struct {
   4.100      /* IN parameters */
   4.101 -    domid_t dom;
   4.102 -    int     port;
   4.103 +    domid_t dom;                      /*  0 */
   4.104 +    u32     port;                     /*  8 */
   4.105      /* OUT parameters */
   4.106  #define EVTCHNSTAT_closed       0  /* Chennel is not in use.                 */
   4.107  #define EVTCHNSTAT_unbound      1  /* Channel is not bound to a source.      */
   4.108  #define EVTCHNSTAT_interdomain  2  /* Channel is connected to remote domain. */
   4.109  #define EVTCHNSTAT_pirq         3  /* Channel is bound to a phys IRQ line.   */
   4.110  #define EVTCHNSTAT_virq         4  /* Channel is bound to a virtual IRQ line */
   4.111 -    int     status;
   4.112 +    u32     status;                   /* 12 */
   4.113      union {
   4.114 -        int __none;    /* EVTCHNSTAT_closed, EVTCHNSTAT_unbound */
   4.115          struct {
   4.116 -            domid_t dom;
   4.117 -            int     port;
   4.118 -        } interdomain; /* EVTCHNSTAT_interdomain */
   4.119 -        int pirq;      /* EVTCHNSTAT_pirq        */
   4.120 -        int virq;      /* EVTCHNSTAT_virq        */
   4.121 -    } u;
   4.122 -} evtchn_status_t;
   4.123 +            domid_t dom;                              /* 16 */
   4.124 +            u32     port;                             /* 24 */
   4.125 +        } PACKED interdomain; /* EVTCHNSTAT_interdomain */
   4.126 +        u32 pirq;      /* EVTCHNSTAT_pirq        */   /* 16 */
   4.127 +        u32 virq;      /* EVTCHNSTAT_virq        */   /* 16 */
   4.128 +    } PACKED u;
   4.129 +} PACKED evtchn_status_t; /* 28 bytes */
   4.130  
   4.131 -typedef struct evtchn_op
   4.132 -{
   4.133 -    int cmd; /* EVTCHNOP_* */
   4.134 -    union {
   4.135 +typedef struct {
   4.136 +    u32 cmd; /* EVTCHNOP_* */         /*  0 */
   4.137 +    u32 __reserved;                   /*  4 */
   4.138 +    union {                           /*  8 */
   4.139          evtchn_bind_interdomain_t bind_interdomain;
   4.140          evtchn_bind_virq_t        bind_virq;
   4.141          evtchn_bind_pirq_t        bind_pirq;
   4.142          evtchn_close_t            close;
   4.143          evtchn_send_t             send;
   4.144          evtchn_status_t           status;
   4.145 -    } u;
   4.146 -} evtchn_op_t;
   4.147 +        u8                        __dummy[32];
   4.148 +    } PACKED u;
   4.149 +} PACKED evtchn_op_t; /* 40 bytes */
   4.150  
   4.151  #endif /* __HYPERVISOR_IFS__EVENT_CHANNEL_H__ */
     5.1 --- a/xen/include/hypervisor-ifs/hypervisor-if.h	Wed Jun 02 09:23:55 2004 +0000
     5.2 +++ b/xen/include/hypervisor-ifs/hypervisor-if.h	Wed Jun 02 14:04:13 2004 +0000
     5.3 @@ -7,6 +7,9 @@
     5.4  #ifndef __HYPERVISOR_IF_H__
     5.5  #define __HYPERVISOR_IF_H__
     5.6  
     5.7 +/* GCC-specific way to pack structure definitions (no implicit padding). */
     5.8 +#define PACKED __attribute__ ((packed))
     5.9 +
    5.10  #include "arch/hypervisor-if.h"
    5.11  
    5.12  /*
    5.13 @@ -197,21 +200,24 @@ typedef u64 domid_t;
    5.14  #include "block.h"
    5.15  
    5.16  /*
    5.17 - * Send an array of these to HYPERVISOR_mmu_update()
    5.18 + * Send an array of these to HYPERVISOR_mmu_update().
    5.19 + * NB. The fields are natural pointer/address size for this architecture.
    5.20   */
    5.21  typedef struct
    5.22  {
    5.23 -    unsigned long ptr, val; /* *ptr = val */
    5.24 -} mmu_update_t;
    5.25 +    memory_t ptr;    /* Machine address of PTE. */
    5.26 +    memory_t val;    /* New contents of PTE.    */
    5.27 +} PACKED mmu_update_t;
    5.28  
    5.29  /*
    5.30 - * Send an array of these to HYPERVISOR_multicall()
    5.31 + * Send an array of these to HYPERVISOR_multicall().
    5.32 + * NB. The fields are natural register size for this architecture.
    5.33   */
    5.34  typedef struct
    5.35  {
    5.36 -    unsigned long op;
    5.37 -    unsigned long args[7];
    5.38 -} multicall_entry_t;
    5.39 +    cpureg_t op;
    5.40 +    cpureg_t args[7];
    5.41 +} PACKED multicall_entry_t;
    5.42  
    5.43  /* Event channel endpoints per domain. */
    5.44  #define NR_EVENT_CHANNELS 1024
    5.45 @@ -258,7 +264,7 @@ typedef struct shared_info_st
    5.46          u8 evtchn_upcall_pending;
    5.47          u8 evtchn_upcall_mask;
    5.48          u8 pad0, pad1;
    5.49 -    } vcpu_data[MAX_VIRT_CPUS];
    5.50 +    } PACKED vcpu_data[MAX_VIRT_CPUS];  /*   0 */
    5.51  
    5.52      /*
    5.53       * A domain can have up to 1024 "event channels" on which it can send
    5.54 @@ -295,16 +301,16 @@ typedef struct shared_info_st
    5.55       * 32-bit selector to be set. Each bit in the selector covers a 32-bit
    5.56       * word in the PENDING bitfield array.
    5.57       */
    5.58 -    u32 evtchn_pending[32];
    5.59 -    u32 evtchn_pending_sel;
    5.60 -    u32 evtchn_exception[32];
    5.61 -    u32 evtchn_mask[32];
    5.62 +    u32 evtchn_pending[32];             /*   4 */
    5.63 +    u32 evtchn_pending_sel;             /* 132 */
    5.64 +    u32 evtchn_exception[32];           /* 136 */
    5.65 +    u32 evtchn_mask[32];                /* 264 */
    5.66  
    5.67      /*
    5.68       * Time: The following abstractions are exposed: System Time, Clock Time,
    5.69       * Domain Virtual Time. Domains can access Cycle counter time directly.
    5.70       */
    5.71 -    u64                cpu_freq;        /* CPU frequency (Hz).               */
    5.72 +    u64                cpu_freq;        /* 392: CPU frequency (Hz).          */
    5.73  
    5.74      /*
    5.75       * The following values are updated periodically (and not necessarily
    5.76 @@ -313,12 +319,12 @@ typedef struct shared_info_st
    5.77       * incremented immediately after. See the Xen-specific Linux code for an
    5.78       * example of how to read these values safely (arch/xen/kernel/time.c).
    5.79       */
    5.80 -    unsigned long      time_version1;   /* A version number for info below.  */
    5.81 -    unsigned long      time_version2;   /* A version number for info below.  */
    5.82 +    u32                time_version1;   /* 400 */
    5.83 +    u32                time_version2;   /* 404 */
    5.84      tsc_timestamp_t    tsc_timestamp;   /* TSC at last update of time vals.  */
    5.85      u64                system_time;     /* Time, in nanosecs, since boot.    */
    5.86 -    unsigned long      wc_sec;          /* Secs  00:00:00 UTC, Jan 1, 1970.  */
    5.87 -    unsigned long      wc_usec;         /* Usecs 00:00:00 UTC, Jan 1, 1970.  */
    5.88 +    u32                wc_sec;          /* Secs  00:00:00 UTC, Jan 1, 1970.  */
    5.89 +    u32                wc_usec;         /* Usecs 00:00:00 UTC, Jan 1, 1970.  */
    5.90      u64                domain_time;     /* Domain virtual time, in nanosecs. */
    5.91  
    5.92      /*
    5.93 @@ -326,8 +332,8 @@ typedef struct shared_info_st
    5.94       * Allow a domain to specify a timeout value in system time and 
    5.95       * domain virtual time.
    5.96       */
    5.97 -    u64                wall_timeout;
    5.98 -    u64                domain_timeout;
    5.99 +    u64                wall_timeout;    /* 440 */
   5.100 +    u64                domain_timeout;  /* 448 */
   5.101  
   5.102      /*
   5.103       * The index structures are all stored here for convenience. The rings 
   5.104 @@ -339,7 +345,7 @@ typedef struct shared_info_st
   5.105  
   5.106      execution_context_t execution_context;
   5.107  
   5.108 -} shared_info_t;
   5.109 +} PACKED shared_info_t;
   5.110  
   5.111  /*
   5.112   * Start-of-day memory layout for the initial domain (DOM0):
     6.1 --- a/xen/include/hypervisor-ifs/physdev.h	Wed Jun 02 09:23:55 2004 +0000
     6.2 +++ b/xen/include/hypervisor-ifs/physdev.h	Wed Jun 02 14:04:13 2004 +0000
     6.3 @@ -20,60 +20,61 @@
     6.4  /* Read from PCI configuration space. */
     6.5  typedef struct {
     6.6      /* IN */
     6.7 -    int bus;
     6.8 -    int dev;
     6.9 -    int func;
    6.10 -    int reg;
    6.11 -    int len;
    6.12 +    u32 bus;                          /*  0 */
    6.13 +    u32 dev;                          /*  4 */
    6.14 +    u32 func;                         /*  8 */
    6.15 +    u32 reg;                          /* 12 */
    6.16 +    u32 len;                          /* 16 */
    6.17      /* OUT */
    6.18 -    u32 value;
    6.19 -} physdevop_pci_cfgreg_read_t;
    6.20 +    u32 value;                        /* 20 */
    6.21 +} PACKED physdevop_pci_cfgreg_read_t; /* 24 bytes */
    6.22  
    6.23  /* Write to PCI configuration space. */
    6.24  typedef struct {
    6.25      /* IN */
    6.26 -    int bus;
    6.27 -    int dev;
    6.28 -    int func;
    6.29 -    int reg;
    6.30 -    int len;
    6.31 -    u32 value;
    6.32 -} physdevop_pci_cfgreg_write_t;
    6.33 +    u32 bus;                          /*  0 */
    6.34 +    u32 dev;                          /*  4 */
    6.35 +    u32 func;                         /*  8 */
    6.36 +    u32 reg;                          /* 12 */
    6.37 +    u32 len;                          /* 16 */
    6.38 +    u32 value;                        /* 20 */
    6.39 +} PACKED physdevop_pci_cfgreg_write_t; /* 24 bytes */
    6.40  
    6.41  /* Do final initialisation of a PCI device (e.g., last-moment IRQ routing). */
    6.42  typedef struct {
    6.43      /* IN */
    6.44 -    int bus;
    6.45 -    int dev;
    6.46 -    int func;
    6.47 -} physdevop_pci_initialise_device_t;
    6.48 +    u32 bus;                          /*  0 */
    6.49 +    u32 dev;                          /*  4 */
    6.50 +    u32 func;                         /*  8 */
    6.51 +} PACKED physdevop_pci_initialise_device_t; /* 12 bytes */
    6.52  
    6.53  /* Find the root buses for subsequent scanning. */
    6.54  typedef struct {
    6.55      /* OUT */
    6.56 -    u32 busmask[256/32];
    6.57 -} physdevop_pci_probe_root_buses_t;
    6.58 +    u32 busmask[256/32];              /*  0 */
    6.59 +} PACKED physdevop_pci_probe_root_buses_t; /* 32 bytes */
    6.60  
    6.61  typedef struct {
    6.62      /* IN */
    6.63 -    int irq;
    6.64 +    u32 irq;                          /*  0 */
    6.65      /* OUT */
    6.66  /* Need to call PHYSDEVOP_IRQ_UNMASK_NOTIFY when the IRQ has been serviced? */
    6.67  #define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY (1<<0)
    6.68 -    unsigned long flags;
    6.69 -} physdevop_irq_status_query_t;
    6.70 +    u32 flags;                        /*  4 */
    6.71 +} PACKED physdevop_irq_status_query_t; /* 8 bytes */
    6.72  
    6.73  typedef struct _physdev_op_st 
    6.74  {
    6.75 -    unsigned long cmd;
    6.76 -    union
    6.77 -    {
    6.78 +    u32 cmd;                          /*  0 */
    6.79 +    u32 __pad;                        /*  4 */
    6.80 +    union {                           /*  8 */
    6.81          physdevop_pci_cfgreg_read_t       pci_cfgreg_read;
    6.82          physdevop_pci_cfgreg_write_t      pci_cfgreg_write;
    6.83          physdevop_pci_initialise_device_t pci_initialise_device;
    6.84          physdevop_pci_probe_root_buses_t  pci_probe_root_buses;
    6.85          physdevop_irq_status_query_t      irq_status_query;
    6.86 -    } u;
    6.87 -} physdev_op_t;
    6.88 +        u8                                __dummy[32];
    6.89 +    } PACKED u;
    6.90 +} PACKED physdev_op_t; /* 40 bytes */
    6.91  
    6.92  #endif /* __HYPERVISOR_IFS_PHYSDEV_H__ */
     7.1 --- a/xen/include/hypervisor-ifs/sched_ctl.h	Wed Jun 02 09:23:55 2004 +0000
     7.2 +++ b/xen/include/hypervisor-ifs/sched_ctl.h	Wed Jun 02 14:04:13 2004 +0000
     7.3 @@ -23,49 +23,45 @@
     7.4   */
     7.5  struct sched_ctl_cmd
     7.6  {
     7.7 -    unsigned int sched_id;
     7.8 -    int direction;          /* are we getting or putting settings? */
     7.9 -    
    7.10 -    union
    7.11 -    {
    7.12 +    u32 sched_id;                     /*  0 */
    7.13 +    u32 direction;                    /*  4 */
    7.14 +    union {                           /*  8 */
    7.15          struct bvt_ctl
    7.16          {
    7.17              /* IN variables. */
    7.18 -            unsigned long ctx_allow;  /* context switch allowance */
    7.19 -        } bvt;
    7.20 +            u32 ctx_allow;            /*  8: context switch allowance */
    7.21 +        } PACKED bvt;
    7.22  
    7.23          struct rrobin_ctl
    7.24          {
    7.25              /* IN variables */
    7.26 -            u64 slice;                /* round robin time slice */
    7.27 -        } rrobin;
    7.28 -    } u;
    7.29 -};
    7.30 +            u64 slice;                /*  8: round robin time slice */
    7.31 +        } PACKED rrobin;
    7.32 +    } PACKED u;
    7.33 +} PACKED; /* 16 bytes */
    7.34  
    7.35  struct sched_adjdom_cmd
    7.36  {
    7.37 -    unsigned int sched_id;
    7.38 -    domid_t domain;
    7.39 -    int direction;          /* are we getting or putting settings? */
    7.40 -    
    7.41 -    union
    7.42 -    {
    7.43 +    u32 sched_id;                     /*  0 */
    7.44 +    u32 direction;                    /*  4 */
    7.45 +    domid_t domain;                   /*  8 */
    7.46 +    union {                           /* 16 */
    7.47          struct bvt_adjdom
    7.48          {
    7.49 -            unsigned long mcu_adv;    /* mcu advance: inverse of weight */
    7.50 -            unsigned long warp;       /* time warp */
    7.51 -            unsigned long warpl;      /* warp limit */
    7.52 -            unsigned long warpu;      /* unwarp time requirement */
    7.53 -        } bvt;
    7.54 +            u32 mcu_adv;    /* 16: mcu advance: inverse of weight */
    7.55 +            u32 warp;       /* 20: time warp */
    7.56 +            u32 warpl;      /* 24: warp limit */
    7.57 +            u32 warpu;      /* 28: unwarp time requirement */
    7.58 +        } PACKED bvt;
    7.59  
    7.60          struct atropos_adjdom
    7.61          {
    7.62 -            u64 nat_period;
    7.63 -            u64 nat_slice;
    7.64 -            u64 latency;
    7.65 -            int xtratime;
    7.66 -        } atropos;
    7.67 -    } u;
    7.68 -};
    7.69 +            u64 nat_period; /* 16 */
    7.70 +            u64 nat_slice;  /* 24 */
    7.71 +            u64 latency;    /* 32 */
    7.72 +            u32 xtratime;   /* 36 */
    7.73 +        } PACKED atropos;
    7.74 +    } PACKED u;
    7.75 +} PACKED; /* 40 bytes */
    7.76  
    7.77  #endif /* __SCHED_CTL_H__ */
     8.1 --- a/xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/blkif.h	Wed Jun 02 09:23:55 2004 +0000
     8.2 +++ b/xenolinux-2.4.26-sparse/arch/xen/drivers/blkif/blkif.h	Wed Jun 02 14:04:13 2004 +0000
     8.3 @@ -27,17 +27,17 @@
     8.4  #define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
     8.5  
     8.6  typedef struct {
     8.7 -    u8             operation;        /* BLKIF_OP_???                         */
     8.8 -    u8             nr_segments;      /* number of segments                   */
     8.9 -    blkif_vdev_t   device;           /* only for read/write requests         */
    8.10 -    unsigned long  id;               /* private guest value, echoed in resp  */
    8.11 +    u8             operation;    /*  0: BLKIF_OP_???                         */
    8.12 +    u8             nr_segments;  /*  1: number of segments                   */
    8.13 +    blkif_vdev_t   device;       /*  2: only for read/write requests         */
    8.14 +    unsigned long  id;           /*  4: private guest value, echoed in resp  */
    8.15      blkif_sector_t sector_number;    /* start sector idx on disk (r/w only)  */
    8.16      /* @f_a_s[2:0]=last_sect ; @f_a_s[5:3]=first_sect ; @f_a_s[:12]=frame.   */
    8.17      /* @first_sect: first sector in frame to transfer (inclusive).           */
    8.18      /* @last_sect: last sector in frame to transfer (inclusive).             */
    8.19      /* @frame: machine page frame number.                                    */
    8.20      unsigned long  frame_and_sects[BLKIF_MAX_SEGMENTS_PER_REQUEST];
    8.21 -} blkif_request_t;
    8.22 +} PACKED blkif_request_t;
    8.23  
    8.24  #define blkif_first_sect(_fas) (((_fas)>>3)&7)
    8.25  #define blkif_last_sect(_fas)  ((_fas)&7)
    8.26 @@ -46,7 +46,7 @@ typedef struct {
    8.27      unsigned long   id;              /* copied from request */
    8.28      u8              operation;       /* copied from request */
    8.29      s16             status;          /* BLKIF_RSP_???       */
    8.30 -} blkif_response_t;
    8.31 +} PACKED blkif_response_t;
    8.32  
    8.33  #define BLKIF_RSP_ERROR  -1 /* non-specific 'error' */
    8.34  #define BLKIF_RSP_OKAY    0 /* non-specific 'okay'  */
    8.35 @@ -55,7 +55,7 @@ typedef struct {
    8.36   * We use a special capitalised type name because it is _essential_ that all 
    8.37   * arithmetic on indexes is done on an integer type of the correct size.
    8.38   */
    8.39 -typedef unsigned int BLKIF_RING_IDX;
    8.40 +typedef u32 BLKIF_RING_IDX;
    8.41  
    8.42  /*
    8.43   * Ring indexes are 'free running'. That is, they are not stored modulo the
    8.44 @@ -65,13 +65,13 @@ typedef unsigned int BLKIF_RING_IDX;
    8.45  #define MASK_BLKIF_IDX(_i) ((_i)&(BLKIF_RING_SIZE-1))
    8.46  
    8.47  typedef struct {
    8.48 -    BLKIF_RING_IDX req_prod;  /* Request producer. Updated by front-end. */
    8.49 -    BLKIF_RING_IDX resp_prod; /* Response producer. Updated by back-end. */
    8.50 -    union {
    8.51 +    BLKIF_RING_IDX req_prod;  /*  0: Request producer. Updated by front-end. */
    8.52 +    BLKIF_RING_IDX resp_prod; /*  4: Response producer. Updated by back-end. */
    8.53 +    union {                   /*  8 */
    8.54          blkif_request_t  req;
    8.55          blkif_response_t resp;
    8.56 -    } ring[BLKIF_RING_SIZE];
    8.57 -} blkif_ring_t;
    8.58 +    } PACKED ring[BLKIF_RING_SIZE];
    8.59 +} PACKED blkif_ring_t;
    8.60  
    8.61  
    8.62  /*
    8.63 @@ -107,9 +107,9 @@ typedef struct {
    8.64  #define VDISK_VIRTUAL(_x)  ((_x) & VDISK_FLAG_VIRT) 
    8.65  
    8.66  typedef struct {
    8.67 -    blkif_sector_t capacity;     /* Size in terms of 512-byte sectors.   */
    8.68 -    blkif_vdev_t   device;       /* Device number (opaque 16 bit value). */
    8.69 -    u16            info;         /* Device type and flags (VDISK_*).     */
    8.70 -} vdisk_t;
    8.71 +    blkif_sector_t capacity;     /*  0: Size in terms of 512-byte sectors.   */
    8.72 +    blkif_vdev_t   device;       /*  8: Device number (opaque 16 bit value). */
    8.73 +    u16            info;         /* 10: Device type and flags (VDISK_*).     */
    8.74 +} PACKED vdisk_t; /* 12 bytes */
    8.75  
    8.76  #endif /* __SHARED_BLKIF_H__ */
     9.1 --- a/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/main.c	Wed Jun 02 09:23:55 2004 +0000
     9.2 +++ b/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/main.c	Wed Jun 02 14:04:13 2004 +0000
     9.3 @@ -16,11 +16,11 @@ static void netif_page_release(struct pa
     9.4  static void make_tx_response(netif_t *netif, 
     9.5                               u16      id,
     9.6                               s8       st);
     9.7 -static int  make_rx_response(netif_t     *netif, 
     9.8 -                             u16          id, 
     9.9 -                             s8           st,
    9.10 -                             netif_addr_t addr,
    9.11 -                             u16          size);
    9.12 +static int  make_rx_response(netif_t *netif, 
    9.13 +                             u16      id, 
    9.14 +                             s8       st,
    9.15 +                             memory_t addr,
    9.16 +                             u16      size);
    9.17  
    9.18  static void net_tx_action(unsigned long unused);
    9.19  static DECLARE_TASKLET(net_tx_tasklet, net_tx_action, 0);
    9.20 @@ -682,11 +682,11 @@ static void make_tx_response(netif_t *ne
    9.21          notify_via_evtchn(netif->evtchn);
    9.22  }
    9.23  
    9.24 -static int make_rx_response(netif_t     *netif, 
    9.25 -                            u16          id, 
    9.26 -                            s8           st,
    9.27 -                            netif_addr_t addr,
    9.28 -                            u16          size)
    9.29 +static int make_rx_response(netif_t *netif, 
    9.30 +                            u16      id, 
    9.31 +                            s8       st,
    9.32 +                            memory_t addr,
    9.33 +                            u16      size)
    9.34  {
    9.35      NET_RING_IDX i = netif->rx_resp_prod;
    9.36      netif_rx_response_t *resp;
    10.1 --- a/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/netif.h	Wed Jun 02 09:23:55 2004 +0000
    10.2 +++ b/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/netif.h	Wed Jun 02 14:04:13 2004 +0000
    10.3 @@ -9,34 +9,35 @@
    10.4  #ifndef __SHARED_NETIF_H__
    10.5  #define __SHARED_NETIF_H__
    10.6  
    10.7 -typedef unsigned long netif_addr_t;
    10.8 -
    10.9  typedef struct {
   10.10 -    netif_addr_t addr;   /* Machine address of packet.  */
   10.11 -    u16          id;     /* Echoed in response message. */
   10.12 -    u16          size;   /* Packet size in bytes.       */
   10.13 -} netif_tx_request_t;
   10.14 +    memory_t addr;   /*  0: Machine address of packet.  */
   10.15 +    MEMORY_PADDING;
   10.16 +    u16      id;     /*  8: Echoed in response message. */
   10.17 +    u16      size;   /* 10: Packet size in bytes.       */
   10.18 +} PACKED netif_tx_request_t; /* 12 bytes */
   10.19  
   10.20  typedef struct {
   10.21 -    u16          id;
   10.22 -    s8           status;
   10.23 -} netif_tx_response_t;
   10.24 +    u16      id;     /*  0 */
   10.25 +    s8       status; /*  2 */
   10.26 +    u8       __pad;  /*  3 */
   10.27 +} PACKED netif_tx_response_t; /* 4 bytes */
   10.28  
   10.29  typedef struct {
   10.30 -    u16          id;     /* Echoed in response message.        */
   10.31 -} netif_rx_request_t;
   10.32 +    u16       id;    /*  0: Echoed in response message.        */
   10.33 +} PACKED netif_rx_request_t; /* 2 bytes */
   10.34  
   10.35  typedef struct {
   10.36 -    netif_addr_t addr;   /* Machine address of packet.              */
   10.37 -    u16          id;
   10.38 -    s16          status; /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
   10.39 -} netif_rx_response_t;
   10.40 +    memory_t addr;   /*  0: Machine address of packet.              */
   10.41 +    MEMORY_PADDING;
   10.42 +    u16      id;     /*  8:  */
   10.43 +    s16      status; /* 10: -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
   10.44 +} PACKED netif_rx_response_t; /* 12 bytes */
   10.45  
   10.46  /*
   10.47   * We use a special capitalised type name because it is _essential_ that all 
   10.48   * arithmetic on indexes is done on an integer type of the correct size.
   10.49   */
   10.50 -typedef unsigned int NETIF_RING_IDX;
   10.51 +typedef u32 NETIF_RING_IDX;
   10.52  
   10.53  /*
   10.54   * Ring indexes are 'free running'. That is, they are not stored modulo the
   10.55 @@ -51,29 +52,33 @@ typedef unsigned int NETIF_RING_IDX;
   10.56  
   10.57  /* This structure must fit in a memory page. */
   10.58  typedef struct {
   10.59 -    union {
   10.60 -        netif_tx_request_t  req;
   10.61 -        netif_tx_response_t resp;
   10.62 -    } ring[NETIF_TX_RING_SIZE];
   10.63      /*
   10.64       * Frontend places packets into ring at tx_req_prod.
   10.65       * Frontend receives event when tx_resp_prod passes tx_event.
   10.66       */
   10.67 -    NETIF_RING_IDX req_prod, resp_prod, event;
   10.68 -} netif_tx_interface_t;
   10.69 +    NETIF_RING_IDX req_prod;       /*  0 */
   10.70 +    NETIF_RING_IDX resp_prod;      /*  4 */
   10.71 +    NETIF_RING_IDX event;          /*  8 */
   10.72 +    union {                        /* 12 */
   10.73 +        netif_tx_request_t  req;
   10.74 +        netif_tx_response_t resp;
   10.75 +    } PACKED ring[NETIF_TX_RING_SIZE];
   10.76 +} PACKED netif_tx_interface_t;
   10.77  
   10.78  /* This structure must fit in a memory page. */
   10.79  typedef struct {
   10.80 -    union {
   10.81 -        netif_rx_request_t  req;
   10.82 -        netif_rx_response_t resp;
   10.83 -    } ring[NETIF_RX_RING_SIZE];
   10.84      /*
   10.85       * Frontend places empty buffers into ring at rx_req_prod.
   10.86       * Frontend receives event when rx_resp_prod passes rx_event.
   10.87       */
   10.88 -    NETIF_RING_IDX req_prod, resp_prod, event;
   10.89 -} netif_rx_interface_t;
   10.90 +    NETIF_RING_IDX req_prod;       /*  0 */
   10.91 +    NETIF_RING_IDX resp_prod;      /*  4 */
   10.92 +    NETIF_RING_IDX event;          /*  8 */
   10.93 +    union {                        /* 12 */
   10.94 +        netif_rx_request_t  req;
   10.95 +        netif_rx_response_t resp;
   10.96 +    } PACKED ring[NETIF_RX_RING_SIZE];
   10.97 +} PACKED netif_rx_interface_t;
   10.98  
   10.99  /* Descriptor status values */
  10.100  #define NETIF_RSP_DROPPED         -2