From a72c3ca1951fb537be948c34a3b0db98577766e8 Mon Sep 17 00:00:00 2001 From: Starnakin Date: Wed, 30 Oct 2024 21:39:51 +0100 Subject: [PATCH] doc: explain the default_page_table --- documentation/assets/memory/heap_map.webp | Bin 0 -> 9128 bytes documentation/memory.md | 7 ++++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 documentation/assets/memory/heap_map.webp diff --git a/documentation/assets/memory/heap_map.webp b/documentation/assets/memory/heap_map.webp new file mode 100644 index 0000000000000000000000000000000000000000..c1a4bb0c65063b963ed1f6fbd6fd208a7dafc30f GIT binary patch literal 9128 zcmZviWmFtZ*RC5FEO>Ay1a}SY9tiFboFPbXm%u;-clQK$4-jMq*8vg;gu&e{5L^y< zp7%Z9`PMrBdR0|ldv{l@?z-G7Hy+?xn2F)_U|M7{Aj ze;tvM{;==b51Dw8NH?^C*A@UiJfxMDR}0Z^FqzStrdhj@ z%~f_?{9b3^=r;eVKjpr~NW@HQCzav`(thp}^nLB&p&|L~!6%QuhbJUt1ZfHhl(bwF zj~UL*(Ua^d_sSHRRG{zeFseBVn-y!S)l>^K#Z`v$_|@lUE%_{=d}y)t*up(mE}P8R{q9;OXV@a7anK^Wn+;(4Dkh^H9!Hj>t9>z~h6Q8Fo5%*!l3IMD4#D74Us zP(*%f0k|TePqFTz&KuSt%bVQoS>a1u zoGH=|2&l-ARm#WJkNr@6`Q@f&$z5F10h%R&dvEL66r65^|6tkw>1eN0o+vC#p?HEI zoG{t?Gka&@{hmsZJy`FrjFP{Zdd%sNLcs>M>o#%&hv&>+|BDi zKU}tk*uP&Wo?RRr++m#F4&BW`o1+d0Q9JZa=ClOqNThxBg&|v2LeQ1L)+wz56HR~-Q&d9bSA(>E6jW4o+&TO_EyJ}_9Wah{>AThc%K2LKe=dBEcy)IG>_U)EIVtE23CJnc6hfH!JD zZG)r{seR=i*&z~XlS|MZWd|fu;@GoCqxJHH3l4i-#?+{69yJCnqt_dl*fCQ4LKGQ1am_pA=UWaPUeqTc*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U^qnDINNHl$v$lA#w?<`e z)d87IV66N`Gvu^PHoYp0#`utP7j)6v@e-?xA*J_~`evd&p9K{+@p8CRVkV$EhLk zTr`U*=|yV%zhx`6W|%nnt*PrSNN2lSPuNfkr2bew1*Ctpbsh`X?T)%kA0sT@Oge z7E);@!4^Z3aXCRr*Ob?m)GZwTyZR%7`A`V$G=$afc%q7=0}EwH`3@#z`To;!0KV0m zOf|mkyf~g&G5f3NaoejSmWrWSVe$UxEHWDFf!d4@E4;{e9|zLCsC%q1UNotO&LCRu zd?s{d*HkgQU)_rho0}HT%NI6~Q7;AGZ8{C4!7*N7$7v;O=eq6s|12jh5(KnIESnGv z6-~KPeZH#1ZkCM?JB7q752C99cpu2EJ_Jgh&D=a zVl&W^MLONo+(X^_SZ9cMMBFpDAh`;0SF*?X5zLFiYYzUF7gjWQbA^XYLfZT+U;By7 zy4sqmV}Z^vFQF2VKRs0i{1Tf-;aFm1cvzlU1D}%JHV@?a{UT33J{^11(qWh?h$8)? z#6nXSzmC@q{t`!~^dFZy6;k#V9<<6X@K*9>enL+9LSk|vxvCi4{)UDEu$;+x>$)^l z?9YndA?B>NaIC#+kE|HU`|aWd0O0=sY&n|a literal 0 HcmV?d00001 diff --git a/documentation/memory.md b/documentation/memory.md index 51cf8c9..0741290 100644 --- a/documentation/memory.md +++ b/documentation/memory.md @@ -2,4 +2,9 @@ ## Pagination -To activate pagination you must put the physic [pd](./memory/page_directory.md) address in the cr3 register and 0x80000000 in the cr0 register. Now the [MMU](./memory/mmu.md) will translate your address \ No newline at end of file +To activate pagination you must put the physic [pd](./memory/page_directory.md) address in the cr3 register and 0x80000000 in the cr0 register. Now the [MMU](./memory/mmu.md) will translate your address + +### Our setup + +Cause create all [pt](./memory/page_table.md) will cost 3MB (768 * 1024 * 4, 768: cause is our heap limite, 1024: cause each pt contains 1024 entry and 4: cause size of pte is 4byte) we decided to create it on the heap and dynamically. So the first pt of the pd (pd[0]) will contain a default_page_table (or heap_pt). Each page create by each the heap_pt will be a pt added to the pd. +![](./assets/memory/heap_map.webp)