summaryrefslogtreecommitdiff
path: root/doc/internals/mmap.md
diff options
context:
space:
mode:
authorBenji Dial <benji3.141@gmail.com>2020-05-16 09:53:58 -0400
committerBenji Dial <benji3.141@gmail.com>2020-05-16 09:53:58 -0400
commitc0daede46df4f546639bd2d3e11dcf064d554966 (patch)
tree2042d915325dc66baf063238b8a3c685bb91d17b /doc/internals/mmap.md
parentf7820301d583ae190b683bdd1371ee6f7a35ac16 (diff)
downloadportland-os-c0daede46df4f546639bd2d3e11dcf064d554966.tar.gz
starting over
Diffstat (limited to 'doc/internals/mmap.md')
-rw-r--r--doc/internals/mmap.md17
1 files changed, 0 insertions, 17 deletions
diff --git a/doc/internals/mmap.md b/doc/internals/mmap.md
deleted file mode 100644
index 0ac1aba..0000000
--- a/doc/internals/mmap.md
+++ /dev/null
@@ -1,17 +0,0 @@
-# Internals - Memory Map
-## `mmap_entry` fields
-* 32-bit base address
-* 32-bit length
-* 16-bit value with 0 representing a free region, 1 representing a hardware-reserved or damaged region, 2 representing kernel memory and high numbers representing memory belonging to the process with that id
-* pointer to `mmap_entry` with base equal to this one's base plus this one's length, or a null pointer if that is the end of memory
-* pointer to `mmap_entry` with base plus length equal to this one's base, or a null pointer if that is the start of memory
-
-## Symbols
-* `mmap_bss` - array of `mmap_entry` structures statically allocated in bss section
-* `MMAP_SIZE` - compile-time constant integer (65536 in the current source) for number of slots in `mmap_bss`
-* `mmap_start` - pointer to slot in `mmap_bss` containing entry with base 0x0
-* `mmap_bitmap` - bitmap statically allocated in bss section with byte `x / 8`, bit `x % 8` representing whether or not the `x`th slot in `mmap_bss` has an entry in it
-
-## Functions
-* `allocate_block` - takes a 32-bit length and a process number, and returns a pointer to a region with that length now owned by that process, or a null pointer if a region of that size cannot be allocated. specifically, goes through each memory region in order, and if it finds one of the same length, changes the owner and returns that. if it finds one of the longer length while going through, splits that one in two. the original has its owner changed and its length changed to the length requested. the new one made is marked free, and starts where the region requested ends, ending where the region originally ended. if there is not space in `mmap_bss` to split this entry, it looks through the rest of the memory map, now ignoring those with a longer length. if this function is unable to find a region with the exact size, and unable to split a region of larger size, a null pointer is returned.
-* `deallocate_block` - takes a pointer to a region of memory, and deallocates it, unless that region is not allocated, in which case nothing is done. specifically, looks through the memory map in order for an entry with the base address matching the region passed. if this entry is not found, nothing is done. if this entry is found, it is marked free. if the region immediately preceding is also free, they are combined. this step is repeated until the region preceding either is not free or does not exist, and then the process is done again with the region following instead of the one preceding. \ No newline at end of file