ia64/xen-unstable

changeset 1055:aadd0dc51c45

bitkeeper revision 1.694 (40133166fMqipwBHlUP1QVHEO6EEOg)

Many files:
From Kip Macy, we now are stricter when compiling the mini os.
author kaf24@scramble.cl.cam.ac.uk
date Sun Jan 25 03:00:54 2004 +0000 (2004-01-25)
parents 8fbde9a89a05
children c67c82ddb44a
files docs/style.tex extras/mini-os/Makefile extras/mini-os/h/hypervisor.h extras/mini-os/h/lib.h extras/mini-os/h/mm.h extras/mini-os/h/os.h extras/mini-os/kernel.c extras/mini-os/lib/malloc.c extras/mini-os/lib/math.c extras/mini-os/lib/printf.c extras/mini-os/lib/string.c extras/mini-os/time.c extras/mini-os/traps.c xen/include/hypervisor-ifs/block.h
line diff
     1.1 --- a/docs/style.tex	Sun Jan 25 02:17:59 2004 +0000
     1.2 +++ b/docs/style.tex	Sun Jan 25 03:00:54 2004 +0000
     1.3 @@ -4,7 +4,7 @@
     1.4  \setcounter{secnumdepth}{10}
     1.5  \setcounter{tocdepth}{2}
     1.6  
     1.7 -\usepackage{sabon}
     1.8 +%\usepackage{sabon}
     1.9  \def\textos#1{#1}
    1.10  
    1.11  %
     2.1 --- a/extras/mini-os/Makefile	Sun Jan 25 02:17:59 2004 +0000
     2.2 +++ b/extras/mini-os/Makefile	Sun Jan 25 03:00:54 2004 +0000
     2.3 @@ -1,17 +1,24 @@
     2.4  
     2.5  CC := gcc
     2.6  LD := ld
     2.7 +
     2.8  # Linker should relocate monitor to this address
     2.9  MONITOR_BASE := 0xE0100000
    2.10 -CFLAGS  := -fno-builtin -O3 -Wall -Ih/
    2.11 +
    2.12 +# NB. '-Wstrict-prototypes -Wredundant-decls -Wpointer-arith -Winline -ansi'
    2.13 +#     might all be okay to add to Xen. '-Wnested-externs' is a maybe.
    2.14 +#     '-Wcast-qual' is evil.
    2.15 +CFLAGS := -fno-builtin -O3 -Wall -Ih/ -Wredundant-decls
    2.16 +CFLAGS += -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Winline -ansi
    2.17  
    2.18  TARGET := mini-os
    2.19  
    2.20 -LOBJS:= lib/malloc.o lib/math.o lib/printf.o lib/string.o 
    2.21 -OBJS := entry.o kernel.o traps.o hypervisor.o mm.o events.o time.o ${LOBJS}
    2.22 +LOBJS := lib/malloc.o lib/math.o lib/printf.o lib/string.o 
    2.23 +OBJS  := entry.o kernel.o traps.o hypervisor.o mm.o events.o time.o ${LOBJS}
    2.24  
    2.25  HINTF := h/hypervisor-ifs/hypervisor-if.h
    2.26 -HDRS :=  h/os.h h/types.h h/hypervisor.h h/mm.h h/events.h h/time.h h/lib.h $(HINTF)
    2.27 +HDRS  :=  h/os.h h/types.h h/hypervisor.h h/mm.h h/events.h h/time.h h/lib.h
    2.28 +HDRS  += $(HINTF)
    2.29  
    2.30  default: $(TARGET)
    2.31  
     3.1 --- a/extras/mini-os/h/hypervisor.h	Sun Jan 25 02:17:59 2004 +0000
     3.2 +++ b/extras/mini-os/h/hypervisor.h	Sun Jan 25 03:00:54 2004 +0000
     3.3 @@ -32,7 +32,7 @@ void ack_hypervisor_event(unsigned int e
     3.4   * Assembler stubs for hyper-calls.
     3.5   */
     3.6  
     3.7 -static inline int HYPERVISOR_set_trap_table(trap_info_t *table)
     3.8 +static __inline__ int HYPERVISOR_set_trap_table(trap_info_t *table)
     3.9  {
    3.10      int ret;
    3.11      __asm__ __volatile__ (
    3.12 @@ -43,7 +43,7 @@ static inline int HYPERVISOR_set_trap_ta
    3.13      return ret;
    3.14  }
    3.15  
    3.16 -static inline int HYPERVISOR_mmu_update(mmu_update_t *req, int count)
    3.17 +static __inline__ int HYPERVISOR_mmu_update(mmu_update_t *req, int count)
    3.18  {
    3.19      int ret;
    3.20      __asm__ __volatile__ (
    3.21 @@ -54,7 +54,7 @@ static inline int HYPERVISOR_mmu_update(
    3.22      return ret;
    3.23  }
    3.24  
    3.25 -static inline int HYPERVISOR_console_write(const char *str, int count)
    3.26 +static __inline__ int HYPERVISOR_console_write(const char *str, int count)
    3.27  {
    3.28      int ret;
    3.29      __asm__ __volatile__ (
    3.30 @@ -66,7 +66,7 @@ static inline int HYPERVISOR_console_wri
    3.31      return ret;
    3.32  }
    3.33  
    3.34 -static inline int HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
    3.35 +static __inline__ int HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
    3.36  {
    3.37      int ret;
    3.38      __asm__ __volatile__ (
    3.39 @@ -78,7 +78,7 @@ static inline int HYPERVISOR_set_gdt(uns
    3.40      return ret;
    3.41  }
    3.42  
    3.43 -static inline int HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
    3.44 +static __inline__ int HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
    3.45  {
    3.46      int ret;
    3.47      __asm__ __volatile__ (
    3.48 @@ -89,7 +89,7 @@ static inline int HYPERVISOR_stack_switc
    3.49      return ret;
    3.50  }
    3.51  
    3.52 -static inline int HYPERVISOR_set_callbacks(
    3.53 +static __inline__ int HYPERVISOR_set_callbacks(
    3.54      unsigned long event_selector, unsigned long event_address,
    3.55      unsigned long failsafe_selector, unsigned long failsafe_address)
    3.56  {
    3.57 @@ -103,7 +103,7 @@ static inline int HYPERVISOR_set_callbac
    3.58      return ret;
    3.59  }
    3.60  
    3.61 -static inline int HYPERVISOR_net_io_op(netop_t *op)
    3.62 +static __inline__ int HYPERVISOR_net_io_op(netop_t *op)
    3.63  {
    3.64      int ret;
    3.65      __asm__ __volatile__ (
    3.66 @@ -114,7 +114,7 @@ static inline int HYPERVISOR_net_io_op(n
    3.67      return ret;
    3.68  }
    3.69  
    3.70 -static inline int HYPERVISOR_fpu_taskswitch(void)
    3.71 +static __inline__ int HYPERVISOR_fpu_taskswitch(void)
    3.72  {
    3.73      int ret;
    3.74      __asm__ __volatile__ (
    3.75 @@ -124,7 +124,7 @@ static inline int HYPERVISOR_fpu_taskswi
    3.76      return ret;
    3.77  }
    3.78  
    3.79 -static inline int HYPERVISOR_yield(void)
    3.80 +static __inline__ int HYPERVISOR_yield(void)
    3.81  {
    3.82      int ret;
    3.83      __asm__ __volatile__ (
    3.84 @@ -135,7 +135,7 @@ static inline int HYPERVISOR_yield(void)
    3.85      return ret;
    3.86  }
    3.87  
    3.88 -static inline int HYPERVISOR_exit(void)
    3.89 +static __inline__ int HYPERVISOR_exit(void)
    3.90  {
    3.91      int ret;
    3.92      __asm__ __volatile__ (
    3.93 @@ -146,7 +146,7 @@ static inline int HYPERVISOR_exit(void)
    3.94      return ret;
    3.95  }
    3.96  
    3.97 -static inline int HYPERVISOR_stop(void)
    3.98 +static __inline__ int HYPERVISOR_stop(void)
    3.99  {
   3.100      int ret;
   3.101      __asm__ __volatile__ (
   3.102 @@ -157,7 +157,7 @@ static inline int HYPERVISOR_stop(void)
   3.103      return ret;
   3.104  }
   3.105  
   3.106 -static inline int HYPERVISOR_dom0_op(void *dom0_op)
   3.107 +static __inline__ int HYPERVISOR_dom0_op(void *dom0_op)
   3.108  {
   3.109      int ret;
   3.110      __asm__ __volatile__ (
   3.111 @@ -168,7 +168,7 @@ static inline int HYPERVISOR_dom0_op(voi
   3.112      return ret;
   3.113  }
   3.114  
   3.115 -static inline int HYPERVISOR_network_op(void *network_op)
   3.116 +static __inline__ int HYPERVISOR_network_op(void *network_op)
   3.117  {
   3.118      int ret;
   3.119      __asm__ __volatile__ (
   3.120 @@ -179,7 +179,7 @@ static inline int HYPERVISOR_network_op(
   3.121      return ret;
   3.122  }
   3.123  
   3.124 -static inline int HYPERVISOR_block_io_op(unsigned int op)
   3.125 +static __inline__ int HYPERVISOR_block_io_op(unsigned int op)
   3.126  {
   3.127      int ret;
   3.128      __asm__ __volatile__ (
   3.129 @@ -190,7 +190,7 @@ static inline int HYPERVISOR_block_io_op
   3.130      return ret;
   3.131  }
   3.132  
   3.133 -static inline int HYPERVISOR_set_debugreg(int reg, unsigned long value)
   3.134 +static __inline__ int HYPERVISOR_set_debugreg(int reg, unsigned long value)
   3.135  {
   3.136      int ret;
   3.137      __asm__ __volatile__ (
   3.138 @@ -201,7 +201,7 @@ static inline int HYPERVISOR_set_debugre
   3.139      return ret;
   3.140  }
   3.141  
   3.142 -static inline unsigned long HYPERVISOR_get_debugreg(int reg)
   3.143 +static __inline__ unsigned long HYPERVISOR_get_debugreg(int reg)
   3.144  {
   3.145      unsigned long ret;
   3.146      __asm__ __volatile__ (
   3.147 @@ -212,7 +212,7 @@ static inline unsigned long HYPERVISOR_g
   3.148      return ret;
   3.149  }
   3.150  
   3.151 -static inline int HYPERVISOR_update_descriptor(
   3.152 +static __inline__ int HYPERVISOR_update_descriptor(
   3.153      unsigned long pa, unsigned long word1, unsigned long word2)
   3.154  {
   3.155      int ret;
   3.156 @@ -224,7 +224,7 @@ static inline int HYPERVISOR_update_desc
   3.157      return ret;
   3.158  }
   3.159  
   3.160 -static inline int HYPERVISOR_set_fast_trap(int idx)
   3.161 +static __inline__ int HYPERVISOR_set_fast_trap(int idx)
   3.162  {
   3.163      int ret;
   3.164      __asm__ __volatile__ (
   3.165 @@ -235,7 +235,7 @@ static inline int HYPERVISOR_set_fast_tr
   3.166      return ret;
   3.167  }
   3.168  
   3.169 -static inline int HYPERVISOR_dom_mem_op(void *dom_mem_op)
   3.170 +static __inline__ int HYPERVISOR_dom_mem_op(void *dom_mem_op)
   3.171  {
   3.172      int ret;
   3.173      __asm__ __volatile__ (
   3.174 @@ -246,7 +246,7 @@ static inline int HYPERVISOR_dom_mem_op(
   3.175      return ret;
   3.176  }
   3.177  
   3.178 -static inline int HYPERVISOR_multicall(void *call_list, int nr_calls)
   3.179 +static __inline__ int HYPERVISOR_multicall(void *call_list, int nr_calls)
   3.180  {
   3.181      int ret;
   3.182      __asm__ __volatile__ (
   3.183 @@ -257,7 +257,7 @@ static inline int HYPERVISOR_multicall(v
   3.184      return ret;
   3.185  }
   3.186  
   3.187 -static inline long HYPERVISOR_kbd_op(unsigned char op, unsigned char val)
   3.188 +static __inline__ long HYPERVISOR_kbd_op(unsigned char op, unsigned char val)
   3.189  {
   3.190      int ret;
   3.191      __asm__ __volatile__ (
   3.192 @@ -268,7 +268,7 @@ static inline long HYPERVISOR_kbd_op(uns
   3.193      return ret;
   3.194  }
   3.195  
   3.196 -static inline int HYPERVISOR_update_va_mapping(
   3.197 +static __inline__ int HYPERVISOR_update_va_mapping(
   3.198      unsigned long page_nr, unsigned long new_val, unsigned long flags)
   3.199  {
   3.200      int ret;
     4.1 --- a/extras/mini-os/h/lib.h	Sun Jan 25 02:17:59 2004 +0000
     4.2 +++ b/extras/mini-os/h/lib.h	Sun Jan 25 03:00:54 2004 +0000
     4.3 @@ -114,7 +114,7 @@ void  free(void* p);
     4.4  void *realloc(void* p, size_t n);
     4.5  void *memalign(size_t alignment, size_t n);
     4.6  void *valloc(size_t n);
     4.7 -struct mallinfo mallinfo();
     4.8 +struct mallinfo mallinfo(void);
     4.9  int  mallopt(int parameter_number, int parameter_value);
    4.10  
    4.11  void **independent_calloc(size_t n_elements, size_t size, void* chunks[]);
    4.12 @@ -123,7 +123,7 @@ void *pvalloc(size_t n);
    4.13  void cfree(void* p);
    4.14  int malloc_trim(size_t pad);
    4.15  size_t malloc_usable_size(void* p);
    4.16 -void malloc_stats();
    4.17 +void malloc_stats(void);
    4.18  
    4.19  
    4.20  #endif /* _LIB_H_ */
     5.1 --- a/extras/mini-os/h/mm.h	Sun Jan 25 02:17:59 2004 +0000
     5.2 +++ b/extras/mini-os/h/mm.h	Sun Jan 25 03:00:54 2004 +0000
     5.3 @@ -51,13 +51,13 @@
     5.4  extern unsigned long *phys_to_machine_mapping;
     5.5  #define pfn_to_mfn(_pfn) (phys_to_machine_mapping[(_pfn)])
     5.6  #define mfn_to_pfn(_mfn) (machine_to_phys_mapping[(_mfn)])
     5.7 -static inline unsigned long phys_to_machine(unsigned long phys)
     5.8 +static __inline__ unsigned long phys_to_machine(unsigned long phys)
     5.9  {
    5.10      unsigned long machine = pfn_to_mfn(phys >> PAGE_SHIFT);
    5.11      machine = (machine << PAGE_SHIFT) | (phys & ~PAGE_MASK);
    5.12      return machine;
    5.13  }
    5.14 -static inline unsigned long machine_to_phys(unsigned long machine)
    5.15 +static __inline__ unsigned long machine_to_phys(unsigned long machine)
    5.16  {
    5.17      unsigned long phys = mfn_to_pfn(machine >> PAGE_SHIFT);
    5.18      phys = (phys << PAGE_SHIFT) | (machine & ~PAGE_MASK);
    5.19 @@ -69,7 +69,7 @@ static inline unsigned long machine_to_p
    5.20  #define to_phys(x)                 ((unsigned long)(x)-VIRT_START)
    5.21  #define to_virt(x)                 ((void *)((unsigned long)(x)+VIRT_START))
    5.22  
    5.23 -void init_mm();
    5.24 +void init_mm(void);
    5.25  unsigned long alloc_pages(int order);
    5.26  
    5.27  #endif /* _MM_H_ */
     6.1 --- a/extras/mini-os/h/os.h	Sun Jan 25 02:17:59 2004 +0000
     6.2 +++ b/extras/mini-os/h/os.h	Sun Jan 25 03:00:54 2004 +0000
     6.3 @@ -137,8 +137,8 @@ typedef struct { volatile int counter; }
     6.4  #define xchg(ptr,v) \
     6.5          ((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr))))
     6.6  struct __xchg_dummy { unsigned long a[100]; };
     6.7 -#define __xg(x) ((struct __xchg_dummy *)(x))
     6.8 -static inline unsigned long __xchg(unsigned long x, volatile void * ptr,
     6.9 +#define __xg(x) ((volatile struct __xchg_dummy *)(x))
    6.10 +static __inline__ unsigned long __xchg(unsigned long x, volatile void * ptr,
    6.11                                     int size)
    6.12  {
    6.13      switch (size) {
     7.1 --- a/extras/mini-os/kernel.c	Sun Jan 25 02:17:59 2004 +0000
     7.2 +++ b/extras/mini-os/kernel.c	Sun Jan 25 03:00:54 2004 +0000
     7.3 @@ -60,10 +60,10 @@ void failsafe_callback(void);
     7.4  static void exit_handler(int ev, struct pt_regs *regs);
     7.5  static void debug_handler(int ev, struct pt_regs *regs);
     7.6  
     7.7 +extern char shared_info[PAGE_SIZE];
     7.8  
     7.9  static shared_info_t *map_shared_info(unsigned long pa)
    7.10  {
    7.11 -    extern char shared_info[PAGE_SIZE];
    7.12      if ( HYPERVISOR_update_va_mapping((unsigned long)shared_info >> PAGE_SHIFT,
    7.13                                        pa | 3, UVMF_INVLPG) )
    7.14      {
     8.1 --- a/extras/mini-os/lib/malloc.c	Sun Jan 25 02:17:59 2004 +0000
     8.2 +++ b/extras/mini-os/lib/malloc.c	Sun Jan 25 03:00:54 2004 +0000
     8.3 @@ -60,7 +60,7 @@ static void *more_core(size_t n)
     8.4      if ( ret )
     8.5      {
     8.6          num_pages = 1 << order;
     8.7 -        last = ret + (num_pages * PAGE_SIZE);
     8.8 +        last = (char *)ret + (num_pages * PAGE_SIZE);
     8.9      }
    8.10  
    8.11      return ret;      
     9.1 --- a/extras/mini-os/lib/math.c	Sun Jan 25 02:17:59 2004 +0000
     9.2 +++ b/extras/mini-os/lib/math.c	Sun Jan 25 03:00:54 2004 +0000
     9.3 @@ -140,8 +140,7 @@ shl(register digit *p, register int len,
     9.4   * leading zeros).
     9.5   */
     9.6  u64
     9.7 -__qdivrem(uq, vq, arq)
     9.8 -	u64 uq, vq, *arq;
     9.9 +__qdivrem(u64 uq, u64 vq, u64 *arq)
    9.10  {
    9.11  	union uu tmp;
    9.12  	digit *u, *v, *q;
    9.13 @@ -363,8 +362,7 @@ s64
    9.14   * Divide two unsigned quads.
    9.15   */
    9.16  u64
    9.17 -__udivdi3(a, b)
    9.18 -        u64 a, b;
    9.19 +__udivdi3(u64 a, u64 b)
    9.20  {
    9.21          return (__qdivrem(a, b, (u64 *)0));
    9.22  }
    9.23 @@ -374,8 +372,7 @@ u64
    9.24   * Return remainder after dividing two unsigned quads.
    9.25   */
    9.26  u_quad_t
    9.27 -__umoddi3(a, b)
    9.28 -        u_quad_t a, b;
    9.29 +__umoddi3(u_quad_t a, u_quad_t b)
    9.30  {
    9.31          u_quad_t r;
    9.32  
    10.1 --- a/extras/mini-os/lib/printf.c	Sun Jan 25 02:17:59 2004 +0000
    10.2 +++ b/extras/mini-os/lib/printf.c	Sun Jan 25 03:00:54 2004 +0000
    10.3 @@ -130,10 +130,7 @@ vsprintf(char *buf, const char *cfmt, va
    10.4   * The buffer pointed to by `nbuf' must have length >= MAXNBUF.
    10.5   */
    10.6  static char *
    10.7 -ksprintn(nbuf, ul, base, lenp)
    10.8 -	char *nbuf;
    10.9 -	u_long ul;
   10.10 -	int base, *lenp;
   10.11 +ksprintn(char *nbuf, u_long ul, int base, int *lenp)
   10.12  {
   10.13  	char *p;
   10.14  
   10.15 @@ -148,10 +145,7 @@ ksprintn(nbuf, ul, base, lenp)
   10.16  }
   10.17  /* ksprintn, but for a quad_t. */
   10.18  static char *
   10.19 -ksprintqn(nbuf, uq, base, lenp)
   10.20 -	char *nbuf;
   10.21 -	u_quad_t uq;
   10.22 -	int base, *lenp;
   10.23 +ksprintqn(char *nbuf, u_quad_t uq, int base, int *lenp)
   10.24  {
   10.25  	char *p;
   10.26  
    11.1 --- a/extras/mini-os/lib/string.c	Sun Jan 25 02:17:59 2004 +0000
    11.2 +++ b/extras/mini-os/lib/string.c	Sun Jan 25 03:00:54 2004 +0000
    11.3 @@ -35,7 +35,8 @@ int memcmp(const void * cs,const void * 
    11.4  
    11.5  void * memcpy(void * dest,const void *src,size_t count)
    11.6  {
    11.7 -	char *tmp = (char *) dest, *s = (char *) src;
    11.8 +	char *tmp = (char *) dest;
    11.9 +    const char *s = src;
   11.10  
   11.11  	while (count--)
   11.12  		*tmp++ = *s++;
   11.13 @@ -120,7 +121,7 @@ char * strchr(const char * s, int c)
   11.14          for(; *s != (char) c; ++s)
   11.15                  if (*s == '\0')
   11.16                          return NULL;
   11.17 -        return (char *) s;
   11.18 +        return (char *)s;
   11.19  }
   11.20  
   11.21  char * strstr(const char * s1,const char * s2)
   11.22 @@ -139,4 +140,3 @@ char * strstr(const char * s1,const char
   11.23          }
   11.24          return NULL;
   11.25  }
   11.26 -
    12.1 --- a/extras/mini-os/time.c	Sun Jan 25 02:17:59 2004 +0000
    12.2 +++ b/extras/mini-os/time.c	Sun Jan 25 03:00:54 2004 +0000
    12.3 @@ -88,7 +88,7 @@ static void get_time_values_from_xen(voi
    12.4      (shadow_time_version == HYPERVISOR_shared_info->time_version2)
    12.5  
    12.6  
    12.7 -static inline unsigned long get_time_delta_usecs(void)
    12.8 +static __inline__ unsigned long get_time_delta_usecs(void)
    12.9  {
   12.10      s32      delta_tsc;
   12.11      u32      low;
    13.1 --- a/extras/mini-os/traps.c	Sun Jan 25 02:17:59 2004 +0000
    13.2 +++ b/extras/mini-os/traps.c	Sun Jan 25 03:00:54 2004 +0000
    13.3 @@ -57,7 +57,7 @@ void dump_regs(struct pt_regs *regs)
    13.4  }	
    13.5  
    13.6  
    13.7 -static inline void dump_code(unsigned eip)
    13.8 +static __inline__ void dump_code(unsigned eip)
    13.9  {
   13.10    unsigned *ptr = (unsigned *)eip;
   13.11    int x;
   13.12 @@ -80,7 +80,7 @@ static inline void dump_code(unsigned ei
   13.13   * register CR2, but that is not accessible in a virtualised OS.
   13.14   */
   13.15  
   13.16 -static void inline do_trap(int trapnr, char *str,
   13.17 +static void __inline__ do_trap(int trapnr, char *str,
   13.18  			   struct pt_regs * regs, long error_code)
   13.19  {
   13.20    printk("FATAL:  Unhandled Trap (see mini-os:traps.c)");
    14.1 --- a/xen/include/hypervisor-ifs/block.h	Sun Jan 25 02:17:59 2004 +0000
    14.2 +++ b/xen/include/hypervisor-ifs/block.h	Sun Jan 25 03:00:54 2004 +0000
    14.3 @@ -104,10 +104,10 @@ typedef struct xen_disk
    14.4  typedef struct xen_disk_info
    14.5  {
    14.6      /* IN variables  */
    14.7 -    int         max;             // maximumum number of disks to report
    14.8 -    xen_disk_t *disks;           // pointer to array of disk info 
    14.9 +    int         max;             /* maximumum number of disks to report */
   14.10 +    xen_disk_t *disks;           /* pointer to array of disk info       */
   14.11      /* OUT variables */
   14.12 -    int         count;           // how many disks we have info about 
   14.13 +    int         count;           /* how many disks we have info about   */
   14.14  } xen_disk_info_t;
   14.15  
   14.16  #endif