mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-16 07:57:13 -04:00
Add some more debug
This commit is contained in:
parent
327e1244e4
commit
ad7525c554
@ -348,6 +348,11 @@ bool allocate_user_memory(scheduler::process_t& process, size_t address, size_t
|
|||||||
auto aligned_physical_memory = paging::page_aligned(physical_memory) ? physical_memory :
|
auto aligned_physical_memory = paging::page_aligned(physical_memory) ? physical_memory :
|
||||||
(physical_memory / paging::PAGE_SIZE + 1) * paging::PAGE_SIZE;
|
(physical_memory / paging::PAGE_SIZE + 1) * paging::PAGE_SIZE;
|
||||||
|
|
||||||
|
if(DEBUG_SCHEDULER){
|
||||||
|
k_printf("Map(p%u) virtual:%h into phys: %h\n", process.pid, first_page, aligned_physical_memory);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//4. Map physical allocated memory to the necessary virtual memory
|
//4. Map physical allocated memory to the necessary virtual memory
|
||||||
if(!paging::user_map_pages(process, first_page, aligned_physical_memory, pages)){
|
if(!paging::user_map_pages(process, first_page, aligned_physical_memory, pages)){
|
||||||
if(DEBUG_SCHEDULER){
|
if(DEBUG_SCHEDULER){
|
||||||
@ -376,6 +381,10 @@ bool create_paging(char* buffer, scheduler::process_t& process){
|
|||||||
process.physical_cr3 = physical_allocator::allocate(1);
|
process.physical_cr3 = physical_allocator::allocate(1);
|
||||||
process.paging_size = paging::PAGE_SIZE;
|
process.paging_size = paging::PAGE_SIZE;
|
||||||
|
|
||||||
|
if(DEBUG_SCHEDULER){
|
||||||
|
k_printf("Process %u cr3:%h\n", process.pid, process.physical_cr3);
|
||||||
|
}
|
||||||
|
|
||||||
clear_physical_memory(process.physical_cr3, 1);
|
clear_physical_memory(process.physical_cr3, 1);
|
||||||
|
|
||||||
//Map the kernel pages inside the user memory space
|
//Map the kernel pages inside the user memory space
|
||||||
@ -418,6 +427,10 @@ bool create_paging(char* buffer, scheduler::process_t& process){
|
|||||||
|
|
||||||
physical_pointer phys_ptr(segment.physical, pages);
|
physical_pointer phys_ptr(segment.physical, pages);
|
||||||
|
|
||||||
|
if(DEBUG_SCHEDULER){
|
||||||
|
k_printf("Copy to physical:%h\n", segment.physical);
|
||||||
|
}
|
||||||
|
|
||||||
auto memory_start = phys_ptr.get() + left_padding;
|
auto memory_start = phys_ptr.get() + left_padding;
|
||||||
|
|
||||||
//In the case of the BSS segment, the segment must be
|
//In the case of the BSS segment, the segment must be
|
||||||
@ -567,8 +580,13 @@ void scheduler::sbrk(size_t inc){
|
|||||||
|
|
||||||
auto virtual_start = process.brk_start;
|
auto virtual_start = process.brk_start;
|
||||||
|
|
||||||
|
if(DEBUG_SCHEDULER){
|
||||||
|
k_printf("Map(p%u) virtual:%h into phys: %h\n", process.pid, virtual_start, physical);
|
||||||
|
}
|
||||||
|
|
||||||
//Map the memory inside the process memory space
|
//Map the memory inside the process memory space
|
||||||
if(!paging::user_map_pages(process, virtual_start, physical, pages)){
|
if(!paging::user_map_pages(process, virtual_start, physical, pages)){
|
||||||
|
k_print_line("impossible");
|
||||||
physical_allocator::free(physical, pages);
|
physical_allocator::free(physical, pages);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user