ia64/xen-unstable

changeset 17722:4c1bb3e4a5a0

minios: Fix width of shifted 1

Shifting 1 more that 32 bits requires 1 to be long-typed.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Sat May 24 09:24:25 2008 +0100 (2008-05-24)
parents c4506386b299
children 572701272661
files extras/mini-os/hypervisor.c extras/mini-os/lib/xmalloc.c extras/mini-os/mm.c
line diff
     1.1 --- a/extras/mini-os/hypervisor.c	Sat May 24 09:23:40 2008 +0100
     1.2 +++ b/extras/mini-os/hypervisor.c	Sat May 24 09:24:25 2008 +0100
     1.3 @@ -55,12 +55,12 @@ void do_hypervisor_callback(struct pt_re
     1.4      while ( l1 != 0 )
     1.5      {
     1.6          l1i = __ffs(l1);
     1.7 -        l1 &= ~(1 << l1i);
     1.8 +        l1 &= ~(1UL << l1i);
     1.9          
    1.10          while ( (l2 = active_evtchns(cpu, s, l1i)) != 0 )
    1.11          {
    1.12              l2i = __ffs(l2);
    1.13 -            l2 &= ~(1 << l2i);
    1.14 +            l2 &= ~(1UL << l2i);
    1.15  
    1.16              port = (l1i * (sizeof(unsigned long) * 8)) + l2i;
    1.17  			do_event(port, regs);
     2.1 --- a/extras/mini-os/lib/xmalloc.c	Sat May 24 09:23:40 2008 +0100
     2.2 +++ b/extras/mini-os/lib/xmalloc.c	Sat May 24 09:24:25 2008 +0100
     2.3 @@ -127,7 +127,7 @@ static void *xmalloc_whole_pages(size_t 
     2.4      if ( hdr == NULL )
     2.5          return NULL;
     2.6  
     2.7 -    hdr->size = (1 << (pageorder + PAGE_SHIFT));
     2.8 +    hdr->size = (1UL << (pageorder + PAGE_SHIFT));
     2.9      /* Debugging aid. */
    2.10      hdr->freelist.next = hdr->freelist.prev = NULL;
    2.11  
     3.1 --- a/extras/mini-os/mm.c	Sat May 24 09:23:40 2008 +0100
     3.2 +++ b/extras/mini-os/mm.c	Sat May 24 09:24:25 2008 +0100
     3.3 @@ -58,7 +58,7 @@ static unsigned long *alloc_bitmap;
     3.4  #define PAGES_PER_MAPWORD (sizeof(unsigned long) * 8)
     3.5  
     3.6  #define allocated_in_map(_pn) \
     3.7 -(alloc_bitmap[(_pn)/PAGES_PER_MAPWORD] & (1<<((_pn)&(PAGES_PER_MAPWORD-1))))
     3.8 +(alloc_bitmap[(_pn)/PAGES_PER_MAPWORD] & (1UL<<((_pn)&(PAGES_PER_MAPWORD-1))))
     3.9  
    3.10  /*
    3.11   * Hint regarding bitwise arithmetic in map_{alloc,free}:
    3.12 @@ -80,13 +80,13 @@ static void map_alloc(unsigned long firs
    3.13  
    3.14      if ( curr_idx == end_idx )
    3.15      {
    3.16 -        alloc_bitmap[curr_idx] |= ((1<<end_off)-1) & -(1<<start_off);
    3.17 +        alloc_bitmap[curr_idx] |= ((1UL<<end_off)-1) & -(1UL<<start_off);
    3.18      }
    3.19      else 
    3.20      {
    3.21 -        alloc_bitmap[curr_idx] |= -(1<<start_off);
    3.22 -        while ( ++curr_idx < end_idx ) alloc_bitmap[curr_idx] = ~0L;
    3.23 -        alloc_bitmap[curr_idx] |= (1<<end_off)-1;
    3.24 +        alloc_bitmap[curr_idx] |= -(1UL<<start_off);
    3.25 +        while ( ++curr_idx < end_idx ) alloc_bitmap[curr_idx] = ~0UL;
    3.26 +        alloc_bitmap[curr_idx] |= (1UL<<end_off)-1;
    3.27      }
    3.28  }
    3.29  
    3.30 @@ -102,13 +102,13 @@ static void map_free(unsigned long first
    3.31  
    3.32      if ( curr_idx == end_idx )
    3.33      {
    3.34 -        alloc_bitmap[curr_idx] &= -(1<<end_off) | ((1<<start_off)-1);
    3.35 +        alloc_bitmap[curr_idx] &= -(1UL<<end_off) | ((1UL<<start_off)-1);
    3.36      }
    3.37      else 
    3.38      {
    3.39 -        alloc_bitmap[curr_idx] &= (1<<start_off)-1;
    3.40 +        alloc_bitmap[curr_idx] &= (1UL<<start_off)-1;
    3.41          while ( ++curr_idx != end_idx ) alloc_bitmap[curr_idx] = 0;
    3.42 -        alloc_bitmap[curr_idx] &= -(1<<end_off);
    3.43 +        alloc_bitmap[curr_idx] &= -(1UL<<end_off);
    3.44      }
    3.45  }
    3.46  
    3.47 @@ -178,7 +178,7 @@ USED static void print_chunks(void *star
    3.48          head = free_head[order];
    3.49          while(!FREELIST_EMPTY(head))
    3.50          {
    3.51 -            for(count = 0; count < 1<< head->level; count++)
    3.52 +            for(count = 0; count < 1UL<< head->level; count++)
    3.53              {
    3.54                  if(count + virt_to_pfn(head) - pfn_start < 1000)
    3.55                      chunks[count + virt_to_pfn(head) - pfn_start] = current;
    3.56 @@ -235,13 +235,13 @@ static void init_page_allocator(unsigned
    3.57           * Next chunk is limited by alignment of min, but also
    3.58           * must not be bigger than remaining range.
    3.59           */
    3.60 -        for ( i = PAGE_SHIFT; (1<<(i+1)) <= range; i++ )
    3.61 -            if ( min & (1<<i) ) break;
    3.62 +        for ( i = PAGE_SHIFT; (1UL<<(i+1)) <= range; i++ )
    3.63 +            if ( min & (1UL<<i) ) break;
    3.64  
    3.65  
    3.66          ch = (chunk_head_t *)min;
    3.67 -        min   += (1<<i);
    3.68 -        range -= (1<<i);
    3.69 +        min   += (1UL<<i);
    3.70 +        range -= (1UL<<i);
    3.71          ct = (chunk_tail_t *)min-1;
    3.72          i -= PAGE_SHIFT;
    3.73          ch->level       = i;
    3.74 @@ -280,8 +280,8 @@ unsigned long alloc_pages(int order)
    3.75      {
    3.76          /* Split into two equal parts. */
    3.77          i--;
    3.78 -        spare_ch = (chunk_head_t *)((char *)alloc_ch + (1<<(i+PAGE_SHIFT)));
    3.79 -        spare_ct = (chunk_tail_t *)((char *)spare_ch + (1<<(i+PAGE_SHIFT)))-1;
    3.80 +        spare_ch = (chunk_head_t *)((char *)alloc_ch + (1UL<<(i+PAGE_SHIFT)));
    3.81 +        spare_ct = (chunk_tail_t *)((char *)spare_ch + (1UL<<(i+PAGE_SHIFT)))-1;
    3.82  
    3.83          /* Create new header for spare chunk. */
    3.84          spare_ch->level = i;
    3.85 @@ -294,7 +294,7 @@ unsigned long alloc_pages(int order)
    3.86          free_head[i] = spare_ch;
    3.87      }
    3.88      
    3.89 -    map_alloc(PHYS_PFN(to_phys(alloc_ch)), 1<<order);
    3.90 +    map_alloc(PHYS_PFN(to_phys(alloc_ch)), 1UL<<order);
    3.91  
    3.92      return((unsigned long)alloc_ch);
    3.93  
    3.94 @@ -312,16 +312,16 @@ void free_pages(void *pointer, int order
    3.95      unsigned long mask;
    3.96      
    3.97      /* First free the chunk */
    3.98 -    map_free(virt_to_pfn(pointer), 1 << order);
    3.99 +    map_free(virt_to_pfn(pointer), 1UL << order);
   3.100      
   3.101      /* Create free chunk */
   3.102      freed_ch = (chunk_head_t *)pointer;
   3.103 -    freed_ct = (chunk_tail_t *)((char *)pointer + (1<<(order + PAGE_SHIFT)))-1;
   3.104 +    freed_ct = (chunk_tail_t *)((char *)pointer + (1UL<<(order + PAGE_SHIFT)))-1;
   3.105      
   3.106      /* Now, possibly we can conseal chunks together */
   3.107      while(order < FREELIST_SIZE)
   3.108      {
   3.109 -        mask = 1 << (order + PAGE_SHIFT);
   3.110 +        mask = 1UL << (order + PAGE_SHIFT);
   3.111          if((unsigned long)freed_ch & mask) 
   3.112          {
   3.113              to_merge_ch = (chunk_head_t *)((char *)freed_ch - mask);