/DragonOS-0.1.2/kernel/src/mm/ |
D | Makefile | 5 all:mm.o slab.o mm-stat.o vma.o mmap.o utils.o mmio.o mmio-buddy.o 7 mm.o: mm.c 8 $(CC) $(CFLAGS) -c mm.c -o mm.o 13 mm-stat.o: mm-stat.c 14 $(CC) $(CFLAGS) -c mm-stat.c -o mm-stat.o
|
D | vma.c | 11 struct vm_area_struct *vm_area_alloc(struct mm_struct *mm) in vm_area_alloc() argument 15 vma_init(vma, mm); in vm_area_alloc() 50 void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma, struct vm_area_struct *prev) in __vma_link_list() argument 61 next = mm->vmas; in __vma_link_list() 62 mm->vmas = vma; in __vma_link_list() 77 void __vma_unlink_list(struct mm_struct *mm, struct vm_area_struct *vma) in __vma_unlink_list() argument 85 mm->vmas = next; in __vma_unlink_list() 98 struct vm_area_struct *vma_find(struct mm_struct *mm, uint64_t addr) in vma_find() argument 100 struct vm_area_struct *vma = mm->vmas; in vma_find() 121 int vma_insert(struct mm_struct *mm, struct vm_area_struct *vma) in vma_insert() argument [all …]
|
D | internal.h | 16 void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma, struct vm_area_struct *prev); 24 void __vma_unlink_list(struct mm_struct *mm, struct vm_area_struct *vma); 33 uint64_t __mm_get_paddr(struct mm_struct *mm, uint64_t vaddr);
|
D | mm.h | 322 static inline void vma_init(struct vm_area_struct *vma, struct mm_struct *mm) in vma_init() argument 325 vma->vm_mm = mm; in vma_init() 340 if (current_pcb->mm == NULL) in vma_is_foreign() 342 if (current_pcb->mm != vma->vm_mm) in vma_is_foreign() 358 struct vm_area_struct *vm_area_alloc(struct mm_struct *mm); 381 struct vm_area_struct *vma_find(struct mm_struct *mm, uint64_t addr); 390 int vma_insert(struct mm_struct *mm, struct vm_area_struct *vma); 455 int mm_create_vma(struct mm_struct *mm, uint64_t vaddr, uint64_t length, vm_flags_t vm_flags, 478 int mm_map(struct mm_struct *mm, uint64_t vaddr, uint64_t length, uint64_t paddr); 488 int mm_unmap_vma(struct mm_struct *mm, struct vm_area_struct *vma, uint64_t *paddr); [all …]
|
D | mmap.c | 320 int mm_create_vma(struct mm_struct *mm, uint64_t vaddr, uint64_t length, vm_flags_t vm_flags, struc… in mm_create_vma() argument 327 struct vm_area_struct *vma = vm_area_alloc(mm); in mm_create_vma() 335 retval = vma_insert(mm, vma); in mm_create_vma() 338 *res_vma = vma_find(mm, vma->vm_start); in mm_create_vma() 473 int mm_map(struct mm_struct *mm, uint64_t vaddr, uint64_t length, uint64_t paddr) in mm_map() argument 480 struct vm_area_struct *vma = vma_find(mm, vaddr + mapped); in mm_map() 516 int mm_unmap_vma(struct mm_struct *mm, struct vm_area_struct *vma, uint64_t *paddr) in mm_unmap_vma() argument 519 if (unlikely(vma->vm_mm != mm)) in mm_unmap_vma() 523 *paddr = __mm_get_paddr(mm, vma->vm_start); in mm_unmap_vma() 528 mm_unmap_proc_table((uint64_t)mm->pgd, true, vma->vm_start, vma->vm_end - vma->vm_start); in mm_unmap_vma() [all …]
|
D | utils.c | 12 uint64_t __mm_get_paddr(struct mm_struct *mm, uint64_t vaddr) in __mm_get_paddr() argument 16 tmp = phys_2_virt((ul *)(((ul)mm->pgd) & (~0xfffUL)) + ((vaddr >> PAGE_GDT_SHIFT) & 0x1ff)); in __mm_get_paddr()
|
D | mm.c | 641 mm_create_vma(current_pcb->mm, i, PAGE_2M_SIZE, VM_USER | VM_ACCESS_FLAGS, NULL, &vma); in mm_do_brk() 642 … mm_map(current_pcb->mm, i, PAGE_2M_SIZE, alloc_pages(ZONE_NORMAL, 1, PAGE_PGT_MAPPED)->addr_phys); in mm_do_brk() 645 current_pcb->mm->brk_end = end_addr; in mm_do_brk() 653 … uint64_t phys = mm_get_PDE((uint64_t)phys_2_virt((uint64_t)current_pcb->mm->pgd), false, i, true); in mm_do_brk() 666 …mm_unmap_proc_table((uint64_t)phys_2_virt((uint64_t)current_pcb->mm->pgd), false, end_addr, PAGE_2… in mm_do_brk()
|
/DragonOS-0.1.2/kernel/src/process/ |
D | process.c | 58 ….mm = &initial_mm, .thread = &initial_thread, .addr_limit = 0xffffffffffffffff, .pid = 0, .priorit… 216 current_pcb->mm->code_addr_start = ehdr.e_entry; in process_load_elf_file() 266 … mm_create_vma(current_pcb->mm, virt_base, PAGE_2M_SIZE, VM_USER | VM_ACCESS_FLAGS, NULL, &vma); in process_load_elf_file() 272 mm_map(current_pcb->mm, virt_base, PAGE_2M_SIZE, pa); in process_load_elf_file() 288 … int val = mm_create_vma(current_pcb->mm, virt_base + off, PAGE_4K_SIZE, VM_USER | VM_ACCESS_FLAGS, in process_load_elf_file() 294 mm_map(current_pcb->mm, virt_base + off, PAGE_4K_SIZE, paddr); in process_load_elf_file() 319 regs->rsp = current_pcb->mm->stack_start; in process_load_elf_file() 320 regs->rbp = current_pcb->mm->stack_start; in process_load_elf_file() 325 …int val = mm_create_vma(current_pcb->mm, current_pcb->mm->stack_start - PAGE_2M_SIZE, PAGE_2M_SIZE, in process_load_elf_file() 334 memset((void *)(current_pcb->mm->stack_start - PAGE_2M_SIZE), 0, PAGE_2M_SIZE); in process_load_elf_file() [all …]
|
D | fork.c | 217 pcb->mm = current_pcb->mm; in process_copy_mm() 226 memcpy(new_mms, current_pcb->mm, sizeof(struct mm_struct)); in process_copy_mm() 228 pcb->mm = new_mms; in process_copy_mm() 236 …memcpy(phys_2_virt(new_mms->pgd) + 256, phys_2_virt(initial_proc[proc_current_cpu_id]->mm->pgd) + … in process_copy_mm() 239 uint64_t *current_pgd = (uint64_t *)phys_2_virt(current_pcb->mm->pgd); in process_copy_mm() 244 struct vm_area_struct *vma = current_pcb->mm->vmas; in process_copy_mm()
|
D | proc-types.h | 87 struct mm_struct *mm; member
|
D | process.h | 172 …asm volatile("movq %0, %%cr3 \n\t" ::"r"(next_pcb->mm->pgd) : "memory"); …
|
/DragonOS-0.1.2/kernel/src/syscall/ |
D | syscall.c | 282 return current_pcb->mm->brk_start; in sys_brk() 287 return current_pcb->mm->brk_end; in sys_brk() 293 if (new_brk >= current_pcb->mm->brk_end) in sys_brk() 294 offset = (int64_t)(new_brk - current_pcb->mm->brk_end); in sys_brk() 296 offset = -(int64_t)(current_pcb->mm->brk_end - new_brk); in sys_brk() 298 new_brk = mm_do_brk(current_pcb->mm->brk_end, offset); // 扩展堆内存空间 in sys_brk() 300 current_pcb->mm->brk_end = new_brk; in sys_brk() 312 uint64_t retval = current_pcb->mm->brk_end; in sys_sbrk() 325 … if ((__int128_t)current_pcb->mm->brk_end + (__int128_t)regs->r8 < current_pcb->mm->brk_start) in sys_sbrk() 329 uint64_t new_brk = mm_do_brk(current_pcb->mm->brk_end, (int64_t)regs->r8); // 调整堆内存空间 in sys_sbrk() [all …]
|
/DragonOS-0.1.2/docs/kernel/memory_management/ |
D | mmio.md | 21   这套机制本质上是使用了伙伴系统来对MMIO虚拟地址空间进行维护。在`mm/mm.h`中指定了MMIO的虚拟地址空间范围,这个范围是`0xffffa10000000000`开始…
|
/DragonOS-0.1.2/kernel/src/ |
D | lib.rs | 22 mod mm; module 30 use mm::allocator::KernelAllocator;
|
D | Makefile | 20 kernel_subdirs := common driver process debug filesystem time arch exception mm smp sched syscall k…
|
/DragonOS-0.1.2/docs/kernel/core_api/ |
D | index.rst | 26 mm-api
|
D | mm-api.md | 257   返回值是一个`mm_mstat_t`结构体,该结构体定义于`mm/mm.h`中。其中包含了以下信息(单位均为字节):
|
/DragonOS-0.1.2/kernel/src/filesystem/procfs/ |
D | procfs.c | 147 hiwater_vm = pcb_t->mm->vmas->vm_end - pcb_t->mm->vmas->vm_start; in procfs_open() 148 text = pcb_t->mm->code_addr_end - pcb_t->mm->code_addr_start; in procfs_open() 149 data = pcb_t->mm->data_addr_end - pcb_t->mm->data_addr_start; in procfs_open()
|
/DragonOS-0.1.2/kernel/src/smp/ |
D | smp.c | 161 current_pcb->mm = &initial_mm; in smp_ap_start()
|