[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 11/25] x86emul: place test blobs in executable section
This allows the section contents to be disassembled without going through any extra hoops, simplifying the analysis of problems in test and/or emulation code. The blobs being emitted as (r/o) data means we need to accept an assembler warning here (about the differing section attributes). Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- v3: New. --- a/tools/tests/x86_emulator/Makefile +++ b/tools/tests/x86_emulator/Makefile @@ -91,7 +91,7 @@ $(addsuffix .h,$(TESTCASES)): %.h: %.c t $(MAKE) -f testcase.mk TESTCASE=$* XEN_TARGET_ARCH=$(arch) $*-cflags="$$cflags" all; \ prefix=$(shell echo $(subst -,_,$*) | sed -e 's,^\([0-9]\),_\1,'); \ flavor=$$(echo $${cflags} | sed -e 's, .*,,' -e 'y,-=,__,') ; \ - (echo "static const unsigned int $${prefix}_$(arch)$${flavor}[] = {"; \ + (echo 'static const unsigned int __attribute__((section(".test"))) '"$${prefix}_$(arch)$${flavor}[] = {"; \ od -v -t x $*.bin | sed -e 's/^[0-9]* /0x/' -e 's/ /, 0x/g' -e 's/$$/,/'; \ echo "};") >>$@.new; \ rm -f $*.bin; \ --- a/tools/tests/x86_emulator/test_x86_emulator.c +++ b/tools/tests/x86_emulator/test_x86_emulator.c @@ -4,6 +4,9 @@ #include <sys/mman.h> #include "x86-emulate.h" + +asm ( ".pushsection .test, \"ax\", @progbits; .popsection" ); + #include "blowfish.h" #include "3dnow.h" #include "sse.h" @@ -1127,9 +1130,9 @@ int main(int argc, char **argv) #define decl_insn(which) extern const unsigned char which[], \ which##_end[] asm ( ".L" #which "_end" ) -#define put_insn(which, insn) ".pushsection .test, \"ax\", @progbits\n" \ - #which ": " insn "\n" \ - ".L" #which "_end:\n" \ +#define put_insn(which, insn) ".pushsection .test\n" \ + #which ": " insn "\n" \ + ".L" #which "_end:\n" \ ".popsection" #define set_insn(which) (regs.eip = (unsigned long)(which)) #define valid_eip(which) (regs.eip >= (unsigned long)(which) && \ _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |