mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:38:12 +00:00
Kernel: Run clang-format on everything.
This commit is contained in:
parent
98eeb8f22d
commit
bc951ca565
63 changed files with 974 additions and 856 deletions
|
@ -3,18 +3,19 @@
|
|||
* just to get going. Don't ever let anyone see this shit. :^)
|
||||
*/
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/kmalloc.h>
|
||||
#include <Kernel/StdLib.h>
|
||||
#include <Kernel/i386.h>
|
||||
#include <Kernel/KSyms.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/Scheduler.h>
|
||||
#include <Kernel/KSyms.h>
|
||||
#include <AK/Assertions.h>
|
||||
#include <Kernel/StdLib.h>
|
||||
#include <Kernel/i386.h>
|
||||
#include <Kernel/kmalloc.h>
|
||||
|
||||
#define SANITIZE_KMALLOC
|
||||
|
||||
struct [[gnu::packed]] allocation_t {
|
||||
struct [[gnu::packed]] allocation_t
|
||||
{
|
||||
size_t start;
|
||||
size_t nchunk;
|
||||
};
|
||||
|
@ -51,7 +52,7 @@ bool is_kmalloc_address(const void* ptr)
|
|||
void kmalloc_init()
|
||||
{
|
||||
memset(&alloc_map, 0, sizeof(alloc_map));
|
||||
memset((void *)BASE_PHYSICAL, 0, POOL_SIZE);
|
||||
memset((void*)BASE_PHYSICAL, 0, POOL_SIZE);
|
||||
|
||||
kmalloc_sum_eternal = 0;
|
||||
sum_alloc = 0;
|
||||
|
@ -126,7 +127,7 @@ void* kmalloc_impl(size_t size)
|
|||
}
|
||||
// FIXME: This scan can be optimized further with LZCNT.
|
||||
for (size_t j = 0; j < 8; ++j) {
|
||||
if (!(alloc_map[i] & (1<<j))) {
|
||||
if (!(alloc_map[i] & (1 << j))) {
|
||||
if (chunks_here == 0) {
|
||||
// Mark where potential allocation starts.
|
||||
first_chunk = i * 8 + j;
|
||||
|
@ -135,8 +136,8 @@ void* kmalloc_impl(size_t size)
|
|||
++chunks_here;
|
||||
|
||||
if (chunks_here == chunks_needed) {
|
||||
auto* a = (allocation_t *)(BASE_PHYSICAL + (first_chunk * CHUNK_SIZE));
|
||||
byte *ptr = (byte *)a;
|
||||
auto* a = (allocation_t*)(BASE_PHYSICAL + (first_chunk * CHUNK_SIZE));
|
||||
byte* ptr = (byte*)a;
|
||||
ptr += sizeof(allocation_t);
|
||||
a->nchunk = chunks_needed;
|
||||
a->start = first_chunk;
|
||||
|
@ -164,7 +165,7 @@ void* kmalloc_impl(size_t size)
|
|||
hang();
|
||||
}
|
||||
|
||||
void kfree(void *ptr)
|
||||
void kfree(void* ptr)
|
||||
{
|
||||
if (!ptr)
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue