StupidOS/docs/img/pmap_bootstrap.mmd

90 lines
2.2 KiB
Plaintext

---
title: pmap_bootstrap
---
flowchart TD
R_BEGIN("Begin")
R_GETMMAP["Get Memory Map entry"]
R_MMAP_LAST{"Last Item ?"}
R_END("End")
subgraph "entry to pmap_block"
C_BEGIN("Begin Proc")
C_IS_FREE{"Is
entry free?"}
C_END("End Proc")
C_OVERLAP_KERNEL{"entry
overlap
kernel?"}
C_REMOVE_KRESERVED["Remove Kernel
Memory from entry"]
C_MEMORY_SIZE_EXCEED{"Is entry size
larger than
0x0x7f80000 ?"}
C_MEMORY_SPLIT["Split entry"]
C_MEMORY_LAST["Is last ?"]
C_BEGIN-->C_IS_FREE
C_IS_FREE--No-->C_END
C_IS_FREE--Yes-->C_OVERLAP_KERNEL
C_OVERLAP_KERNEL--Yes-->C_REMOVE_KRESERVED
C_REMOVE_KRESERVED-->C_MEMORY_SIZE_EXCEED
C_OVERLAP_KERNEL--No-->C_MEMORY_SIZE_EXCEED
C_MEMORY_SIZE_EXCEED--Yes-->C_MEMORY_SPLIT
C_MEMORY_SPLIT-->C_MEMORY_LAST
C_MEMORY_LAST--Yes-->C_END
end
subgraph "create & store pmap_block"
D_BEGIN("Begin Proc")
D_BOOSTRAP_EXIST{"Bootstrap
pmap_block
exist?"}
D_SETUP_BOOTSTRAP["Setup bootstrap pmap"]
D_END("End Proc")
D_SET_HEAD_BOOTSTRAP["Set bootstrap as Head"]
D_SEARCH_FREE_PAGE["Search free page in Head->bitmap"]
D_FREE_PAGE_FOUND{"Free Page found ?"}
D_HEAD_NEXT_NULL{"Head->next == NULL?"}
D_HEAD_NEXT["Set Head to Head->next"]
D_CREATE_PMAP["Create new pmap_block
in free page"]
D_APPEND_PMAP["Append pmap_block
at end of
linked list"]
D_BEGIN-->D_BOOSTRAP_EXIST
D_BOOSTRAP_EXIST--No-->D_SETUP_BOOTSTRAP
D_SETUP_BOOTSTRAP-->D_END
D_BOOSTRAP_EXIST--Yes-->D_SET_HEAD_BOOTSTRAP
D_SET_HEAD_BOOTSTRAP-->D_SEARCH_FREE_PAGE
D_SEARCH_FREE_PAGE-->D_FREE_PAGE_FOUND
D_FREE_PAGE_FOUND--No-->D_HEAD_NEXT_NULL
D_HEAD_NEXT_NULL--No-->D_HEAD_NEXT
D_HEAD_NEXT-->D_SEARCH_FREE_PAGE
D_FREE_PAGE_FOUND--Yes-->D_CREATE_PMAP
D_CREATE_PMAP-->D_APPEND_PMAP
D_APPEND_PMAP-->D_END
end
R_BEGIN-->R_GETMMAP
R_GETMMAP-->R_MMAP_LAST
R_MMAP_LAST--Yes-->R_END
R_MMAP_LAST--No-->C_BEGIN
C_MEMORY_SIZE_EXCEED--No-->D_BEGIN
D_END--Try get next-->C_MEMORY_LAST
C_MEMORY_LAST--No-->D_BEGIN
C_END--Try get next entry-->R_MMAP_LAST
style R_BEGIN fill:#6CA300
style R_END fill:#A30000
style C_BEGIN fill:#6CA300
style C_END fill:#A30000
style D_BEGIN fill:#6CA300
style D_END fill:#A30000