arm/powerpc: make argv[0] the program name
Subsystems (2)
v3 cover arm/powerpc: make argv[0] the program name
v3:
- fixed x86 compilation by adding a weak symbol for auxinfo
- reworked all patches to avoid the ugly, although temporary, #ifdeffery
- also squashed patches 3/4 and 4/4 together
- moved initializer out of for() [Thomas]
- dropped all of Thomas' r-b's, as I changed too much to keep them, but he shouldn't need to review much of the two "reserve..." patches again.
repost:
- rebased to latest upstream master (fixed trivial conflicts with 4c6b5d and dc0a22, the Makefile cleanup patches)
- added Thomas' r-b's
v2:
- copy auxinfo.prognam into argv[0] [drew]
It just came to my attention that x86 has the normal argv[0], the program name, thanks to seabios. That raised the priority of fixing one of my pet peeves - arm and powerpc starting arguments at argv[0], as that just ain't right. This series fixes that. A few temporary hacks are used to avoid one big patch fixing both arm and powerpc at the same time. The hacks are gone by the end of the series.
Andrew Jones (3):
arm/arm64: reserve argv[0] for prognam
powerpc/ppc64: reserve argv[0] for prognam
arm & powerpc: populate argv[0] with prognam
arm/Makefile.common | 6 +++++- arm/selftest.c | 14 +++++++------- arm/spinlock-test.c | 2 +- lib/argv.c | 27 +++++++++++++++++++++++---- lib/arm/setup.c | 4 ++-- lib/auxinfo.c | 2 ++ lib/auxinfo.h | 7 +++++++ lib/powerpc/setup.c | 4 ++-- powerpc/Makefile.common | 6 +++++- powerpc/emulator.c | 2 +- powerpc/rtas.c | 12 ++++++------ powerpc/selftest.c | 8 ++++---- powerpc/spapr_hcall.c | 6 +++--- scripts/auxinfo.mak | 7 +++++++ x86/Makefile.common | 1 + 15 files changed, 76 insertions(+), 32 deletions(-) create mode 100644 lib/auxinfo.c create mode 100644 lib/auxinfo.h create mode 100755 scripts/auxinfo.mak
Signature · 1 line
2.4.11
PATCH v3 1/3 arm/arm64: reserve argv[0] for prognam
--- arm/selftest.c | 14 +++++++------- arm/spinlock-test.c | 2 +- lib/argv.c | 15 +++++++++++++++ lib/arm/setup.c | 4 ++-- 4 files changed, 25 insertions(+), 10 deletions(-)
arm/selftest.c +7 -7
@@ -324,25 +324,25 @@ int main(int argc, char **argv) {report_prefix_push ("selftest" ); -if (!argc) +if (argc <2 )report_abort ("no test specified" ); -report_prefix_push (argv[0 ]); +report_prefix_push (argv[1 ]); -if (strcmp (argv[0 ],"setup" ) ==0 ) { +if (strcmp (argv[1 ],"setup" ) ==0 ) { -check_setup (argc-1 , &argv[1 ]); +check_setup (argc-2 , &argv[2 ]); - }else if (strcmp (argv[0 ],"vectors-kernel" ) ==0 ) { + }else if (strcmp (argv[1 ],"vectors-kernel" ) ==0 ) {check_vectors (NULL ); - }else if (strcmp (argv[0 ],"vectors-user" ) ==0 ) { + }else if (strcmp (argv[1 ],"vectors-user" ) ==0 ) {start_usr (check_vectors,NULL , (unsigned long )thread_stack_alloc ()); - }else if (strcmp (argv[0 ],"smp" ) ==0 ) { + }else if (strcmp (argv[1 ],"smp" ) ==0 ) {int cpu;
arm/spinlock-test.c +1 -1
@@ -69,7 +69,7 @@ int main(int argc, char **argv) {int cpu; -if (argc &&strcmp (argv[0 ],"bad" ) !=0 ) { +if (argc >1 &&strcmp (argv[1 ],"bad" ) !=0 ) { lock_ops.lock = gcc_builtin_lock; lock_ops.unlock = gcc_builtin_unlock; }else {
lib/argv.c +15 -0
@@ -40,3 +40,18 @@ void setup_args(char *args) __args = args;__setup_args (); } + +void setup_args_prognam (char *args) +{ +int i; + +if (args) { + __args = args; +__setup_args (); + +for (i = __argc; i >0 ; --i) + __argv[i] = __argv[i-1 ]; + } + __argv[0 ] =NULL ;// just reserve for now + ++__argc; +}
lib/arm/setup.c +2 -2
@@ -22,7 +22,7 @@extern unsigned long stacktop;extern void io_init (void ); -extern void setup_args (const char *args); +extern void setup_args_prognam (const char *args);u32 cpus[NR_CPUS ] = { [0 ...NR_CPUS -1 ] = (~0U ) };int nr_cpus;
@@ -124,5 +124,5 @@ void setup(const void *fdt) ret =dt_get_bootargs (&bootargs);assert (ret ==0 ); -setup_args (bootargs); +setup_args_prognam (bootargs); }
Signature · 1 line
2.4.11
Re: [kvm-unit-tests PATCH v3 1/3] arm/arm64: reserve argv[0] for prognam
Quoted 96 lines · Andrew Jones
Signed-off-by Andrew Jones <[email protected]>--- arm/selftest.c | 14 +++++++------- arm/spinlock-test.c | 2 +- lib/argv.c | 15 +++++++++++++++ lib/arm/setup.c | 4 ++-- 4 files changed, 25 insertions(+), 10 deletions(-)arm/selftest.c +7
-7@@ -324,25 +324,25 @@ int main(int argc, char **argv) {report_prefix_push ("selftest" ); -if (!argc) +if (argc <2 )report_abort ("no test specified" ); -report_prefix_push (argv[0 ]); +report_prefix_push (argv[1 ]); -if (strcmp (argv[0 ],"setup" ) ==0 ) { +if (strcmp (argv[1 ],"setup" ) ==0 ) { -check_setup (argc-1 , &argv[1 ]); +check_setup (argc-2 , &argv[2 ]); - }else if (strcmp (argv[0 ],"vectors-kernel" ) ==0 ) { + }else if (strcmp (argv[1 ],"vectors-kernel" ) ==0 ) {check_vectors (NULL ); - }else if (strcmp (argv[0 ],"vectors-user" ) ==0 ) { + }else if (strcmp (argv[1 ],"vectors-user" ) ==0 ) {start_usr (check_vectors,NULL , (unsigned long )thread_stack_alloc ()); - }else if (strcmp (argv[0 ],"smp" ) ==0 ) { + }else if (strcmp (argv[1 ],"smp" ) ==0 ) {int cpu;arm/spinlock-test.c +1
-1@@ -69,7 +69,7 @@ int main(int argc, char **argv) {int cpu; -if (argc &&strcmp (argv[0 ],"bad" ) !=0 ) { +if (argc >1 &&strcmp (argv[1 ],"bad" ) !=0 ) { lock_ops.lock = gcc_builtin_lock; lock_ops.unlock = gcc_builtin_unlock; }else {lib/argv.c +15
-0@@ -40,3 +40,18 @@ void setup_args(char *args) __args = args;__setup_args (); } + +void setup_args_prognam (char *args) +{ +int i; + +if (args) { + __args = args; +__setup_args (); + +for (i = __argc; i >0 ; --i) + __argv[i] = __argv[i-1 ]; + } + __argv[0 ] =NULL ;// just reserve for now + ++__argc; +}lib/arm/setup.c +1
-1@@ -22,7 +22,7 @@extern unsigned long stacktop;extern void io_init (void ); -extern void setup_args (const char *args); +extern void setup_args_prognam (const char *args);u32 cpus[NR_CPUS ] = { [0 ...NR_CPUS -1 ] = (~0U ) };int nr_cpus;
lib/arm/setup.c void setup(const void *fdt) · line 128
Quoted 6 lines
lib/arm/setup.c +1
-1@@ -124,5 +124,5 @@ void setup(const void *fdt) ret =dt_get_bootargs (&bootargs);assert (ret ==0 ); -setup_args (bootargs); +setup_args_prognam (bootargs); }
Re: [kvm-unit-tests PATCH v3 1/3] arm/arm64: reserve argv[0] for prognam
In reply to Andrew JonesQuoted 1 line · Andrew Jones
Signed-off-by Andrew Jones <[email protected]>
Quoted 101 lines
--- arm/selftest.c | 14 +++++++------- arm/spinlock-test.c | 2 +- lib/argv.c | 15 +++++++++++++++ lib/arm/setup.c | 4 ++-- 4 files changed, 25 insertions(+), 10 deletions(-)arm/selftest.c +7
-7@@ -324,25 +324,25 @@ int main(int argc, char **argv) {report_prefix_push ("selftest" ); -if (!argc) +if (argc <2 )report_abort ("no test specified" ); -report_prefix_push (argv[0 ]); +report_prefix_push (argv[1 ]); -if (strcmp (argv[0 ],"setup" ) ==0 ) { +if (strcmp (argv[1 ],"setup" ) ==0 ) { -check_setup (argc-1 , &argv[1 ]); +check_setup (argc-2 , &argv[2 ]); - }else if (strcmp (argv[0 ],"vectors-kernel" ) ==0 ) { + }else if (strcmp (argv[1 ],"vectors-kernel" ) ==0 ) {check_vectors (NULL ); - }else if (strcmp (argv[0 ],"vectors-user" ) ==0 ) { + }else if (strcmp (argv[1 ],"vectors-user" ) ==0 ) {start_usr (check_vectors,NULL , (unsigned long )thread_stack_alloc ()); - }else if (strcmp (argv[0 ],"smp" ) ==0 ) { + }else if (strcmp (argv[1 ],"smp" ) ==0 ) {int cpu;arm/spinlock-test.c +1
-1@@ -69,7 +69,7 @@ int main(int argc, char **argv) {int cpu; -if (argc &&strcmp (argv[0 ],"bad" ) !=0 ) { +if (argc >1 &&strcmp (argv[1 ],"bad" ) !=0 ) { lock_ops.lock = gcc_builtin_lock; lock_ops.unlock = gcc_builtin_unlock; }else {lib/argv.c +15
-0@@ -40,3 +40,18 @@ void setup_args(char *args) __args = args;__setup_args (); } + +void setup_args_prognam (char *args) +{ +int i; + +if (args) { + __args = args; +__setup_args (); + +for (i = __argc; i >0 ; --i) + __argv[i] = __argv[i-1 ]; + } + __argv[0 ] =NULL ;// just reserve for now + ++__argc; +}lib/arm/setup.c +2
-2@@ -22,7 +22,7 @@extern unsigned long stacktop;extern void io_init (void ); -extern void setup_args (const char *args); +extern void setup_args_prognam (const char *args);u32 cpus[NR_CPUS ] = { [0 ...NR_CPUS -1 ] = (~0U ) };int nr_cpus;@@ -124,5 +124,5 @@ void setup(const void *fdt) ret =dt_get_bootargs (&bootargs);assert (ret ==0 ); -setup_args (bootargs); +setup_args_prognam (bootargs); }
PATCH v3 2/3 powerpc/ppc64: reserve argv[0] for prognam
In reply to Andrew Jones--- lib/powerpc/setup.c | 4 ++-- powerpc/emulator.c | 2 +- powerpc/rtas.c | 12 ++++++------ powerpc/selftest.c | 8 ++++---- powerpc/spapr_hcall.c | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-)
lib/powerpc/setup.c +2 -2
@@ -20,7 +20,7 @@extern unsigned long stacktop;extern void io_init (void ); -extern void setup_args (const char *args); +extern void setup_args_prognam (const char *args);u32 cpus[NR_CPUS ] = { [0 ...NR_CPUS -1 ] = (~0U ) };int nr_cpus;
@@ -164,5 +164,5 @@ void setup(const void *fdt) ret =dt_get_bootargs (&bootargs);assert (ret ==0 ); -setup_args (bootargs); +setup_args_prognam (bootargs); }
powerpc/emulator.c +1 -1
@@ -354,7 +354,7 @@ int main(int argc, char **argv)handle_exception (0x700 , program_check_handler, (void *)&is_invalid);handle_exception (0x600 , alignment_handler, (void *)&alignment); -for (i =0 ; i < argc; i++) { +for (i =1 ; i < argc; i++) {if (strcmp (argv[i],"-v" ) ==0 ) { verbose =1 ; }
powerpc/rtas.c +6 -6
@@ -115,23 +115,23 @@ int main(int argc, char **argv)report_prefix_push ("rtas" ); -if (!argc) +if (argc <2 )report_abort ("no test specified" ); -report_prefix_push (argv[0 ]); +report_prefix_push (argv[1 ]); -if (strcmp (argv[0 ],"get-time-of-day" ) ==0 ) { +if (strcmp (argv[1 ],"get-time-of-day" ) ==0 ) { - len =parse_keyval (argv[1 ], &val); + len =parse_keyval (argv[2 ], &val);if (len ==-1 ) {printf ("Missing parameter \"date\"\n" );abort (); } - argv[1 ][len] ='\0' ; + argv[2 ][len] ='\0' ;check_get_time_of_day (val); - }else if (strcmp (argv[0 ],"set-time-of-day" ) ==0 ) { + }else if (strcmp (argv[1 ],"set-time-of-day" ) ==0 ) {check_set_time_of_day ();
powerpc/selftest.c +4 -4
@@ -49,14 +49,14 @@ int main(int argc, char **argv) {report_prefix_push ("selftest" ); -if (!argc) +if (argc <2 )report_abort ("no test specified" ); -report_prefix_push (argv[0 ]); +report_prefix_push (argv[1 ]); -if (strcmp (argv[0 ],"setup" ) ==0 ) { +if (strcmp (argv[1 ],"setup" ) ==0 ) { -check_setup (argc-1 , &argv[1 ]); +check_setup (argc-2 , &argv[2 ]); }
powerpc/spapr_hcall.c +3 -3
@@ -154,13 +154,13 @@ int main(int argc, char **argv)report_prefix_push ("hypercall" ); -if (!argc || (argc ==1 && !strcmp (argv[0 ],"all" ))) +if (argc <2 || (argc ==2 && !strcmp (argv[1 ],"all" ))) all =1 ;for (i =0 ; hctests[i].name !=NULL ; i++) {report_prefix_push (hctests[i].name); -if (all ||strcmp (argv[0 ], hctests[i].name) ==0 ) { - hctests[i].func (argc, argv); +if (all ||strcmp (argv[1 ], hctests[i].name) ==0 ) { + hctests[i].func (argc-1 , &argv[1 ]); }report_prefix_pop (); }
Signature · 1 line
2.4.11
Re: [kvm-unit-tests PATCH v3 2/3] powerpc/ppc64: reserve argv[0] for prognam
Quoted 8 lines · Andrew Jones
Signed-off-by Andrew Jones <[email protected]>--- lib/powerpc/setup.c | 4 ++-- powerpc/emulator.c | 2 +- powerpc/rtas.c | 12 ++++++------ powerpc/selftest.c | 8 ++++---- powerpc/spapr_hcall.c | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-)
Re: [kvm-unit-tests PATCH v3 2/3] powerpc/ppc64: reserve argv[0] for prognam
In reply to Andrew JonesQuoted 1 line · Andrew Jones
Signed-off-by Andrew Jones <[email protected]>
Quoted 120 lines
--- lib/powerpc/setup.c | 4 ++-- powerpc/emulator.c | 2 +- powerpc/rtas.c | 12 ++++++------ powerpc/selftest.c | 8 ++++---- powerpc/spapr_hcall.c | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-)lib/powerpc/setup.c +2
-2@@ -20,7 +20,7 @@extern unsigned long stacktop;extern void io_init (void ); -extern void setup_args (const char *args); +extern void setup_args_prognam (const char *args);u32 cpus[NR_CPUS ] = { [0 ...NR_CPUS -1 ] = (~0U ) };int nr_cpus;@@ -164,5 +164,5 @@ void setup(const void *fdt) ret =dt_get_bootargs (&bootargs);assert (ret ==0 ); -setup_args (bootargs); +setup_args_prognam (bootargs); }powerpc/emulator.c +1
-1@@ -354,7 +354,7 @@ int main(int argc, char **argv)handle_exception (0x700 , program_check_handler, (void *)&is_invalid);handle_exception (0x600 , alignment_handler, (void *)&alignment); -for (i =0 ; i < argc; i++) { +for (i =1 ; i < argc; i++) {if (strcmp (argv[i],"-v" ) ==0 ) { verbose =1 ; }powerpc/rtas.c +6
-6@@ -115,23 +115,23 @@ int main(int argc, char **argv)report_prefix_push ("rtas" ); -if (!argc) +if (argc <2 )report_abort ("no test specified" ); -report_prefix_push (argv[0 ]); +report_prefix_push (argv[1 ]); -if (strcmp (argv[0 ],"get-time-of-day" ) ==0 ) { +if (strcmp (argv[1 ],"get-time-of-day" ) ==0 ) { - len =parse_keyval (argv[1 ], &val); + len =parse_keyval (argv[2 ], &val);if (len ==-1 ) {printf ("Missing parameter \"date\"\n" );abort (); } - argv[1 ][len] ='\0' ; + argv[2 ][len] ='\0' ;check_get_time_of_day (val); - }else if (strcmp (argv[0 ],"set-time-of-day" ) ==0 ) { + }else if (strcmp (argv[1 ],"set-time-of-day" ) ==0 ) {check_set_time_of_day ();powerpc/selftest.c +4
-4@@ -49,14 +49,14 @@ int main(int argc, char **argv) {report_prefix_push ("selftest" ); -if (!argc) +if (argc <2 )report_abort ("no test specified" ); -report_prefix_push (argv[0 ]); +report_prefix_push (argv[1 ]); -if (strcmp (argv[0 ],"setup" ) ==0 ) { +if (strcmp (argv[1 ],"setup" ) ==0 ) { -check_setup (argc-1 , &argv[1 ]); +check_setup (argc-2 , &argv[2 ]); }powerpc/spapr_hcall.c +3
-3@@ -154,13 +154,13 @@ int main(int argc, char **argv)report_prefix_push ("hypercall" ); -if (!argc || (argc ==1 && !strcmp (argv[0 ],"all" ))) +if (argc <2 || (argc ==2 && !strcmp (argv[1 ],"all" ))) all =1 ;for (i =0 ; hctests[i].name !=NULL ; i++) {report_prefix_push (hctests[i].name); -if (all ||strcmp (argv[0 ], hctests[i].name) ==0 ) { - hctests[i].func (argc, argv); +if (all ||strcmp (argv[1 ], hctests[i].name) ==0 ) { + hctests[i].func (argc-1 , &argv[1 ]); }report_prefix_pop (); }
PATCH v3 3/3 arm & powerpc: populate argv[0] with prognam
In reply to Andrew Jones--- arm/Makefile.common | 6 +++++- lib/argv.c | 14 +++++++++----- lib/auxinfo.c | 2 ++ lib/auxinfo.h | 7 +++++++ powerpc/Makefile.common | 6 +++++- scripts/auxinfo.mak | 7 +++++++ x86/Makefile.common | 1 + 7 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 lib/auxinfo.c create mode 100644 lib/auxinfo.h create mode 100755 scripts/auxinfo.mak
arm/Makefile.common +5 -1
@@ -29,6 +29,7 @@ CFLAGS += -I lib -I lib/libfdt asm-offsets = lib/$(ARCH)/asm-offsets.h include scripts/asm-offsets.mak +include scripts/auxinfo.mak cflatobjs += lib/util.o cflatobjs += lib/alloc.o
@@ -52,9 +53,12 @@ start_addr := $(shell printf "%x\n" $$(( $(phys_base) + $(kernel_offset) ))) FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi) %.elf: LDFLAGS = $(CFLAGS) -nostdlib %.elf: %.o $(FLATLIBS) arm/flat.lds $(cstart.o) + $(call gen-auxinfo,$(@:.elf=.aux.c),$(@:.elf=.flat)) + $(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) $(@:.elf=.aux.c) $(CC) $(LDFLAGS) -o $@ \ -Wl,-T,arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \ - $(filter %.o, $^) $(FLATLIBS) + $(filter %.o, $^) $(FLATLIBS) $(@:.elf=.aux.o) + $(RM) $(@:.elf=.aux).* %.flat: %.elf $(OBJCOPY) -O binary $^ $@
lib/argv.c +9 -5
@@ -1,10 +1,13 @@#include "libcflat.h" +#include "auxinfo.h" int __argc;char *__argv[100 ];char *__args;char __args_copy[1000 ]; +static char *copy_ptr = __args_copy; +static bool isblank (char p) {return p ==' ' || p =='\t' ;
@@ -21,13 +24,12 @@ void __setup_args(void) {char *args = __args;char **argv = __argv; -char *p = __args_copy;while (*(args =skip_blanks (args)) !='\0' ) { - *argv++ = p; + *argv++ = copy_ptr;while (*args !='\0' && !isblank (*args)) - *p++ = *args++; - *p++ ='\0' ; + *copy_ptr++ = *args++; + *copy_ptr++ ='\0' ; } __argc = argv - __argv; }
@@ -52,6 +54,8 @@ void setup_args_prognam(char *args)for (i = __argc; i >0 ; --i) __argv[i] = __argv[i-1 ]; } - __argv[0 ] =NULL ;// just reserve for now + __argv[0 ] = copy_ptr; +strcpy (__argv[0 ], auxinfo.prognam); + copy_ptr +=strlen (auxinfo.prognam) +1 ; ++__argc; }
lib/auxinfo.c new file +2 -0
@@ -0,0 +1,2 @@ +#include "auxinfo.h" +struct auxinfo auxinfo __attribute__((weak));
lib/auxinfo.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef _AUXINFO_H_ +#define _AUXINFO_H_ +struct auxinfo { +const char *prognam; +}; +extern struct auxinfo auxinfo; +#endif
powerpc/Makefile.common +5 -1
@@ -27,6 +27,7 @@ CFLAGS += -fpie asm-offsets = lib/$(ARCH)/asm-offsets.h include scripts/asm-offsets.mak +include scripts/auxinfo.mak cflatobjs += lib/util.o cflatobjs += lib/alloc.o
@@ -41,9 +42,12 @@ FLATLIBS = $(libcflat) $(LIBFDT_archive) %.elf: CFLAGS += $(arch_CFLAGS) %.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie %.elf: %.o $(FLATLIBS) powerpc/flat.lds $(cstart.o) $(reloc.o) + $(call gen-auxinfo,$(@:.elf=.aux.c),$@) + $(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) $(@:.elf=.aux.c) $(LD) $(LDFLAGS) -o $@ \ -T powerpc/flat.lds --build-id=none \ - $(filter %.o, $^) $(FLATLIBS) + $(filter %.o, $^) $(FLATLIBS) $(@:.elf=.aux.o) + $(RM) $(@:.elf=.aux).* @echo -n Checking $@ for unsupported reloc types... @if $(OBJDUMP) -R $@ | grep R_ | grep -v R_PPC64_RELATIVE; then \ false; \
scripts/auxinfo.mak new file +7 -0
@@ -0,0 +1,7 @@ + +define gen-auxinfo + (echo "#include <auxinfo.h>"; \ + echo "struct auxinfo auxinfo = {"; \ + echo " .prognam = \"$(2)\","; \ + echo "};" ) > $(1) +endef
x86/Makefile.common +1 -0
@@ -2,6 +2,7 @@ all: test_cases +cflatobjs += lib/auxinfo.o cflatobjs += lib/pci.o cflatobjs += lib/x86/io.o cflatobjs += lib/x86/smp.o
Signature · 1 line
2.4.11
Re: [kvm-unit-tests PATCH v3 3/3] arm & powerpc: populate argv[0] with prognam
Quoted 1 line · Andrew Jones
Signed-off-by Andrew Jones <[email protected]>
Quoted 157 lines
--- arm/Makefile.common | 6 +++++- lib/argv.c | 14 +++++++++----- lib/auxinfo.c | 2 ++ lib/auxinfo.h | 7 +++++++ powerpc/Makefile.common | 6 +++++- scripts/auxinfo.mak | 7 +++++++ x86/Makefile.common | 1 + 7 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 lib/auxinfo.c create mode 100644 lib/auxinfo.h create mode 100755 scripts/auxinfo.makarm/Makefile.common +5
-1@@ -29,6 +29,7 @@ CFLAGS += -I lib -I lib/libfdt asm-offsets = lib/$(ARCH)/asm-offsets.h include scripts/asm-offsets.mak +include scripts/auxinfo.mak cflatobjs += lib/util.o cflatobjs += lib/alloc.o@@ -52,9 +53,12 @@ start_addr := $(shell printf "%x\n" $$(( $(phys_base) + $(kernel_offset) ))) FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi) %.elf: LDFLAGS = $(CFLAGS) -nostdlib %.elf: %.o $(FLATLIBS) arm/flat.lds $(cstart.o) + $(call gen-auxinfo,$(@:.elf=.aux.c),$(@:.elf=.flat)) + $(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) $(@:.elf=.aux.c) $(CC) $(LDFLAGS) -o $@ \ -Wl,-T,arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \ - $(filter %.o, $^) $(FLATLIBS) + $(filter %.o, $^) $(FLATLIBS) $(@:.elf=.aux.o) + $(RM) $(@:.elf=.aux).* %.flat: %.elf $(OBJCOPY) -O binary $^ $@lib/argv.c +9
-5@@ -1,10 +1,13 @@#include "libcflat.h" +#include "auxinfo.h" int __argc;char *__argv[100 ];char *__args;char __args_copy[1000 ]; +static char *copy_ptr = __args_copy; +static bool isblank (char p) {return p ==' ' || p =='\t' ;@@ -21,13 +24,12 @@ void __setup_args(void) {char *args = __args;char **argv = __argv; -char *p = __args_copy;while (*(args =skip_blanks (args)) !='\0' ) { - *argv++ = p; + *argv++ = copy_ptr;while (*args !='\0' && !isblank (*args)) - *p++ = *args++; - *p++ ='\0' ; + *copy_ptr++ = *args++; + *copy_ptr++ ='\0' ; } __argc = argv - __argv; }@@ -52,6 +54,8 @@ void setup_args_prognam(char *args)for (i = __argc; i >0 ; --i) __argv[i] = __argv[i-1 ]; } - __argv[0 ] =NULL ;// just reserve for now + __argv[0 ] = copy_ptr; +strcpy (__argv[0 ], auxinfo.prognam); + copy_ptr +=strlen (auxinfo.prognam) +1 ; ++__argc; }lib/auxinfo.c new file +2
-0@@ -0,0 +1,2 @@ +#include "auxinfo.h" +struct auxinfo auxinfo __attribute__((weak));lib/auxinfo.h new file +7
-0@@ -0,0 +1,7 @@ +#ifndef _AUXINFO_H_ +#define _AUXINFO_H_ +struct auxinfo { +const char *prognam; +}; +extern struct auxinfo auxinfo; +#endif powerpc/Makefile.common +5
-1@@ -27,6 +27,7 @@ CFLAGS += -fpie asm-offsets = lib/$(ARCH)/asm-offsets.h include scripts/asm-offsets.mak +include scripts/auxinfo.mak cflatobjs += lib/util.o cflatobjs += lib/alloc.o@@ -41,9 +42,12 @@ FLATLIBS = $(libcflat) $(LIBFDT_archive) %.elf: CFLAGS += $(arch_CFLAGS) %.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie %.elf: %.o $(FLATLIBS) powerpc/flat.lds $(cstart.o) $(reloc.o) + $(call gen-auxinfo,$(@:.elf=.aux.c),$@) + $(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) $(@:.elf=.aux.c) $(LD) $(LDFLAGS) -o $@ \ -T powerpc/flat.lds --build-id=none \ - $(filter %.o, $^) $(FLATLIBS) + $(filter %.o, $^) $(FLATLIBS) $(@:.elf=.aux.o) + $(RM) $(@:.elf=.aux).* @echo -n Checking $@ for unsupported reloc types... @if $(OBJDUMP) -R $@ | grep R_ | grep -v R_PPC64_RELATIVE; then \ false; \scripts/auxinfo.mak new file +7
-0@@ -0,0 +1,7 @@ + +define gen-auxinfo + (echo "#include <auxinfo.h>"; \ + echo "struct auxinfo auxinfo = {"; \ + echo " .prognam = \"$(2)\","; \ + echo "};" ) > $(1) +endefx86/Makefile.common +1
-0@@ -2,6 +2,7 @@ all: test_cases +cflatobjs += lib/auxinfo.o cflatobjs += lib/pci.o cflatobjs += lib/x86/io.o cflatobjs += lib/x86/smp.o
Re: [kvm-unit-tests PATCH v3 3/3] arm & powerpc: populate argv[0] with prognam
In reply to Andrew JonesQuoted 13 lines · Andrew Jones
Signed-off-by Andrew Jones <[email protected]>--- arm/Makefile.common | 6 +++++- lib/argv.c | 14 +++++++++----- lib/auxinfo.c | 2 ++ lib/auxinfo.h | 7 +++++++ powerpc/Makefile.common | 6 +++++- scripts/auxinfo.mak | 7 +++++++ x86/Makefile.common | 1 + 7 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 lib/auxinfo.c create mode 100644 lib/auxinfo.h create mode 100755 scripts/auxinfo.mak
Paolo Bonzini
maintainerRe: [kvm-unit-tests PATCH v3 3/3] arm & powerpc: populate argv[0] with prognam
In reply to Andrew JonesWhat about this slightly simpler Makefilery? I'll test ARM shortly, help with PPC will be gladly accepted. :)
Paolo
arm/Makefile.common +1 -1
@@ -54,7 +54,7 @@ FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi) %.elf: %.o $(FLATLIBS) arm/flat.lds $(cstart.o) $(CC) $(LDFLAGS) -o $@ \ -Wl,-T,arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \ - $(filter %.o, $^) $(FLATLIBS) + $(filter %.o, $^) $(FLATLIBS) lib/auxinfo.c -DPROGNAME=\"$(*F)\" %.flat: %.elf $(OBJCOPY) -O binary $^ $@
lib/argv.c +9 -5
@@ -1,10 +1,13 @@#include "libcflat.h" +#include "auxinfo.h" int __argc;char *__argv[100 ];char *__args;char __args_copy[1000 ]; +static char *copy_ptr = __args_copy; +static bool isblank (char p) {return p ==' ' || p =='\t' ;
@@ -21,13 +24,12 @@ void __setup_args(void) {char *args = __args;char **argv = __argv; -char *p = __args_copy;while (*(args =skip_blanks (args)) !='\0' ) { - *argv++ = p; + *argv++ = copy_ptr;while (*args !='\0' && !isblank (*args)) - *p++ = *args++; - *p++ ='\0' ; + *copy_ptr++ = *args++; + *copy_ptr++ ='\0' ; } __argc = argv - __argv; }
@@ -52,6 +54,8 @@ void setup_args_prognam(char *args)for (i = __argc; i >0 ; --i) __argv[i] = __argv[i-1 ]; } - __argv[0 ] =NULL ;// just reserve for now + __argv[0 ] = copy_ptr; +strcpy (__argv[0 ], auxinfo.prognam); + copy_ptr +=strlen (auxinfo.prognam) +1 ; ++__argc; }
lib/auxinfo.c new file +2 -0
@@ -0,0 +1,2 @@ +#include "auxinfo.h" +struct auxinfo auxinfo = {PROGNAME };
lib/auxinfo.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef _AUXINFO_H_ +#define _AUXINFO_H_ +struct auxinfo { +const char *prognam; +}; + +/* No extern! Define a common symbol. */ +struct auxinfo auxinfo; +#endif
powerpc/Makefile.common +4 -3
@@ -41,9 +41,10 @@ FLATLIBS = $(libcflat) $(LIBFDT_archive) %.elf: CFLAGS += $(arch_CFLAGS) %.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie %.elf: %.o $(FLATLIBS) powerpc/flat.lds $(cstart.o) $(reloc.o) - $(LD) $(LDFLAGS) -o $@ \ - -T powerpc/flat.lds --build-id=none \ - $(filter %.o, $^) $(FLATLIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ \ + -Wl,-T,powerpc/flat.lds -Wl,--build-id=none \ + $(filter %.o, $^) $(FLATLIBS) \ + lib/auxinfo.c -DPROGNAME=\"$*\" @echo -n Checking $@ for unsupported reloc types... @if $(OBJDUMP) -R $@ | grep R_ | grep -v R_PPC64_RELATIVE; then \ false; \
x86/Makefile.common +1 -1
@@ -31,7 +31,7 @@ libgcc := $(shell $(CC) -m$(bits) --print-libgcc-file-name) FLATLIBS = lib/libcflat.a $(libgcc) %.elf: %.o $(FLATLIBS) x86/flat.lds $(cstart.o) $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,x86/flat.lds \ - $(filter %.o, $^) $(FLATLIBS) + $(filter %.o, $^) $(FLATLIBS) lib/auxinfo.c -DPROGNAME=\"$(*F)\" %.flat: %.elf $(OBJCOPY) -O elf32-i386 $^ $@
Re: [kvm-unit-tests PATCH v3 3/3] arm & powerpc: populate argv[0] with prognam
Quoted 2 lines · Paolo Bonzini
What about this slightly simpler Makefilery? I'll test ARM shortly, help with PPC will be gladly accepted. :)
If it works, it works for me :-)
I guess we don't need the x86/Makefile.common hunk though, as seabios gets you argv[0]=prognam already.
nit: I'ed like to either add an 'e' to .prognam or remove the 'E' from PROGNAME.
Thanks,
drew
Quoted 119 lines
Paolo
arm/Makefile.common +1
-1@@ -54,7 +54,7 @@ FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi) %.elf: %.o $(FLATLIBS) arm/flat.lds $(cstart.o) $(CC) $(LDFLAGS) -o $@ \ -Wl,-T,arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \ - $(filter %.o, $^) $(FLATLIBS) + $(filter %.o, $^) $(FLATLIBS) lib/auxinfo.c -DPROGNAME=\"$(*F)\" %.flat: %.elf $(OBJCOPY) -O binary $^ $@lib/argv.c +9
-5@@ -1,10 +1,13 @@#include "libcflat.h" +#include "auxinfo.h" int __argc;char *__argv[100 ];char *__args;char __args_copy[1000 ]; +static char *copy_ptr = __args_copy; +static bool isblank (char p) {return p ==' ' || p =='\t' ;@@ -21,13 +24,12 @@ void __setup_args(void) {char *args = __args;char **argv = __argv; -char *p = __args_copy;while (*(args =skip_blanks (args)) !='\0' ) { - *argv++ = p; + *argv++ = copy_ptr;while (*args !='\0' && !isblank (*args)) - *p++ = *args++; - *p++ ='\0' ; + *copy_ptr++ = *args++; + *copy_ptr++ ='\0' ; } __argc = argv - __argv; }@@ -52,6 +54,8 @@ void setup_args_prognam(char *args)for (i = __argc; i >0 ; --i) __argv[i] = __argv[i-1 ]; } - __argv[0 ] =NULL ;// just reserve for now + __argv[0 ] = copy_ptr; +strcpy (__argv[0 ], auxinfo.prognam); + copy_ptr +=strlen (auxinfo.prognam) +1 ; ++__argc; }lib/auxinfo.c new file +2
-0@@ -0,0 +1,2 @@ +#include "auxinfo.h" +struct auxinfo auxinfo = {PROGNAME };lib/auxinfo.h new file +9
-0@@ -0,0 +1,9 @@ +#ifndef _AUXINFO_H_ +#define _AUXINFO_H_ +struct auxinfo { +const char *prognam; +}; + +/* No extern! Define a common symbol. */ +struct auxinfo auxinfo; +#endif powerpc/Makefile.common +4
-3@@ -41,9 +41,10 @@ FLATLIBS = $(libcflat) $(LIBFDT_archive) %.elf: CFLAGS += $(arch_CFLAGS) %.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie %.elf: %.o $(FLATLIBS) powerpc/flat.lds $(cstart.o) $(reloc.o) - $(LD) $(LDFLAGS) -o $@ \ - -T powerpc/flat.lds --build-id=none \ - $(filter %.o, $^) $(FLATLIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ \ + -Wl,-T,powerpc/flat.lds -Wl,--build-id=none \ + $(filter %.o, $^) $(FLATLIBS) \ + lib/auxinfo.c -DPROGNAME=\"$*\" @echo -n Checking $@ for unsupported reloc types... @if $(OBJDUMP) -R $@ | grep R_ | grep -v R_PPC64_RELATIVE; then \ false; \x86/Makefile.common +1
-2@@ -31,7 +31,7 @@ libgcc := $(shell $(CC) -m$(bits) --print-libgcc-file-name) FLATLIBS = lib/libcflat.a $(libgcc) %.elf: %.o $(FLATLIBS) x86/flat.lds $(cstart.o) $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,x86/flat.lds \ - $(filter %.o, $^) $(FLATLIBS) + $(filter %.o, $^) $(FLATLIBS) lib/auxinfo.c -DPROGNAME=\"$(*F)\" %.flat: %.elf $(OBJCOPY) -O elf32-i386 $^ $@ --To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Paolo Bonzini
maintainerRe: [kvm-unit-tests PATCH v3 3/3] arm & powerpc: populate argv[0] with prognam
Quoted 8 lines · Andrew Jones
Quoted 2 lines · Paolo Bonzini
What about this slightly simpler Makefilery? I'll test ARM shortly, help with PPC will be gladly accepted. :)
If it works, it works for me :-)
I guess we don't need the x86/Makefile.common hunk though, as seabios gets you argv[0]=prognam already.
Right, I left that in only for testing. :) x86 is the reason why I'm making the symbol common in auxinfo.h.
Paolo
Quoted 125 lines
nit: I'ed like to either add an 'e' to .prognam or remove the 'E' from PROGNAME.
Thanks,
drewQuoted 119 lines
Paolo
arm/Makefile.common +1
-1@@ -54,7 +54,7 @@ FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi) %.elf: %.o $(FLATLIBS) arm/flat.lds $(cstart.o) $(CC) $(LDFLAGS) -o $@ \ -Wl,-T,arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \ - $(filter %.o, $^) $(FLATLIBS) + $(filter %.o, $^) $(FLATLIBS) lib/auxinfo.c -DPROGNAME=\"$(*F)\" %.flat: %.elf $(OBJCOPY) -O binary $^ $@lib/argv.c +9
-5@@ -1,10 +1,13 @@#include "libcflat.h" +#include "auxinfo.h" int __argc;char *__argv[100 ];char *__args;char __args_copy[1000 ]; +static char *copy_ptr = __args_copy; +static bool isblank (char p) {return p ==' ' || p =='\t' ;@@ -21,13 +24,12 @@ void __setup_args(void) {char *args = __args;char **argv = __argv; -char *p = __args_copy;while (*(args =skip_blanks (args)) !='\0' ) { - *argv++ = p; + *argv++ = copy_ptr;while (*args !='\0' && !isblank (*args)) - *p++ = *args++; - *p++ ='\0' ; + *copy_ptr++ = *args++; + *copy_ptr++ ='\0' ; } __argc = argv - __argv; }@@ -52,6 +54,8 @@ void setup_args_prognam(char *args)for (i = __argc; i >0 ; --i) __argv[i] = __argv[i-1 ]; } - __argv[0 ] =NULL ;// just reserve for now + __argv[0 ] = copy_ptr; +strcpy (__argv[0 ], auxinfo.prognam); + copy_ptr +=strlen (auxinfo.prognam) +1 ; ++__argc; }lib/auxinfo.c new file +2
-0@@ -0,0 +1,2 @@ +#include "auxinfo.h" +struct auxinfo auxinfo = {PROGNAME };lib/auxinfo.h new file +9
-0@@ -0,0 +1,9 @@ +#ifndef _AUXINFO_H_ +#define _AUXINFO_H_ +struct auxinfo { +const char *prognam; +}; + +/* No extern! Define a common symbol. */ +struct auxinfo auxinfo; +#endif powerpc/Makefile.common +4
-3@@ -41,9 +41,10 @@ FLATLIBS = $(libcflat) $(LIBFDT_archive) %.elf: CFLAGS += $(arch_CFLAGS) %.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie %.elf: %.o $(FLATLIBS) powerpc/flat.lds $(cstart.o) $(reloc.o) - $(LD) $(LDFLAGS) -o $@ \ - -T powerpc/flat.lds --build-id=none \ - $(filter %.o, $^) $(FLATLIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ \ + -Wl,-T,powerpc/flat.lds -Wl,--build-id=none \ + $(filter %.o, $^) $(FLATLIBS) \ + lib/auxinfo.c -DPROGNAME=\"$*\" @echo -n Checking $@ for unsupported reloc types... @if $(OBJDUMP) -R $@ | grep R_ | grep -v R_PPC64_RELATIVE; then \ false; \x86/Makefile.common +1
-2@@ -31,7 +31,7 @@ libgcc := $(shell $(CC) -m$(bits) --print-libgcc-file-name) FLATLIBS = lib/libcflat.a $(libgcc) %.elf: %.o $(FLATLIBS) x86/flat.lds $(cstart.o) $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,x86/flat.lds \ - $(filter %.o, $^) $(FLATLIBS) + $(filter %.o, $^) $(FLATLIBS) lib/auxinfo.c -DPROGNAME=\"$(*F)\" %.flat: %.elf $(OBJCOPY) -O elf32-i386 $^ $@ --To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [kvm-unit-tests PATCH v3 3/3] arm & powerpc: populate argv[0] with prognam
In reply to Andrew JonesQuoted 5 lines · Andrew Jones
Quoted 2 lines · Paolo Bonzini
What about this slightly simpler Makefilery? I'll test ARM shortly, help with PPC will be gladly accepted. :)
If it works, it works for me :-)
Sorry this message was written poorly. It probably mostly looks like "works for me", as in tested-by, but really I was just agreeing with the patch without actually having tested it yet, thus the "*If* it works" part. Anyway, it doesn't :-) I just sent a fixup patch for it though.
Thanks,
drew
Quoted 133 lines
I guess we don't need the x86/Makefile.common hunk though, as seabios gets you argv[0]=prognam already.
nit: I'ed like to either add an 'e' to .prognam or remove the 'E' from PROGNAME.
Thanks,
drewQuoted 116 lines
Paolo
arm/Makefile.common +1
-1@@ -54,7 +54,7 @@ FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi) %.elf: %.o $(FLATLIBS) arm/flat.lds $(cstart.o) $(CC) $(LDFLAGS) -o $@ \ -Wl,-T,arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \ - $(filter %.o, $^) $(FLATLIBS) + $(filter %.o, $^) $(FLATLIBS) lib/auxinfo.c -DPROGNAME=\"$(*F)\" %.flat: %.elf $(OBJCOPY) -O binary $^ $@lib/argv.c +9
-5@@ -1,10 +1,13 @@#include "libcflat.h" +#include "auxinfo.h" int __argc;char *__argv[100 ];char *__args;char __args_copy[1000 ]; +static char *copy_ptr = __args_copy; +static bool isblank (char p) {return p ==' ' || p =='\t' ;@@ -21,13 +24,12 @@ void __setup_args(void) {char *args = __args;char **argv = __argv; -char *p = __args_copy;while (*(args =skip_blanks (args)) !='\0' ) { - *argv++ = p; + *argv++ = copy_ptr;while (*args !='\0' && !isblank (*args)) - *p++ = *args++; - *p++ ='\0' ; + *copy_ptr++ = *args++; + *copy_ptr++ ='\0' ; } __argc = argv - __argv; }@@ -52,6 +54,8 @@ void setup_args_prognam(char *args)for (i = __argc; i >0 ; --i) __argv[i] = __argv[i-1 ]; } - __argv[0 ] =NULL ;// just reserve for now + __argv[0 ] = copy_ptr; +strcpy (__argv[0 ], auxinfo.prognam); + copy_ptr +=strlen (auxinfo.prognam) +1 ; ++__argc; }lib/auxinfo.c new file +2
-0@@ -0,0 +1,2 @@ +#include "auxinfo.h" +struct auxinfo auxinfo = {PROGNAME };lib/auxinfo.h new file +9
-0@@ -0,0 +1,9 @@ +#ifndef _AUXINFO_H_ +#define _AUXINFO_H_ +struct auxinfo { +const char *prognam; +}; + +/* No extern! Define a common symbol. */ +struct auxinfo auxinfo; +#endif powerpc/Makefile.common +4
-3@@ -41,9 +41,10 @@ FLATLIBS = $(libcflat) $(LIBFDT_archive) %.elf: CFLAGS += $(arch_CFLAGS) %.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie %.elf: %.o $(FLATLIBS) powerpc/flat.lds $(cstart.o) $(reloc.o) - $(LD) $(LDFLAGS) -o $@ \ - -T powerpc/flat.lds --build-id=none \ - $(filter %.o, $^) $(FLATLIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ \ + -Wl,-T,powerpc/flat.lds -Wl,--build-id=none \ + $(filter %.o, $^) $(FLATLIBS) \ + lib/auxinfo.c -DPROGNAME=\"$*\" @echo -n Checking $@ for unsupported reloc types... @if $(OBJDUMP) -R $@ | grep R_ | grep -v R_PPC64_RELATIVE; then \ false; \x86/Makefile.common +1
-2@@ -31,7 +31,7 @@ libgcc := $(shell $(CC) -m$(bits) --print-libgcc-file-name) FLATLIBS = lib/libcflat.a $(libgcc) %.elf: %.o $(FLATLIBS) x86/flat.lds $(cstart.o) $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,x86/flat.lds \ - $(filter %.o, $^) $(FLATLIBS) + $(filter %.o, $^) $(FLATLIBS) lib/auxinfo.c -DPROGNAME=\"$(*F)\" %.flat: %.elf $(OBJCOPY) -O elf32-i386 $^ $@ --Quoted 3 lines
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Paolo Bonzini
maintainerRe: [kvm-unit-tests PATCH v3 3/3] arm & powerpc: populate argv[0] with prognam
Quoted 11 lines · Andrew Jones
Quoted 5 lines · Andrew Jones
Quoted 2 lines · Paolo Bonzini
What about this slightly simpler Makefilery? I'll test ARM shortly, help with PPC will be gladly accepted. :)
If it works, it works for me :-)
Sorry this message was written poorly. It probably mostly looks like "works for me", as in tested-by, but really I was just agreeing with the patch without actually having tested it yet, thus the "*If* it works" part.
No, I had understood it right... I only tested ARM though before pushing.
Paolo
Hi Paolo,
Can you take a look at this series?
Thanks,
drew
Quoted 58 lines · Andrew Jones
v3:
- fixed x86 compilation by adding a weak symbol for auxinfo
- reworked all patches to avoid the ugly, although temporary, #ifdeffery
- also squashed patches 3/4 and 4/4 together
- moved initializer out offor()[Thomas]
- dropped all of Thomas' r-b's, as I changed too much to keep them, but he shouldn't need to review much of the two "reserve..." patches again.repost:
- rebased to latest upstream master (fixed trivial conflicts with 4c6b5d and dc0a22, theMakefilecleanup patches)
- added Thomas' r-b's
v2:
- copy auxinfo.prognam into argv[0] [drew]It just came to my attention that x86 has the normal argv[0], the program name, thanks to seabios. That raised the priority of fixing one of my pet peeves - arm and powerpc starting arguments at argv[0], as that just ain't right. This series fixes that. A few temporary hacks are used to avoid one big patch fixing both arm and powerpc at the same time. The hacks are gone by the end of the series.
Andrew Jones (3):
arm/arm64: reserve argv[0] for prognam
powerpc/ppc64: reserve argv[0] for prognam
arm & powerpc: populate argv[0] with prognamarm/Makefile.common | 6 +++++- arm/selftest.c | 14 +++++++------- arm/spinlock-test.c | 2 +- lib/argv.c | 27 +++++++++++++++++++++++---- lib/arm/setup.c | 4 ++-- lib/auxinfo.c | 2 ++ lib/auxinfo.h | 7 +++++++ lib/powerpc/setup.c | 4 ++-- powerpc/Makefile.common | 6 +++++- powerpc/emulator.c | 2 +- powerpc/rtas.c | 12 ++++++------ powerpc/selftest.c | 8 ++++---- powerpc/spapr_hcall.c | 6 +++--- scripts/auxinfo.mak | 7 +++++++ x86/Makefile.common | 1 + 15 files changed, 76 insertions(+), 32 deletions(-) create mode 100644 lib/auxinfo.c create mode 100644 lib/auxinfo.h create mode 100755 scripts/auxinfo.makSignature · 6 lines
2.4.11 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Paolo Bonzini
maintainerQuoted 4 lines · Andrew Jones
Hi Paolo,
Can you take a look at this series?
Yes, I wanted to find a little tomorrow to push x86 argv down by one item and then apply it.
Paolo
Quoted 63 lines
Thanks,
drewQuoted 58 lines · Andrew Jones
v3:
- fixed x86 compilation by adding a weak symbol for auxinfo
- reworked all patches to avoid the ugly, although temporary, #ifdeffery
- also squashed patches 3/4 and 4/4 together
- moved initializer out offor()[Thomas]
- dropped all of Thomas' r-b's, as I changed too much to keep them, but he shouldn't need to review much of the two "reserve..." patches again.repost:
- rebased to latest upstream master (fixed trivial conflicts with 4c6b5d and dc0a22, theMakefilecleanup patches)
- added Thomas' r-b's
v2:
- copy auxinfo.prognam into argv[0] [drew]It just came to my attention that x86 has the normal argv[0], the program name, thanks to seabios. That raised the priority of fixing one of my pet peeves - arm and powerpc starting arguments at argv[0], as that just ain't right. This series fixes that. A few temporary hacks are used to avoid one big patch fixing both arm and powerpc at the same time. The hacks are gone by the end of the series.
Andrew Jones (3):
arm/arm64: reserve argv[0] for prognam
powerpc/ppc64: reserve argv[0] for prognam
arm & powerpc: populate argv[0] with prognamarm/Makefile.common | 6 +++++- arm/selftest.c | 14 +++++++------- arm/spinlock-test.c | 2 +- lib/argv.c | 27 +++++++++++++++++++++++---- lib/arm/setup.c | 4 ++-- lib/auxinfo.c | 2 ++ lib/auxinfo.h | 7 +++++++ lib/powerpc/setup.c | 4 ++-- powerpc/Makefile.common | 6 +++++- powerpc/emulator.c | 2 +- powerpc/rtas.c | 12 ++++++------ powerpc/selftest.c | 8 ++++---- powerpc/spapr_hcall.c | 6 +++--- scripts/auxinfo.mak | 7 +++++++ x86/Makefile.common | 1 + 15 files changed, 76 insertions(+), 32 deletions(-) create mode 100644 lib/auxinfo.c create mode 100644 lib/auxinfo.h create mode 100755 scripts/auxinfo.makSignature · 6 lines
2.4.11 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Paolo Bonzini
Quoted 4 lines · Andrew Jones
Hi Paolo,
Can you take a look at this series?
Yes, I wanted to find a little tomorrow to push x86 argv down by one item and then apply it.
ping?
Thanks,
drew
Quoted 70 lines
Paolo
Quoted 4 lines
Thanks,
drewQuoted 59 lines
Quoted 58 lines · Andrew Jones
v3:
- fixed x86 compilation by adding a weak symbol for auxinfo
- reworked all patches to avoid the ugly, although temporary, #ifdeffery
- also squashed patches 3/4 and 4/4 together
- moved initializer out offor()[Thomas]
- dropped all of Thomas' r-b's, as I changed too much to keep them, but he shouldn't need to review much of the two "reserve..." patches again.repost:
- rebased to latest upstream master (fixed trivial conflicts with 4c6b5d and dc0a22, theMakefilecleanup patches)
- added Thomas' r-b's
v2:
- copy auxinfo.prognam into argv[0] [drew]It just came to my attention that x86 has the normal argv[0], the program name, thanks to seabios. That raised the priority of fixing one of my pet peeves - arm and powerpc starting arguments at argv[0], as that just ain't right. This series fixes that. A few temporary hacks are used to avoid one big patch fixing both arm and powerpc at the same time. The hacks are gone by the end of the series.
Andrew Jones (3):
arm/arm64: reserve argv[0] for prognam
powerpc/ppc64: reserve argv[0] for prognam
arm & powerpc: populate argv[0] with prognamarm/Makefile.common | 6 +++++- arm/selftest.c | 14 +++++++------- arm/spinlock-test.c | 2 +- lib/argv.c | 27 +++++++++++++++++++++++---- lib/arm/setup.c | 4 ++-- lib/auxinfo.c | 2 ++ lib/auxinfo.h | 7 +++++++ lib/powerpc/setup.c | 4 ++-- powerpc/Makefile.common | 6 +++++- powerpc/emulator.c | 2 +- powerpc/rtas.c | 12 ++++++------ powerpc/selftest.c | 8 ++++---- powerpc/spapr_hcall.c | 6 +++--- scripts/auxinfo.mak | 7 +++++++ x86/Makefile.common | 1 + 15 files changed, 76 insertions(+), 32 deletions(-) create mode 100644 lib/auxinfo.c create mode 100644 lib/auxinfo.h create mode 100755 scripts/auxinfo.makSignature · 6 lines
2.4.11 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html