From: Andrew Cooper Date: Fri, 22 Apr 2016 18:59:02 +0000 (+0100) Subject: Introduce ENDFUNC() and annotate ASM functions as such X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9de8a22188a546bb7736fe368f98ead81ca91428;p=people%2Froyger%2Fxen-test-framework.git Introduce ENDFUNC() and annotate ASM functions as such Signed-off-by: Andrew Cooper --- diff --git a/arch/x86/boot/head_hvm.S b/arch/x86/boot/head_hvm.S index 466ca5c..7f503d6 100644 --- a/arch/x86/boot/head_hvm.S +++ b/arch/x86/boot/head_hvm.S @@ -79,7 +79,7 @@ GLOBAL(_start) /* HVM common setup. */ push $main_err_msg #endif call panic -SIZE(_start) +ENDFUNC(_start) .section .rodata.str1, "aMS", @progbits, 1 diff --git a/arch/x86/boot/head_pv.S b/arch/x86/boot/head_pv.S index 9312fef..cdb1b2b 100644 --- a/arch/x86/boot/head_pv.S +++ b/arch/x86/boot/head_pv.S @@ -46,7 +46,7 @@ GLOBAL(_start) push $main_err_msg #endif call panic -SIZE(_start) +ENDFUNC(_start) .section .rodata.str1, "aMS", @progbits, 1 diff --git a/arch/x86/entry_32.S b/arch/x86/entry_32.S index 9f2fd51..1ffedb7 100644 --- a/arch/x86/entry_32.S +++ b/arch/x86/entry_32.S @@ -46,6 +46,8 @@ ENTRY(entry_\sym) push $\vec jmp handle_exception + +ENDFUNC(entry_\sym) .endm exception_entry DE X86_EXC_DE @@ -81,6 +83,7 @@ handle_exception: add $8, %esp /* Pop error_code/entry_vector. */ env_IRET +ENDFUNC(handle_exception) ENTRY(entry_ret_to_kernel) /* int $0x20 (return to kernel) */ @@ -91,6 +94,7 @@ ENTRY(entry_ret_to_kernel) /* int $0x20 (return to kernel) */ mov 3*4(%esp), %esp /* Load %esp from iret frame */ jmp *%eax /* Jump back */ +ENDFUNC(entry_ret_to_kernel) ENTRY(exec_user) /* void (*fn)(void) */ @@ -113,6 +117,8 @@ ENTRY(exec_user) /* void (*fn)(void) */ int $0x20 /* Return to kernel privilege. */ ret +ENDFUNC(exec_user) + /* * Local variables: * tab-width: 8 diff --git a/arch/x86/entry_64.S b/arch/x86/entry_64.S index d8f13e7..1154d9c 100644 --- a/arch/x86/entry_64.S +++ b/arch/x86/entry_64.S @@ -61,6 +61,8 @@ ENTRY(entry_\sym) movl $\vec, 4(%rsp) jmp handle_exception + +ENDFUNC(entry_\sym) .endm exception_entry DE X86_EXC_DE @@ -95,6 +97,7 @@ handle_exception: add $8, %rsp /* Pop error_code/entry_vector. */ env_IRETQ +ENDFUNC(handle_exception) ENTRY(entry_ret_to_kernel) /* int $0x20 (return to kernel) */ @@ -104,6 +107,7 @@ ENTRY(entry_ret_to_kernel) /* int $0x20 (return to kernel) */ mov 3*8(%rsp), %rsp /* Load %esp from iret frame */ jmp *%rax /* Jump back */ +ENDFUNC(entry_ret_to_kernel) ENTRY(exec_user) /* void (*fn)(void) */ @@ -126,6 +130,8 @@ ENTRY(exec_user) /* void (*fn)(void) */ int $0x20 /* Return to kernel privilege. */ ret +ENDFUNC(exec_user) + /* * Local variables: * tab-width: 8 diff --git a/include/xtf/asm_macros.h b/include/xtf/asm_macros.h index 1de91ae..1806fa1 100644 --- a/include/xtf/asm_macros.h +++ b/include/xtf/asm_macros.h @@ -35,6 +35,14 @@ name: #define SIZE(name) \ .size name, . - name; +/** + * Set the type of @p name to function, and set its size. + * @param name Symbol name. + */ +#define ENDFUNC(name) \ + .type name, STT_FUNC; \ + SIZE(name) + /** * Create an ELF note entry. * diff --git a/tests/swint-emulation/lowlevel.S b/tests/swint-emulation/lowlevel.S index f2010b5..67f0e61 100644 --- a/tests/swint-emulation/lowlevel.S +++ b/tests/swint-emulation/lowlevel.S @@ -70,6 +70,8 @@ GLOBAL(label_\insn\()_\type\()_trap) /* Fixup from fault label to trap label. */ _ASM_EXTABLE(label_\insn\()_\type\()_fault, label_\insn\()_\type\()_trap) + +ENDFUNC(stub_\insn\()_\type) .endm /* For a single instruction, generate each test variant. */