git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix: incorrect settings of msi registers.
[lunaix-os.git]
/
lunaix-os
/
kernel
/
mm
/
kalloc.c
diff --git
a/lunaix-os/kernel/mm/kalloc.c
b/lunaix-os/kernel/mm/kalloc.c
index 3aba61ec62d5f33a0df6ae1f2cfb1de3a704d325..6b5b878d12a5b188270af05f0fa096de78a3a79e 100644
(file)
--- a/
lunaix-os/kernel/mm/kalloc.c
+++ b/
lunaix-os/kernel/mm/kalloc.c
@@
-13,6
+13,7
@@
*/
#include <lunaix/mm/dmm.h>
#include <lunaix/mm/kalloc.h>
*/
#include <lunaix/mm/dmm.h>
#include <lunaix/mm/kalloc.h>
+#include <lunaix/mm/vmm.h>
#include <lunaix/common.h>
#include <lunaix/spike.h>
#include <lunaix/common.h>
#include <lunaix/spike.h>
@@
-58,15
+59,23
@@
lx_grow_heap(heap_context_t* heap, size_t sz);
Note: the brk always point to the beginning of epilogue.
*/
Note: the brk always point to the beginning of epilogue.
*/
-// FIXME: This should be per-process but not global!
static heap_context_t kheap;
int
kalloc_init()
{
static heap_context_t kheap;
int
kalloc_init()
{
- kheap.start =
&__kernel_heap_start
;
+ kheap.start =
KHEAP_START
;
kheap.brk = NULL;
kheap.brk = NULL;
- kheap.max_addr = (void*)KSTACK_START;
+ kheap.max_addr =
+ (void*)PROC_START; // 在新的布局中,堆结束的地方即为进程表开始的地方
+
+ for (size_t i = 0; i < KHEAP_SIZE_MB >> 2; i++) {
+ vmm_set_mapping(PD_REFERENCED,
+ (uintptr_t)kheap.start + (i << 22),
+ 0,
+ PG_PREM_RW,
+ VMAP_NOMAP);
+ }
if (!dmm_init(&kheap)) {
return 0;
if (!dmm_init(&kheap)) {
return 0;