OurOS 0.1
Operating System built by McGill Students
 
Loading...
Searching...
No Matches
frame.h File Reference
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Functions

struct frame * alloc_frame (const char *identifier)
 Allocates a frame and returns a pointer to it. The allocated frame will be zeroed out.
 
void free_frame (struct frame *frame)
 Frees a frame.
 
size_t frame_to_pfn (struct frame *frame)
 Returns the PFN of a frame.
 
size_t pfn_to_phys (size_t pfn)
 Converts a PFN to a physical address.
 
void frame_init ()
 Initializes the frame allocator and memory map.
 

Function Documentation

◆ alloc_frame()

struct frame * alloc_frame ( const char *  identifier)

Allocates a frame and returns a pointer to it. The allocated frame will be zeroed out.

Parameters
identifierA string identifier for the frame (for debugging purposes).
Returns
A pointer to the allocated frame.

◆ frame_init()

void frame_init ( )

Initializes the frame allocator and memory map.

◆ frame_to_pfn()

size_t frame_to_pfn ( struct frame *  frame)

Returns the PFN of a frame.

Parameters
frameA pointer to the frame.
Returns
The PFN of the frame.

◆ free_frame()

void free_frame ( struct frame *  frame)

Frees a frame.

Parameters
frameA pointer to the frame to free.
Note
The frame will only be truly freed if its reference count drops to 0.

◆ pfn_to_phys()

size_t pfn_to_phys ( size_t  pfn)

Converts a PFN to a physical address.

Parameters
pfnThe PFN to convert.
Returns
The physical address.