ia64/xen-unstable

changeset 1485:44512070eb7b

bitkeeper revision 1.969 (40d06e5bLmMtClRlYKKJQZd2RPCAyw)

Allow privileged build to be used in non-priv domain without crashing.
author kaf24@scramble.cl.cam.ac.uk
date Wed Jun 16 15:59:23 2004 +0000 (2004-06-16)
parents fc5d9f57f546
children 55825bcb964e
files .rootkeys BitKeeper/etc/ignore linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/frontend/main.c linux-2.4.26-xen-sparse/arch/xen/drivers/netif/frontend/main.c linux-2.4.26-xen-sparse/arch/xen/kernel/setup.c linux-2.4.26-xen-sparse/arch/xen/vmlinux.lds linux-2.4.26-xen-sparse/include/asm-xen/io.h linux-2.4.26-xen-sparse/include/asm-xen/module.h linux-2.4.26-xen-sparse/mkbuildtree
line diff
     1.1 --- a/.rootkeys	Tue Jun 15 15:28:22 2004 +0000
     1.2 +++ b/.rootkeys	Wed Jun 16 15:59:23 2004 +0000
     1.3 @@ -117,6 +117,7 @@ 4060044fVx7-tokvNLKBf_6qBB4lqQ linux-2.4
     1.4  3e5a4e673p7PEOyHFm3nHkYX6HQYBg linux-2.4.26-xen-sparse/include/asm-xen/irq.h
     1.5  3ead095db_LRUXnxaqs0dA1DWhPoQQ linux-2.4.26-xen-sparse/include/asm-xen/keyboard.h
     1.6  3e5a4e678ddsQOpbSiRdy1GRcDc9WA linux-2.4.26-xen-sparse/include/asm-xen/mmu_context.h
     1.7 +40d06e5b2YWInUX1Xv9amVANwd_2Xg linux-2.4.26-xen-sparse/include/asm-xen/module.h
     1.8  3f8707e7ZmZ6TxyX0ZUEfvhA2Pb_xQ linux-2.4.26-xen-sparse/include/asm-xen/msr.h
     1.9  3e7270deQqtGPSnFxcW4AvJZuTUWfg linux-2.4.26-xen-sparse/include/asm-xen/multicall.h
    1.10  3e5a4e67mnQfh-R8KcQCaVo2Oho6yg linux-2.4.26-xen-sparse/include/asm-xen/page.h
     2.1 --- a/BitKeeper/etc/ignore	Tue Jun 15 15:28:22 2004 +0000
     2.2 +++ b/BitKeeper/etc/ignore	Wed Jun 16 15:59:23 2004 +0000
     2.3 @@ -3,6 +3,7 @@
     2.4  *.pyc
     2.5  *.so
     2.6  *.so.*
     2.7 +*.tar.gz
     2.8  *~
     2.9  BitKeeper/*/*
    2.10  PENDING/*
    2.11 @@ -10,8 +11,6 @@ TAGS
    2.12  extras/mini-os/h/hypervisor-ifs
    2.13  install
    2.14  install/*
    2.15 -linux-*-xen/*
    2.16 -linux-*.tar.gz
    2.17  linux-2.4.26-xen/*
    2.18  linux-xen-sparse
    2.19  tools/*/build/lib*/*.py
    2.20 @@ -20,7 +19,6 @@ tools/misc/miniterm/miniterm
    2.21  tools/misc/xen_cpuperf
    2.22  tools/misc/xen_log
    2.23  tools/misc/xen_read_console
    2.24 -tools/xend-2004-06-10_1309.tgz
    2.25  tools/xentrace/xentrace
    2.26  xen/drivers/pci/classlist.h
    2.27  xen/drivers/pci/devlist.h
     3.1 --- a/linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/frontend/main.c	Tue Jun 15 15:28:22 2004 +0000
     3.2 +++ b/linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/frontend/main.c	Wed Jun 16 15:59:23 2004 +0000
     3.3 @@ -799,13 +799,9 @@ module_exit(xlblk_cleanup);
     3.4  
     3.5  void blkdev_suspend(void)
     3.6  {
     3.7 -    /* XXX FIXME */
     3.8 -    BUG();
     3.9  }
    3.10  
    3.11  
    3.12  void blkdev_resume(void)
    3.13  {
    3.14 -    /* XXX FIXME */
    3.15 -    BUG();
    3.16  }
     4.1 --- a/linux-2.4.26-xen-sparse/arch/xen/drivers/netif/frontend/main.c	Tue Jun 15 15:28:22 2004 +0000
     4.2 +++ b/linux-2.4.26-xen-sparse/arch/xen/drivers/netif/frontend/main.c	Wed Jun 16 15:59:23 2004 +0000
     4.3 @@ -100,7 +100,6 @@ static struct net_device *find_dev_by_ha
     4.4  }
     4.5  
     4.6  #define MULTIVIF
     4.7 -//#ifdef MULTIVIF
     4.8  
     4.9  /** Network interface info. */
    4.10  struct netif_ctrl {
    4.11 @@ -112,10 +111,11 @@ struct netif_ctrl {
    4.12      int err;
    4.13  };
    4.14  
    4.15 -static struct netif_ctrl netctrl = {};
    4.16 +static struct netif_ctrl netctrl;
    4.17  
    4.18 -static void netctrl_init(void){
    4.19 -    netctrl = (struct netif_ctrl){};
    4.20 +static void netctrl_init(void)
    4.21 +{
    4.22 +    memset(&netctrl, 0, sizeof(netctrl));
    4.23      netctrl.interface_n = -1;
    4.24  }
    4.25  
    4.26 @@ -164,8 +164,6 @@ static int netctrl_connected_count(void)
    4.27      return connected;
    4.28  }
    4.29  
    4.30 -//#endif
    4.31 -
    4.32  static int network_open(struct net_device *dev)
    4.33  {
    4.34      struct net_private *np = dev->priv;
    4.35 @@ -636,12 +634,12 @@ static void netif_status_change(netif_fe
    4.36      struct net_device *dev;
    4.37      struct net_private *np;
    4.38      
    4.39 -//#ifdef MULTIVIF
    4.40 -    if(netctrl.interface_n <= 0){
    4.41 +    if ( netctrl.interface_n <= 0 )
    4.42 +    {
    4.43          printk(KERN_WARNING "Status change: no interfaces\n");
    4.44          return;
    4.45      }
    4.46 -//#endif
    4.47 +
    4.48      dev = find_dev_by_handle(status->handle);
    4.49      if(!dev){
    4.50          printk(KERN_WARNING "Status change: invalid netif handle %u\n",
    4.51 @@ -790,11 +788,12 @@ static int create_netdev(int handle, str
    4.52      return err;
    4.53  }
    4.54  
    4.55 -//#ifdef MULTIVIF
    4.56 -/** Initialize the network control interface. Set the number of network devices
    4.57 +/*
    4.58 + * Initialize the network control interface. Set the number of network devices
    4.59   * and create them.
    4.60   */
    4.61 -static void netif_driver_status_change(netif_fe_driver_status_changed_t *status)
    4.62 +static void netif_driver_status_change(
    4.63 +    netif_fe_driver_status_changed_t *status)
    4.64  {
    4.65      int err = 0;
    4.66      int i;
    4.67 @@ -810,12 +809,11 @@ static void netif_driver_status_change(n
    4.68          }
    4.69      }
    4.70  }
    4.71 -//#endif
    4.72 -
    4.73  
    4.74  static void netif_ctrlif_rx(ctrl_msg_t *msg, unsigned long id)
    4.75  {
    4.76      int respond = 1;
    4.77 +
    4.78      switch ( msg->subtype )
    4.79      {
    4.80      case CMSG_NETIF_FE_INTERFACE_STATUS_CHANGED:
    4.81 @@ -824,24 +822,24 @@ static void netif_ctrlif_rx(ctrl_msg_t *
    4.82          netif_status_change((netif_fe_interface_status_changed_t *)
    4.83                              &msg->msg[0]);
    4.84          break;
    4.85 -//#ifdef MULTIVIF
    4.86 +
    4.87      case CMSG_NETIF_FE_DRIVER_STATUS_CHANGED:
    4.88          if ( msg->length != sizeof(netif_fe_driver_status_changed_t) )
    4.89              goto error;
    4.90          netif_driver_status_change((netif_fe_driver_status_changed_t *)
    4.91                                     &msg->msg[0]);
    4.92 -        // Message is a response, so do not respond.
    4.93 +        /* Message is a response */
    4.94          respond = 0;
    4.95          break;
    4.96 -//#endif
    4.97 -      error:
    4.98 +
    4.99 +    error:
   4.100      default:
   4.101          msg->length = 0;
   4.102          break;
   4.103      }
   4.104 -    if(respond){
   4.105 +
   4.106 +    if ( respond )
   4.107          ctrl_if_send_response(msg);
   4.108 -    }
   4.109  }
   4.110  
   4.111  
   4.112 @@ -880,15 +878,11 @@ static int __init init_module(void)
   4.113  
   4.114  #ifdef MULTIVIF
   4.115      /* Wait for all interfaces to be connected. */
   4.116 -    for(wait_i = 0; 1; wait_i++) {
   4.117 -        if(wait_i < wait_n){
   4.118 -            err = netctrl_connected();
   4.119 -        } else {
   4.120 -            err = -ENETDOWN;
   4.121 -        }
   4.122 -        if(err < 0) goto exit;
   4.123 -        if(err > 0){
   4.124 -            err = 0;
   4.125 +    for ( wait_i = 0; ; wait_i++)
   4.126 +    {
   4.127 +        if ( (err = (wait_i < wait_n) ? netctrl_connected() : -ENETDOWN) != 0 )
   4.128 +        {
   4.129 +            err = (err > 0) ? 0 : err;
   4.130              break;
   4.131          }
   4.132          set_current_state(TASK_INTERRUPTIBLE);
   4.133 @@ -896,8 +890,9 @@ static int __init init_module(void)
   4.134       }
   4.135  #endif
   4.136  
   4.137 - exit:
   4.138 -    if(err) cleanup_module();
   4.139 +    if ( err )
   4.140 +        ctrl_if_unregister_receiver(CMSG_NETIF_FE, netif_ctrlif_rx);
   4.141 +
   4.142      return err;
   4.143  }
   4.144  
     5.1 --- a/linux-2.4.26-xen-sparse/arch/xen/kernel/setup.c	Tue Jun 15 15:28:22 2004 +0000
     5.2 +++ b/linux-2.4.26-xen-sparse/arch/xen/kernel/setup.c	Wed Jun 16 15:59:23 2004 +0000
     5.3 @@ -162,6 +162,36 @@ static void __init parse_mem_cmdline (ch
     5.4      *cmdline_p = command_line;
     5.5  }
     5.6  
     5.7 +/*
     5.8 + * Every exception-fixup table is sorted (i.e., kernel main table, and every
     5.9 + * module table. Some elements may be out of order if they reference text.init,
    5.10 + * for example. 
    5.11 + */
    5.12 +static void sort_exception_table(struct exception_table_entry *start,
    5.13 +                                 struct exception_table_entry *end)
    5.14 +{
    5.15 +    struct exception_table_entry *p, *q, tmp;
    5.16 +
    5.17 +    for ( p = start; p < end; p++ )
    5.18 +    {
    5.19 +        for ( q = p-1; q > start; q-- )
    5.20 +            if ( p->insn > q->insn )
    5.21 +                break;
    5.22 +        if ( ++q != p )
    5.23 +        {
    5.24 +            tmp = *p;
    5.25 +            memmove(q+1, q, (p-q)*sizeof(*p));
    5.26 +            *q = tmp;
    5.27 +        }
    5.28 +    }
    5.29 +}
    5.30 +
    5.31 +int xen_module_init(struct module *mod)
    5.32 +{
    5.33 +    sort_exception_table(mod->ex_table_start, mod->ex_table_end);
    5.34 +    return 0;
    5.35 +}
    5.36 +
    5.37  void __init setup_arch(char **cmdline_p)
    5.38  {
    5.39      unsigned long bootmap_size, start_pfn, max_low_pfn;
    5.40 @@ -172,11 +202,17 @@ void __init setup_arch(char **cmdline_p)
    5.41      extern unsigned long cpu0_pte_quicklist[];
    5.42      extern unsigned long cpu0_pgd_quicklist[];
    5.43  
    5.44 +    extern const struct exception_table_entry __start___ex_table[];
    5.45 +    extern const struct exception_table_entry __stop___ex_table[];
    5.46 +
    5.47      /* Force a quick death if the kernel panics. */
    5.48      extern int panic_timeout;
    5.49      if ( panic_timeout == 0 )
    5.50          panic_timeout = 1;
    5.51  
    5.52 +    /* Ensure that the kernel exception-fixup table is sorted. */
    5.53 +    sort_exception_table(__start___ex_table, __stop___ex_table);
    5.54 +
    5.55  #ifndef CONFIG_HIGHIO
    5.56      blk_nohighio = 1;
    5.57  #endif
     6.1 --- a/linux-2.4.26-xen-sparse/arch/xen/vmlinux.lds	Tue Jun 15 15:28:22 2004 +0000
     6.2 +++ b/linux-2.4.26-xen-sparse/arch/xen/vmlinux.lds	Wed Jun 16 15:59:23 2004 +0000
     6.3 @@ -64,13 +64,6 @@ SECTIONS
     6.4  	}
     6.5    _end = . ;
     6.6  
     6.7 -  /* Sections to be discarded */
     6.8 -  /DISCARD/ : {
     6.9 -	*(.text.exit)
    6.10 -	*(.data.exit)
    6.11 -	*(.exitcall.exit)
    6.12 -	}
    6.13 -
    6.14    /* Stabs debugging sections.  */
    6.15    .stab 0 : { *(.stab) }
    6.16    .stabstr 0 : { *(.stabstr) }
     7.1 --- a/linux-2.4.26-xen-sparse/include/asm-xen/io.h	Tue Jun 15 15:28:22 2004 +0000
     7.2 +++ b/linux-2.4.26-xen-sparse/include/asm-xen/io.h	Wed Jun 16 15:59:23 2004 +0000
     7.3 @@ -309,8 +309,15 @@ static inline void flush_write_buffers(v
     7.4  
     7.5  #ifdef SLOW_IO_BY_JUMPING
     7.6  #define __SLOW_DOWN_IO "\njmp 1f\n1:\tjmp 1f\n1:"
     7.7 +#elif defined(__UNSAFE_IO__)
     7.8 +#define __SLOW_DOWN_IO "\noutb %%al,$0x80"
     7.9  #else
    7.10 -#define __SLOW_DOWN_IO "\noutb %%al,$0x80"
    7.11 +#define __SLOW_DOWN_IO "\n1: outb %%al,$0x80\n"           \
    7.12 +                       "2:\n"                             \
    7.13 +                       ".section __ex_table,\"a\"\n\t"    \
    7.14 +                       ".align 4\n\t"                     \
    7.15 +                       ".long 1b,2b\n"                    \
    7.16 +                       ".previous"
    7.17  #endif
    7.18  
    7.19  #ifdef REALLY_SLOW_IO
    7.20 @@ -329,8 +336,18 @@ extern void *xquad_portio;    /* Where t
    7.21  #define __OUT1(s,x) \
    7.22  static inline void out##s(unsigned x value, unsigned short port) {
    7.23  
    7.24 +#ifdef __UNSAFE_IO__
    7.25  #define __OUT2(s,s1,s2) \
    7.26  __asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1"
    7.27 +#else
    7.28 +#define __OUT2(s,s1,s2)                                  \
    7.29 +__asm__ __volatile__ ("1: out" #s " %" s1 "0,%" s2 "1\n" \
    7.30 +                      "2:\n"                             \
    7.31 +                      ".section __ex_table,\"a\"\n\t"    \
    7.32 +                      ".align 4\n\t"                     \
    7.33 +                      ".long 1b,2b\n"                    \
    7.34 +                      ".previous"
    7.35 +#endif
    7.36  
    7.37  #if defined (CONFIG_MULTIQUAD) && !defined(STANDALONE)
    7.38  #define __OUTQ(s,ss,x)    /* Do the equivalent of the portio op on quads */ \
    7.39 @@ -378,8 +395,22 @@ static inline RETURN_TYPE in##ss##_quad(
    7.40  #define __IN1(s) \
    7.41  static inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v;
    7.42  
    7.43 +#ifdef __UNSAFE_IO__
    7.44  #define __IN2(s,s1,s2) \
    7.45  __asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0"
    7.46 +#else
    7.47 +#define __IN2(s,s1,s2) \
    7.48 +__asm__ __volatile__ ("1: in" #s " %" s2 "1,%" s1 "0\n" \
    7.49 +                      "2:\n"                            \
    7.50 +                      ".section .fixup,\"ax\"\n"        \
    7.51 +                      "3: mov" #s " $~0,%" s1 "0\n\t"   \
    7.52 +                      "jmp 2b\n"                        \
    7.53 +                      ".previous\n"                     \
    7.54 +                      ".section __ex_table,\"a\"\n\t"   \
    7.55 +                      ".align 4\n\t"                    \
    7.56 +                      ".long 1b,3b\n"                   \
    7.57 +                      ".previous"
    7.58 +#endif
    7.59  
    7.60  #if !defined(CONFIG_MULTIQUAD) || defined(STANDALONE)
    7.61  #define __IN(s,s1,i...) \
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/linux-2.4.26-xen-sparse/include/asm-xen/module.h	Wed Jun 16 15:59:23 2004 +0000
     8.3 @@ -0,0 +1,14 @@
     8.4 +#ifndef _ASM_I386_MODULE_H
     8.5 +#define _ASM_I386_MODULE_H
     8.6 +/*
     8.7 + * This file contains the i386 architecture specific module code.
     8.8 + */
     8.9 +
    8.10 +extern int xen_module_init(struct module *mod);
    8.11 +
    8.12 +#define module_map(x)		vmalloc(x)
    8.13 +#define module_unmap(x)		vfree(x)
    8.14 +#define module_arch_init(x)	xen_module_init(x)
    8.15 +#define arch_init_modules(x)	do { } while (0)
    8.16 +
    8.17 +#endif /* _ASM_I386_MODULE_H */
     9.1 --- a/linux-2.4.26-xen-sparse/mkbuildtree	Tue Jun 15 15:28:22 2004 +0000
     9.2 +++ b/linux-2.4.26-xen-sparse/mkbuildtree	Wed Jun 16 15:59:23 2004 +0000
     9.3 @@ -156,7 +156,6 @@ ln -sf ../asm-i386/mca_dma.h
     9.4  ln -sf ../asm-i386/mman.h 
     9.5  ln -sf ../asm-i386/mmu.h 
     9.6  ln -sf ../asm-i386/mmx.h 
     9.7 -ln -sf ../asm-i386/module.h 
     9.8  ln -sf ../asm-i386/mpspec.h 
     9.9  ln -sf ../asm-i386/msgbuf.h 
    9.10  ln -sf ../asm-i386/mtrr.h