Revert "新的内存管理模块 (#301)" (#302)

This reverts commit d8ad0a5e77.
This commit is contained in:
LoGin
2023-07-22 16:24:55 +08:00
committed by GitHub
parent d8ad0a5e77
commit bb5f098a86
124 changed files with 5151 additions and 8278 deletions

View File

@ -156,7 +156,6 @@ static int malloc_enlarge(int64_t size)
// 在新分配的内存的底部放置header
// printf("managed addr = %#018lx\n", brk_managed_addr);
malloc_mem_chunk_t *new_ck = (malloc_mem_chunk_t *)brk_managed_addr;
memset(new_ck, 0, sizeof(malloc_mem_chunk_t));
new_ck->length = brk_max_addr - brk_managed_addr;
// printf("new_ck->start_addr=%#018lx\tbrk_max_addr=%#018lx\tbrk_managed_addr=%#018lx\n", (uint64_t)new_ck, brk_max_addr, brk_managed_addr);
new_ck->prev = NULL;

View File

@ -70,8 +70,7 @@ pid_t fork(void)
*
* @return int 如果失败返回负数
*/
int pipe(int fd[2])
{
int pipe(int fd[2]){
return (int)syscall_invoke(SYS_PIPE, fd, 0, 0, 0, 0, 0, 0, 0);
}
/**
@ -96,8 +95,7 @@ pid_t vfork(void)
uint64_t brk(uint64_t end_brk)
{
uint64_t x = (uint64_t)syscall_invoke(SYS_BRK, (uint64_t)end_brk, 0, 0, 0, 0, 0, 0, 0);
if (x < end_brk)
{
if (x < end_brk){
errno = -ENOMEM;
return -1;
}
@ -219,7 +217,7 @@ pid_t getpid(void)
int dup(int fd)
{
return syscall_invoke(SYS_DUP, fd, 0, 0, 0, 0, 0, 0, 0);
return syscall_invoke(SYS_DUP, fd, 0, 0, 0, 0, 0, 0, 0);
}
int dup2(int ofd, int nfd)