diff --git a/src/boot/memory_map.cpp b/src/boot/memory_map.cpp index afbc6be..eebcfa9 100644 --- a/src/boot/memory_map.cpp +++ b/src/boot/memory_map.cpp @@ -249,13 +249,13 @@ build_frame_blocks(const util::counted &kmap) unsigned i = 0; uint64_t b1 = (page_count + 4095) / 4096; - blk->map1 = (1 << b1) - 1; + blk->map1 = (1ull << b1) - 1; uint64_t b2 = (page_count + 63) / 64; uint64_t b2q = b2 / 64; uint64_t b2r = b2 % 64; g_alloc.memset(blk->map2, b2q, 0xff); - blk->map2[b2q] = (1 << b2r) - 1; + blk->map2[b2q] = (1ull << b2r) - 1; break; } } @@ -269,7 +269,7 @@ build_frame_blocks(const util::counted &kmap) size_t b = blk.count / 64; size_t r = blk.count % 64; g_alloc.memset(blk.bitmap, b*8, 0xff); - blk.bitmap[b] = (1 << r) - 1; + blk.bitmap[b] = (1ull << r) - 1; bitmap += bitmap_size(blk.count); } diff --git a/src/kernel/device_manager.cpp b/src/kernel/device_manager.cpp index ede9f99..930b20f 100644 --- a/src/kernel/device_manager.cpp +++ b/src/kernel/device_manager.cpp @@ -385,7 +385,7 @@ device_manager::dispatch_irq(unsigned irq) if (!binding.target || binding.target == ignore_event) return binding.target == ignore_event; - binding.target->signal(1 << binding.signal); + binding.target->signal(1ull << binding.signal); return true; } diff --git a/src/kernel/frame_allocator.cpp b/src/kernel/frame_allocator.cpp index b0822be..9226ac2 100644 --- a/src/kernel/frame_allocator.cpp +++ b/src/kernel/frame_allocator.cpp @@ -101,9 +101,9 @@ frame_allocator::free(uintptr_t address, size_t count) unsigned o3 = frame & 0x3f; while (count--) { - block.map1 |= (1 << o1); - block.map2[o1] |= (1 << o2); - block.bitmap[o2] |= (1 << o3); + block.map1 |= (1ull << o1); + block.map2[o1] |= (1ull << o2); + block.bitmap[o2] |= (1ull << o3); if (++o3 == 64) { o3 = 0; if (++o2 == 64) { @@ -139,12 +139,12 @@ frame_allocator::used(uintptr_t address, size_t count) unsigned o3 = frame & 0x3f; while (count--) { - block.bitmap[o2] &= ~(1 << o3); + block.bitmap[o2] &= ~(1ull << o3); if (!block.bitmap[o2]) { - block.map2[o1] &= ~(1 << o2); + block.map2[o1] &= ~(1ull << o2); if (!block.map2[o1]) { - block.map1 &= ~(1 << o1); + block.map1 &= ~(1ull << o1); } } diff --git a/src/kernel/heap_allocator.cpp b/src/kernel/heap_allocator.cpp index ea62536..5622135 100644 --- a/src/kernel/heap_allocator.cpp +++ b/src/kernel/heap_allocator.cpp @@ -27,7 +27,7 @@ struct heap_allocator::free_header inline free_header * buddy() const { return reinterpret_cast( - reinterpret_cast(this) ^ (1 << order)); + reinterpret_cast(this) ^ (1ull << order)); } inline bool eldest() const { return this < buddy(); } @@ -67,7 +67,7 @@ heap_allocator::allocate(size_t length) util::scoped_lock lock {m_lock}; - m_allocated_size += (1 << order); + m_allocated_size += (1ull << order); free_header *block = pop_free(order); if (!block && !split_off(order, block)) { @@ -95,7 +95,8 @@ heap_allocator::free(void *p) kassert(info, "Attempt to free pointer not known to the heap"); if (!info) return; - m_allocated_size -= (1 << info->order); + size_t size = (1ull << info->order); + m_allocated_size -= size; block->clear(info->order); block = merge_block(block); @@ -118,7 +119,7 @@ heap_allocator::reallocate(void *p, size_t old_length, size_t new_length) if (!info) return nullptr; - if (new_length <= (1 << info->order)) + if (new_length <= (1ull << info->order)) return p; lock.release(); @@ -180,12 +181,12 @@ heap_allocator::new_block(unsigned order) unsigned current = address_order(m_end); while (current < order) { register_free_block(reinterpret_cast(m_end), current); - m_end += 1 << current; + m_end += 1ull << current; current = address_order(m_end); } void *block = reinterpret_cast(m_end); - m_end += 1 << order; + m_end += 1ull << order; m_map[map_key(block)].order = order; return block; } diff --git a/src/libraries/util/util/map.h b/src/libraries/util/util/map.h index 09f3bc5..fd1c23b 100644 --- a/src/libraries/util/util/map.h +++ b/src/libraries/util/util/map.h @@ -84,7 +84,7 @@ public: m_nodes(nullptr) { if (capacity) - set_capacity(1 << log2(capacity)); + set_capacity(1ull << log2(capacity)); } virtual ~base_map() { diff --git a/src/libraries/util/util/node_map.h b/src/libraries/util/util/node_map.h index be06197..68d867f 100644 --- a/src/libraries/util/util/node_map.h +++ b/src/libraries/util/util/node_map.h @@ -50,7 +50,7 @@ public: m_nodes {nullptr} { if (capacity) { - m_capacity = 1 << log2(capacity); + m_capacity = 1ull << log2(capacity); m_nodes = reinterpret_cast( alloc::allocate(m_capacity * sizeof(node_type))); for (size_t i = 0; i < m_capacity; ++i) diff --git a/src/libraries/util/util/vector.h b/src/libraries/util/util/vector.h index ed76f4f..c177c17 100644 --- a/src/libraries/util/util/vector.h +++ b/src/libraries/util/util/vector.h @@ -265,7 +265,7 @@ public: void ensure_capacity(count_t size) { if (capacity() >= size) return; - count_t capacity = (1 << log2(size)); + count_t capacity = (1ull << log2(size)); if (capacity < min_capacity) capacity = min_capacity; set_capacity(capacity);