FrostWing
A lightweight raw-control operating system.
Loading...
Searching...
No Matches
paging.h File Reference

Contains code and definitons for Paging. More...

#include <basics.h>
#include <userland.h>
#include <limine.h>
Include dependency graph for paging.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PAGE_SIZE   4096ULL
#define PAGE_PRESENT   0x1
#define PAGE_RW   0x2
#define PAGE_USER   0x4
#define PAGE_NX   (1ULL << 63)
#define USER_CODE_FLAGS   (PAGE_PRESENT | PAGE_USER | PAGE_RW )
#define USER_DATA_FLAGS   (PAGE_PRESENT | PAGE_USER | PAGE_RW | PAGE_NX)

Functions

void map_user_page (uint64_t virt, uint64_t phys, uint64_t flags)
 Function to map userland pages.
void unmap_user_page (uint64_t virt)
void paging_set_hhdm_offset (uint64_t offset)
 Sets the HHDM offset used to access physical memory virtually.
uintptr_t allocate_page (void)
uintptr_t allocate_pages (size_t count)
uint64_t virtual_to_physical (uint64_t virt)
uint64_t fast_virt_to_phys (void *v)
uint64_t virt_to_phys (void *v)

Variables

struct limine_memmap_responsememmap

Detailed Description

Contains code and definitons for Paging.

Author
Pradosh (prado.nosp@m.shga.nosp@m.me@gm.nosp@m.ail..nosp@m.com)
Version
0.1
Date
2023-12-17

Definition in file paging.h.

Macro Definition Documentation

◆ PAGE_NX

#define PAGE_NX   (1ULL << 63)

Definition at line 23 of file paging.h.

◆ PAGE_PRESENT

#define PAGE_PRESENT   0x1

Definition at line 20 of file paging.h.

◆ PAGE_RW

#define PAGE_RW   0x2

Definition at line 21 of file paging.h.

◆ PAGE_SIZE

#define PAGE_SIZE   4096ULL

Definition at line 18 of file paging.h.

◆ PAGE_USER

#define PAGE_USER   0x4

Definition at line 22 of file paging.h.

◆ USER_CODE_FLAGS

#define USER_CODE_FLAGS   (PAGE_PRESENT | PAGE_USER | PAGE_RW )

Definition at line 25 of file paging.h.

◆ USER_DATA_FLAGS

#define USER_DATA_FLAGS   (PAGE_PRESENT | PAGE_USER | PAGE_RW | PAGE_NX)

Definition at line 26 of file paging.h.

Function Documentation

◆ map_user_page()

void map_user_page ( uint64_t virt,
uint64_t phys,
uint64_t flags )

Function to map userland pages.

Parameters
virtVirtual memory address of user
physPhysical memory address of kernel's user code.
flagsPermissions

◆ paging_set_hhdm_offset()

void paging_set_hhdm_offset ( uint64_t offset)

Sets the HHDM offset used to access physical memory virtually.

Parameters
offsetHHDM offset provided by Limine.