[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Move more kernel decompression bits to .init.* sections



# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxxxx>
# Date 1299687613 0
# Node ID 768269c4391474ea880c474585c6bf9956aa8503
# Parent  eb64b8f8eebb17ea1b14e4a6cf413738df4f26e8
Move more kernel decompression bits to .init.* sections

Based on how c/s 22986:076b63b74cf6 changed xen/libelf/Makefile I
suppose this is compatibile with those clang/llvm changes, but I
didn't actually test it.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---


diff -r eb64b8f8eebb -r 768269c43914 xen/Rules.mk
--- a/xen/Rules.mk      Wed Mar 09 16:19:36 2011 +0000
+++ b/xen/Rules.mk      Wed Mar 09 16:20:13 2011 +0000
@@ -152,6 +152,18 @@
 %.o: %.S Makefile
        $(CC) $(AFLAGS) -c $< -o $@
 
+SPECIAL_DATA_SECTIONS := rodata $(foreach n,1 2 4 8,rodata.str1.$(n)) \
+                        $(foreach r,rel rel.ro,data.$(r) data.$(r).local)
+
+%.init.o: %.o Makefile
+       $(OBJDUMP) -h $< | sed -n '/[0-9]/{s,00*,0,g;p}' | while read idx name 
sz rest; do \
+               case "$$name" in \
+               .text|.data|.bss) test $$sz = 0 || \
+                       { echo "Error: size of $<:$$name is 0x$$sz" >&2; exit 
$$idx; };; \
+               esac; \
+       done
+       $(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section 
.$(s)=.init.$(s)) $< $@
+
 %.i: %.c Makefile
        $(CPP) $(CFLAGS) $< -o $@
 
diff -r eb64b8f8eebb -r 768269c43914 xen/arch/x86/Makefile
--- a/xen/arch/x86/Makefile     Wed Mar 09 16:19:36 2011 +0000
+++ b/xen/arch/x86/Makefile     Wed Mar 09 16:20:13 2011 +0000
@@ -10,6 +10,7 @@
 
 obj-y += apic.o
 obj-y += bitops.o
+obj-bin-y += bzimage.init.o
 obj-bin-y += clear_page.o
 obj-bin-y += copy_page.o
 obj-y += compat.o
@@ -55,7 +56,6 @@
 obj-y += crash.o
 obj-y += tboot.o
 obj-y += hpet.o
-obj-y += bzimage.o
 
 obj-$(crash_debug) += gdbstub.o
 
diff -r eb64b8f8eebb -r 768269c43914 xen/arch/x86/bzimage.c
--- a/xen/arch/x86/bzimage.c    Wed Mar 09 16:19:36 2011 +0000
+++ b/xen/arch/x86/bzimage.c    Wed Mar 09 16:20:13 2011 +0000
@@ -9,21 +9,21 @@
 
 #define HEAPORDER 3
 
-static unsigned char *window;
+static unsigned char *__initdata window;
 #define memptr long
-static memptr free_mem_ptr;
-static memptr free_mem_end_ptr;
+static memptr __initdata free_mem_ptr;
+static memptr __initdata free_mem_end_ptr;
 
 #define WSIZE           0x80000000
 
-static unsigned char    *inbuf;
-static unsigned         insize;
+static unsigned char *__initdata inbuf;
+static unsigned __initdata insize;
 
 /* Index of next byte to be processed in inbuf: */
-static unsigned         inptr;
+static unsigned __initdata inptr;
 
 /* Bytes in output buffer: */
-static unsigned         outcnt;
+static unsigned __initdata outcnt;
 
 #define OF(args)        args
 #define STATIC          static
@@ -34,7 +34,8 @@
 typedef unsigned short  ush;
 typedef unsigned long   ulg;
 
-#define INIT __init
+#define INIT            __init
+#define INITDATA        __initdata
 
 #define get_byte()      (inptr < insize ? inbuf[inptr++] : fill_inbuf())
 
@@ -55,7 +56,7 @@
 #  define Tracecv(c, x)
 #endif
 
-static long bytes_out;
+static long __initdata bytes_out;
 static void flush_window(void);
 
 static __init void error(char *x)
diff -r eb64b8f8eebb -r 768269c43914 xen/common/Makefile
--- a/xen/common/Makefile       Wed Mar 09 16:19:36 2011 +0000
+++ b/xen/common/Makefile       Wed Mar 09 16:20:13 2011 +0000
@@ -43,7 +43,7 @@
 obj-y += rbtree.o
 obj-y += lzo.o
 
-obj-$(CONFIG_X86) += decompress.o bunzip2.o unxz.o unlzma.o unlzo.o
+obj-bin-$(CONFIG_X86) += $(foreach n,decompress bunzip2 unxz unlzma 
unlzo,$(n).init.o)
 
 obj-$(perfc)       += perfc.o
 obj-$(crash_debug) += gdbstub.o
diff -r eb64b8f8eebb -r 768269c43914 xen/common/inflate.c
--- a/xen/common/inflate.c      Wed Mar 09 16:19:36 2011 +0000
+++ b/xen/common/inflate.c      Wed Mar 09 16:20:13 2011 +0000
@@ -120,6 +120,7 @@
 
 #ifndef INIT
 #define INIT
+#define INITDATA
 #endif
  
 #define slide window
@@ -216,8 +217,8 @@
    the stream.
  */
 
-STATIC ulg bb;                         /* bit buffer */
-STATIC unsigned bk;                    /* bits in bit buffer */
+STATIC ulg INITDATA bb;                /* bit buffer */
+STATIC unsigned INITDATA bk;           /* bits in bit buffer */
 
 STATIC const ush mask_bits[] = {
     0x0000,
@@ -234,10 +235,10 @@
  *  malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
  */
 
-static unsigned long malloc_ptr;
-static int malloc_count;
+static unsigned long INITDATA malloc_ptr;
+static int INITDATA malloc_count;
 
-static void *malloc(int size)
+static void *INIT malloc(int size)
 {
     void *p;
 
@@ -258,7 +259,7 @@
     return p;
 }
 
-static void free(void *where)
+static void INIT free(void *where)
 {
     malloc_count--;
     if (!malloc_count)
@@ -311,7 +312,7 @@
 #define N_MAX 288       /* maximum number of codes in any set */
 
 
-STATIC unsigned hufts;         /* track memory usage */
+STATIC unsigned INITDATA hufts;      /* track memory usage */
 
 
 STATIC int INIT huft_build(
@@ -1129,8 +1130,8 @@
  *
  **********************************************************************/
 
-static ulg crc_32_tab[256];
-static ulg crc;  /* initialized in makecrc() so it'll reside in bss */
+static ulg INITDATA crc_32_tab[256];
+static ulg INITDATA crc;  /* initialized in makecrc() so it'll reside in bss */
 #define CRC_VALUE (crc ^ 0xffffffffUL)
 
 /*
diff -r eb64b8f8eebb -r 768269c43914 xen/common/libelf/Makefile
--- a/xen/common/libelf/Makefile        Wed Mar 09 16:19:36 2011 +0000
+++ b/xen/common/libelf/Makefile        Wed Mar 09 16:20:13 2011 +0000
@@ -1,6 +1,6 @@
 obj-bin-y := libelf.o
 
-SECTIONS := text data rodata $(foreach n,1 2 4 8,rodata.str1.$(n)) $(foreach 
r,rel rel.ro,data.$(r) data.$(r).local)
+SECTIONS := text data $(SPECIAL_DATA_SECTIONS)
 
 libelf.o: libelf-temp.o Makefile
        $(OBJCOPY) $(foreach s,$(SECTIONS),--rename-section .$(s)=.init.$(s)) 
$< $@
diff -r eb64b8f8eebb -r 768269c43914 xen/common/unlzma.c
--- a/xen/common/unlzma.c       Wed Mar 09 16:19:36 2011 +0000
+++ b/xen/common/unlzma.c       Wed Mar 09 16:20:13 2011 +0000
@@ -75,7 +75,7 @@
 #define RC_MODEL_TOTAL_BITS 11
 
 
-static int nofill(void *buffer, unsigned int len)
+static int INIT nofill(void *buffer, unsigned int len)
 {
        return -1;
 }
diff -r eb64b8f8eebb -r 768269c43914 xen/common/xz/dec_bcj.c
--- a/xen/common/xz/dec_bcj.c   Wed Mar 09 16:19:36 2011 +0000
+++ b/xen/common/xz/dec_bcj.c   Wed Mar 09 16:20:13 2011 +0000
@@ -87,11 +87,10 @@
 
 static size_t INIT bcj_x86(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 {
-       static /*const*/ bool_t INITDATA mask_to_allowed_status[8]
+       static const bool_t mask_to_allowed_status[8]
                = { true, true, true, false, true, false, false, false };
 
-       static /*const*/ uint8_t INITDATA mask_to_bit_num[8]
-               = { 0, 1, 2, 2, 3, 3, 3, 3 };
+       static const uint8_t mask_to_bit_num[8] = { 0, 1, 2, 2, 3, 3, 3, 3 };
 
        size_t i;
        size_t prev_pos = (size_t)-1;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.