/DragonOS-0.1.7/kernel/src/mm/ |
D | slab.h | 23 ul count_using; 24 ul count_free; 30 ul bmp_len; // 位图的长度(字节) 31 ul bmp_count; // 位图的有效位数 32 ul *bmp; 38 ul size; // 单位:byte 39 ul count_total_using; 40 ul count_total_free; 49 void *(*constructor)(void *vaddr, ul arg); 50 void *(*destructor)(void *vaddr, ul arg); [all …]
|
D | mm-types.h | 38 ul BaseAddr; // 基地址 39 ul Length; // 内存长度 以字节为单位 50 ul len_e820; // 物理内存段长度 52 ul *bmp; // 物理空间页映射位图 53 ul bmp_len; // bmp的长度 54 ul bits_size; // 物理地址空间页数量 57 ul count_pages; // struct page结构体的总数 58 ul pages_struct_len; // pages_struct链表的长度 61 ul count_zones; // zone结构体的数量 62 ul zones_struct_len; // zones_struct列表的长度 [all …]
|
D | utils.c | 14 ul *tmp; in __mm_get_paddr() 16 tmp = phys_2_virt((ul *)(((ul)mm->pgd) & (~0xfffUL)) + ((vaddr >> PAGE_GDT_SHIFT) & 0x1ff)); in __mm_get_paddr() 22 tmp = phys_2_virt((ul *)(*tmp & (~0xfffUL)) + ((vaddr >> PAGE_1G_SHIFT) & 0x1ff)); in __mm_get_paddr() 29 tmp = phys_2_virt(((ul *)(*tmp & (~0xfffUL)) + (((ul)(vaddr) >> PAGE_2M_SHIFT) & 0x1ff))); in __mm_get_paddr() 43 tmp = phys_2_virt(((ul *)(*tmp & (~0xfffUL)) + (((ul)(vaddr) >> PAGE_4K_SHIFT) & 0x1ff))); in __mm_get_paddr() 57 bool mm_check_mapped(ul page_table_phys_addr, uint64_t virt_addr) in mm_check_mapped() 59 ul *tmp; in mm_check_mapped() 61 …tmp = phys_2_virt((ul *)((ul)page_table_phys_addr & (~0xfffUL)) + ((virt_addr >> PAGE_GDT_SHIFT) &… in mm_check_mapped() 67 tmp = phys_2_virt((ul *)(*tmp & (~0xfffUL)) + ((virt_addr >> PAGE_1G_SHIFT) & 0x1ff)); in mm_check_mapped() 74 tmp = phys_2_virt(((ul *)(*tmp & (~0xfffUL)) + (((ul)(virt_addr) >> PAGE_2M_SHIFT) & 0x1ff))); in mm_check_mapped() [all …]
|
D | mm.c | 28 uint64_t mm_get_PDE(ul proc_page_table_addr, bool is_phys, ul virt_addr, bool clear); 51 memory_management_struct.kernel_code_start = (ul)&_text; in mm_init() 52 memory_management_struct.kernel_code_end = (ul)&_etext; in mm_init() 53 memory_management_struct.kernel_data_end = (ul)&_edata; in mm_init() 54 memory_management_struct.rodata_end = (ul)&_erodata; in mm_init() 55 memory_management_struct.start_brk = (ul)&_end; in mm_init() 90 ul addr_start = PAGE_2M_ALIGN(memory_management_struct.e820[i].BaseAddr); in mm_init() 92 …ul addr_end = ((memory_management_struct.e820[i].BaseAddr + memory_management_struct.e820[i].Lengt… in mm_init() 103 …ul max_addr = memory_management_struct.e820[memory_management_struct.len_e820].BaseAddr + memory_m… in mm_init() 126 …memory_management_struct.zones_struct = (struct Zone *)(((ul)memory_management_struct.pages_struct… in mm_init() [all …]
|
D | mm.h | 152 …ul tmp; … 224 unsigned long page_init(struct Page *page, ul flags); 233 ul *tmp; in get_CR3() 246 struct Page *alloc_pages(unsigned int zone_select, int num, ul flags); 270 ul get_page_attr(struct Page *page); 279 ul set_page_attr(struct Page *page, ul flags); 407 int mm_map_phys_addr(ul virt_addr_start, ul phys_addr_start, ul length, ul flags, bool use4k); 421 int mm_map_proc_page_table(ul proc_page_table_addr, bool is_phys, ul virt_addr_start, ul phys_addr_… 422 ul flags, bool user, bool flush, bool use4k); 424 int mm_map_phys_addr_user(ul virt_addr_start, ul phys_addr_start, ul length, ul flags); [all …]
|
D | mmap.c | 46 int mm_map_phys_addr(ul virt_addr_start, ul phys_addr_start, ul length, ul flags, bool use4k) in mm_map_phys_addr() 53 int mm_map_phys_addr_user(ul virt_addr_start, ul phys_addr_start, ul length, ul flags) in mm_map_phys_addr_user() 71 int mm_map_proc_page_table(ul proc_page_table_addr, bool is_phys, ul virt_addr_start, ul phys_addr_… in mm_map_proc_page_table() 90 pml4_ptr = phys_2_virt((ul *)((ul)proc_page_table_addr & (~0xfffUL))); in mm_map_proc_page_table() 92 pml4_ptr = (ul *)((ul)proc_page_table_addr & (~0xfffUL)); in mm_map_proc_page_table() 100 ul *pml4e_ptr = pml4_ptr + pml4e_id; in mm_map_proc_page_table() 105 ul *virt_addr = kmalloc(PAGE_4K_SIZE, 0); in mm_map_proc_page_table() 122 ul *virt_addr = kmalloc(PAGE_4K_SIZE, 0); in mm_map_proc_page_table() 135 ul *pde_ptr = pd_ptr + pde_id; in mm_map_proc_page_table() 165 …set_pt(pte_ptr, mk_pt((ul)phys_addr_start + length_mapped, flags | (user ? PAGE_USER_4K_PAGE : PAG… in mm_map_proc_page_table() [all …]
|
D | slab.c | 33 struct slab *slab_create(ul size, void *(*constructor)(void *vaddr, ul arg), void *(*destructor)(vo… in slab_create() 95 …slab_pool->cache_pool_entry->bmp_len = ((slab_pool->cache_pool_entry->bmp_count + sizeof(ul) * 8 -… in slab_create() 97 slab_pool->cache_pool_entry->bmp = (ul *)kmalloc(slab_pool->cache_pool_entry->bmp_len, 0); in slab_create() 121 ul slab_destroy(struct slab *slab_pool) in slab_destroy() 163 void *slab_malloc(struct slab *slab_pool, ul arg) in slab_malloc() 198 tmp_slab_obj->bmp_len = ((tmp_slab_obj->bmp_count + sizeof(ul) * 8 - 1) >> 6) << 3; in slab_malloc() 199 tmp_slab_obj->bmp = (ul *)kmalloc(tmp_slab_obj->bmp_len, 0); in slab_malloc() 289 ul slab_free(struct slab *slab_pool, void *addr, ul arg) in slab_free() 346 ul slab_init() in slab_init() 350 ul tmp_addr = memory_management_struct.end_of_struct; in slab_init() [all …]
|
/DragonOS-0.1.7/kernel/src/process/ |
D | proc-types.h | 47 ul rbp; // in tss rsp0 49 ul rip; 51 ul rsp; 53 ul fs, gs; 55 ul cr2; 57 ul trap_num; 59 ul err_code; 145 ul stack[STACK_SIZE / sizeof(ul)]; 151 ul rsp0; 152 ul rsp1; [all …]
|
D | process.h | 36 ….reserved0 = 0, .rsp0 = (ul)(initial_proc_union.stack + STACK_SIZE / sizeof(ul)), … 37 ….rsp1 = (ul)(initial_proc_union.stack + STACK_SIZE / sizeof(ul)), … 38 ….rsp2 = (ul)(initial_proc_union.stack + STACK_SIZE / sizeof(ul)), .reserved1 = 0, .ist1 = 0xffff80… 124 ul do_execve(struct pt_regs *regs, char *path, char *argv[], char *envp[]); 140 ul process_do_exit(ul code); 180 extern ul _stack_start;
|
D | process.c | 41 ul _stack_start; // initial proc的栈基地址(虚拟地址) 64 .rbp = (ul)(initial_proc_union.stack + STACK_SIZE / sizeof(ul)), 65 .rsp = (ul)(initial_proc_union.stack + STACK_SIZE / sizeof(ul)), 414 ul do_execve(struct pt_regs *regs, char *path, char *argv[], char *envp[]) in do_execve() 556 ul initial_kernel_thread(ul arg) in initial_kernel_thread() 604 current_pcb->thread->rip = (ul)ret_from_intr; in initial_kernel_thread() 605 current_pcb->thread->rsp = (ul)current_pcb + STACK_SIZE - sizeof(struct pt_regs); in initial_kernel_thread() 645 ul process_do_exit(ul code) in process_do_exit() 683 regs.rbx = (ul)fn; in kernel_thread() 685 regs.rdx = (ul)arg; in kernel_thread() [all …]
|
/DragonOS-0.1.7/kernel/src/exception/ |
D | irq.h | 24 extern void do_IRQ(struct pt_regs *regs, ul number); 112 void (*enable)(ul irq_num); 114 void (*disable)(ul irq_num); 117 ul (*install)(ul irq_num, void *arg); 119 void (*uninstall)(ul irq_num); 121 void (*ack)(ul irq_num); 131 ul parameter; 133 void (*handler)(ul irq_num, ul parameter, struct pt_regs *regs); 136 ul flags; 157 int irq_register(ul irq_num, void *arg, void (*handler)(ul irq_num, ul parameter, struct pt_regs *r… [all …]
|
D | gate.h | 53 void set_gate(ul *gate_selector_addr, ul attr, unsigned char ist, ul *code_addr) in set_gate() 55 ul __d0 = 0, __d1 = 0; in set_gate() 56 ul tmp_code_addr = *code_addr; in set_gate() 59 __d0 |= ((ul)(ist) << 32); // 设置ist in set_gate()
|
D | irq.c | 188 int irq_register(ul irq_num, void *arg, void (*handler)(ul irq_num, ul parameter, struct pt_regs *r… in irq_register() 229 int irq_unregister(ul irq_num) in irq_unregister()
|
/DragonOS-0.1.7/kernel/src/syscall/ |
D | syscall.h | 34 long enter_syscall_int(ul syscall_id, ul arg0, ul arg1, ul arg2, ul arg3, ul arg4, ul arg5, ul arg6… 42 ul system_call_not_exists(struct pt_regs *regs); 55 ul sys_printf(struct pt_regs *regs); 86 ul sys_ahci_end_req(struct pt_regs *regs);
|
D | syscall.c | 95 ul system_call_not_exists(struct pt_regs *regs) in system_call_not_exists() 134 long enter_syscall_int(ul syscall_id, ul arg0, ul arg1, ul arg2, ul arg3, ul arg4, ul arg5, ul arg6… in enter_syscall_int() 165 ul sys_put_string(struct pt_regs *regs) in sys_put_string() 392 ul sys_ahci_end_req(struct pt_regs *regs) in sys_ahci_end_req() 401 ul ret = system_call_table[regs->rax](regs); in do_syscall_int()
|
/DragonOS-0.1.7/kernel/src/ |
D | main.c | 42 ul bsp_idt_size, bsp_gdt_size; 52 gdtp.gdt_vaddr = (ul)phys_2_virt((ul)&GDT_Table); in reload_gdt() 61 idtp.idt_vaddr = (ul)phys_2_virt((ul)&IDT_Table); in reload_idt() 77 ul tss_item_addr = (ul)phys_2_virt(0x7c00); in system_initialize() 107 initial_tss[0].ist1 = (ul)ptr; in system_initialize() 108 initial_tss[0].ist2 = (ul)ptr; in system_initialize() 109 initial_tss[0].ist3 = (ul)ptr; in system_initialize() 110 initial_tss[0].ist4 = (ul)ptr; in system_initialize() 111 initial_tss[0].ist5 = (ul)ptr; in system_initialize() 112 initial_tss[0].ist6 = (ul)ptr; in system_initialize() [all …]
|
/DragonOS-0.1.7/kernel/src/driver/acpi/ |
D | acpi.c | 19 static ul acpi_RSDT_offset = 0; 20 static ul acpi_XSDT_offset = 0; 24 static ul acpi_RSDT_entry_phys_base = 0; // RSDT中的第一个entry所在物理页的基地址 44 ul *ent = &(xsdt->Entry); in acpi_iter_SDT() 48 …sdt_header = (struct acpi_system_description_table_header_t *)((ul)(acpi_description_header_base +… in acpi_iter_SDT() 60 …r = (struct acpi_system_description_table_header_t *)(acpi_get_RSDT_entry_vaddr((ul)(*(ent + i)))); in acpi_iter_SDT() 85 *(ul *)_data = (ul)_iter_data; in acpi_get_MADT() 86 acpi_madt_vaddr = (ul)_iter_data; in acpi_get_MADT() 102 *(ul *)_data = (ul)_iter_data; in acpi_get_HPET() 118 *(ul *)_data = (ul)_iter_data; in acpi_get_MCFG() [all …]
|
/DragonOS-0.1.7/docs/kernel/core_api/ |
D | mm-api.md | 64 ### `struct Page *alloc_pages(unsigned int zone_select, int num, ul flags)` 126 ### `int mm_map_phys_addr(ul virt_addr_start, ul phys_addr_start, ul length, ul flags, bool use4k)` 154 …# `int mm_map_proc_page_table(ul proc_page_table_addr, bool is_phys, ul virt_addr_start, ul phys_a… 203 ### `void mm_unmap_proc_table(ul proc_page_table_addr, bool is_phys, ul virt_addr_start, ul length)`
|
/DragonOS-0.1.7/kernel/src/driver/interrupt/apic/ |
D | apic.h | 265 void do_IRQ(struct pt_regs *rsp, ul number); 273 ul apic_ioapic_read_rte(unsigned char index); 281 void apic_ioapic_write_rte(unsigned char index, ul value); 303 uint apic_get_ics(const uint type, ul ret_vaddr[], uint *total); 306 void apic_ioapic_enable(ul irq_num); 307 void apic_ioapic_disable(ul irq_num); 308 ul apic_ioapic_install(ul irq_num, void *arg); 309 void apic_ioapic_uninstall(ul irq_num); 310 void apic_ioapic_level_ack(ul irq_num); // ioapic电平触发 应答 311 void apic_ioapic_edge_ack(ul irq_num); // ioapic边沿触发 应答 [all …]
|
D | apic.c | 57 ul madt_addr; in apic_io_apic_init() 89 … mm_map_phys_addr((ul)apic_ioapic_map.virtual_index_addr, apic_ioapic_map.addr_phys, PAGE_2M_SIZE, in apic_io_apic_init() 405 void do_IRQ(struct pt_regs *rsp, ul number) in do_IRQ() 482 ul apic_ioapic_read_rte(unsigned char index) in apic_ioapic_read_rte() 485 ul ret; in apic_ioapic_read_rte() 509 void apic_ioapic_write_rte(unsigned char index, ul value) in apic_ioapic_write_rte() 527 void apic_ioapic_enable(ul irq_num) in apic_ioapic_enable() 529 ul index = 0x10 + ((irq_num - 32) << 1); in apic_ioapic_enable() 530 ul value = apic_ioapic_read_rte(index); in apic_ioapic_enable() 535 void apic_ioapic_disable(ul irq_num) in apic_ioapic_disable() [all …]
|
D | apic_timer.c | 52 uint64_t apic_timer_install(ul irq_num, void *arg) in apic_timer_install() 69 void apic_timer_uninstall(ul irq_num) in apic_timer_uninstall()
|
/DragonOS-0.1.7/kernel/src/common/ |
D | glib.h | 37 typedef unsigned long ul; typedef 50 ul round(double x) in round() 52 return (ul)(x + 0.5); in round() 62 static __always_inline ul ALIGN(const ul addr, const ul _align) in ALIGN() 64 return (ul)((addr + _align - 1) & (~(_align - 1))); in ALIGN() 68 void *memset(void *dst, unsigned char C, ul size) in memset()
|
D | blk_types.h | 44 void (*end_handler)(ul num, ul arg); 54 ul request_count;
|
/DragonOS-0.1.7/kernel/src/driver/interrupt/8259A/ |
D | 8259A.h | 30 void do_IRQ(struct pt_regs* rsp, ul number);
|
/DragonOS-0.1.7/kernel/src/driver/disk/ |
D | ata.c | 14 void ata_disk_handler(ul irq_num, ul param, struct pt_regs *regs) in ata_disk_handler()
|