Initial ramdisk support
- Create initrd library to support definitions and loading - Allow tools compiled for the host machine to be built by wscript - Create makerd tool to build initrd from manifest - Move screenfont to initrd, so don't load framebuffer initially
This commit is contained in:
@@ -25,4 +25,13 @@ memcpy(void *dest, void *src, size_t n)
|
||||
return d;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
checksum(const void *p, size_t len, size_t off)
|
||||
{
|
||||
uint8_t sum = 0;
|
||||
const uint8_t *c = reinterpret_cast<const uint8_t *>(p);
|
||||
for (int i = off; i < len; ++i) sum += c[i];
|
||||
return sum;
|
||||
}
|
||||
|
||||
} // namespace kutil
|
||||
|
||||
@@ -66,4 +66,10 @@ inline T* mask_pointer(T *p, addr_t mask)
|
||||
return reinterpret_cast<T *>(reinterpret_cast<addr_t>(p) & ~mask);
|
||||
}
|
||||
|
||||
/// Do a simple byte-wise checksum of an area of memory.
|
||||
/// \arg p The start of the memory region
|
||||
/// \arg len The number of bytes in the region
|
||||
/// \arg off An optional offset into the region
|
||||
uint8_t checksum(const void *p, size_t len, size_t off = 0);
|
||||
|
||||
} // namespace kutil
|
||||
|
||||
Reference in New Issue
Block a user