Skip to content

Commit d4654b9

Browse files
committed
small changes
1 parent 55b5ddb commit d4654b9

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

docs/os/paging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ A virtual address is comprised of 3 parts, a table index, a entry index, and an
2626

2727
The following diagram shows a decomposition. The construction of a physical address requires having a page directory populated with tables.
2828

29-
[Decomposition](vaddr_decomp.png)
29+
![Decomposition](vaddr_decomp.png)
3030

3131
### Mappings
3232

src/os/paging.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#define IDENTITY_PT_LIMIT 0x95000
88
#define TABLE_COUNT ((IDENTITY_PT_LIMIT - IDENTITY_PT_BASE) / 0x1000)
99

10+
#define MiB4 0x400000
11+
1012
PageDirectory *idendirectory = (PageDirectory *)(ID_PAGE_DIRECTORY_BASE);
1113

1214
bool pageTablePresent(PageDirectoryEntry tableEntry) {
@@ -114,7 +116,7 @@ void identityMapTable(PageDirectory *directory, uint16_t idx, uint32_t flags) {
114116

115117
// 4GiB per directory
116118
// 4MiB per table
117-
uint32_t baseAddr = idx * 0x400000;
119+
uint32_t baseAddr = idx * MiB4;
118120

119121
for (uint32_t page_idx = 0; page_idx < PAGE_ENTRY_COUNT; ++page_idx) {
120122
PageTableEntry entry = flags & ~(ENTRY_ADDR);

0 commit comments

Comments
 (0)