/DragonOS-0.1.2/kernel/src/mm/ |
D | vma.c | 13 struct vm_area_struct *vma = (struct vm_area_struct *)kmalloc(sizeof(struct vm_area_struct), 0); in vm_area_alloc() local 14 if (vma) in vm_area_alloc() 15 vma_init(vma, mm); in vm_area_alloc() 16 return vma; in vm_area_alloc() 24 void vm_area_del(struct vm_area_struct *vma) in vm_area_del() argument 26 if (vma->vm_mm == NULL) in vm_area_del() 28 __vma_unlink_list(vma->vm_mm, vma); in vm_area_del() 36 void vm_area_free(struct vm_area_struct *vma) in vm_area_free() argument 38 if (vma->vm_prev == NULL && vma->vm_next == NULL) // 如果当前是剩余的最后一个vma in vm_area_free() 39 vma->vm_mm->vmas = NULL; in vm_area_free() [all …]
|
D | mmap.c | 327 struct vm_area_struct *vma = vm_area_alloc(mm); in mm_create_vma() local 328 if (unlikely(vma == NULL)) in mm_create_vma() 330 vma->vm_ops = vm_ops; in mm_create_vma() 331 vma->vm_flags = vm_flags; in mm_create_vma() 332 vma->vm_start = vaddr; in mm_create_vma() 333 vma->vm_end = vaddr + length; 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() 339 kfree(vma); in mm_create_vma() 347 *res_vma = vma; in mm_create_vma() [all …]
|
D | mmio.c | 91 struct vm_area_struct *vma = vma_find(&initial_mm, vaddr + i); in mmio_release() local 92 if (unlikely(vma == NULL)) in mmio_release() 98 if (unlikely(vma->vm_start != (vaddr + i))) in mmio_release() 104 retval = __mmio_buddy_give_back(vma->vm_start, 31 - __clz(vma->vm_end - vma->vm_start)); in mmio_release() 105 i += vma->vm_end - vma->vm_start; in mmio_release() 108 vm_area_del(vma); in mmio_release() 109 vm_area_free(vma); in mmio_release()
|
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); 60 int __anon_vma_add(struct anon_vma_t *anon_vma, struct vm_area_struct *vma); 68 int __anon_vma_del(struct vm_area_struct *vma);
|
D | mm.h | 322 static inline void vma_init(struct vm_area_struct *vma, struct mm_struct *mm) in vma_init() argument 324 memset(vma, 0, sizeof(struct vm_area_struct)); in vma_init() 325 vma->vm_mm = mm; in vma_init() 326 vma->vm_prev = vma->vm_next = NULL; in vma_init() 327 vma->vm_ops = NULL; in vma_init() 328 list_init(&vma->anon_vma_list); in vma_init() 338 static inline bool vma_is_foreign(struct vm_area_struct *vma) in vma_is_foreign() argument 342 if (current_pcb->mm != vma->vm_mm) in vma_is_foreign() 347 static inline bool vma_is_accessible(struct vm_area_struct *vma) in vma_is_accessible() argument 349 return vma->vm_flags & VM_ACCESS_FLAGS; in vma_is_accessible() [all …]
|
D | Makefile | 5 all:mm.o slab.o mm-stat.o vma.o mmap.o utils.o mmio.o mmio-buddy.o 16 vma.o: vma.c 17 $(CC) $(CFLAGS) -c vma.c -o vma.o
|
D | mm.c | 640 struct vm_area_struct *vma = NULL; in mm_do_brk() local 641 mm_create_vma(current_pcb->mm, i, PAGE_2M_SIZE, VM_USER | VM_ACCESS_FLAGS, NULL, &vma); in mm_do_brk()
|
/DragonOS-0.1.2/kernel/src/process/ |
D | fork.c | 244 struct vm_area_struct *vma = current_pcb->mm->vmas; in process_copy_mm() local 245 while (vma != NULL) in process_copy_mm() 247 if (vma->vm_end > USER_MAX_LINEAR_ADDR || vma->vm_flags & VM_DONTCOPY) in process_copy_mm() 249 vma = vma->vm_next; in process_copy_mm() 253 int64_t vma_size = vma->vm_end - vma->vm_start; in process_copy_mm() 263 … int ret = mm_create_vma(new_mms, vma->vm_start + i * PAGE_2M_SIZE, PAGE_2M_SIZE, vma->vm_flags, in process_copy_mm() 264 vma->vm_ops, &new_vma); in process_copy_mm() 271 memcpy((void *)phys_2_virt(pa), (void *)(vma->vm_start + i * PAGE_2M_SIZE), in process_copy_mm() 282 … int ret = mm_create_vma(new_mms, vma->vm_start, map_size, vma->vm_flags, vma->vm_ops, &new_vma); in process_copy_mm() 289 memcpy((void *)va, (void *)vma->vm_start, vma_size); in process_copy_mm() [all …]
|
D | process.c | 264 struct vm_area_struct *vma = NULL; in process_load_elf_file() local 266 … mm_create_vma(current_pcb->mm, virt_base, PAGE_2M_SIZE, VM_USER | VM_ACCESS_FLAGS, NULL, &vma); in process_load_elf_file() 287 struct vm_area_struct *vma = NULL; in process_load_elf_file() local 289 NULL, &vma); in process_load_elf_file() 323 struct vm_area_struct *vma = NULL; in process_load_elf_file() local 326 VM_USER | VM_ACCESS_FLAGS, NULL, &vma); in process_load_elf_file() 330 mm_map_vma(vma, pa, 0, PAGE_2M_SIZE); in process_load_elf_file() 754 struct vm_area_struct *vma = pcb->mm->vmas; in process_exit_mm() local 755 while (vma != NULL) in process_exit_mm() 758 struct vm_area_struct *cur_vma = vma; in process_exit_mm() [all …]
|
/DragonOS-0.1.2/docs/kernel/memory_management/ |
D | mmio.md | 28 4. 创建VMA,并将VMA标记为`VM_IO|VM_DONTCOPY`。MMIO的vma只绑定在`initial_mm`下,且不会被拷贝。 31 一旦MMIO地址空间分配完成,它就像普通的vma一样,可以使用mmap系列函数进行操作。
|