Skip to content

Commit 1dc2911

Browse files
committed
Write back cache and add mfence before enabling paging
1 parent e223470 commit 1dc2911

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/stage_3.s

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ set_up_page_tables:
9090
mov [_p1 + ecx * 8], eax
9191

9292
enable_paging:
93+
# Write back cache and add a memory fence. I'm not sure if this is
94+
# necessary, but better be on the safe side.
95+
wbinvd
96+
mfence
97+
9398
# load P4 to cr3 register (cpu uses this to access the P4 table)
9499
lea eax, [_p4]
95100
mov cr3, eax

0 commit comments

Comments
 (0)