From 3552ddb5ff105b8394e16abda6b8ca00b66055f2 Mon Sep 17 00:00:00 2001
From: patacongo
Date: Tue, 5 Apr 2011 15:50:01 +0000
Subject: [PATCH] Add a layer to redirect kernel-mode memory manager accesses
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3466 42af7a65-404d-4744-a932-0658087f49c3
---
Documentation/NuttxPortingGuide.html | 5 +-
configs/README.txt | 3 +-
configs/avr32dev1/nsh/defconfig | 3 -
configs/avr32dev1/ostest/defconfig | 3 -
configs/c5471evm/httpd/defconfig | 3 -
configs/c5471evm/nettest/defconfig | 3 -
configs/c5471evm/nsh/defconfig | 3 -
configs/c5471evm/ostest/defconfig | 3 -
configs/demo9s12ne64/ostest/defconfig | 3 -
configs/detron/hidkbd/defconfig | 3 -
configs/detron/nsh/defconfig | 3 -
configs/detron/ostest/defconfig | 3 -
configs/detron/wlan/defconfig | 3 -
configs/ea3131/nsh/defconfig | 3 -
configs/ea3131/ostest/defconfig | 3 -
configs/ea3131/pgnsh/defconfig | 3 -
configs/ea3131/usbserial/defconfig | 3 -
configs/ea3131/usbstorage/defconfig | 3 -
configs/eagle100/httpd/defconfig | 3 -
configs/eagle100/nettest/defconfig | 3 -
configs/eagle100/nsh/defconfig | 3 -
configs/eagle100/nxflat/defconfig | 3 -
configs/eagle100/ostest/defconfig | 3 -
configs/eagle100/thttpd/defconfig | 3 -
configs/ez80f910200kitg/ostest/defconfig | 3 -
configs/ez80f910200zco/dhcpd/defconfig | 3 -
configs/ez80f910200zco/httpd/defconfig | 3 -
configs/ez80f910200zco/nettest/defconfig | 3 -
configs/ez80f910200zco/nsh/defconfig | 3 -
configs/ez80f910200zco/ostest/defconfig | 3 -
configs/ez80f910200zco/poll/defconfig | 3 -
configs/lm3s6965-ek/nsh/defconfig | 3 -
configs/lm3s6965-ek/nx/defconfig | 3 -
configs/lm3s6965-ek/ostest/defconfig | 3 -
configs/lm3s8962-ek/nsh/defconfig | 3 -
configs/lm3s8962-ek/nx/defconfig | 3 -
configs/lm3s8962-ek/ostest/defconfig | 3 -
configs/m68332evb/defconfig | 3 -
configs/mbed/hidkbd/defconfig | 3 -
configs/mbed/nsh/defconfig | 3 -
configs/mcu123-lpc214x/nsh/defconfig | 3 -
configs/mcu123-lpc214x/ostest/defconfig | 3 -
configs/mcu123-lpc214x/usbserial/defconfig | 3 -
configs/mcu123-lpc214x/usbstorage/defconfig | 3 -
configs/mx1ads/ostest/defconfig | 3 -
configs/ne64badge/ostest/defconfig | 3 -
configs/ntosd-dm320/nettest/defconfig | 3 -
configs/ntosd-dm320/nsh/defconfig | 3 -
configs/ntosd-dm320/ostest/defconfig | 3 -
configs/ntosd-dm320/poll/defconfig | 3 -
configs/ntosd-dm320/thttpd/defconfig | 3 -
configs/ntosd-dm320/udp/defconfig | 3 -
configs/ntosd-dm320/uip/defconfig | 3 -
configs/nucleus2g/nsh/defconfig | 3 -
configs/nucleus2g/ostest/defconfig | 3 -
configs/nucleus2g/usbserial/defconfig | 3 -
configs/nucleus2g/usbstorage/defconfig | 3 -
configs/olimex-lpc1766stk/hidkbd/defconfig | 3 -
configs/olimex-lpc1766stk/nettest/defconfig | 3 -
configs/olimex-lpc1766stk/nsh/defconfig | 3 -
configs/olimex-lpc1766stk/nx/defconfig | 3 -
configs/olimex-lpc1766stk/ostest/defconfig | 3 -
.../olimex-lpc1766stk/slip-httpd/defconfig | 3 -
configs/olimex-lpc1766stk/thttpd/defconfig | 3 -
configs/olimex-lpc1766stk/usbserial/defconfig | 3 -
.../olimex-lpc1766stk/usbstorage/defconfig | 3 -
configs/olimex-lpc1766stk/wlan/defconfig | 3 -
configs/olimex-lpc2378/nsh/defconfig | 3 -
configs/olimex-lpc2378/ostest/defconfig | 3 -
configs/olimex-strp711/nettest/defconfig | 3 -
configs/olimex-strp711/nsh/defconfig | 3 -
configs/olimex-strp711/ostest/defconfig | 3 -
configs/pjrc-8051/defconfig | 3 -
configs/qemu-i486/nsh/defconfig | 3 -
configs/qemu-i486/ostest/defconfig | 3 -
configs/sam3u-ek/kernel/Makefile | 12 +-
configs/sam3u-ek/kernel/kernel.ld | 6 +
configs/sam3u-ek/knsh/defconfig | 3 -
configs/sam3u-ek/nsh/defconfig | 3 -
configs/sam3u-ek/nx/defconfig | 3 -
configs/sam3u-ek/ostest/defconfig | 3 -
configs/sim/mount/defconfig | 3 -
configs/sim/nettest/defconfig | 3 -
configs/sim/nsh/defconfig | 3 -
configs/sim/nx/defconfig | 3 -
configs/sim/nx/defconfig-x11 | 3 -
configs/sim/ostest/defconfig | 3 -
configs/sim/pashello/defconfig | 3 -
configs/skp16c26/ostest/defconfig | 3 -
configs/stm3210e-eval/RIDE/defconfig | 3 -
configs/stm3210e-eval/nsh/defconfig | 3 -
configs/stm3210e-eval/ostest/defconfig | 3 -
configs/stm3210e-eval/usbserial/defconfig | 3 -
configs/stm3210e-eval/usbstorage/defconfig | 3 -
configs/us7032evb1/nsh/defconfig | 3 -
configs/us7032evb1/ostest/defconfig | 3 -
configs/vsn/nsh/defconfig | 3 -
configs/xtrs/nsh/defconfig | 3 -
configs/xtrs/ostest/defconfig | 3 -
configs/xtrs/pashello/defconfig | 3 -
configs/z16f2800100zcog/ostest/defconfig | 3 -
configs/z16f2800100zcog/pashello/defconfig | 3 -
configs/z80sim/nsh/defconfig | 3 -
configs/z80sim/ostest/defconfig | 3 -
configs/z80sim/pashello/defconfig | 3 -
configs/z8encore000zco/ostest/defconfig | 3 -
configs/z8f64200100kit/ostest/defconfig | 3 -
include/nuttx/kmalloc.h | 43 +++----
sched/Makefile | 6 +
sched/env_putenv.c | 1 +
sched/env_setenv.c | 1 +
sched/kmm_kfree.c | 110 ++++++++++++++++++
sched/kmm_kmalloc.c | 110 ++++++++++++++++++
sched/kmm_krealloc.c | 110 ++++++++++++++++++
sched/kmm_kzalloc.c | 110 ++++++++++++++++++
sched/task_delete.c | 12 +-
sched/timer_delete.c | 1 +
117 files changed, 496 insertions(+), 343 deletions(-)
create mode 100644 sched/kmm_kfree.c
create mode 100644 sched/kmm_kmalloc.c
create mode 100644 sched/kmm_krealloc.c
create mode 100644 sched/kmm_kzalloc.c
diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html
index eaa603a4a1..1f27a55653 100644
--- a/Documentation/NuttxPortingGuide.html
+++ b/Documentation/NuttxPortingGuide.html
@@ -12,7 +12,7 @@
NuttX RTOS Porting Guide
- Last Updated: April 3, 2011
+ Last Updated: April 5, 2011
@@ -3209,8 +3209,7 @@ build
CONFIG_ARCH_MEMCPY
, CONFIG_ARCH_MEMCMP
, CONFIG_ARCH_MEMMOVE
,
CONFIG_ARCH_MEMSET
, CONFIG_ARCH_STRCMP
, CONFIG_ARCH_STRCPY
,
CONFIG_ARCH_STRNCPY
, CONFIG_ARCH_STRLEN
, CONFIG_ARCH_STRNLEN
,
- CONFIG_ARCH_BZERO
, CONFIG_ARCH_KMALLOC
, CONFIG_ARCH_KZMALLOC
,
- ONFIG_ARCH_KFREE
,
+ CONFIG_ARCH_BZERO
diff --git a/configs/README.txt b/configs/README.txt
index 560aa2a114..ed3462b281 100644
--- a/configs/README.txt
+++ b/configs/README.txt
@@ -478,8 +478,7 @@ defconfig -- This is a configuration file similar to the Linux
CONFIG_ARCH_MEMCPY, CONFIG_ARCH_MEMCMP, CONFIG_ARCH_MEMMOVE
CONFIG_ARCH_MEMSET, CONFIG_ARCH_STRCMP, CONFIG_ARCH_STRCPY
CONFIG_ARCH_STRNCPY, CONFIG_ARCH_STRLEN, CONFIG_ARCH_STRNLEN
- CONFIG_ARCH_BZERO, CONFIG_ARCH_KMALLOC, CONFIG_ARCH_KZMALLOC
- CONFIG_ARCH_KFREE
+ CONFIG_ARCH_BZERO
Sizes of configurable things (0 disables)
diff --git a/configs/avr32dev1/nsh/defconfig b/configs/avr32dev1/nsh/defconfig
index bbe3a92f98..20793d48b6 100755
--- a/configs/avr32dev1/nsh/defconfig
+++ b/configs/avr32dev1/nsh/defconfig
@@ -383,9 +383,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/avr32dev1/ostest/defconfig b/configs/avr32dev1/ostest/defconfig
index c689843530..7039557bc2 100755
--- a/configs/avr32dev1/ostest/defconfig
+++ b/configs/avr32dev1/ostest/defconfig
@@ -383,9 +383,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/c5471evm/httpd/defconfig b/configs/c5471evm/httpd/defconfig
index e7e3479f84..6f27c57088 100644
--- a/configs/c5471evm/httpd/defconfig
+++ b/configs/c5471evm/httpd/defconfig
@@ -272,9 +272,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/c5471evm/nettest/defconfig b/configs/c5471evm/nettest/defconfig
index fb35d1ee85..07b217fcaf 100644
--- a/configs/c5471evm/nettest/defconfig
+++ b/configs/c5471evm/nettest/defconfig
@@ -272,9 +272,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/c5471evm/nsh/defconfig b/configs/c5471evm/nsh/defconfig
index 026d761ba9..81b09c5700 100644
--- a/configs/c5471evm/nsh/defconfig
+++ b/configs/c5471evm/nsh/defconfig
@@ -272,9 +272,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/c5471evm/ostest/defconfig b/configs/c5471evm/ostest/defconfig
index 2cbc0fe513..d265a2b33d 100644
--- a/configs/c5471evm/ostest/defconfig
+++ b/configs/c5471evm/ostest/defconfig
@@ -272,9 +272,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/demo9s12ne64/ostest/defconfig b/configs/demo9s12ne64/ostest/defconfig
index b5b4327598..e3542a07c2 100755
--- a/configs/demo9s12ne64/ostest/defconfig
+++ b/configs/demo9s12ne64/ostest/defconfig
@@ -362,9 +362,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/detron/hidkbd/defconfig b/configs/detron/hidkbd/defconfig
index 28efc6d742..b359b2953e 100755
--- a/configs/detron/hidkbd/defconfig
+++ b/configs/detron/hidkbd/defconfig
@@ -402,9 +402,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/detron/nsh/defconfig b/configs/detron/nsh/defconfig
index c8af3917b6..326ba47d9d 100755
--- a/configs/detron/nsh/defconfig
+++ b/configs/detron/nsh/defconfig
@@ -407,9 +407,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/detron/ostest/defconfig b/configs/detron/ostest/defconfig
index f247c9a2a2..115ee6b742 100755
--- a/configs/detron/ostest/defconfig
+++ b/configs/detron/ostest/defconfig
@@ -397,9 +397,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/detron/wlan/defconfig b/configs/detron/wlan/defconfig
index 7bb17be90b..6ab071b014 100755
--- a/configs/detron/wlan/defconfig
+++ b/configs/detron/wlan/defconfig
@@ -406,9 +406,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ea3131/nsh/defconfig b/configs/ea3131/nsh/defconfig
index 712c85fd8c..9c6faa8ace 100755
--- a/configs/ea3131/nsh/defconfig
+++ b/configs/ea3131/nsh/defconfig
@@ -368,9 +368,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ea3131/ostest/defconfig b/configs/ea3131/ostest/defconfig
index c09f0c00be..9df0b90c12 100755
--- a/configs/ea3131/ostest/defconfig
+++ b/configs/ea3131/ostest/defconfig
@@ -368,9 +368,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ea3131/pgnsh/defconfig b/configs/ea3131/pgnsh/defconfig
index aa18038b99..471792d591 100755
--- a/configs/ea3131/pgnsh/defconfig
+++ b/configs/ea3131/pgnsh/defconfig
@@ -514,9 +514,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ea3131/usbserial/defconfig b/configs/ea3131/usbserial/defconfig
index 4b2530af63..f5df530024 100755
--- a/configs/ea3131/usbserial/defconfig
+++ b/configs/ea3131/usbserial/defconfig
@@ -370,9 +370,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ea3131/usbstorage/defconfig b/configs/ea3131/usbstorage/defconfig
index da1f5afc78..e8cb6216ef 100755
--- a/configs/ea3131/usbstorage/defconfig
+++ b/configs/ea3131/usbstorage/defconfig
@@ -370,9 +370,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/eagle100/httpd/defconfig b/configs/eagle100/httpd/defconfig
index 4d819930b0..78eda467df 100644
--- a/configs/eagle100/httpd/defconfig
+++ b/configs/eagle100/httpd/defconfig
@@ -341,9 +341,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/eagle100/nettest/defconfig b/configs/eagle100/nettest/defconfig
index f7810a201b..31c4e39464 100644
--- a/configs/eagle100/nettest/defconfig
+++ b/configs/eagle100/nettest/defconfig
@@ -341,9 +341,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/eagle100/nsh/defconfig b/configs/eagle100/nsh/defconfig
index b20d339d72..d3a4642b05 100644
--- a/configs/eagle100/nsh/defconfig
+++ b/configs/eagle100/nsh/defconfig
@@ -340,9 +340,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/eagle100/nxflat/defconfig b/configs/eagle100/nxflat/defconfig
index dd5c46a4bf..d6782d333c 100644
--- a/configs/eagle100/nxflat/defconfig
+++ b/configs/eagle100/nxflat/defconfig
@@ -353,9 +353,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/eagle100/ostest/defconfig b/configs/eagle100/ostest/defconfig
index 321a0911a4..2f531a06e5 100644
--- a/configs/eagle100/ostest/defconfig
+++ b/configs/eagle100/ostest/defconfig
@@ -347,9 +347,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/eagle100/thttpd/defconfig b/configs/eagle100/thttpd/defconfig
index 0008b8e75d..08a6f4835a 100644
--- a/configs/eagle100/thttpd/defconfig
+++ b/configs/eagle100/thttpd/defconfig
@@ -360,9 +360,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ez80f910200kitg/ostest/defconfig b/configs/ez80f910200kitg/ostest/defconfig
index fe23817c13..93960cd508 100644
--- a/configs/ez80f910200kitg/ostest/defconfig
+++ b/configs/ez80f910200kitg/ostest/defconfig
@@ -306,9 +306,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ez80f910200zco/dhcpd/defconfig b/configs/ez80f910200zco/dhcpd/defconfig
index 9270d05228..d2540d204d 100644
--- a/configs/ez80f910200zco/dhcpd/defconfig
+++ b/configs/ez80f910200zco/dhcpd/defconfig
@@ -312,9 +312,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ez80f910200zco/httpd/defconfig b/configs/ez80f910200zco/httpd/defconfig
index 026ccdd085..1cbea1a6dd 100644
--- a/configs/ez80f910200zco/httpd/defconfig
+++ b/configs/ez80f910200zco/httpd/defconfig
@@ -312,9 +312,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ez80f910200zco/nettest/defconfig b/configs/ez80f910200zco/nettest/defconfig
index 746bd02247..5cf42e7e06 100644
--- a/configs/ez80f910200zco/nettest/defconfig
+++ b/configs/ez80f910200zco/nettest/defconfig
@@ -312,9 +312,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ez80f910200zco/nsh/defconfig b/configs/ez80f910200zco/nsh/defconfig
index c866e95428..78741dad29 100644
--- a/configs/ez80f910200zco/nsh/defconfig
+++ b/configs/ez80f910200zco/nsh/defconfig
@@ -312,9 +312,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ez80f910200zco/ostest/defconfig b/configs/ez80f910200zco/ostest/defconfig
index 2bb4ce44e4..4ab55d5f36 100644
--- a/configs/ez80f910200zco/ostest/defconfig
+++ b/configs/ez80f910200zco/ostest/defconfig
@@ -309,9 +309,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ez80f910200zco/poll/defconfig b/configs/ez80f910200zco/poll/defconfig
index b5cde349f3..6d08c03915 100644
--- a/configs/ez80f910200zco/poll/defconfig
+++ b/configs/ez80f910200zco/poll/defconfig
@@ -312,9 +312,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/lm3s6965-ek/nsh/defconfig b/configs/lm3s6965-ek/nsh/defconfig
index 77357971f5..27d09a8681 100755
--- a/configs/lm3s6965-ek/nsh/defconfig
+++ b/configs/lm3s6965-ek/nsh/defconfig
@@ -362,9 +362,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/lm3s6965-ek/nx/defconfig b/configs/lm3s6965-ek/nx/defconfig
index a0f1555593..8c89c0594c 100755
--- a/configs/lm3s6965-ek/nx/defconfig
+++ b/configs/lm3s6965-ek/nx/defconfig
@@ -368,9 +368,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/lm3s6965-ek/ostest/defconfig b/configs/lm3s6965-ek/ostest/defconfig
index 933db9a5a9..7c678b3a4a 100755
--- a/configs/lm3s6965-ek/ostest/defconfig
+++ b/configs/lm3s6965-ek/ostest/defconfig
@@ -361,9 +361,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/lm3s8962-ek/nsh/defconfig b/configs/lm3s8962-ek/nsh/defconfig
index add9a61678..ef71ef6629 100755
--- a/configs/lm3s8962-ek/nsh/defconfig
+++ b/configs/lm3s8962-ek/nsh/defconfig
@@ -362,9 +362,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/lm3s8962-ek/nx/defconfig b/configs/lm3s8962-ek/nx/defconfig
index 1be795ecd6..24d9e0ebc3 100755
--- a/configs/lm3s8962-ek/nx/defconfig
+++ b/configs/lm3s8962-ek/nx/defconfig
@@ -368,9 +368,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/lm3s8962-ek/ostest/defconfig b/configs/lm3s8962-ek/ostest/defconfig
index db9304a4cc..a858ea3eba 100755
--- a/configs/lm3s8962-ek/ostest/defconfig
+++ b/configs/lm3s8962-ek/ostest/defconfig
@@ -361,9 +361,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/m68332evb/defconfig b/configs/m68332evb/defconfig
index ddd7fcbf6a..7af074c760 100644
--- a/configs/m68332evb/defconfig
+++ b/configs/m68332evb/defconfig
@@ -238,9 +238,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/mbed/hidkbd/defconfig b/configs/mbed/hidkbd/defconfig
index dbda7b3e3f..25260cee97 100644
--- a/configs/mbed/hidkbd/defconfig
+++ b/configs/mbed/hidkbd/defconfig
@@ -405,9 +405,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/mbed/nsh/defconfig b/configs/mbed/nsh/defconfig
index 905a11a7fe..308e58bda2 100755
--- a/configs/mbed/nsh/defconfig
+++ b/configs/mbed/nsh/defconfig
@@ -397,9 +397,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/mcu123-lpc214x/nsh/defconfig b/configs/mcu123-lpc214x/nsh/defconfig
index 66f9def27c..c5dad88257 100644
--- a/configs/mcu123-lpc214x/nsh/defconfig
+++ b/configs/mcu123-lpc214x/nsh/defconfig
@@ -276,9 +276,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/mcu123-lpc214x/ostest/defconfig b/configs/mcu123-lpc214x/ostest/defconfig
index 1e47a77a22..5446b0ca8d 100644
--- a/configs/mcu123-lpc214x/ostest/defconfig
+++ b/configs/mcu123-lpc214x/ostest/defconfig
@@ -276,9 +276,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/mcu123-lpc214x/usbserial/defconfig b/configs/mcu123-lpc214x/usbserial/defconfig
index 5ae98dba85..0f8d4925a3 100644
--- a/configs/mcu123-lpc214x/usbserial/defconfig
+++ b/configs/mcu123-lpc214x/usbserial/defconfig
@@ -276,9 +276,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/mcu123-lpc214x/usbstorage/defconfig b/configs/mcu123-lpc214x/usbstorage/defconfig
index f4e4237808..21c09e07cc 100644
--- a/configs/mcu123-lpc214x/usbstorage/defconfig
+++ b/configs/mcu123-lpc214x/usbstorage/defconfig
@@ -277,9 +277,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/mx1ads/ostest/defconfig b/configs/mx1ads/ostest/defconfig
index 81f271ec00..ea908547fd 100644
--- a/configs/mx1ads/ostest/defconfig
+++ b/configs/mx1ads/ostest/defconfig
@@ -292,9 +292,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ne64badge/ostest/defconfig b/configs/ne64badge/ostest/defconfig
index 61f09986d7..c46d58d432 100755
--- a/configs/ne64badge/ostest/defconfig
+++ b/configs/ne64badge/ostest/defconfig
@@ -373,9 +373,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ntosd-dm320/nettest/defconfig b/configs/ntosd-dm320/nettest/defconfig
index 216eff7e74..87fd5d140e 100644
--- a/configs/ntosd-dm320/nettest/defconfig
+++ b/configs/ntosd-dm320/nettest/defconfig
@@ -280,9 +280,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ntosd-dm320/nsh/defconfig b/configs/ntosd-dm320/nsh/defconfig
index d46a1b6c5d..78f2aeddb9 100644
--- a/configs/ntosd-dm320/nsh/defconfig
+++ b/configs/ntosd-dm320/nsh/defconfig
@@ -279,9 +279,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ntosd-dm320/ostest/defconfig b/configs/ntosd-dm320/ostest/defconfig
index f9b863c280..246bbae293 100644
--- a/configs/ntosd-dm320/ostest/defconfig
+++ b/configs/ntosd-dm320/ostest/defconfig
@@ -280,9 +280,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ntosd-dm320/poll/defconfig b/configs/ntosd-dm320/poll/defconfig
index bb584936a8..51c9981bf0 100644
--- a/configs/ntosd-dm320/poll/defconfig
+++ b/configs/ntosd-dm320/poll/defconfig
@@ -280,9 +280,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ntosd-dm320/thttpd/defconfig b/configs/ntosd-dm320/thttpd/defconfig
index d92b971d1a..886af9e890 100644
--- a/configs/ntosd-dm320/thttpd/defconfig
+++ b/configs/ntosd-dm320/thttpd/defconfig
@@ -305,9 +305,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ntosd-dm320/udp/defconfig b/configs/ntosd-dm320/udp/defconfig
index a9dc75dcf4..67c204bb26 100644
--- a/configs/ntosd-dm320/udp/defconfig
+++ b/configs/ntosd-dm320/udp/defconfig
@@ -280,9 +280,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/ntosd-dm320/uip/defconfig b/configs/ntosd-dm320/uip/defconfig
index 5b8b8d8788..2b0d101e61 100644
--- a/configs/ntosd-dm320/uip/defconfig
+++ b/configs/ntosd-dm320/uip/defconfig
@@ -280,9 +280,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/nucleus2g/nsh/defconfig b/configs/nucleus2g/nsh/defconfig
index 7c8bc2c173..4dc066b8a8 100755
--- a/configs/nucleus2g/nsh/defconfig
+++ b/configs/nucleus2g/nsh/defconfig
@@ -401,9 +401,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/nucleus2g/ostest/defconfig b/configs/nucleus2g/ostest/defconfig
index 0b8df61243..82549346cd 100755
--- a/configs/nucleus2g/ostest/defconfig
+++ b/configs/nucleus2g/ostest/defconfig
@@ -397,9 +397,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/nucleus2g/usbserial/defconfig b/configs/nucleus2g/usbserial/defconfig
index f20eed8f36..7d9ed920fa 100755
--- a/configs/nucleus2g/usbserial/defconfig
+++ b/configs/nucleus2g/usbserial/defconfig
@@ -398,9 +398,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/nucleus2g/usbstorage/defconfig b/configs/nucleus2g/usbstorage/defconfig
index 4eeac6d4fb..6d852d94b1 100755
--- a/configs/nucleus2g/usbstorage/defconfig
+++ b/configs/nucleus2g/usbstorage/defconfig
@@ -398,9 +398,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/olimex-lpc1766stk/hidkbd/defconfig b/configs/olimex-lpc1766stk/hidkbd/defconfig
index a55ba91a9a..5da615c1b1 100755
--- a/configs/olimex-lpc1766stk/hidkbd/defconfig
+++ b/configs/olimex-lpc1766stk/hidkbd/defconfig
@@ -405,9 +405,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/olimex-lpc1766stk/nettest/defconfig b/configs/olimex-lpc1766stk/nettest/defconfig
index 353036bfd4..87a8de9885 100755
--- a/configs/olimex-lpc1766stk/nettest/defconfig
+++ b/configs/olimex-lpc1766stk/nettest/defconfig
@@ -405,9 +405,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/olimex-lpc1766stk/nsh/defconfig b/configs/olimex-lpc1766stk/nsh/defconfig
index db03deeeae..5c8bcf0673 100755
--- a/configs/olimex-lpc1766stk/nsh/defconfig
+++ b/configs/olimex-lpc1766stk/nsh/defconfig
@@ -405,9 +405,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/olimex-lpc1766stk/nx/defconfig b/configs/olimex-lpc1766stk/nx/defconfig
index 2d61bca84b..b0a8b795ba 100755
--- a/configs/olimex-lpc1766stk/nx/defconfig
+++ b/configs/olimex-lpc1766stk/nx/defconfig
@@ -409,9 +409,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/olimex-lpc1766stk/ostest/defconfig b/configs/olimex-lpc1766stk/ostest/defconfig
index 4122d8d09b..01f6e418bc 100755
--- a/configs/olimex-lpc1766stk/ostest/defconfig
+++ b/configs/olimex-lpc1766stk/ostest/defconfig
@@ -398,9 +398,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/olimex-lpc1766stk/slip-httpd/defconfig b/configs/olimex-lpc1766stk/slip-httpd/defconfig
index 71a5109dfc..068d44f8a1 100755
--- a/configs/olimex-lpc1766stk/slip-httpd/defconfig
+++ b/configs/olimex-lpc1766stk/slip-httpd/defconfig
@@ -416,9 +416,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/olimex-lpc1766stk/thttpd/defconfig b/configs/olimex-lpc1766stk/thttpd/defconfig
index b92d886d54..f51f083a8b 100755
--- a/configs/olimex-lpc1766stk/thttpd/defconfig
+++ b/configs/olimex-lpc1766stk/thttpd/defconfig
@@ -414,9 +414,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/olimex-lpc1766stk/usbserial/defconfig b/configs/olimex-lpc1766stk/usbserial/defconfig
index 73f52406db..f5237146f2 100755
--- a/configs/olimex-lpc1766stk/usbserial/defconfig
+++ b/configs/olimex-lpc1766stk/usbserial/defconfig
@@ -399,9 +399,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/olimex-lpc1766stk/usbstorage/defconfig b/configs/olimex-lpc1766stk/usbstorage/defconfig
index 841601f744..c7ecd01876 100755
--- a/configs/olimex-lpc1766stk/usbstorage/defconfig
+++ b/configs/olimex-lpc1766stk/usbstorage/defconfig
@@ -399,9 +399,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/olimex-lpc1766stk/wlan/defconfig b/configs/olimex-lpc1766stk/wlan/defconfig
index 00c02552f8..7a8441feb4 100755
--- a/configs/olimex-lpc1766stk/wlan/defconfig
+++ b/configs/olimex-lpc1766stk/wlan/defconfig
@@ -405,9 +405,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/olimex-lpc2378/nsh/defconfig b/configs/olimex-lpc2378/nsh/defconfig
index 597b80d5db..7aaeb27ae2 100755
--- a/configs/olimex-lpc2378/nsh/defconfig
+++ b/configs/olimex-lpc2378/nsh/defconfig
@@ -266,9 +266,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/olimex-lpc2378/ostest/defconfig b/configs/olimex-lpc2378/ostest/defconfig
index a7b0b25d5e..3e10937235 100755
--- a/configs/olimex-lpc2378/ostest/defconfig
+++ b/configs/olimex-lpc2378/ostest/defconfig
@@ -266,9 +266,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/olimex-strp711/nettest/defconfig b/configs/olimex-strp711/nettest/defconfig
index 9179ae8d3c..159c5916a9 100755
--- a/configs/olimex-strp711/nettest/defconfig
+++ b/configs/olimex-strp711/nettest/defconfig
@@ -367,9 +367,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/olimex-strp711/nsh/defconfig b/configs/olimex-strp711/nsh/defconfig
index a8ba527095..cf324c4dc9 100644
--- a/configs/olimex-strp711/nsh/defconfig
+++ b/configs/olimex-strp711/nsh/defconfig
@@ -343,9 +343,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/olimex-strp711/ostest/defconfig b/configs/olimex-strp711/ostest/defconfig
index dc81b213fb..d914aaa74e 100644
--- a/configs/olimex-strp711/ostest/defconfig
+++ b/configs/olimex-strp711/ostest/defconfig
@@ -343,9 +343,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/pjrc-8051/defconfig b/configs/pjrc-8051/defconfig
index 2ae280ff16..811d346b56 100644
--- a/configs/pjrc-8051/defconfig
+++ b/configs/pjrc-8051/defconfig
@@ -236,9 +236,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/qemu-i486/nsh/defconfig b/configs/qemu-i486/nsh/defconfig
index 3a70e23f3c..9660d737af 100644
--- a/configs/qemu-i486/nsh/defconfig
+++ b/configs/qemu-i486/nsh/defconfig
@@ -297,9 +297,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# General build options
diff --git a/configs/qemu-i486/ostest/defconfig b/configs/qemu-i486/ostest/defconfig
index 140dc90326..1de2636518 100644
--- a/configs/qemu-i486/ostest/defconfig
+++ b/configs/qemu-i486/ostest/defconfig
@@ -213,9 +213,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# General build options
diff --git a/configs/sam3u-ek/kernel/Makefile b/configs/sam3u-ek/kernel/Makefile
index 38abe2b0a3..5f7d939b23 100755
--- a/configs/sam3u-ek/kernel/Makefile
+++ b/configs/sam3u-ek/kernel/Makefile
@@ -88,14 +88,20 @@ $(BOARD_INCLUDE)/user_map.h: $(TOPDIR)/User.map
@echo "/* General memory map */" >> $(BOARD_INCLUDE)/user_map.h
@echo "" >> $(BOARD_INCLUDE)/user_map.h
@echo "#define CONFIG_USER_ENTRYPOINT 0x`grep \" user_start$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
- @echo "#define CONFIG_USER_DATASOURCE 0x`grep \" _eronly$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
- @echo "#define CONFIG_USER_DATADESTSTART 0x`grep \" _sdata$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
- @echo "#define CONFIG_USER_DATADESTEND 0x`grep \" _edata$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_DATASOURCE 0x`grep \" _eronly$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_DATADESTSTART 0x`grep \" _sdata$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_DATADESTEND 0x`grep \" _edata$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
@echo "" >> $(BOARD_INCLUDE)/user_map.h
@echo "/* Memory manager entry points */" >> $(BOARD_INCLUDE)/user_map.h
@echo "" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_MMINIT 0x`grep \" mm_initialize$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_MMADDREGION 0x`grep \" mm_addregion$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_TRYSEM 0x`grep \" mm_trysemaphore$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_GIVSEM 0x`grep \" mm_givesemaphore$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "" >> $(BOARD_INCLUDE)/user_map.h
@echo "#define CONFIG_USER_MALLOC 0x`grep \" malloc$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
@echo "#define CONFIG_USER_REALLOC 0x`grep \" realloc$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
+ @echo "#define CONFIG_USER_ZALLOC 0x`grep \" zalloc$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
@echo "#define CONFIG_USER_FREE 0x`grep \" free$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h
@echo "" >> $(BOARD_INCLUDE)/user_map.h
@echo "#endif /* __ARCH_BOARD_USER_MAP_H */" >> $(BOARD_INCLUDE)/user_map.h
diff --git a/configs/sam3u-ek/kernel/kernel.ld b/configs/sam3u-ek/kernel/kernel.ld
index 2679639784..b15188787c 100644
--- a/configs/sam3u-ek/kernel/kernel.ld
+++ b/configs/sam3u-ek/kernel/kernel.ld
@@ -70,8 +70,14 @@ EXTERN(user_start)
# Currently, the plan is that the memory manager will reside in user-space
# but be usable both by kernel- and user-space code
+EXTERN(mm_initialize)
+EXTERN(mm_addregion)
+EXTERN(mm_trysemaphore)
+EXTERN(mm_givesemaphore)
+
EXTERN(malloc)
EXTERN(realloc)
+EXTERN(zalloc)
EXTERN(free)
OUTPUT_ARCH(arm)
diff --git a/configs/sam3u-ek/knsh/defconfig b/configs/sam3u-ek/knsh/defconfig
index 6602685c53..b2bed075a0 100755
--- a/configs/sam3u-ek/knsh/defconfig
+++ b/configs/sam3u-ek/knsh/defconfig
@@ -397,9 +397,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/sam3u-ek/nsh/defconfig b/configs/sam3u-ek/nsh/defconfig
index 5e44d5fe54..d1b271e282 100755
--- a/configs/sam3u-ek/nsh/defconfig
+++ b/configs/sam3u-ek/nsh/defconfig
@@ -370,9 +370,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/sam3u-ek/nx/defconfig b/configs/sam3u-ek/nx/defconfig
index 6c11f93aef..f06c2c2341 100755
--- a/configs/sam3u-ek/nx/defconfig
+++ b/configs/sam3u-ek/nx/defconfig
@@ -371,9 +371,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/sam3u-ek/ostest/defconfig b/configs/sam3u-ek/ostest/defconfig
index f5991cdc5a..a90e7cc7ac 100755
--- a/configs/sam3u-ek/ostest/defconfig
+++ b/configs/sam3u-ek/ostest/defconfig
@@ -371,9 +371,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/sim/mount/defconfig b/configs/sim/mount/defconfig
index f829db30c3..9738f8cbd1 100644
--- a/configs/sim/mount/defconfig
+++ b/configs/sim/mount/defconfig
@@ -185,9 +185,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# General build options
diff --git a/configs/sim/nettest/defconfig b/configs/sim/nettest/defconfig
index 378a0cf3e2..88e899f610 100644
--- a/configs/sim/nettest/defconfig
+++ b/configs/sim/nettest/defconfig
@@ -185,9 +185,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# General build options
diff --git a/configs/sim/nsh/defconfig b/configs/sim/nsh/defconfig
index 5bc0c34c76..7cd746c6ee 100644
--- a/configs/sim/nsh/defconfig
+++ b/configs/sim/nsh/defconfig
@@ -185,9 +185,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# General build options
diff --git a/configs/sim/nx/defconfig b/configs/sim/nx/defconfig
index f2d13ac0ed..2d5825f513 100644
--- a/configs/sim/nx/defconfig
+++ b/configs/sim/nx/defconfig
@@ -193,9 +193,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# General build options
diff --git a/configs/sim/nx/defconfig-x11 b/configs/sim/nx/defconfig-x11
index f53d6c1b5c..ec90d0181b 100644
--- a/configs/sim/nx/defconfig-x11
+++ b/configs/sim/nx/defconfig-x11
@@ -193,9 +193,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# General build options
diff --git a/configs/sim/ostest/defconfig b/configs/sim/ostest/defconfig
index 7c998e8472..f970524f5f 100644
--- a/configs/sim/ostest/defconfig
+++ b/configs/sim/ostest/defconfig
@@ -185,9 +185,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
##
# General build options
diff --git a/configs/sim/pashello/defconfig b/configs/sim/pashello/defconfig
index f697e247da..082bd66a0d 100644
--- a/configs/sim/pashello/defconfig
+++ b/configs/sim/pashello/defconfig
@@ -185,9 +185,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# General build options
diff --git a/configs/skp16c26/ostest/defconfig b/configs/skp16c26/ostest/defconfig
index 1b611c63c2..363c9a4323 100644
--- a/configs/skp16c26/ostest/defconfig
+++ b/configs/skp16c26/ostest/defconfig
@@ -283,9 +283,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/stm3210e-eval/RIDE/defconfig b/configs/stm3210e-eval/RIDE/defconfig
index 78da2fa7ea..b802ef9f40 100755
--- a/configs/stm3210e-eval/RIDE/defconfig
+++ b/configs/stm3210e-eval/RIDE/defconfig
@@ -394,9 +394,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/stm3210e-eval/nsh/defconfig b/configs/stm3210e-eval/nsh/defconfig
index 384a96a1a7..2ec1edc330 100755
--- a/configs/stm3210e-eval/nsh/defconfig
+++ b/configs/stm3210e-eval/nsh/defconfig
@@ -403,9 +403,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/stm3210e-eval/ostest/defconfig b/configs/stm3210e-eval/ostest/defconfig
index 9a4a8bb0a1..8df5955cb6 100755
--- a/configs/stm3210e-eval/ostest/defconfig
+++ b/configs/stm3210e-eval/ostest/defconfig
@@ -405,9 +405,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/stm3210e-eval/usbserial/defconfig b/configs/stm3210e-eval/usbserial/defconfig
index e4b640ea01..78d2f9472f 100755
--- a/configs/stm3210e-eval/usbserial/defconfig
+++ b/configs/stm3210e-eval/usbserial/defconfig
@@ -406,9 +406,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/stm3210e-eval/usbstorage/defconfig b/configs/stm3210e-eval/usbstorage/defconfig
index 48b4480e41..2f407ee962 100755
--- a/configs/stm3210e-eval/usbstorage/defconfig
+++ b/configs/stm3210e-eval/usbstorage/defconfig
@@ -405,9 +405,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/us7032evb1/nsh/defconfig b/configs/us7032evb1/nsh/defconfig
index 768a83d5fb..eb023ecb2a 100644
--- a/configs/us7032evb1/nsh/defconfig
+++ b/configs/us7032evb1/nsh/defconfig
@@ -287,9 +287,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/us7032evb1/ostest/defconfig b/configs/us7032evb1/ostest/defconfig
index 06326b2ab9..40cd908f96 100644
--- a/configs/us7032evb1/ostest/defconfig
+++ b/configs/us7032evb1/ostest/defconfig
@@ -287,9 +287,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/vsn/nsh/defconfig b/configs/vsn/nsh/defconfig
index b51342cb52..916ff5d9e1 100755
--- a/configs/vsn/nsh/defconfig
+++ b/configs/vsn/nsh/defconfig
@@ -446,9 +446,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/xtrs/nsh/defconfig b/configs/xtrs/nsh/defconfig
index 9fdcc52372..ec73f289f6 100644
--- a/configs/xtrs/nsh/defconfig
+++ b/configs/xtrs/nsh/defconfig
@@ -232,9 +232,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/xtrs/ostest/defconfig b/configs/xtrs/ostest/defconfig
index e067876367..00c7cf090f 100644
--- a/configs/xtrs/ostest/defconfig
+++ b/configs/xtrs/ostest/defconfig
@@ -232,9 +232,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/xtrs/pashello/defconfig b/configs/xtrs/pashello/defconfig
index b5e4a68b03..942d7f732e 100644
--- a/configs/xtrs/pashello/defconfig
+++ b/configs/xtrs/pashello/defconfig
@@ -232,9 +232,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/z16f2800100zcog/ostest/defconfig b/configs/z16f2800100zcog/ostest/defconfig
index a1d304ed79..b84cc5040d 100644
--- a/configs/z16f2800100zcog/ostest/defconfig
+++ b/configs/z16f2800100zcog/ostest/defconfig
@@ -260,9 +260,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/z16f2800100zcog/pashello/defconfig b/configs/z16f2800100zcog/pashello/defconfig
index 6103d82369..c253f9aaaa 100644
--- a/configs/z16f2800100zcog/pashello/defconfig
+++ b/configs/z16f2800100zcog/pashello/defconfig
@@ -260,9 +260,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/z80sim/nsh/defconfig b/configs/z80sim/nsh/defconfig
index ad71864ef5..58b1538b1d 100644
--- a/configs/z80sim/nsh/defconfig
+++ b/configs/z80sim/nsh/defconfig
@@ -222,9 +222,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/z80sim/ostest/defconfig b/configs/z80sim/ostest/defconfig
index 32db986071..80bad06812 100644
--- a/configs/z80sim/ostest/defconfig
+++ b/configs/z80sim/ostest/defconfig
@@ -222,9 +222,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/z80sim/pashello/defconfig b/configs/z80sim/pashello/defconfig
index 6c5d3724ac..4f0a2ef0fa 100644
--- a/configs/z80sim/pashello/defconfig
+++ b/configs/z80sim/pashello/defconfig
@@ -222,9 +222,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/z8encore000zco/ostest/defconfig b/configs/z8encore000zco/ostest/defconfig
index 6d89cca843..0b87b751bb 100644
--- a/configs/z8encore000zco/ostest/defconfig
+++ b/configs/z8encore000zco/ostest/defconfig
@@ -256,9 +256,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/configs/z8f64200100kit/ostest/defconfig b/configs/z8f64200100kit/ostest/defconfig
index d814d7fcc4..c552987bc1 100644
--- a/configs/z8f64200100kit/ostest/defconfig
+++ b/configs/z8f64200100kit/ostest/defconfig
@@ -256,9 +256,6 @@ CONFIG_ARCH_STRNCPY=n
CONFIG_ARCH_STRLEN=n
CONFIG_ARCH_STRNLEN=n
CONFIG_ARCH_BZERO=n
-CONFIG_ARCH_KMALLOC=n
-CONFIG_ARCH_KZMALLOC=n
-CONFIG_ARCH_KFREE=n
#
# Sizes of configurable things (0 disables)
diff --git a/include/nuttx/kmalloc.h b/include/nuttx/kmalloc.h
index 7fb37a5d04..08b1b319bb 100644
--- a/include/nuttx/kmalloc.h
+++ b/include/nuttx/kmalloc.h
@@ -43,12 +43,16 @@
#include
#include
+#ifndef CONFIG_NUTTX_KERNEL
+# include
+#endif
+
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
- * Public Function Prototypes
+ * Public Data
****************************************************************************/
#undef KMALLOC_EXTERN
@@ -59,32 +63,29 @@ extern "C" {
# define KMALLOC_EXTERN extern
#endif
-#ifndef CONFIG_ARCH_KMALLOC
-# include
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/* For a monolithic, kernel-mode NuttX build. Special allocators must be
+ * used. Otherwise, the standard allocators prototyped in stdlib.h may
+ * be used for both the kernel- and user-mode objects.
+ */
+
+#ifndef CONFIG_NUTTX_KERNEL
+
# define kmalloc(s) malloc(s)
-#else
-KMALLOC_EXTERN FAR void *kmalloc(size_t);
-#endif
-
-#ifndef CONFIG_ARCH_KZALLOC
-# include
# define kzalloc(s) zalloc(s)
-#else
-KMALLOC_EXTERN FAR void *kzalloc(size_t);
-#endif
-
-#ifndef CONFIG_ARCH_KREALLOC
-# include
# define krealloc(p,s) realloc(p,s)
-#else
-KMALLOC_EXTERN FAR void *krealloc(FAR void*, size_t);
-#endif
-
-#ifndef CONFIG_ARCH_KFREE
-# include
# define kfree(p) free(p)
+
#else
+
+KMALLOC_EXTERN FAR void *kmalloc(size_t);
+KMALLOC_EXTERN FAR void *kzalloc(size_t);
+KMALLOC_EXTERN FAR void *krealloc(FAR void*, size_t);
KMALLOC_EXTERN void kfree(FAR void*);
+
#endif
/* Functions defined in os_list.c *******************************************/
diff --git a/sched/Makefile b/sched/Makefile
index f5d2ce9dbf..f164630bfd 100644
--- a/sched/Makefile
+++ b/sched/Makefile
@@ -134,6 +134,8 @@ endif
IRQ_SRCS = irq_initialize.c irq_attach.c irq_dispatch.c irq_unexpectedisr.c
+KMM_SRCS = kmm_kmalloc.c kmm_kzalloc.c kmm_krealloc.c kmm_kfree.c
+
CSRCS = $(MISC_SRCS) $(TSK_SRCS) $(SCHED_SRCS) $(WDOG_SRCS) $(TIME_SRCS) \
$(SEM_SRCS) $(TIMER_SRCS) $(WORK_SRCS) $(PGFILL_SRCS) $(IRQ_SRCS)
@@ -152,6 +154,10 @@ endif
ifneq ($(CONFIG_DISABLE_ENVIRON),y)
CSRCS += $(ENV_SRCS)
endif
+ifeq ($(CONFIG_NUTTX_KERNEL),y)
+CSRCS += $(KMM_SRCS)
+endif
+
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
diff --git a/sched/env_putenv.c b/sched/env_putenv.c
index 65c3d4c032..68674023af 100644
--- a/sched/env_putenv.c
+++ b/sched/env_putenv.c
@@ -41,6 +41,7 @@
#ifndef CONFIG_DISABLE_ENVIRON
+#include
#include
#include
#include
diff --git a/sched/env_setenv.c b/sched/env_setenv.c
index 8193aa5640..bc1ff33b15 100644
--- a/sched/env_setenv.c
+++ b/sched/env_setenv.c
@@ -42,6 +42,7 @@
#ifndef CONFIG_DISABLE_ENVIRON
#include
+#include
#include
#include
#include
diff --git a/sched/kmm_kfree.c b/sched/kmm_kfree.c
new file mode 100644
index 0000000000..0370ce8ee9
--- /dev/null
+++ b/sched/kmm_kfree.c
@@ -0,0 +1,110 @@
+/************************************************************************
+ * sched/kmm_kfree.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************/
+
+/************************************************************************
+ * Included Files
+ ************************************************************************/
+
+#include
+#include
+
+#ifdef CONFIG_NUTTX_KERNEL
+
+/* This logic is all tentatively and, hopefully, will grow in usability.
+ * For now, the kernel-mode build uses the memory manager that is
+ * provided in the user-space build. That is awkward but reasonable for
+ * the current level of support: At present, only memory protection is
+ * provided. Kernel-mode code may call into user-mode code, but not
+ * vice-versa. So hosting the memory manager in user-space allows the
+ * memory manager to be shared in both kernel- and user-mode spaces.
+ *
+ * In the longer run, if an MMU is support that can provide virtualized
+ * memory, then some SLAB memory manager will be required in kernel-space
+ * with some kind of brk() system call to obtain mapped heap space.
+ *
+ * In the current build model, the user-space module is built first. The
+ * file user_map.h is generated in the first pass and contains the
+ * addresses of the memory manager needed in this file:
+ */
+
+#include
+
+/************************************************************************
+ * Pre-processor definition
+ ************************************************************************/
+
+/* This value is obtained from user_map.h */
+
+#define KFREE(p) ((kfree_t)CONFIG_USER_FREE)(p)
+
+/************************************************************************
+ * Private Types
+ ************************************************************************/
+
+typedef void (*kfree_t)(FAR void *);
+
+/************************************************************************
+ * Private Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Public Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Function: kfree
+ *
+ * Description:
+ * This is a simple redirection to the user-space free() function.
+ *
+ * Parameters:
+ * None
+ *
+ * Return Value:
+ * None
+ *
+ * Assumptions:
+ * 1. free() resides in user-space
+ * 2. The address of the user space free() is provided in user_map.h
+ * 3. The user-space free() is callable from kernel-space.
+ *
+ ************************************************************************/
+
+void free(FAR void *mem)
+{
+ return KFREE(mem);
+}
+
+#endif /* CONFIG_NUTTX_KERNEL */
diff --git a/sched/kmm_kmalloc.c b/sched/kmm_kmalloc.c
new file mode 100644
index 0000000000..01267ab486
--- /dev/null
+++ b/sched/kmm_kmalloc.c
@@ -0,0 +1,110 @@
+/************************************************************************
+ * sched/kmm_kmalloc.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************/
+
+/************************************************************************
+ * Included Files
+ ************************************************************************/
+
+#include
+#include
+
+#ifdef CONFIG_NUTTX_KERNEL
+
+/* This logic is all tentatively and, hopefully, will grow in usability.
+ * For now, the kernel-mode build uses the memory manager that is
+ * provided in the user-space build. That is awkward but reasonable for
+ * the current level of support: At present, only memory protection is
+ * provided. Kernel-mode code may call into user-mode code, but not
+ * vice-versa. So hosting the memory manager in user-space allows the
+ * memory manager to be shared in both kernel- and user-mode spaces.
+ *
+ * In the longer run, if an MMU is support that can provide virtualized
+ * memory, then some SLAB memory manager will be required in kernel-space
+ * with some kind of brk() system call to obtain mapped heap space.
+ *
+ * In the current build model, the user-space module is built first. The
+ * file user_map.h is generated in the first pass and contains the
+ * addresses of the memory manager needed in this file:
+ */
+
+#include
+
+/************************************************************************
+ * Pre-processor definition
+ ************************************************************************/
+
+/* This value is obtained from user_map.h */
+
+#define KMALLOC(s) ((kmalloc_t)CONFIG_USER_MALLOC)(s)
+
+/************************************************************************
+ * Private Types
+ ************************************************************************/
+
+typedef FAR void *(*kmalloc_t)(size_t);
+
+/************************************************************************
+ * Private Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Public Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Function: kmalloc
+ *
+ * Description:
+ * This is a simple redirection to the user-space malloc() function.
+ *
+ * Parameters:
+ * None
+ *
+ * Return Value:
+ * The address of the allocated memory (NULL on failure to allocate)
+ *
+ * Assumptions:
+ * 1. malloc() resides in user-space
+ * 2. The address of the user space malloc() is provided in user_map.h
+ * 3. The user-space malloc() is callable from kernel-space.
+ *
+ ************************************************************************/
+
+FAR void *kmalloc(size_t size)
+{
+ return KMALLOC(size);
+}
+
+#endif /* CONFIG_NUTTX_KERNEL */
diff --git a/sched/kmm_krealloc.c b/sched/kmm_krealloc.c
new file mode 100644
index 0000000000..b52d864995
--- /dev/null
+++ b/sched/kmm_krealloc.c
@@ -0,0 +1,110 @@
+/************************************************************************
+ * sched/kmm_krealloc.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************/
+
+/************************************************************************
+ * Included Files
+ ************************************************************************/
+
+#include
+#include
+
+#ifdef CONFIG_NUTTX_KERNEL
+
+/* This logic is all tentatively and, hopefully, will grow in usability.
+ * For now, the kernel-mode build uses the memory manager that is
+ * provided in the user-space build. That is awkward but reasonable for
+ * the current level of support: At present, only memory protection is
+ * provided. Kernel-mode code may call into user-mode code, but not
+ * vice-versa. So hosting the memory manager in user-space allows the
+ * memory manager to be shared in both kernel- and user-mode spaces.
+ *
+ * In the longer run, if an MMU is support that can provide virtualized
+ * memory, then some SLAB memory manager will be required in kernel-space
+ * with some kind of brk() system call to obtain mapped heap space.
+ *
+ * In the current build model, the user-space module is built first. The
+ * file user_map.h is generated in the first pass and contains the
+ * addresses of the memory manager needed in this file:
+ */
+
+#include
+
+/************************************************************************
+ * Pre-processor definition
+ ************************************************************************/
+
+/* This value is obtained from user_map.h */
+
+#define KREALLOC(p,s) ((krealloc_t)CONFIG_USER_REALLOC)(p,s)
+
+/************************************************************************
+ * Private Types
+ ************************************************************************/
+
+typedef FAR void *(*krealloc_t)(FAR void*, size_t);
+
+/************************************************************************
+ * Private Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Public Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Function: krealloc
+ *
+ * Description:
+ * This is a simple redirection to the user-space realloc() function.
+ *
+ * Parameters:
+ * None
+ *
+ * Return Value:
+ * The address of the re-allocated memory (NULL on failure to re-allocate)
+ *
+ * Assumptions:
+ * 1. realloc() resides in user-space
+ * 2. The address of the user space realloc() is provided in user_map.h
+ * 3. The user-space realloc() is callable from kernel-space.
+ *
+ ************************************************************************/
+
+FAR void *krealloc(FAR void *oldmem, size_t size)
+{
+ return KREALLOC(oldmem, size);
+}
+
+#endif /* CONFIG_NUTTX_KERNEL */
diff --git a/sched/kmm_kzalloc.c b/sched/kmm_kzalloc.c
new file mode 100644
index 0000000000..567cd37d43
--- /dev/null
+++ b/sched/kmm_kzalloc.c
@@ -0,0 +1,110 @@
+/************************************************************************
+ * sched/kmm_kzalloc.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************/
+
+/************************************************************************
+ * Included Files
+ ************************************************************************/
+
+#include
+#include
+
+#ifdef CONFIG_NUTTX_KERNEL
+
+/* This logic is all tentatively and, hopefully, will grow in usability.
+ * For now, the kernel-mode build uses the memory manager that is
+ * provided in the user-space build. That is awkward but reasonable for
+ * the current level of support: At present, only memory protection is
+ * provided. Kernel-mode code may call into user-mode code, but not
+ * vice-versa. So hosting the memory manager in user-space allows the
+ * memory manager to be shared in both kernel- and user-mode spaces.
+ *
+ * In the longer run, if an MMU is support that can provide virtualized
+ * memory, then some SLAB memory manager will be required in kernel-space
+ * with some kind of brk() system call to obtain mapped heap space.
+ *
+ * In the current build model, the user-space module is built first. The
+ * file user_map.h is generated in the first pass and contains the
+ * addresses of the memory manager needed in this file:
+ */
+
+#include
+
+/************************************************************************
+ * Pre-processor definition
+ ************************************************************************/
+
+/* This value is obtained from user_map.h */
+
+#define KZALLOC(s) ((kzalloc_t)CONFIG_USER_ZALLOC)(s)
+
+/************************************************************************
+ * Private Types
+ ************************************************************************/
+
+typedef FAR void *(*kzalloc_t)(size_t);
+
+/************************************************************************
+ * Private Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Public Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Function: kzalloc
+ *
+ * Description:
+ * This is a simple redirection to the user-space zalloc() function.
+ *
+ * Parameters:
+ * None
+ *
+ * Return Value:
+ * The address of the allocated memory (NULL on failure to allocate)
+ *
+ * Assumptions:
+ * 1. zalloc() resides in user-space
+ * 2. The address of the user space zalloc() is provided in user_map.h
+ * 3. The user-space zalloc() is callable from kernel-space.
+ *
+ ************************************************************************/
+
+FAR void *kzalloc(size_t size)
+{
+ return KZALLOC(size);
+}
+
+#endif /* CONFIG_NUTTX_KERNEL */
diff --git a/sched/task_delete.c b/sched/task_delete.c
index 683fbd18de..4fd49a4ea4 100644
--- a/sched/task_delete.c
+++ b/sched/task_delete.c
@@ -1,7 +1,7 @@
/****************************************************************************
* sched/task_delete.c
*
- * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -37,11 +37,13 @@
* Included Files
****************************************************************************/
-#include
+#include
-#include
-#include
-#include "os_internal.h"
+#include
+#include
+#include
+
+#include "os_internal.h"
#ifndef CONFIG_DISABLE_SIGNALS
# include "sig_internal.h"
#endif
diff --git a/sched/timer_delete.c b/sched/timer_delete.c
index d4a24fca37..e89dd15a1e 100644
--- a/sched/timer_delete.c
+++ b/sched/timer_delete.c
@@ -38,6 +38,7 @@
********************************************************************************/
#include
+
#include
#include