forked from PoliEcho-holding-org/kern
maybe fix colors in kmalloc
This commit is contained in:
@@ -55,15 +55,15 @@ void* kmalloc(size_t size) {
|
|||||||
size_t alloc_index;
|
size_t alloc_index;
|
||||||
{
|
{
|
||||||
uint8_t leading_zeros = __builtin_clzll(size);
|
uint8_t leading_zeros = __builtin_clzll(size);
|
||||||
if (__builtin_popcountll(size) == 1) {
|
if (/*__builtin_popcountll(size) == */1) {
|
||||||
alloc_index = leading_zeros;
|
alloc_index = leading_zeros;
|
||||||
} else {
|
} else {
|
||||||
alloc_index = sizeof(size) * CHAR_BIT - leading_zeros;
|
alloc_index = sizeof(size) * CHAR_BIT - leading_zeros;
|
||||||
}
|
}
|
||||||
if (alloc_index > KMALLOC_MAX_SIZE) {
|
if (alloc_index > KMALLOC_MAX_SIZE) {
|
||||||
// NOT IMPLEMENTED
|
// NOT IMPLEMENTED
|
||||||
printk("Cannot allocate [%lu] bytes: \e[1MNOT "
|
printk("Cannot allocate [%lu] bytes: \e[1mNOT "
|
||||||
"IMPLEMENTED!\e[8M\n",
|
"IMPLEMENTED!\e[0m\n",
|
||||||
size);
|
size);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user