2024-07-07 09:44:51 +00:00
|
|
|
;; File: mm.inc
|
2024-07-07 13:29:41 +00:00
|
|
|
;; StupidOS Memory Manager
|
|
|
|
|
2024-07-06 13:19:35 +00:00
|
|
|
include "pmm.inc"
|
2024-02-04 19:18:52 +00:00
|
|
|
|
|
|
|
mm_init:
|
2024-07-07 09:24:51 +00:00
|
|
|
mov esi, szMsgMmInit
|
|
|
|
call klog
|
|
|
|
|
|
|
|
call pmm_alloc_page
|
|
|
|
mov [pKernelPgDir], eax
|
|
|
|
|
|
|
|
push eax
|
|
|
|
mov esi, szMsgMmKernelPgDir
|
|
|
|
call klog
|
|
|
|
|
2024-07-07 13:29:41 +00:00
|
|
|
; clear page dir
|
|
|
|
mov ecx, 4096
|
|
|
|
xor al, al
|
|
|
|
mov edi, [pKernelPgDir]
|
|
|
|
rep stosb
|
|
|
|
|
|
|
|
;; Map kernel and kmemory
|
|
|
|
call pmm_alloc_page
|
|
|
|
push eax
|
|
|
|
mov ecx, 4096
|
|
|
|
mov edi, eax
|
|
|
|
xor al, al
|
|
|
|
rep stosb
|
|
|
|
pop eax
|
|
|
|
|
2024-07-07 09:44:51 +00:00
|
|
|
;; Map video
|
|
|
|
|
|
|
|
|
|
|
|
;; Map free memory
|
|
|
|
|
|
|
|
; mov eax, [pKernelPgDir]
|
|
|
|
; mov cr3, eax
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
mm_wallk_pagedir:
|
2024-04-28 06:41:36 +00:00
|
|
|
ret
|
2024-07-07 09:24:51 +00:00
|
|
|
|
|
|
|
szMsgMmInit db "MM: initialize", 0
|
|
|
|
szMsgMmKernelPgDir db "MM: Kernel page dir at %x", 0
|
|
|
|
pKernelPgDir dd ?
|