Patchwork [kvm-unit-tests,v2,10/12] lib/auxinfo: add flags field

login
register
mail settings
Submitter Andrew Jones
Date Jan. 17, 2018, 10:40 a.m.
Message ID <20180117104005.29211-11-drjones@redhat.com>
Download mbox | patch
Permalink /patch/429651/
State New
Headers show

Comments

Andrew Jones - Jan. 17, 2018, 10:40 a.m.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 arm/Makefile.common |  3 ++-
 lib/auxinfo.c       | 13 ++++++++++++-
 lib/auxinfo.h       |  1 +
 3 files changed, 15 insertions(+), 2 deletions(-)

Patch

diff --git a/arm/Makefile.common b/arm/Makefile.common
index 0a039cff5f94..b4174af6b692 100644
--- a/arm/Makefile.common
+++ b/arm/Makefile.common
@@ -22,6 +22,7 @@  all: directories $(tests-all)
 
 ##################################################################
 phys_base = $(LOADADDR)
+AUXFLAGS ?= 0x0
 
 CFLAGS += -std=gnu99
 CFLAGS += -ffreestanding
@@ -69,7 +70,7 @@  FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi)
 	$(CC) $(LDFLAGS) -o $@ \
 		-Wl,-T,$(SRCDIR)/arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \
 		$(filter %.o, $^) $(FLATLIBS) \
-		$(SRCDIR)/lib/auxinfo.c -DPROGNAME=\"$(@:.elf=.flat)\"
+		$(SRCDIR)/lib/auxinfo.c -DPROGNAME=\"$(@:.elf=.flat)\" -DAUXFLAGS=$(AUXFLAGS)
 
 %.flat: %.elf
 	$(OBJCOPY) -O binary $^ $@
diff --git a/lib/auxinfo.c b/lib/auxinfo.c
index bffeac2f7ecb..a646306364b7 100644
--- a/lib/auxinfo.c
+++ b/lib/auxinfo.c
@@ -1,2 +1,13 @@ 
 #include "auxinfo.h"
-struct auxinfo auxinfo = { PROGNAME };
+
+#ifndef PROGNAME
+#define PROGNAME ((void *)0)
+#endif
+#ifndef AUXFLAGS
+#define AUXFLAGS 0
+#endif
+
+struct auxinfo auxinfo = {
+	.progname = PROGNAME,
+	.flags = AUXFLAGS,
+};
diff --git a/lib/auxinfo.h b/lib/auxinfo.h
index 669ba5dabefe..c074f43a0b83 100644
--- a/lib/auxinfo.h
+++ b/lib/auxinfo.h
@@ -6,6 +6,7 @@ 
 #define _AUXINFO_H_
 struct auxinfo {
 	const char *progname;
+	unsigned long flags;
 };
 
 /* No extern!  Define a common symbol.  */