Skip to contentSkip to conversation

DLMALLOC:!X86: add av_ initialization

PATCH Superseded Nishanth Menon 3 participants 5 messages Oct 7, 2009

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 DLMALLOC:!X86: add av_ initialization

Remove the predefined static initialization and generate the map dynamically to reduce code size.

This patch benefits were pointed out by Peter:
http://www.nabble.com/forum/Permalink.jtp?root=25518020&post=25523748&page=y

Cc Peter Tyser <[email protected]>
Cc Sandeep Paulraj <[email protected]>
Cc Tom Rix <[email protected]>
---
 common/dlmalloc.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
common/dlmalloc.c +9 -0
index 241db8c..25e5314 100644
@@ -1474,6 +1474,7 @@ typedef struct malloc_chunk* mbinptr;
 
 #define IAV(i)  bin_at(i), bin_at(i)
 
+#ifdef CONFIG_X86
 static mbinptr av_[NAV * 2 + 2] = {
  0, 0,
  IAV(0),   IAV(1),   IAV(2),   IAV(3),   IAV(4),   IAV(5),   IAV(6),   IAV(7),
@@ -1493,6 +1494,9 @@ static mbinptr av_[NAV * 2 + 2] = {
  IAV(112), IAV(113), IAV(114), IAV(115), IAV(116), IAV(117), IAV(118), IAV(119),
  IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127)
 };
+#else
+static mbinptr av_[NAV * 2 + 2];
+#endif
 
 void malloc_bin_reloc (void)
 {
@@ -1527,6 +1531,11 @@ void *sbrk(ptrdiff_t increment)
  */
 void mem_malloc_init(ulong start, ulong size)
 {
+	u8 i;
+	av_[0] = av_[1] = 0;
+	for (i = 0; i < 128; i++)
+		av_[2 + i * 2] = av_[2 + i * 2 + 1] = bin_at(i);
+
 	mem_malloc_start = start;
 	mem_malloc_end = start + size;
 	mem_malloc_brk = start;
Signature · 1 line
1.6.0.4
#1 lore raw

PATCH 1/1 OMAP3: remove SZ definition in config definitions

SZ definitions are deprecated as indicated by wd here:
http://www.nabble.com/forum/Permalink.jtp?root=25518020&post=25584065&page=y

Fix by running the following script

I=`cat include/asm-arm/sizes.h |grep SZ_|cut -d ' ' -f2`
I=`cat include/asm-arm/sizes.h |grep SZ_|cut -d ' ' -f4-`

sz_array=( $I )
val_array=( $J )
for file in include/configs/omap3_*;
do

	x=0
	for i in $I
	do
		o=${sz_array[$x]}
		n=${val_array[$x]}
		cat $file |sed -e "s/$o/$n/g">b
		mv b $file
		x=$(( x + 1 ))
	done

done

Cc Vikram Pandita <[email protected]>
Cc Sandeep Paulraj <[email protected]>
Cc Tom Rix <[email protected]>
Cc Dirk Behme <[email protected]>
---
 include/configs/omap3_beagle.h  |   16 ++++++++--------
 include/configs/omap3_evm.h     |   16 ++++++++--------
 include/configs/omap3_overo.h   |   16 ++++++++--------
 include/configs/omap3_pandora.h |   16 ++++++++--------
 include/configs/omap3_zoom1.h   |   16 ++++++++--------
 include/configs/omap3_zoom2.h   |   16 ++++++++--------
 6 files changed, 48 insertions(+), 48 deletions(-)
include/configs/omap3_beagle.h +8 -8
index 55eeb94..14754c3 100644
@@ -61,10 +61,10 @@
 
 /*
  * Size of malloc() pool
+ * Total env = 128K, malloc = 128K
  */
-#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size Environment */
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
+#define CONFIG_ENV_SIZE			0x00020000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
 						/* initial data */
 
@@ -239,10 +239,10 @@
  *
  * The stack sizes are set up in start.S using the settings below
  */
-#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
+#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
 #ifdef CONFIG_USE_IRQ
-#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
-#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
+#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
 #endif
 
 /*-----------------------------------------------------------------------
@@ -250,7 +250,7 @@
  */
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
+#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
 #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
 
 /* SDRAM Bank Allocation method */
@@ -269,7 +269,7 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
 						/* one chip */
 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
-#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors */
+#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors */
 
 #define CONFIG_SYS_FLASH_BASE		boot_flash_base
 
include/configs/omap3_evm.h +8 -8
index 72e9626..f615a4e 100644
@@ -66,10 +66,10 @@
 
 /*
  * Size of malloc() pool
+ * Total Environment = 128K + malloc = 128K
  */
-#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size Environment */
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
+#define CONFIG_ENV_SIZE			0x00020000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
 						/* initial data */
 /*
@@ -231,10 +231,10 @@
  *
  * The stack sizes are set up in start.S using the settings below
  */
-#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
+#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
 #ifdef CONFIG_USE_IRQ
-#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
-#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
+#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
 #endif
 
 /*-----------------------------------------------------------------------
@@ -242,7 +242,7 @@
  */
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
+#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
 #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
 
 /* SDRAM Bank Allocation method */
@@ -261,7 +261,7 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors */
 						/* on one chip */
 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
-#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors */
+#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors */
 
 #define CONFIG_SYS_FLASH_BASE		boot_flash_base
 
include/configs/omap3_overo.h +8 -8
index 1a91921..3ba9b69 100644
@@ -53,10 +53,10 @@
 
 /*
  * Size of malloc() pool
+ * Total Environment = 128K + malloc = 128K
  */
-#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size Environment */
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
+#define CONFIG_ENV_SIZE			0x00020000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
 						/* initial data */
 
@@ -224,10 +224,10 @@
  *
  * The stack sizes are set up in start.S using the settings below
  */
-#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
+#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
 #ifdef CONFIG_USE_IRQ
-#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
-#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
+#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
 #endif
 
 /*-----------------------------------------------------------------------
@@ -235,7 +235,7 @@
  */
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
+#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
 #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
 
 /* SDRAM Bank Allocation method */
@@ -254,7 +254,7 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
 						/* one chip */
 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
-#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors */
+#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors */
 
 #define CONFIG_SYS_FLASH_BASE		boot_flash_base
 
include/configs/omap3_pandora.h +8 -8
index 064c0bc..517df23 100644
@@ -56,10 +56,10 @@
 
 /*
  * Size of malloc() pool
+ * Total Environment = 128K + malloc = 128K
  */
-#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size Environment */
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
+#define CONFIG_ENV_SIZE			0x00020000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
 						/* initial data */
 
@@ -228,10 +228,10 @@
  *
  * The stack sizes are set up in start.S using the settings below
  */
-#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
+#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
 #ifdef CONFIG_USE_IRQ
-#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
-#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
+#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
 #endif
 
 /*-----------------------------------------------------------------------
@@ -239,7 +239,7 @@
  */
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
+#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
 #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
 
 /* SDRAM Bank Allocation method */
@@ -258,7 +258,7 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
 						/* one chip */
 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
-#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors */
+#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors */
 
 #define CONFIG_SYS_FLASH_BASE		boot_flash_base
 
include/configs/omap3_zoom1.h +8 -8
index b55b8f0..f428039 100644
@@ -62,10 +62,10 @@
 
 /*
  * Size of malloc() pool
+ * Total Environment = 128K + malloc = 128K
  */
-#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size Environment */
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
+#define CONFIG_ENV_SIZE			0x00020000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
 						/* initial data */
 
@@ -236,10 +236,10 @@
  *
  * The stack sizes are set up in start.S using the settings below
  */
-#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
+#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
 #ifdef CONFIG_USE_IRQ
-#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
-#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
+#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
 #endif
 
 /*-----------------------------------------------------------------------
@@ -247,7 +247,7 @@
  */
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
+#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
 #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
 
 /* SDRAM Bank Allocation method */
@@ -266,7 +266,7 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
 						/* one chip */
 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
-#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors */
+#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors */
 
 #define CONFIG_SYS_FLASH_BASE		boot_flash_base
 
include/configs/omap3_zoom2.h +8 -8
index 75ab980..d1989f7 100644
@@ -63,10 +63,10 @@
 
 /*
  * Size of malloc() pool
+ * Total Environment = 128K + malloc = 128K
  */
-#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size Environment */
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
+#define CONFIG_ENV_SIZE			0x00020000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
 						/* initial data */
 /*
@@ -201,10 +201,10 @@
  *
  * The stack sizes are set up in start.S using these settings
  */
-#define CONFIG_STACKSIZE	SZ_128K
+#define CONFIG_STACKSIZE	0x00020000
 #ifdef CONFIG_USE_IRQ
-#define CONFIG_STACKSIZE_IRQ	SZ_4K
-#define CONFIG_STACKSIZE_FIQ	SZ_4K
+#define CONFIG_STACKSIZE_IRQ	0x00001000
+#define CONFIG_STACKSIZE_FIQ	0x00001000
 #endif
 
 /*-----------------------------------------------------------------------
@@ -212,7 +212,7 @@
  */
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
+#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
 #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
 
 /* SDRAM Bank Allocation method */
@@ -231,7 +231,7 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
 						/* one chip */
 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
-#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors */
+#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors */
 
 #define CONFIG_SYS_FLASH_BASE		boot_flash_base
 
Signature · 1 line
1.6.0.4
#2 lore raw

PATCH 1/1 OMAP3: remove SZ definition in config definitions

Quoted 24 lines

Subject: [PATCH] OMAP3: remove SZ definition in config definitions

SZ definitions are deprecated as indicated by wd here:
http://www.nabble.com/forum/Permalink.jtp?root=25518020&post=25584065&page
=y

Fix by running the following script

I=`cat include/asm-arm/sizes.h |grep SZ_|cut -d ' ' -f2`
I=`cat include/asm-arm/sizes.h |grep SZ_|cut -d ' ' -f4-`

sz_array=( $I )
val_array=( $J )
for file in include/configs/omap3_*;
do

	x=0
	for i in $I
	do
		o=${sz_array[$x]}
		n=${val_array[$x]}
		cat $file |sed -e "s/$o/$n/g">b
		mv b $file
		x=$(( x + 1 ))
	done
Quoted 8 lines

done

Cc Vikram Pandita <[email protected]>
Cc Sandeep Paulraj <[email protected]>
Cc Tom Rix <[email protected]>
Cc Dirk Behme <[email protected]>

---

Nishanth, a general comment.

I submitted a similar patch for DaVinci. I had done the same things as you have done. But Wolfgang commented that instead of 0x00001000 it is better to use (4 << 10)

-#define CONFIG_STACKSIZE_IRQ SZ_4K /* IRQ stack */
-#define CONFIG_STACKSIZE_FIQ SZ_4K /* FIQ stack */
+#define CONFIG_STACKSIZE_IRQ 0x00001000 /* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ 0x00001000 /* FIQ stack */

Taking the above as an example according to Wolfgang , you should have

+#define CONFIG_STACKSIZE_FIQ (4 << 10) /* IRQ stack of 4K */

Infact I have already submitted a patch for the above for OMAP, but I had to address some comments from Tom. Tom had commented on OMAP 2420 H4 specific code which had similar references.

Thanks,
Sandeep

Quoted 330 lines
 include/configs/omap3_beagle.h  |   16 ++++++++--------
 include/configs/omap3_evm.h     |   16 ++++++++--------
 include/configs/omap3_overo.h   |   16 ++++++++--------
 include/configs/omap3_pandora.h |   16 ++++++++--------
 include/configs/omap3_zoom1.h   |   16 ++++++++--------
 include/configs/omap3_zoom2.h   |   16 ++++++++--------
 6 files changed, 48 insertions(+), 48 deletions(-)
include/configs/omap3_beagle.h +1 -1
index 55eeb94..14754c3 100644
@@ -61,10 +61,10 @@
 
 /*
  * Size of malloc() pool
+ * Total env = 128K, malloc = 128K
  */
-#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size

Environment */

include/configs/omap3_beagle.h +7 -7
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
+#define CONFIG_ENV_SIZE			0x00020000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
 						/* initial data */
@@ -239,10 +239,10 @@
  *
  * The stack sizes are set up in start.S using the settings below
  */
-#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
+#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
 #ifdef CONFIG_USE_IRQ
-#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
-#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
+#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
 #endif
 
 /*-----------------------------------------------------------------------
@@ -250,7 +250,7 @@
  */
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
+#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
 #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
 
 /* SDRAM Bank Allocation method */
@@ -269,7 +269,7 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
 						/* one chip */
 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
-#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors
 */
+#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors
 */
 

#define CONFIG_SYS_FLASH_BASE boot_flash_base

include/configs/omap3_evm.h +1 -1
index 72e9626..f615a4e 100644
@@ -66,10 +66,10 @@
 
 /*
  * Size of malloc() pool
+ * Total Environment = 128K + malloc = 128K
  */
-#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size

Environment */

include/configs/omap3_evm.h +7 -7
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
+#define CONFIG_ENV_SIZE			0x00020000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
 						/* initial data */
 /*
@@ -231,10 +231,10 @@
  *
  * The stack sizes are set up in start.S using the settings below
  */
-#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
+#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
 #ifdef CONFIG_USE_IRQ
-#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
-#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
+#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
 #endif
 
 /*-----------------------------------------------------------------------
@@ -242,7 +242,7 @@
  */
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
+#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
 #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
 
 /* SDRAM Bank Allocation method */
@@ -261,7 +261,7 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors */
 						/* on one chip */
 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
-#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors
 */
+#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors
 */
 

#define CONFIG_SYS_FLASH_BASE boot_flash_base

include/configs/omap3_overo.h +1 -1
index 1a91921..3ba9b69 100644
@@ -53,10 +53,10 @@
 
 /*
  * Size of malloc() pool
+ * Total Environment = 128K + malloc = 128K
  */
-#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size

Environment */

include/configs/omap3_overo.h +7 -7
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
+#define CONFIG_ENV_SIZE			0x00020000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
 						/* initial data */
@@ -224,10 +224,10 @@
  *
  * The stack sizes are set up in start.S using the settings below
  */
-#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
+#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
 #ifdef CONFIG_USE_IRQ
-#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
-#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
+#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
 #endif
 
 /*-----------------------------------------------------------------------
@@ -235,7 +235,7 @@
  */
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
+#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
 #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
 
 /* SDRAM Bank Allocation method */
@@ -254,7 +254,7 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
 						/* one chip */
 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
-#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors
 */
+#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors
 */
 

#define CONFIG_SYS_FLASH_BASE boot_flash_base

include/configs/omap3_pandora.h +1 -1
index 064c0bc..517df23 100644
@@ -56,10 +56,10 @@
 
 /*
  * Size of malloc() pool
+ * Total Environment = 128K + malloc = 128K
  */
-#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size

Environment */

include/configs/omap3_pandora.h +7 -7
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
+#define CONFIG_ENV_SIZE			0x00020000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
 						/* initial data */
@@ -228,10 +228,10 @@
  *
  * The stack sizes are set up in start.S using the settings below
  */
-#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
+#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
 #ifdef CONFIG_USE_IRQ
-#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
-#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
+#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
 #endif
 
 /*-----------------------------------------------------------------------
@@ -239,7 +239,7 @@
  */
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
+#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
 #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
 
 /* SDRAM Bank Allocation method */
@@ -258,7 +258,7 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
 						/* one chip */
 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
-#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors
 */
+#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors
 */
 

#define CONFIG_SYS_FLASH_BASE boot_flash_base

include/configs/omap3_zoom1.h +1 -1
index b55b8f0..f428039 100644
@@ -62,10 +62,10 @@
 
 /*
  * Size of malloc() pool
+ * Total Environment = 128K + malloc = 128K
  */
-#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size

Environment */

include/configs/omap3_zoom1.h +7 -7
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
+#define CONFIG_ENV_SIZE			0x00020000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
 						/* initial data */
@@ -236,10 +236,10 @@
  *
  * The stack sizes are set up in start.S using the settings below
  */
-#define CONFIG_STACKSIZE	SZ_128K	/* regular stack */
+#define CONFIG_STACKSIZE	0x00020000	/* regular stack */
 #ifdef CONFIG_USE_IRQ
-#define CONFIG_STACKSIZE_IRQ	SZ_4K	/* IRQ stack */
-#define CONFIG_STACKSIZE_FIQ	SZ_4K	/* FIQ stack */
+#define CONFIG_STACKSIZE_IRQ	0x00001000	/* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ	0x00001000	/* FIQ stack */
 #endif
 
 /*-----------------------------------------------------------------------
@@ -247,7 +247,7 @@
  */
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
+#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
 #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
 
 /* SDRAM Bank Allocation method */
@@ -266,7 +266,7 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
 						/* one chip */
 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
-#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors
 */
+#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors
 */
 

#define CONFIG_SYS_FLASH_BASE boot_flash_base

include/configs/omap3_zoom2.h +1 -1
index 75ab980..d1989f7 100644
@@ -63,10 +63,10 @@
 
 /*
  * Size of malloc() pool
+ * Total Environment = 128K + malloc = 128K
  */
-#define CONFIG_ENV_SIZE			SZ_128K	/* Total Size

Environment */

include/configs/omap3_zoom2.h +7 -7
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_128K)
+#define CONFIG_ENV_SIZE			0x00020000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 0x00020000)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */
 						/* initial data */
 /*
@@ -201,10 +201,10 @@
  *
  * The stack sizes are set up in start.S using these settings
  */
-#define CONFIG_STACKSIZE	SZ_128K
+#define CONFIG_STACKSIZE	0x00020000
 #ifdef CONFIG_USE_IRQ
-#define CONFIG_STACKSIZE_IRQ	SZ_4K
-#define CONFIG_STACKSIZE_FIQ	SZ_4K
+#define CONFIG_STACKSIZE_IRQ	0x00001000
+#define CONFIG_STACKSIZE_FIQ	0x00001000
 #endif
 
 /*-----------------------------------------------------------------------
@@ -212,7 +212,7 @@
  */
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_1_SIZE	SZ_32M	/* at least 32 meg */
+#define PHYS_SDRAM_1_SIZE	0x02000000	/* at least 32 meg */
 #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1
 
 /* SDRAM Bank Allocation method */
@@ -231,7 +231,7 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	520	/* max number of sectors on */
 						/* one chip */
 #define CONFIG_SYS_MAX_FLASH_BANKS	2	/* max number of flash banks */
-#define CONFIG_SYS_MONITOR_LEN		SZ_256K	/* Reserve 2 sectors
 */
+#define CONFIG_SYS_MONITOR_LEN		0x00040000	/* Reserve 2 sectors
 */
 

#define CONFIG_SYS_FLASH_BASE boot_flash_base

--
1.6.0.4

#3 lore raw

PATCH v2 1/1 DLMALLOC:!X86: add av_ initialization

In reply to Nishanth Menon
Quoted 28 lines · Nishanth Menon

Remove the predefined static initialization and generate the map dynamically to reduce code size.

This patch benefits were pointed out by Peter:
http://www.nabble.com/forum/Permalink.jtp?root=25518020&post=25523748&page=y

Cc Peter Tyser <[email protected]>
Cc Sandeep Paulraj <[email protected]>
Cc Tom Rix <[email protected]>
---
 common/dlmalloc.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
common/dlmalloc.c +1 -0
index 241db8c..25e5314 100644
@@ -1474,6 +1474,7 @@ typedef struct malloc_chunk* mbinptr;
 
 #define IAV(i)  bin_at(i), bin_at(i)
 
+#ifdef CONFIG_X86
 static mbinptr av_[NAV * 2 + 2] = {
 0, 0,
 IAV(0),   IAV(1),   IAV(2),   IAV(3),   IAV(4),   IAV(5),   IAV(6),   IAV(7),

common/dlmalloc.c static mbinptr av_[NAV * 2 + 2] = { · line 1499

Quoted 6 lines
common/dlmalloc.c +3 -0
@@ -1493,6 +1494,9 @@ static mbinptr av_[NAV * 2 + 2] = {
 IAV(112), IAV(113), IAV(114), IAV(115), IAV(116), IAV(117), IAV(118), IAV(119),
 IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127)
 };
+#else
+static mbinptr av_[NAV * 2 + 2];
+#endif

Is there any reason why X86 is treated differently? I know the previous patch to dlmalloc.c did, but in the end it really didn't need to and ended up breaking the x86 build anyway (my fault for not getting time to test it before it went mainline)

Feel free to remove this #ifdef unless you are 100% sure it IS needed. Mainline x86 is broken anyway - if this change introduces another break, I will submit a consolidated fix soon

Quoted 16 lines
common/dlmalloc.c +5 -1
 void malloc_bin_reloc (void)
 {
@@ -1527,6 +1531,11 @@ void *sbrk(ptrdiff_t increment)
 */
 void mem_malloc_init(ulong start, ulong size)
 {
+       u8 i;
+       av_[0] = av_[1] = 0;
+       for (i = 0; i < 128; i++)
+               av_[2 + i * 2] = av_[2 + i * 2 + 1] = bin_at(i);
+
       mem_malloc_start = start;
       mem_malloc_end = start + size;
       mem_malloc_brk = start;
--
Quoted 1 line

1.6.0.4

Regards,

Graeme

#4 lore raw

PATCH v2 1/1 DLMALLOC:!X86: add av_ initialization

Graeme Russ had written, on 10/06/2009 09:52 PM, the following:

Quoted 41 lines · Nishanth Menon
Quoted 28 lines

Remove the predefined static initialization and generate the map dynamically to reduce code size.

This patch benefits were pointed out by Peter:
http://www.nabble.com/forum/Permalink.jtp?root=25518020&post=25523748&page=y

Cc Peter Tyser <[email protected]>
Cc Sandeep Paulraj <[email protected]>
Cc Tom Rix <[email protected]>
---
 common/dlmalloc.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
common/dlmalloc.c +1 -0
index 241db8c..25e5314 100644
@@ -1474,6 +1474,7 @@ typedef struct malloc_chunk* mbinptr;
 
 #define IAV(i)  bin_at(i), bin_at(i)
 
+#ifdef CONFIG_X86
 static mbinptr av_[NAV * 2 + 2] = {
 0, 0,
 IAV(0),   IAV(1),   IAV(2),   IAV(3),   IAV(4),   IAV(5),   IAV(6),   IAV(7),

common/dlmalloc.c static mbinptr av_[NAV * 2 + 2] = { · line 1499

Quoted 6 lines
common/dlmalloc.c +3 -0
@@ -1493,6 +1494,9 @@ static mbinptr av_[NAV * 2 + 2] = {
 IAV(112), IAV(113), IAV(114), IAV(115), IAV(116), IAV(117), IAV(118), IAV(119),
 IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127)
 };
+#else
+static mbinptr av_[NAV * 2 + 2];
+#endif

Is there any reason why X86 is treated differently? I know the previous patch to dlmalloc.c did, but in the end it really didn't need to and ended up breaking the x86 build anyway (my fault for not getting time to test it before it went mainline)

Quoted 3 lines

Feel free to remove this #ifdef unless you are 100% sure it IS needed. Mainline x86 is broken anyway - if this change introduces another break, I will submit a consolidated fix soon

I dont have any rationale to retain the #ifdef.. it is ugly.. will kick it out and send out a v3 of this patch in a short while.

Quoted 22 lines
Quoted 16 lines
common/dlmalloc.c +5 -1
 void malloc_bin_reloc (void)
 {
@@ -1527,6 +1531,11 @@ void *sbrk(ptrdiff_t increment)
 */
 void mem_malloc_init(ulong start, ulong size)
 {
+       u8 i;
+       av_[0] = av_[1] = 0;
+       for (i = 0; i < 128; i++)
+               av_[2 + i * 2] = av_[2 + i * 2 + 1] = bin_at(i);
+
       mem_malloc_start = start;
       mem_malloc_end = start + size;
       mem_malloc_brk = start;
--
Quoted 1 line

1.6.0.4

Regards,

Graeme

Signature · 2 lines
Regards,
Nishanth Menon