Fixed alignment check of memory allocated by kmalloc.

This commit is contained in:
Saksham Gupta 2021-03-10 10:34:06 +05:30 committed by GitHub
parent 7aff64740e
commit 7462dfc8f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,7 @@ u32 free_mem_addr = 0x10000;
* keeps growing */
u32 kmalloc(u32 size, int align, u32 *phys_addr) {
/* Pages are aligned to 4K, or 0x1000 */
if (align == 1 && (free_mem_addr & 0xFFFFF000)) {
if (align == 1 && (free_mem_addr & 0x00000FFF)) {
free_mem_addr &= 0xFFFFF000;
free_mem_addr += 0x1000;
}