Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
2010 - 2011
1
Contents
INTRODUCTION .......................................................................................................................... 4
DETAILS ..................................................................................................................................... 9
env_create( ) ......................................................................................................................................................... 9
env_free( ) .......................................................................................................................................................... 13
BONUSES .................................................................................................................................. 15
CHALLENGE!! ............................................................................................................................ 15
2
Read an environment page from the page file to the main memory .............................................................................. 19
Update certain environment page in the page file by contents from the main memory ................................................... 20
Read an environment table from the page file to the main memory ............................................................................. 20
Structures ........................................................................................................................................................... 27
Functions ............................................................................................................................................................ 27
inline void bufferList_add_page(struct Linked_List* bufferList,struct Frame_Info *ptr_frame_info) .................................. 27
inline void bufferlist_remove_page(struct Linked_List* bufferList, struct Frame_Info *ptr_frame_info) ............................ 27
3
Group Members: 3-6
Group Registration: you should register your group here due to FRI 20/5/2011
Due to Date: Week #13 starting from SUN 29/5/2011 to THU 2/6/2011. (Subject to change according to lab exam
schedule)
Code: Make sure you are working on the FOS_PROJECT_2011_template.zip provided to you; you will not use PART1 or
PART2 for your project
Introduction
What’s new?!
Previously: all segments of the program binary plus the stack page should be loaded in the main memory. If there’s
no enough memory, the program will not be loaded. See the following figure:
env_create( )
BIN All
This means that you may not be able to run one of your programs if there’s no enough main memory for it!! This is
not the case in real OS!! In windows for example, you can run any program you want regardless the size of main
memory… do you know WHY?!
YES… it uses part of secondary memory as a virtual memory. So, the loading of the program will be distributed
between the main memory and secondary memory.
NOW in the project: when loading a program, only part of it will be loaded in the main memory while the whole
program will be loaded on the secondary memory (H.D.D.). See the following figure:
env_create( )
Set of pages
Required Tables
BIN
All
Pages
This means that a “Page Fault” can occur during the program run. (i.e. an exception thrown by the processor to
indicate that a page is not present in main memory). The kernel should handle it by loading the faulted page back to
the main memory from the secondary memory (H.D.D.).
4
Project Specifications
In the light of the studied memory management system, you are required add new features for your FOS memory
manager, these new features are:
1- Load multiple user programs that are partially loaded in main memory and fully loaded
in secondary memory (H.D.D.)
3- Exit any of the loaded programs: (i.e. remove it from the main and secondary memory)
4- Allow user program to dynamically allocate and free memory space at run-time (i.e.
malloc and freeMem functions)
For loading only part of a program in main memory, we use the working set concept; the working set is the set of all
pages (or tables) loaded in main memory of the program at run time at any instant of time.
Each program environment is modified to hold its working sets information. The working sets are a FIXED size array
of virtual addresses corresponding to pages that are loaded in main memory.
The virtual space of any loaded user application is as described in lab 6, see figure 1.
Virtual
Memory
4 GB
Free Memory
USER_TOP
USTACKTOP
User Stack
…..
USER_HEAP_MAX
User Heap
1.0 GB
Memory
USER_HEAP_START
2 GB
User Code +
Data
0
There are two important concepts you need to understand in order to implement the project; these concepts are the
Working Set and Page File.
5
New Concepts
The Working Sets
We have previously defined the working set as the set of all pages (or tables) loaded in main memory of the program
at run time which is implemented as a FIXED size array of virtual addresses corresponding to pages that are loaded in
main memory.
See Appendix II for description about the working sets data structure and helper functions.
The maximum allowed number of pages (or tables) for any running user program in memory is defined inside FOS1,
let's say N pages (or M tables), when the program needs memory (either when the program is being loaded or by
dynamic allocation during the program run) FOS must allow maximum N pages (or M tables) for the program in main
memory.
So, when page fault occur during the program execution, the page (or table) should be loaded from the secondary
memory (the PAGE FILE as described later) to the WORKING SET of the program. If the working set is complete, then
one of the program environment pages (or tables) from the working set should be replaced with the new page (or
table). This is called LOCAL replacement since each program should replace one of its own loaded pages (or tables).
This means that our working sets are FIXED size with LOCAL replacement facility.
FOS must maintain the working sets during the run time of the program, when new pages (or tables) from PAGE FILE
are loaded to main memory, the working set must be updated.
Therefore the working sets of any loaded program must always contain the correct information about the pages (or
tables) loaded in main memory.
The initialization of the working set by the set of pages during the program loading is already implemented
for you in "env_create()", and you will be responsible for maintaining the working set during the run time of
the program.
You might wonder why we need to keep all pages of the program in secondary memory during run!!
The reason for this is to have a copy of each page in the page file. So, we don’t need to write back each swapped out
page to the page file. Only MODIFIED pages are written back to the page file.
NO…!
Don’t panic, we wrote some helper functions for you that allow us to deal with the page file. These functions provide
the following facilities:
1
defined in “inc/environment_definitions.h” with name "PAGE_WS_MAX_SIZE" and "TABLE_WS_MAX_SIZE"
6
1- Add a new environment empty page to the page file.
2- Read an environment page (or a table) from the page file to the main memory.
3- Update certain environment page (or WRITE a table) in the page file from the main memory.
4- Remove an existing environment page (or a table) from the page file.
The loading of ALL program binary segments plus the stack page to the page file is already implemented for
you in "env_create()", you will need to maintain the page file in the rest of the project.
Page Buffering
An interesting strategy that can improve paging performance is page buffering. A replaced page is not lost but rather
is assigned to one of two lists:
1. the free frame list if the page has not been modified, or
Note that the page is not physically moved about in main memory; instead, the PRESENT bit for this page is set to 0
and its "Frame_Info" is placed in either the free or modified list.
When a page is to be read in, the frame at the head of the free frame list is used, destroying the page that was there.
When an unmodified page is to be replaced, it remains in memory and its "Frame_info" is added to the tail of the
free frame list. Similarly, when a modified page is to be written out and replaced, its "Frame_info" is added to the
tail of the modified page list.
The pages on the modified list can periodically be written out in batches when their count reaches
"MAX_MODIFIED_LIST_COUNT2" and moved to the unmodified list. A page on the unmodified list is either
reclaimed if it is referenced, or lost when its frame is assigned to another page.
1. The page to be replaced remains in memory. Thus if the process references that page, it is returned to the
working set of that process at little cost (by setting its PRESENT bit to 1).
2. Modified pages are written out in clusters rather than one at a time. This significantly reduces the number of
I/O operations and therefore the amount of disk access time.
2
defined in “inc/environment_definitions.h”
7
Overall View
The following figure shows an overall view of all project components together with the interaction between them.
The components marked with (*) should be written by you. The unmarked components are already implemented.
env_create( ) Pages Working Set in Memory
Working Sets Tables Working Set in Memory * Remove Buffered
BIN Frames from both Lists Exiting
All (make them not buffered)
(Unloading)
All pages in Page File
No tables initially on Page File
Program
Loaded env_free()
env_run()
Running
If Modified Buffer reaches Max then write it into page file Buffered Frames
mod.l.
Write Pages f.f.l.
Concatenate lists f.f.l.
mod.l.
NEW Victim
Exist Exist
NEW
8
Details
env_create( )
in “kern/user_environment.c” (no student code needed, just understand)
After env_create() is executed to load a program binary, the binary will partially loaded in main memory (part of
segments + stack page) and FULLY loaded in page file (all segments + stack page)
Segment 1, page 2
202000 *
BIN
Loaded in virtual address 202000
Segment 1, page 3
Loaded in virtual address 203000 203000 *
Segment 2, page 1
Loaded in virtual address 801000 801000 *
Segment 2, page 2
USTAKTOP—PAGESIZE *
NOT Loaded in
main memory
Program Binary Working Set after
Segments and pages loading
First Stack Page (WS_MAX_SIZE = 5)
Figure 3: View of working set after loading a program binary with env_create(). [(1): * this asterisk means that
“Used Bit” is set to 1 in page table for this virtual address, (2) “WS_Last_index”: the WS index to start iterating
from (used in clock algorithm)]
Fault Handler
In function fault_handler() , " kern/trap.c"
o A page can’t be accessed due to either it’s not present in the main memory OR
o A page table is not present in the main memory. (see the following figure)
9
CASE1: Table not exist CASE2: Page not exist
10 bits 10 bits 12 bits 10 bits 10 bits 12 bits
Linear Linear
DIR PAGE OFFSET DIR PAGE OFFSET
Address Address
4 KB
CR3 CR3
32 bits 32 bits
a. Allocate a new page (or a new page table) for this faulted page in the main memory
b. Loading the faulted page (or its page table) back to main memory from page file (secondary
memory) if the page (or the table) exists in page file. Otherwise, add it to the page file.
You can handle the page (or page table) fault in function “fault_handler() ” in “trap.c”, as follows
11
Table fault handler should be written as follows:
Placement:
2. allocate a new frame for the table and link it with the directory entry of the faulted address
(create_page_table() function will do this for you)
4. else
3. Remove it from page file as we will never read it again from page file.
else, do
Replacement:
1. implement clock algorithm to find the virtual address of the victim table from table WS to
replace (refer to APPENDIX II)
1. unlink it from the directory entry by setting PRESENT BIT to 0 (IMPORTANT NOTE:
Don’t set the whole directory entry to 0 (NULL), this means that the victim table
doesn’t exist in both memory and page file, which is not the case here)
11
Page fault handler should work as follows:
Placement:
1. check if required page is buffered (see APPENDIX III), if true, do the following:
o Just reclaim the page by setting present bit to 1, and buffered bit to 0, and set its
frame_info->isBuffered to 0. (see APPENDIX III, and IV)
o remove its Frame_Info from: "modified_frame_list" if the page was modified
(modified bit = 1), or from "free_frame_list" if the page was not modified (modified
bit = 0) (see APPENDIX III and IV)
else
o allocate and map a frame for the faulted page
o read the faulted page from page file to memory
If the page does not exist on page file, then CHECK if it is a stack page. If it is a
new stack page, add a new empty page with this faulted address to page file
(refer to Appendix I and II )
else, do
Replacement:
4. implement clock algorithm to find the victim virtual address from page working set
Prepare its Frame_Info by flagging it as buffered, setting the environment and the
victim virtual address inside this Frame_Info
Set the buffered bit to 1 in the victim page table
Set the present bit to 0 in the victim page table
Add the victim frame to "free_frame_list" at the tail (see APPENDIX IV)
Else
Add the victim frame to "modified_frame_list" at the tail (see APPENDIX IV)
Refer to helper functions to deal with flags of Page Table (or page Directory) entries (Appendix III)
Refer to the linked lists, basic and helper memory manager functions (Appendix V)
12
env_free( )
in “kern/user_environment.c”
o Else
Frees all pages and tables from page file, this code is already written for you
Dynamic allocation/free
Functions malloc() and freeHeap() in "lib/malloc.c"
You will need to implement a dynamic allocation function for your user programs to make runtime
allocations, also a free Heap function to free ALL the heap
Your should implement function “malloc()” (allocates user memory) and “freeHeap()” (frees all user
heap) functions in “lib/malloc.c”
The user should call the kernel to allocate/free memory for it.
But wait a minute…!! remember that the user code is not the kernel (i.e. when a user code is
executing, the processor runs user mode (less privileged mode), and to execute kernel code the
processor need to go from user mode to kernel mode)
The switch from user mode to kernel mode is done by a software interrupt called “System Call”.
All you need to do is to call a function prefixed “sys_” from your user code to call the kernel code
that does the job, (e.g. from user function malloc(), call sys_allocateMem() which then will call
kernel function allocateMem() to allocate memory for the user) as shown in figure:
13
Switch to
Kernel mode
Call *
USER
Malloc()
S/W INT
sys_allocateMem()
Call
KERNEL
allocateMem()*
Switch back to
User mode
In allocateMem(), all pages you allocate will not be added to the working set (not exist in main
memory), but they should added to the page file, so that when this page is accessed, a page fault
will load it to memory.
Else
o Remove ONLY working set pages and working set page tables that are located in the given
user virtual address range. (REMEMBER to update the working sets after removing)
o Remove all pages and all tables in the given range from the page file.
14
BONUSES
1- Free some/all frames from the modified page list and add them to the free frame list
2- If the modified list is empty, then you should free at least 1 frame from the user working set by applying the
clock algorithm
Since the page tables are always modified (due to continuous changes in status bits), any fault on it cause it to be
written back in the page file (H.D.D) which consume a lot of time and cause the CPU to be idle.
In order to solve this problem, we can apply the BUFFERING concept on the page tables just as we apply it for pages.
Your task is to define the required variables in your code and maintain them during the whole code in order to
manage the PAGE TABLE BUFFERING.
CHALLENGE!!
In fault_handler() function you are required to write TABLE replacement algorithm using NORMAL CLOCK, normal
clock works with 1 used bit of the table, however, it does not achieve good level of fairness when choosing a victim!.
and it will generate a lot of table faults due to
1- It doesn’t care about the pages that each page table refer to
2- It deal with all tables as a same regardless how many times each table is used
These two issues may lead to remove table that is either frequently used or contains pages that are currently
used.
Challenge Description
Develop a table replacement algorithm that minimizes the number of table faults occur when testing FOS project.
Every effort is welcomed, search the books, ask faculty staff, search the
internet or even invent your own algorithm.
15
Testing
How to test your project
To test your implementation, you need to run each of the following test programs. Each program should
test certain part from the project. In addition, after completing all parts, you can test the whole project
using quickSort program. User programs found in "user/" folder:
PAGE_WS_MAX_SIZE = 20
TABLE_WS_MAX_SIZE = 20
PAGE_WS_MAX_SIZE = 8
TABLE_WS_MAX_SIZE = 20
test_pf_stack.c: to test your implementation for handling the new stack pages and the modified pages.
You need to initialize the Working set sizes as follows:
PAGE_WS_MAX_SIZE = 8
TABLE_WS_MAX_SIZE = 20
PAGE_WS_MAX_SIZE = 30
TABLE_WS_MAX_SIZE = 3
PAGE_WS_MAX_SIZE = 4
TABLE_WS_MAX_SIZE = 3
16
Testing Dynamic Allocation & Free:
test_malloc.c : to test your implementation for the malloc() and allocateMem() functions. You need to
initialize the Working set sizes as follows:
PAGE_WS_MAX_SIZE = 15
TABLE_WS_MAX_SIZE = 15
test_freeHeap.c : to test your implementation for the freeHeap() and freeMem() functions. You need to
initialize the Working set sizes as follows:
PAGE_WS_MAX_SIZE = 15
TABLE_WS_MAX_SIZE = 5
Scenario 1: Env_Free
1. Make sure that PAGE_WS_MAX_SIZE = 10, and TABLE_WS_MAX_SIZE = 20
2. run command “meminfo”
denote free frames as FF1
3. Run user program “fos_add”
4. kill “fos_add”
5. run command “meminfo”
make sure that free frames = FF1
PAGE_WS_MAX_SIZE = 4
TABLE_WS_MAX_SIZE = 3
17
Scenario 4: QuickSort_freeHeap Program
1. Make sure that PAGE_WS_MAX_SIZE = 500, and TABLE_WS_MAX_SIZE = 20
2. run user program “fos_helloWorld”
3. run user program “fos_add”
4. run user program “quicksort_heap_freeHeap” and test it according to the following steps:
“At each step, the program should sort the array successfully and DON’T panic”
Enjoy your OS
GOOD LUCK
18
APPENDICES
APPENDIX I: Page File Helper Functions
There are some functions that help you work with the page file. They are declared and defined in
“kern/file_manager.h” and “kern/file_manager.c” respectively. Following is brief description about those functions:
Read an environment page from the page file to the main memory
Description:
Read an existing environment page at the given virtual address from the page file.
Function declaration:
int pf_read_env_page(struct Env* ptr_env, void *virtual_address);
Parameters:
ptr_env: pointer to the environment that you want to read its page from the page file.
virtual_address: the virtual address of the page to be read.
Return value:
= 0: the page is read successfully to the given virtual address of the given environment.
= E_PAGE_NOT_EXIST_IN_PF: the page doesn’t exist on the page file (i.e. no one added it before to
the page file).
Example:
In placement steps: let for example there is a page fault occur at certain virtual address, then, we
want to read it from the page file and place it in the main memory at the faulted virtual address as
follows:
19
int ret = pf_read_env_page(ptr_env, fault_va);
if (ret == E_PAGE_NOT_EXIST_IN_PF)
{
...
}
Update certain environment page in the page file by contents from the main memory
Description:
Updates an existing page in the page file by the given frame in memory
Function declaration:
int pf_update_env_page(struct Env* ptr_env, void *virtual_address, struct
Frame_Info* modified_page_frame_info));
Parameters:
ptr_env: pointer to the environment that you want to update its page on the page file.
virtual_address: the virtual address of the page to be updated.
modified_page_frame_info: the Frame_Info* related to this page.
Return value:
= 0: the page is updated successfully on the page file.
= E_PAGE_NOT_EXIST_IN_PF: the page to be updated doesn’t exist on the page file (i.e. no one add
it before to the page file).
Example:
struct Frame_Info *ptr_frame_info = get_frame_info(…);
int ret = pf_update_env_page(environment, virtual_address, ptr_frame_info);
Read an environment table from the page file to the main memory
Description:
Read an existing environment table at the given virtual address from the page file memory.
Function declaration:
int pf_read_env_table(struct Env* ptr_env, uint32 virtual_address, uint32*
tableKVirtualAddress);
Parameters:
ptr_env: pointer to the environment that you want to read its page from the page file.
virtual_address: the first user virtual address of the table (in user space)
tableKVirtualAddress: the kernel virtual address of the table needed to be read from page file
Return value:
= 0: the table is read successfully to the given table virtual address.
= E_TABLE_NOT_EXIST_IN_PF: the table doesn’t exist on the page file
Example:
Assume for example that there is a table fault at certain virtual address, then, we want to read table
from the page file and place it in the working set in main memory:
uint32* ptr_table;
create_page_table(faulted_Env->env_pgdir, fault_va, &ptr_table);
pf_read_env_table(ptr_env, fault_va, ptr_table);
21
Write a certain environment table to the page file
Description:
Write an environment page table to the page file.
Function declaration:
int pf_write_env_table(struct Env* ptr_env, void *virtual_address, uint32*
tableKVirtualAddress);
Parameters:
ptr_env: pointer to the environment that you want to write its page to the page file.
virtual_address: the first user virtual address of the table (in user space)
tableKVirtualAddress: the kernel virtual address of the table needed to be written to page file
Return value:
= 0: the table is written successfully to the page file
= E_NO_PAGE_FILE_SPACE: the page file is full, can’t add any more pages (tables) to it.
Example:
// write a table to page file
uint32* ptr_table;
get_page_table(faulted_env->env_pgdir, (void*) virtual_address,
&ptr_table(;
int success = pf_write_env_table(curenv, virtual_address, ptr_table);
Or that we want to free 1 table at the beginning of the user heap (i.e. at address
USER_HEAP_START), so we need to remove this table from the page file as follows:
pf_remove_env_table(ptr_env, USER_HEAP_START);
21
APPENDIX II: Working Set Structure & Helper Functions
Working Set Structure
As stated before, each environment has two working sets with FIXED size that hold the virtual addresses
corresponding to the pages/tables that are loaded in main memory.
The working set is defined as a fixed size array of virtual addresses inside the environment structure “struct Env”
located in “inc/environment_definitions.h”.
#define PAGE_WS_MAX_SIZE 5
#define TABLE_WS_MAX_SIZE 5
struct WorkingSetElement {
uint32 virtual_address; // the virtual address of the page
uint8 empty; // if empty = 0, the entry is valid, if empty = 1 , entry is
empty or free
};
struct Env {
.
.
.
//page working set management, array of PAGE_WS_MAX_SIZE entries
struct WorkingSetElement pageworkingSet[PAGE_WS_MAX_SIZE];
// used for modified clock algorithm, the next item (page) pointer
uint32 page_WS_last_index;
// used for clock algorithm, the next item (table) pointer
uint32 table_WS_last_index;
};
Figure 6: Definitions of 2 working sets & their indices inside struct Env
Description:
Counts the pages/tables loaded in main memory of a given environment
Parameters:
e: pointer to the environment that you want to count its working set size
Return value:
Number of pages/tables loaded in main memory for environment “e”,(i.e. “e” working set size)
22
inline void env_page_ws_invalidate(struct Env* e, uint32 virtual_address)
inline void env_table_ws_invalidate(struct Env* e, uint32 virtual_address)
Description:
Removes page/table entry at the given virtual address from the working set of “e”
Parameters:
e: pointer to an environment
virtual_address: the virtual address to remove from working set
Description:
Sets the entry number “entry_index” in “e” working set to given virtual address after ROUNDING it
DOWN to the start of page (or page table)
Parameters:
e: pointer to an environment
entry_index: the working set entry index to set the given virtual address
virtual_address: the virtual address to set
Description:
Clears (make empty) the entry at “entry_index” in “e” working set.
Parameters:
e: pointer to an environment
entry_index: working set entry index
Description:
Returns the virtual address of the page at entry “entry_index” in environment “e” working set
Parameters:
e: pointer to an environment
entry_index: working set entry index
Return value:
The virtual address of the page at entry “entry_index” in environment “e” working set
23
inline uint32 env_page_ws_is_entry_empty(struct Env* e, uint32 entry_index)
inline uint32 env_table_ws_is_entry_empty(struct Env* e, uint32 entry_index)
Description:
Returns a value indicating whether the entry at “entry_index” in environment “e” working set is
empty
Parameters:
e: pointer to an environment
entry_index: working set entry index
Return value:
0: if the working set entry at “entry _index” is NOT empty
1: if the working set entry at “entry _index” is empty
Description:
Print the page (or table) working set together with the used and modified bits. It also show where
the last_WS_index of the working set is point to.
Parameters:
e: pointer to an environment
24
APPENDIX III: Functions for manipulating permissions in page tables and
directory
inline void pt_set_page_permissions(struct Env* ptr_env, uint32 virtual_address, uint32
permissions_to_set, uint32 permissions_to_clear)
Description:
Sets the permissions given by “permissions_to_set” to “1” in the page table entry of the given
page (virtual address), and clears the permissions given by “permissions_to_clear”. The
environment used is the one given by “ptr_pgdir”
Parameters:
ptr_env: pointer to environment that you should work on
virtual_address: any virtual address of the page
permissions_to_set: page permissions to be set to 1
permissions_to_clear: page permissions to be set to 0
Return value: none
Example1: to set page PERM_BUFFERED bit to 1 and set PERM_PRESENT to 0
pt_set_page_permissions(environment, virtual_address,
PERM_BUFFERED, PERM_PRESENT);
pt_set_page_permissions(environment, virtual_address, 0,
PERM_MODIFIED);
25
inline uint32 pd_is_table_used(uint32* ptr_pgdir, uint32 virtual_address)
Description:
Returns a value indicating whether the table at “virtual_address” in was used by the processor
Parameters:
ptr_pgdir: pointer to environment page directory
virtual_address: any virtual address inside the table
Return value:
0: if the table at “virtual_address” is not used (accessed) by the processor
1: if the table at “virtual_address” is used (accessed) by the processor
Example:
if(pd_is_table_used(faulted_env->pgdir, virtual_address))
{
…
}
26
APPENDIX IV: Page Buffering
Structures
In order to keep track of the buffered frames, the following changes were added to FOS:
1- We use one of the available bits in the page table as a BUFFERED bit (Bit number 9) to indicate whether
the frame of this page is buffered or not.
31 12 11 9 8 7 6 5 4 3 2 1 0
U R
PAGE FRAME ADDRESS 12...31 AVAIL B 0 0 D A 0 0 / / P
S W
P: Present bit (PERM_PRESENT)
R/W: Read/Write bit (PERM_WRITABLE)
U/S: User/Supervisor bit (PERM_USER)
A: Accessed bit (PERM_USED)
D: Dirty bit (PERM_MODIFIED)
B: Buffered bit (PERM_BUFFERED)
AVAIL: Available for system programmers use
NOTE: 0 indicates Intel reserved. Don’t define.
b- va: virtual address of the page that was mapped to this buffered frame
A new Frame_Info* linked list is added to FOS to keep track of buffered modified page frames,(see
memory_manager.c):
Functions
Basic Functions
The basic memory manager functions that you may need to use are defined in “kern/memory_manager.c” file:
Used by “unmap_frame” to get both the page table and the frame of the given
get_frame_info
virtual address
Helpers Functions
There are some helper functions that we may need to use them in the rest of the course:
28
Function Description Defined in…
PDX (uint32 virtual Gets the page directory index in the given virtual
Inc/mmu.h
address) address (10 bits from 22 – 31).
PTX (uint32 virtual Gets the page table index in the given virtual address
Inc/mmu.h
address) (10 bits from 12 – 21).
ROUNDUP Rounds a given “value” to the nearest upper value that
(uint32 value, uint32 is divisible by “align”. Inc/types.h
align)
ROUNDDOWN Rounds a given “value” to the nearest lower value that
(uint32 value, uint32 is divisible by “align”. Inc/types.h
align)
tlb_invalidate Refresh the cache memory (TLB) to remove the given
(uint32* virtual address from it.
page_directory, Kern/helpers.c
uint32 virtual
address)
lcr3(uint32 physical Load the given physical address of the page directory
Inc/x86.h
address of directory) into CR3
GOOD LUCK
29