direct-io.hg

changeset 3961:a19f7bbbe144

bitkeeper revision 1.1236.1.44 (4224f156AyEV3oV5JinuYtfS9e_ITA)

Rationalise memory-barrier definitions in user-space tools.
Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@scramble.cl.cam.ac.uk
date Tue Mar 01 22:48:54 2005 +0000 (2005-03-01)
parents 09c70b5f2e07
children 180fe147132c
files tools/blktap/blktaplib.h tools/libxc/xc.h tools/python/xen/lowlevel/xu/xu.c tools/xcs/xcs.h
line diff
     1.1 --- a/tools/blktap/blktaplib.h	Tue Mar 01 20:47:20 2005 +0000
     1.2 +++ b/tools/blktap/blktaplib.h	Tue Mar 01 22:48:54 2005 +0000
     1.3 @@ -10,22 +10,6 @@
     1.4  
     1.5  #include <stdint.h>
     1.6  
     1.7 -typedef uint8_t            u8;
     1.8 -typedef uint16_t           u16;
     1.9 -typedef uint32_t           u32;
    1.10 -typedef uint64_t           u64;
    1.11 -typedef int8_t             s8;
    1.12 -typedef int16_t            s16;
    1.13 -typedef int32_t            s32;
    1.14 -typedef int64_t            s64;
    1.15 -                                                                                
    1.16 -#if defined(__i386__)
    1.17 -#define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
    1.18 -#define wmb() __asm__ __volatile__ ( "" : : : "memory" )
    1.19 -#else
    1.20 -#error "Define barriers"
    1.21 -#endif
    1.22 -    
    1.23  #include <sys/user.h>
    1.24  #include <xen/xen.h>
    1.25  #include <xen/io/blkif.h>
     2.1 --- a/tools/libxc/xc.h	Tue Mar 01 20:47:20 2005 +0000
     2.2 +++ b/tools/libxc/xc.h	Tue Mar 01 22:48:54 2005 +0000
     2.3 @@ -25,9 +25,25 @@ typedef int64_t            s64;
     2.4  #include <xen/event_channel.h>
     2.5  #include <xen/sched_ctl.h>
     2.6  
     2.7 -/*\
     2.8 +
     2.9 +/*
    2.10 + *  DEFINITIONS FOR CPU BARRIERS
    2.11 + */ 
    2.12 +
    2.13 +#if defined(__i386__)
    2.14 +#define rmb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory")
    2.15 +#define wmb() __asm__ __volatile__ ("" : : : "memory")
    2.16 +#elif defined(__x86_64__)
    2.17 +#define mb()     asm volatile("mfence":::"memory")
    2.18 +#define rmb()    asm volatile("lfence":::"memory")
    2.19 +#define wmb()    asm volatile( "" :::"memory")
    2.20 +#else
    2.21 +#error "Define barriers"
    2.22 +#endif
    2.23 +
    2.24 +/*
    2.25   *  INITIALIZATION FUNCTIONS
    2.26 -\*/ 
    2.27 + */ 
    2.28  
    2.29  /**
    2.30   * This function opens a handle to the hypervisor interface.  This function can
    2.31 @@ -55,9 +71,9 @@ int xc_interface_open(void);
    2.32   */
    2.33  int xc_interface_close(int xc_handle);
    2.34  
    2.35 -/*\
    2.36 +/*
    2.37   * DOMAIN MANAGEMENT FUNCTIONS
    2.38 -\*/
    2.39 + */
    2.40  
    2.41  typedef struct {
    2.42      u32           domid;
    2.43 @@ -257,9 +273,9 @@ int xc_rrobin_global_get(int xc_handle, 
    2.44  
    2.45  typedef evtchn_status_t xc_evtchn_status_t;
    2.46  
    2.47 -/*\
    2.48 +/*
    2.49   * EVENT CHANNEL FUNCTIONS
    2.50 -\*/
    2.51 + */
    2.52  
    2.53  /**
    2.54   * This function allocates an unbound port.  Ports are named endpoints used for
     3.1 --- a/tools/python/xen/lowlevel/xu/xu.c	Tue Mar 01 20:47:20 2005 +0000
     3.2 +++ b/tools/python/xen/lowlevel/xu/xu.c	Tue Mar 01 22:48:54 2005 +0000
     3.3 @@ -49,14 +49,6 @@
     3.4  /* Size of a machine page frame. */
     3.5  #define PAGE_SIZE 4096
     3.6  
     3.7 -#if defined(__i386__)
     3.8 -#define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
     3.9 -#define wmb() __asm__ __volatile__ ( "" : : : "memory" )
    3.10 -#else
    3.11 -#error "Define barriers"
    3.12 -#endif
    3.13 -
    3.14 -
    3.15  /* Set the close-on-exec flag on a file descriptor.  Doesn't currently bother
    3.16   * to check for errors. */
    3.17  /*
     4.1 --- a/tools/xcs/xcs.h	Tue Mar 01 20:47:20 2005 +0000
     4.2 +++ b/tools/xcs/xcs.h	Tue Mar 01 22:48:54 2005 +0000
     4.3 @@ -39,13 +39,6 @@
     4.4  /* Size of a machine page frame. */
     4.5  #define PAGE_SIZE 4096
     4.6  
     4.7 -#if defined(__i386__)
     4.8 -#define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
     4.9 -#define wmb() __asm__ __volatile__ ( "" : : : "memory" )
    4.10 -#else
    4.11 -#error "Define barriers"
    4.12 -#endif
    4.13 -
    4.14  #ifndef timersub /* XOPEN and __BSD don't cooperate well... */
    4.15  #define timersub(a, b, result)                                                \
    4.16    do {                                                                        \