Я пытаюсь скопировать содержимое байта указателя в другой указатель, но я застреваю в цикле for в функции ниже.Я считаю, что это может быть что-то, связанное с языком Си.Любая подсказка, почему это может происходить?
void copy_COW(unsigned int pid, unsigned int vaddr) {
//pid is the current process id, vaddr is the double mapped page which has a fault
dprintf("copying on write...\n"); dprintf("\n");
//set fresh_page_index to perm writeable
unsigned int writeable_perm = PTE_P | PTE_W | PTE_U;
unsigned int* contents_to_copy;
unsigned int* fresh_page_index;
unsigned int i;
//allocate fresh page
fresh_page_index = (unsigned int*) alloc_page(pid, vaddr, writeable_perm);
contents_to_copy = (unsigned int*) get_ptbl_entry_by_va(pid, vaddr);
//fresh_page_index |= writeable_perm; //make page writeable, usable by user and present
//copy contents at vaddr (dir, page) to fresh_page_index by looping thru
for (i=0; i<4096 ;i++)
{
//dprintf("i is %d \n", i);
char byteToCopy = contents_to_copy[i];
fresh_page_index[i] = byteToCopy;
}
//update memory mapping in pdir to use fresh_page_index
set_ptbl_entry_by_va(pid, vaddr, (unsigned int) fresh_page_index, writeable_perm);
}