luna, kernel: Replace some uses of char by truly 1-byte wide types
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
329e8ab182
commit
1d92784608
@ -433,7 +433,7 @@ namespace MemoryManager
|
|||||||
uintptr_t user_ptr = (uintptr_t)user;
|
uintptr_t user_ptr = (uintptr_t)user;
|
||||||
uintptr_t user_page = align_down<ARCH_PAGE_SIZE>(user_ptr);
|
uintptr_t user_page = align_down<ARCH_PAGE_SIZE>(user_ptr);
|
||||||
|
|
||||||
const char* kernel_ptr = (const char*)kernel;
|
const u8* kernel_ptr = (const u8*)kernel;
|
||||||
|
|
||||||
// Userspace pointer not aligned on page boundary
|
// Userspace pointer not aligned on page boundary
|
||||||
if (user_ptr != user_page)
|
if (user_ptr != user_page)
|
||||||
@ -449,7 +449,7 @@ namespace MemoryManager
|
|||||||
if (!validate_user_writable_page(user_ptr)) return false;
|
if (!validate_user_writable_page(user_ptr)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*(char*)user_ptr = *kernel_ptr++;
|
*(u8*)user_ptr = *kernel_ptr++;
|
||||||
user_ptr++;
|
user_ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ namespace MemoryManager
|
|||||||
uintptr_t user_ptr = (uintptr_t)user;
|
uintptr_t user_ptr = (uintptr_t)user;
|
||||||
uintptr_t user_page = align_down<ARCH_PAGE_SIZE>(user_ptr);
|
uintptr_t user_page = align_down<ARCH_PAGE_SIZE>(user_ptr);
|
||||||
|
|
||||||
char* kernel_ptr = (char*)kernel;
|
u8* kernel_ptr = (u8*)kernel;
|
||||||
|
|
||||||
// Userspace pointer not aligned on page boundary
|
// Userspace pointer not aligned on page boundary
|
||||||
if (user_ptr != user_page)
|
if (user_ptr != user_page)
|
||||||
@ -477,7 +477,7 @@ namespace MemoryManager
|
|||||||
if (!validate_user_readable_page(user_ptr)) return false;
|
if (!validate_user_readable_page(user_ptr)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*kernel_ptr++ = *(const char*)user_ptr;
|
*kernel_ptr++ = *(const u8*)user_ptr;
|
||||||
user_ptr++;
|
user_ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,5 @@ static_assert(get_blocks_from_size(0, 256) == 0);
|
|||||||
// arithmetic.
|
// arithmetic.
|
||||||
template <typename T, typename Offset> constexpr T* offset_ptr(T* ptr, Offset offset)
|
template <typename T, typename Offset> constexpr T* offset_ptr(T* ptr, Offset offset)
|
||||||
{
|
{
|
||||||
// FIXME: The C standard does not mandate that char be 1 byte. This function (and probably many others) rely on that
|
return (T*)((u8*)ptr + offset);
|
||||||
// assumption.
|
|
||||||
return (T*)((char*)ptr + offset);
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user