aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/os-Linux/main.c')
-rw-r--r--arch/um/os-Linux/main.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index 425aa8960649..bfabb883daae 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -19,7 +19,6 @@
19#include "user.h" 19#include "user.h"
20#include "init.h" 20#include "init.h"
21#include "mode.h" 21#include "mode.h"
22#include "choose-mode.h"
23#include "uml-config.h" 22#include "uml-config.h"
24#include "os.h" 23#include "os.h"
25#include "um_malloc.h" 24#include "um_malloc.h"
@@ -189,16 +188,13 @@ int __init main(int argc, char **argv, char **envp)
189 return uml_exitcode; 188 return uml_exitcode;
190} 189}
191 190
192#define CAN_KMALLOC() \
193 (kmalloc_ok && CHOOSE_MODE((os_getpid() != tracing_pid), 1))
194
195extern void *__real_malloc(int); 191extern void *__real_malloc(int);
196 192
197void *__wrap_malloc(int size) 193void *__wrap_malloc(int size)
198{ 194{
199 void *ret; 195 void *ret;
200 196
201 if(!CAN_KMALLOC()) 197 if(!kmalloc_ok)
202 return __real_malloc(size); 198 return __real_malloc(size);
203 else if(size <= UM_KERN_PAGE_SIZE) 199 else if(size <= UM_KERN_PAGE_SIZE)
204 /* finding contiguous pages can be hard*/ 200 /* finding contiguous pages can be hard*/
@@ -251,11 +247,11 @@ void __wrap_free(void *ptr)
251 */ 247 */
252 248
253 if((addr >= uml_physmem) && (addr < high_physmem)){ 249 if((addr >= uml_physmem) && (addr < high_physmem)){
254 if(CAN_KMALLOC()) 250 if(kmalloc_ok)
255 kfree(ptr); 251 kfree(ptr);
256 } 252 }
257 else if((addr >= start_vm) && (addr < end_vm)){ 253 else if((addr >= start_vm) && (addr < end_vm)){
258 if(CAN_KMALLOC()) 254 if(kmalloc_ok)
259 vfree(ptr); 255 vfree(ptr);
260 } 256 }
261 else __real_free(ptr); 257 else __real_free(ptr);