Removed sys_brk()
authorBarret Rhoden <brho@cs.berkeley.edu>
Sat, 7 Aug 2010 00:27:42 +0000 (17:27 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:35:50 +0000 (17:35 -0700)
It's been deprecated for a while, and no one uses it.

kern/include/ros/bits/syscall.h
kern/src/syscall.c
user/include/parlib.h
user/parlib/syscall.c

index fca18fd..a1d8788 100644 (file)
@@ -30,7 +30,7 @@
 #define SYS_mlock
 #define SYS_msync
 */
-#define SYS_brk                                                21
+/* sys_brk removed */
 #define SYS_shared_page_alloc          22
 #define SYS_shared_page_free           23
 #define SYS_resource_req                       24
index a9bdd7d..2a256f9 100644 (file)
@@ -502,37 +502,6 @@ static intreg_t sys_munmap(struct proc* p, void* addr, size_t len)
        return munmap(p, (uintptr_t)addr, len);
 }
 
-static void* sys_brk(struct proc *p, void* addr) {
-       ssize_t range;
-
-       // TODO: remove sys_brk
-       printk("[kernel] don't use brk, unsupported and will be removed soon.\n");
-
-       spin_lock(&p->proc_lock);
-
-       if((addr < p->procinfo->heap_bottom) || (addr >= (void*)BRK_END))
-               goto out;
-
-       uintptr_t real_heap_top = ROUNDUP((uintptr_t)p->heap_top,PGSIZE);
-       uintptr_t real_new_heap_top = ROUNDUP((uintptr_t)addr,PGSIZE);
-       range = real_new_heap_top - real_heap_top;
-
-       if (range > 0) {
-               if(__do_mmap(p, real_heap_top, range, PROT_READ | PROT_WRITE,
-                            MAP_FIXED | MAP_ANONYMOUS, NULL, 0) == MAP_FAILED)
-                       goto out;
-       }
-       else if (range < 0) {
-               if(__do_munmap(p, real_new_heap_top, -range))
-                       goto out;
-       }
-       p->heap_top = addr;
-
-out:
-       spin_unlock(&p->proc_lock);
-       return p->heap_top;
-}
-
 static ssize_t sys_shared_page_alloc(env_t* p1,
                                      void**DANGEROUS _addr, pid_t p2_id,
                                      int p1_flags, int p2_flags
@@ -1100,7 +1069,6 @@ intreg_t syscall(struct proc *p, uintreg_t syscallno, uintreg_t a1,
                [SYS_mmap] = (syscall_t)sys_mmap,
                [SYS_munmap] = (syscall_t)sys_munmap,
                [SYS_mprotect] = (syscall_t)sys_mprotect,
-               [SYS_brk] = (syscall_t)sys_brk,
                [SYS_shared_page_alloc] = (syscall_t)sys_shared_page_alloc,
                [SYS_shared_page_free] = (syscall_t)sys_shared_page_free,
                [SYS_resource_req] = (syscall_t)resource_req,
index a180f2a..f9312df 100644 (file)
@@ -30,7 +30,6 @@ ssize_t     sys_serial_read(void* buf, size_t len);
 ssize_t     sys_eth_write(void *COUNT(len) buf, size_t len); 
 ssize_t     sys_eth_read(void *COUNT(len) buf, size_t len);
 size_t      sys_getcpuid(void);
-void *      sys_brk(void* addr);
 /* Process Management */
 int         sys_getpid(void);
 int         sys_proc_destroy(int pid, int exitcode);
index ce166b9..0b04e7a 100644 (file)
@@ -7,11 +7,6 @@ int sys_proc_destroy(int pid, int exitcode)
        return ros_syscall(SYS_proc_destroy, pid, exitcode, 0, 0, 0);
 }
 
-void* sys_brk(void* addr)
-{
-       return (void*)ros_syscall(SYS_brk, addr, 0, 0, 0, 0);
-}
-
 int sys_getpid(void)
 {
         return ros_syscall(SYS_getpid, 0, 0, 0, 0, 0);