1 /* 2 * COFF (DJGPP) object format 3 * 4 * Copyright (C) 2007 Peter Johnson 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * POSSIBILITY OF SUCH DAMAGE. 26 */ 27 #ifndef COFF_OBJFMT_H 28 #define COFF_OBJFMT_H 29 30 typedef struct coff_unwind_code { 31 SLIST_ENTRY(coff_unwind_code) link; 32 33 /*@dependent@*/ yasm_symrec *proc; /* Start of procedure */ 34 /*@dependent@*/ yasm_symrec *loc; /* Location of operation */ 35 /* Unwind operation code */ 36 enum { 37 UWOP_PUSH_NONVOL = 0, 38 UWOP_ALLOC_LARGE = 1, 39 UWOP_ALLOC_SMALL = 2, 40 UWOP_SET_FPREG = 3, 41 UWOP_SAVE_NONVOL = 4, 42 UWOP_SAVE_NONVOL_FAR = 5, 43 UWOP_SAVE_XMM128 = 8, 44 UWOP_SAVE_XMM128_FAR = 9, 45 UWOP_PUSH_MACHFRAME = 10 46 } opcode; 47 unsigned int info; /* Operation info */ 48 yasm_value off; /* Offset expression (used for some codes) */ 49 } coff_unwind_code; 50 51 typedef struct coff_unwind_info { 52 /*@dependent@*/ yasm_symrec *proc; /* Start of procedure */ 53 /*@dependent@*/ yasm_symrec *prolog; /* End of prologue */ 54 55 /*@null@*/ /*@dependent@*/ yasm_symrec *ehandler; /* Error handler */ 56 57 unsigned long framereg; /* Frame register */ 58 yasm_value frameoff; /* Frame offset */ 59 60 /* Linked list of codes, in decreasing location offset order. 61 * Inserting at the head of this list during assembly naturally results 62 * in this sorting. 63 */ 64 SLIST_HEAD(coff_unwind_code_head, coff_unwind_code) codes; 65 66 /* These aren't used until inside of generate. */ 67 yasm_value prolog_size; 68 yasm_value codes_count; 69 } coff_unwind_info; 70 71 coff_unwind_info *yasm_win64__uwinfo_create(void); 72 void yasm_win64__uwinfo_destroy(coff_unwind_info *info); 73 void yasm_win64__unwind_generate(yasm_section *xdata, 74 /*@only@*/ coff_unwind_info *info, 75 unsigned long line); 76 77 #endif 78