aboutsummaryrefslogtreecommitdiff
path: root/src/buildvm_x86.dasc
diff options
context:
space:
mode:
authorMike Pall <mike>2009-12-29 05:25:24 +0100
committerMike Pall <mike>2009-12-29 05:25:24 +0100
commit42124227cf8c490f113c6e4b5253970f17864a79 (patch)
tree9ae2d1c143a5b7f9b699e0587f4eff6d28484d3b /src/buildvm_x86.dasc
parent24429ed1f5c52258700e2e16c898c1dd9b8c4203 (diff)
downloadluajit-42124227cf8c490f113c6e4b5253970f17864a79.tar.gz
luajit-42124227cf8c490f113c6e4b5253970f17864a79.tar.bz2
luajit-42124227cf8c490f113c6e4b5253970f17864a79.zip
Add DWARF2 unwind info for x64 interpreter.
Diffstat (limited to 'src/buildvm_x86.dasc')
-rw-r--r--src/buildvm_x86.dasc88
1 files changed, 65 insertions, 23 deletions
diff --git a/src/buildvm_x86.dasc b/src/buildvm_x86.dasc
index 0fe7cd88..c110b098 100644
--- a/src/buildvm_x86.dasc
+++ b/src/buildvm_x86.dasc
@@ -4832,6 +4832,17 @@ static int build_backend(BuildCtx *ctx)
4832/* Emit pseudo frame-info for all assembler functions. */ 4832/* Emit pseudo frame-info for all assembler functions. */
4833static void emit_asm_debug(BuildCtx *ctx) 4833static void emit_asm_debug(BuildCtx *ctx)
4834{ 4834{
4835#if LJ_64
4836#define SZPTR "8"
4837#define BSZPTR "3"
4838#define REG_SP "0x7"
4839#define REG_RA "0x10"
4840#else
4841#define SZPTR "4"
4842#define BSZPTR "2"
4843#define REG_SP "0x4"
4844#define REG_RA "0x8"
4845#endif
4835 switch (ctx->mode) { 4846 switch (ctx->mode) {
4836 case BUILD_elfasm: 4847 case BUILD_elfasm:
4837 fprintf(ctx->fp, "\t.section .debug_frame,\"\",@progbits\n"); 4848 fprintf(ctx->fp, "\t.section .debug_frame,\"\",@progbits\n");
@@ -4843,11 +4854,11 @@ static void emit_asm_debug(BuildCtx *ctx)
4843 "\t.byte 0x1\n" 4854 "\t.byte 0x1\n"
4844 "\t.string \"\"\n" 4855 "\t.string \"\"\n"
4845 "\t.uleb128 0x1\n" 4856 "\t.uleb128 0x1\n"
4846 "\t.sleb128 -4\n" 4857 "\t.sleb128 -" SZPTR "\n"
4847 "\t.byte 0x8\n" 4858 "\t.byte " REG_RA "\n"
4848 "\t.byte 0xc\n\t.uleb128 0x4\n\t.uleb128 0x4\n" 4859 "\t.byte 0xc\n\t.uleb128 " REG_SP "\n\t.uleb128 " SZPTR "\n"
4849 "\t.byte 0x88\n\t.uleb128 0x1\n" 4860 "\t.byte 0x80+" REG_RA "\n\t.uleb128 0x1\n"
4850 "\t.align 4\n" 4861 "\t.align " SZPTR "\n"
4851 ".LECIE0:\n\n"); 4862 ".LECIE0:\n\n");
4852 fprintf(ctx->fp, 4863 fprintf(ctx->fp,
4853 ".LSFDE0:\n" 4864 ".LSFDE0:\n"
@@ -4856,13 +4867,22 @@ static void emit_asm_debug(BuildCtx *ctx)
4856 "\t.long .Lframe0\n" 4867 "\t.long .Lframe0\n"
4857 "\t.long .Lbegin\n" 4868 "\t.long .Lbegin\n"
4858 "\t.long %d\n" 4869 "\t.long %d\n"
4859 "\t.byte 0xe\n\t.uleb128 0x30\n" /* def_cfa_offset */ 4870 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
4871#if LJ_64
4872 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
4873 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
4874 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
4875 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
4876 "\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */
4877 "\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */
4878#else
4860 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */ 4879 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
4861 "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */ 4880 "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */
4862 "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */ 4881 "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */
4863 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ 4882 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
4864 "\t.align 4\n" 4883#endif
4865 ".LEFDE0:\n\n", (int)ctx->codesz); 4884 "\t.align " SZPTR "\n"
4885 ".LEFDE0:\n\n", (int)ctx->codesz, CFRAME_SIZE);
4866 fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@progbits\n"); 4886 fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@progbits\n");
4867 fprintf(ctx->fp, 4887 fprintf(ctx->fp,
4868 ".Lframe1:\n" 4888 ".Lframe1:\n"
@@ -4872,15 +4892,15 @@ static void emit_asm_debug(BuildCtx *ctx)
4872 "\t.byte 0x1\n" 4892 "\t.byte 0x1\n"
4873 "\t.string \"zPR\"\n" 4893 "\t.string \"zPR\"\n"
4874 "\t.uleb128 0x1\n" 4894 "\t.uleb128 0x1\n"
4875 "\t.sleb128 -4\n" 4895 "\t.sleb128 -" SZPTR "\n"
4876 "\t.byte 0x8\n" 4896 "\t.byte " REG_RA "\n"
4877 "\t.uleb128 6\n" /* augmentation length */ 4897 "\t.uleb128 6\n" /* augmentation length */
4878 "\t.byte 0x1b\n" /* pcrel|sdata4 */ 4898 "\t.byte 0x1b\n" /* pcrel|sdata4 */
4879 "\t.long lj_err_unwind_dwarf-.\n" 4899 "\t.long lj_err_unwind_dwarf-.\n"
4880 "\t.byte 0x1b\n" /* pcrel|sdata4 */ 4900 "\t.byte 0x1b\n" /* pcrel|sdata4 */
4881 "\t.byte 0xc\n\t.uleb128 0x4\n\t.uleb128 0x4\n" 4901 "\t.byte 0xc\n\t.uleb128 " REG_SP "\n\t.uleb128 " SZPTR "\n"
4882 "\t.byte 0x88\n\t.uleb128 0x1\n" 4902 "\t.byte 0x80+" REG_RA "\n\t.uleb128 0x1\n"
4883 "\t.align 4\n" 4903 "\t.align " SZPTR "\n"
4884 ".LECIE1:\n\n"); 4904 ".LECIE1:\n\n");
4885 fprintf(ctx->fp, 4905 fprintf(ctx->fp,
4886 ".LSFDE1:\n" 4906 ".LSFDE1:\n"
@@ -4890,13 +4910,22 @@ static void emit_asm_debug(BuildCtx *ctx)
4890 "\t.long .Lbegin-.\n" 4910 "\t.long .Lbegin-.\n"
4891 "\t.long %d\n" 4911 "\t.long %d\n"
4892 "\t.uleb128 0\n" /* augmentation length */ 4912 "\t.uleb128 0\n" /* augmentation length */
4893 "\t.byte 0xe\n\t.uleb128 0x30\n" /* def_cfa_offset */ 4913 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
4914#if LJ_64
4915 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
4916 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
4917 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
4918 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
4919 "\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */
4920 "\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */
4921#else
4894 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */ 4922 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
4895 "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */ 4923 "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */
4896 "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */ 4924 "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */
4897 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ 4925 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
4898 "\t.align 4\n" 4926#endif
4899 ".LEFDE1:\n\n", (int)ctx->codesz); 4927 "\t.align " SZPTR "\n"
4928 ".LEFDE1:\n\n", (int)ctx->codesz, CFRAME_SIZE);
4900 break; 4929 break;
4901 case BUILD_machasm: 4930 case BUILD_machasm:
4902 fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n"); 4931 fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n");
@@ -4909,15 +4938,19 @@ static void emit_asm_debug(BuildCtx *ctx)
4909 "\t.byte 0x1\n" 4938 "\t.byte 0x1\n"
4910 "\t.ascii \"zPR\\0\"\n" 4939 "\t.ascii \"zPR\\0\"\n"
4911 "\t.byte 0x1\n" 4940 "\t.byte 0x1\n"
4912 "\t.byte 128-4\n" 4941 "\t.byte 128-" SZPTR "\n"
4913 "\t.byte 0x8\n" 4942 "\t.byte " REG_RA "\n"
4914 "\t.byte 6\n" /* augmentation length */ 4943 "\t.byte 6\n" /* augmentation length */
4915 "\t.byte 0x9b\n" /* indirect|pcrel|sdata4 */ 4944 "\t.byte 0x9b\n" /* indirect|pcrel|sdata4 */
4916 "\t.long L_lj_err_unwind_dwarf$non_lazy_ptr-.\n" 4945 "\t.long L_lj_err_unwind_dwarf$non_lazy_ptr-.\n"
4917 "\t.byte 0x1b\n" /* pcrel|sdata4 */ 4946 "\t.byte 0x1b\n" /* pcrel|sdata4 */
4947#if LJ_64
4948 "\t.byte 0xc\n\t.byte " REG_SP "\n\t.byte " SZPTR "\n"
4949#else
4918 "\t.byte 0xc\n\t.byte 0x5\n\t.byte 0x4\n" /* esp=5 on 32 bit MACH-O. */ 4950 "\t.byte 0xc\n\t.byte 0x5\n\t.byte 0x4\n" /* esp=5 on 32 bit MACH-O. */
4919 "\t.byte 0x88\n\t.byte 0x1\n" 4951#endif
4920 "\t.align 2\n" 4952 "\t.byte 0x80+" REG_RA "\n\t.byte 0x1\n"
4953 "\t.align " BSZPTR "\n"
4921 "LECIE1:\n\n"); 4954 "LECIE1:\n\n");
4922 fprintf(ctx->fp, 4955 fprintf(ctx->fp,
4923 "_lj_vm_asm_begin.eh:\n" 4956 "_lj_vm_asm_begin.eh:\n"
@@ -4929,13 +4962,22 @@ static void emit_asm_debug(BuildCtx *ctx)
4929 "\t.long _lj_vm_asm_begin-.\n" 4962 "\t.long _lj_vm_asm_begin-.\n"
4930 "\t.long %d\n" 4963 "\t.long %d\n"
4931 "\t.byte 0\n" /* augmentation length */ 4964 "\t.byte 0\n" /* augmentation length */
4932 "\t.byte 0xe\n\t.byte 0x30\n" /* def_cfa_offset */ 4965 "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */
4966#if LJ_64
4967 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
4968 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
4969 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
4970 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
4971 "\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */
4972 "\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */
4973#else
4933 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/ 4974 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
4934 "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */ 4975 "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */
4935 "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */ 4976 "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */
4936 "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */ 4977 "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */
4937 "\t.align 2\n" 4978#endif
4938 "LEFDE1:\n\n", (int)ctx->codesz); 4979 "\t.align " BSZPTR "\n"
4980 "LEFDE1:\n\n", (int)ctx->codesz, CFRAME_SIZE);
4939 fprintf(ctx->fp, 4981 fprintf(ctx->fp,
4940 "\t.non_lazy_symbol_pointer\n" 4982 "\t.non_lazy_symbol_pointer\n"
4941 "L_lj_err_unwind_dwarf$non_lazy_ptr:\n" 4983 "L_lj_err_unwind_dwarf$non_lazy_ptr:\n"