This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / arch / um / main.c
index 9d06171..ead5e2c 100644 (file)
@@ -17,8 +17,6 @@
 #include "kern_util.h"
 #include "mem_user.h"
 #include "signal_user.h"
-#include "time_user.h"
-#include "irq_user.h"
 #include "user.h"
 #include "init.h"
 #include "mode.h"
@@ -149,20 +147,7 @@ int main(int argc, char **argv, char **envp)
        
        /* Reboot */
        if(ret){
-               int err;
-
                printf("\n");
-
-               /* Let any pending signals fire, then disable them.  This 
-                * ensures that they won't be delivered after the exec, when 
-                * they are definitely not expected.
-                */
-               unblock_signals();
-               disable_timer();
-               err = deactivate_all_fds();
-               if(err)
-                       printf("deactivate_all_fds failed, errno = %d\n", -err);
-
                execvp(new_argv[0], new_argv);
                perror("Failed to exec kernel");
                ret = 1;
@@ -178,21 +163,10 @@ extern void *__real_malloc(int);
 
 void *__wrap_malloc(int size)
 {
-       void *ret;
-
-       if(!CAN_KMALLOC())
+       if(CAN_KMALLOC())
+               return(um_kmalloc(size));
+       else
                return(__real_malloc(size));
-       else if(size <= PAGE_SIZE) /* finding contiguos pages is hard */
-               ret = um_kmalloc(size);
-       else ret = um_vmalloc(size);
-
-       /* glibc people insist that if malloc fails, errno should be
-        * set by malloc as well. So we do.
-        */
-       if(ret == NULL)
-               errno = ENOMEM;
-
-       return(ret);
 }
 
 void *__wrap_calloc(int n, int size)
@@ -206,35 +180,9 @@ void *__wrap_calloc(int n, int size)
 
 extern void __real_free(void *);
 
-extern unsigned long high_physmem;
-
 void __wrap_free(void *ptr)
 {
-       unsigned long addr = (unsigned long) ptr;
-
-       /* We need to know how the allocation happened, so it can be correctly
-        * freed.  This is done by seeing what region of memory the pointer is
-        * in -
-        *      physical memory - kmalloc/kfree
-        *      kernel virtual memory - vmalloc/vfree
-        *      anywhere else - malloc/free
-        * If kmalloc is not yet possible, then the kernel memory regions
-        * may not be set up yet, and the variables not set up.  So,
-        * free is called.
-        *
-        * CAN_KMALLOC is checked because it would be bad to free a buffer
-        * with kmalloc/vmalloc after they have been turned off during 
-        * shutdown.
-        */
-
-       if((addr >= uml_physmem) && (addr < high_physmem)){
-               if(CAN_KMALLOC())
-                       kfree(ptr);
-       }
-       else if((addr >= start_vm) && (addr < end_vm)){
-               if(CAN_KMALLOC())
-                       vfree(ptr);
-       }
+       if(CAN_KMALLOC()) kfree(ptr);
        else __real_free(ptr);
 }