diff --git a/headers/memory.h b/headers/memory.h index d7f0632..b78158d 100644 --- a/headers/memory.h +++ b/headers/memory.h @@ -32,7 +32,10 @@ ((uint32_t *)(VIRT_PT_BASE + ((uint32_t)pd_index) * 4096 + \ ((uint32_t)pt_index) * 4)) -#define PTE2VA(pd_index, pt_index) ((uint32_t*) ((((((uint32_t)pd_index) * 1024) + ((uint32_t)pt_index)) * 4096))) +#define PTE2VA(pd_index, pt_index) \ + ((uint32_t *)(( \ + ((((uint32_t)pd_index) * 1024) + ((uint32_t)pt_index)) * 4096))) + static inline uint32_t *VA2PTE(uint32_t va) { uint32_t pde = va >> 22; diff --git a/src/multitasking/fork.c b/src/multitasking/fork.c index 8ed8b3a..1e3cd51 100644 --- a/src/multitasking/fork.c +++ b/src/multitasking/fork.c @@ -102,7 +102,7 @@ pid_t fork(void) kfree(e); goto error; } - memcpy(it->content, new_content, sizeof(struct tcb)); + memcpy(new_content, it->content, sizeof(struct tcb)); new_content->process = new_pcb; e->next = NULL; prev = e;