From: Keir Fraser Date: Sat, 24 May 2008 08:24:25 +0000 (+0100) Subject: minios: Fix width of shifted 1 X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14207^2~43 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b9920f5849e0e712d9b11ad65776a18264f24e59;p=xen.git minios: Fix width of shifted 1 Shifting 1 more that 32 bits requires 1 to be long-typed. Signed-off-by: Samuel Thibault --- diff --git a/extras/mini-os/hypervisor.c b/extras/mini-os/hypervisor.c index acc9494c01..299180e3d2 100644 --- a/extras/mini-os/hypervisor.c +++ b/extras/mini-os/hypervisor.c @@ -55,12 +55,12 @@ void do_hypervisor_callback(struct pt_regs *regs) while ( l1 != 0 ) { l1i = __ffs(l1); - l1 &= ~(1 << l1i); + l1 &= ~(1UL << l1i); while ( (l2 = active_evtchns(cpu, s, l1i)) != 0 ) { l2i = __ffs(l2); - l2 &= ~(1 << l2i); + l2 &= ~(1UL << l2i); port = (l1i * (sizeof(unsigned long) * 8)) + l2i; do_event(port, regs); diff --git a/extras/mini-os/lib/xmalloc.c b/extras/mini-os/lib/xmalloc.c index 59f4ad5dd8..f73721f0dc 100644 --- a/extras/mini-os/lib/xmalloc.c +++ b/extras/mini-os/lib/xmalloc.c @@ -127,7 +127,7 @@ static void *xmalloc_whole_pages(size_t size, size_t align) if ( hdr == NULL ) return NULL; - hdr->size = (1 << (pageorder + PAGE_SHIFT)); + hdr->size = (1UL << (pageorder + PAGE_SHIFT)); /* Debugging aid. */ hdr->freelist.next = hdr->freelist.prev = NULL; diff --git a/extras/mini-os/mm.c b/extras/mini-os/mm.c index 2cc9e9db6d..bc56030a25 100644 --- a/extras/mini-os/mm.c +++ b/extras/mini-os/mm.c @@ -58,7 +58,7 @@ static unsigned long *alloc_bitmap; #define PAGES_PER_MAPWORD (sizeof(unsigned long) * 8) #define allocated_in_map(_pn) \ -(alloc_bitmap[(_pn)/PAGES_PER_MAPWORD] & (1<<((_pn)&(PAGES_PER_MAPWORD-1)))) +(alloc_bitmap[(_pn)/PAGES_PER_MAPWORD] & (1UL<<((_pn)&(PAGES_PER_MAPWORD-1)))) /* * Hint regarding bitwise arithmetic in map_{alloc,free}: @@ -80,13 +80,13 @@ static void map_alloc(unsigned long first_page, unsigned long nr_pages) if ( curr_idx == end_idx ) { - alloc_bitmap[curr_idx] |= ((1<level; count++) + for(count = 0; count < 1UL<< head->level; count++) { if(count + virt_to_pfn(head) - pfn_start < 1000) chunks[count + virt_to_pfn(head) - pfn_start] = current; @@ -235,13 +235,13 @@ static void init_page_allocator(unsigned long min, unsigned long max) * Next chunk is limited by alignment of min, but also * must not be bigger than remaining range. */ - for ( i = PAGE_SHIFT; (1<<(i+1)) <= range; i++ ) - if ( min & (1<level = i; @@ -280,8 +280,8 @@ unsigned long alloc_pages(int order) { /* Split into two equal parts. */ i--; - spare_ch = (chunk_head_t *)((char *)alloc_ch + (1<<(i+PAGE_SHIFT))); - spare_ct = (chunk_tail_t *)((char *)spare_ch + (1<<(i+PAGE_SHIFT)))-1; + spare_ch = (chunk_head_t *)((char *)alloc_ch + (1UL<<(i+PAGE_SHIFT))); + spare_ct = (chunk_tail_t *)((char *)spare_ch + (1UL<<(i+PAGE_SHIFT)))-1; /* Create new header for spare chunk. */ spare_ch->level = i; @@ -294,7 +294,7 @@ unsigned long alloc_pages(int order) free_head[i] = spare_ch; } - map_alloc(PHYS_PFN(to_phys(alloc_ch)), 1<