static inline void *cow_malloc(int size)
 {
-       return um_kmalloc(size);
+       return kmalloc(size, UM_GFP_KERNEL);
 }
 
 static inline void cow_free(void *ptr)
 
 {
        struct sockaddr_un *sun;
 
-       sun = um_kmalloc(sizeof(struct sockaddr_un));
+       sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
        if(sun == NULL){
                printk("new_addr: allocation of sockaddr_un failed\n");
                return NULL;
                goto out_close;
        }
 
-       sun = um_kmalloc(sizeof(struct sockaddr_un));
+       sun = kmalloc(sizeof(struct sockaddr_un), UM_GFP_KERNEL);
        if(sun == NULL){
                printk("new_addr: allocation of sockaddr_un failed\n");
                err = -ENOMEM;
 
                printk("fd_init : couldn't parse file descriptor '%s'\n", str);
                return(NULL);
        }
-       data = um_kmalloc(sizeof(*data));
+       data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
        if(data == NULL) return(NULL);
        *data = ((struct fd_chan) { .fd         = n,
                                    .raw        = opts->raw });
 
 {
        struct sockaddr_in *sin;
 
-       sin = um_kmalloc(sizeof(struct sockaddr_in));
+       sin = kmalloc(sizeof(struct sockaddr_in), UM_GFP_KERNEL);
        if(sin == NULL){
                printk("new_addr: allocation of sockaddr_in failed\n");
                return NULL;
 
                netmask[2], netmask[3]);
 
        output_len = UM_KERN_PAGE_SIZE;
-       output = um_kmalloc(output_len);
+       output = kmalloc(output_len, UM_GFP_KERNEL);
        if(output == NULL)
                printk("change : failed to allocate output buffer\n");
 
 
        if(kern_data == NULL)
                return NULL;
 
-       data = um_kmalloc(sizeof(*data));
+       data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
        if(data == NULL)
                goto err;
 
 
 {
        struct pty_chan *data;
 
-       data = um_kmalloc(sizeof(*data));
+       data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
        if (data == NULL)
                return NULL;
 
 
        pid = err;
 
        output_len = UM_KERN_PAGE_SIZE;
-       output = um_kmalloc(output_len);
+       output = kmalloc(output_len, UM_GFP_KERNEL);
        if(output == NULL){
                printk("slip_tramp : failed to allocate output buffer\n");
                os_kill_process(pid, 1);
 
        }
        str++;
 
-       data = um_kmalloc(sizeof(*data));
+       data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
        if(data == NULL)
                return NULL;
        *data = ((struct tty_chan) { .dev       = str,
 
 
 DEFINE(UM_NR_CPUS, NR_CPUS);
 
+DEFINE(UM_GFP_KERNEL, GFP_KERNEL);
+DEFINE(UM_GFP_ATOMIC, GFP_ATOMIC);
+
 /* For crypto assembler code. */
 DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
 
 
 #ifndef __UM_MALLOC_H__
 #define __UM_MALLOC_H__
 
-extern void *um_kmalloc(int size);
-extern void *um_kmalloc_atomic(int size);
+#include "kern_constants.h"
+
+extern void *__kmalloc(int size, int flags);
+static inline void *kmalloc(int size, int flags)
+{
+       return __kmalloc(size, flags);
+}
+
 extern void kfree(const void *ptr);
 
-extern void *um_vmalloc(int size);
+extern void *vmalloc(unsigned long size);
 extern void vfree(void *ptr);
 
 #endif /* __UM_MALLOC_H__ */
 
 #include "irq_kern.h"
 #include "os.h"
 #include "sigio.h"
-#include "um_malloc.h"
 #include "misc_constants.h"
 #include "as-layout.h"
 
 
 #include "mode.h"
 #include "mode_kern.h"
 #include "choose-mode.h"
-#include "um_malloc.h"
 
 /* This is a per-cpu array.  A processor only modifies its entry and it only
  * cares about its entry, so it's OK if another processor is modifying its
 {
 }
 
-void *um_kmalloc(int size)
-{
-       return kmalloc(size, GFP_KERNEL);
-}
-
-void *um_kmalloc_atomic(int size)
-{
-       return kmalloc(size, GFP_ATOMIC);
-}
-
-void *um_vmalloc(int size)
-{
-       return vmalloc(size);
-}
-
 int __cant_sleep(void) {
        return in_atomic() || irqs_disabled() || in_interrupt();
        /* Is in_interrupt() really needed? */
 
                return;
        }
 
-       output = um_kmalloc(UM_KERN_PAGE_SIZE);
+       output = kmalloc(UM_KERN_PAGE_SIZE, UM_GFP_KERNEL);
        if(output == NULL)
                printk("etap_change : Failed to allocate output buffer\n");
        read_output(fd, output, UM_KERN_PAGE_SIZE);
        err = etap_tramp(pri->dev_name, pri->gate_addr, control_fds[0], 
                         control_fds[1], data_fds[0], data_fds[1]);
        output_len = UM_KERN_PAGE_SIZE;
-       output = um_kmalloc(output_len);
+       output = kmalloc(output_len, UM_GFP_KERNEL);
        read_output(control_fds[0], output, output_len);
 
        if(output == NULL)
 
        data.pre_data = pre_data;
        data.argv = argv;
        data.fd = fds[1];
-       data.buf = __cant_sleep() ? um_kmalloc_atomic(PATH_MAX) :
-                                       um_kmalloc(PATH_MAX);
+       data.buf = __cant_sleep() ? kmalloc(PATH_MAX, UM_GFP_ATOMIC) :
+                                       kmalloc(PATH_MAX, UM_GFP_KERNEL);
        pid = clone(helper_child, (void *) sp, CLONE_VM | SIGCHLD, &data);
        if (pid < 0) {
                ret = -errno;
 
                return __real_malloc(size);
        else if(size <= UM_KERN_PAGE_SIZE)
                /* finding contiguous pages can be hard*/
-               ret = um_kmalloc(size);
-       else ret = um_vmalloc(size);
+               ret = kmalloc(size, UM_GFP_KERNEL);
+       else ret = vmalloc(size);
 
        /* glibc people insist that if malloc fails, errno should be
         * set by malloc as well. So we do.
 
        if(n <= polls->size)
                return 0;
 
-       new = um_kmalloc_atomic(n * sizeof(struct pollfd));
+       new = kmalloc(n * sizeof(struct pollfd), UM_GFP_ATOMIC);
        if(new == NULL){
                printk("need_poll : failed to allocate new pollfds\n");
                return -ENOMEM;
 {
        struct pollfd *p;
 
-       p = um_kmalloc(sizeof(struct pollfd));
+       p = kmalloc(sizeof(struct pollfd), UM_GFP_KERNEL);
        if (p == NULL) {
                printk("setup_initial_poll : failed to allocate poll\n");
                return NULL;