<commit_before>#ifndef MEMLAYOUT_H
#define MEMLAYOUT_H

#include <stdint.h>

// These two variables are defined by the linker. They are located where you
// would expect based on the names.
extern uint32_t kernel_start;
extern uint32_t kernel_end;

#define KERNEL_END ((uint32_t)&kernel_end)
#define KERNEL_START ((uint32_t)&kernel_start)
#define KERNEL_END ((uint32_t)&kernel_end)
#define KERNEL_SIZE (KERNEL_START - KERNEL_END)

// Paging related
#define PAGE_ALIGN(x) (((uintptr_t)(x)) & ~0xfff)
#define NEXT_PAGE(x) (((uintptr_t)(x)+PAGE_SIZE) & ~0xfff)
#define PAGE_DIRECTORY NEXT_PAGE(KERNEL_END)

// Heap related
#define KHEAP_PHYS_ROOT ((void*)0x100000)
#define KHEAP_PHYS_END ((void*)NEXT_PAGE(KHEAP_PHYS_ROOT))

// Video memory related
#define VIDEO_MEMORY_BEGIN 0xB8000
#define VIDEO_MEMORY_SIZE (80 * 24)

#endif
<commit_msg>Reorganize macros<commit_after>#ifndef MEMLAYOUT_H
#define MEMLAYOUT_H

#include <stdint.h>

#define KB 1024
#define MB 1024*1024
#define GB 1024*1024*1024

#define PHYS_MEMORY_SIZE 1*GB
#define PAGE_SIZE 4096

// These two variables are defined by the linker. They are located where you
// would expect based on the names.
extern uint32_t kernel_start;
extern uint32_t kernel_end;

#define KERNEL_END ((uint32_t)&kernel_end)
#define KERNEL_START ((uint32_t)&kernel_start)
#define KERNEL_END ((uint32_t)&kernel_end)
#define KERNEL_SIZE (KERNEL_START - KERNEL_END)

// Paging related
#define PAGE_ALIGN(x) (((uintptr_t)(x)) & ~0xfff)
#define NEXT_PAGE(x) (((uintptr_t)(x)+PAGE_SIZE) & ~0xfff)

// Heap related
#define KHEAP_PHYS_ROOT NEXT_PAGE(KERNEL_END)
#define KHEAP_PHYS_END ((void*)NEXT_PAGE(KHEAP_PHYS_ROOT))

// Also paging related
#define PAGE_DIRECTORY NEXT_PAGE(KERNEL_END)

// Video memory related
#define VIDEO_MEMORY_BEGIN 0xB8000
#define VIDEO_MEMORY_SIZE (80 * 24)

#endif

{'fraction_non_alphanumeric': 0.10855263157894737, 'fraction_numerical': 0.04276315789473684, 'mean_word_length': 6.668067226890757, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '491225', 'n_tokens_mistral': 762, 'n_tokens_neox': 690, 'n_words': 171}