coff-objfmt.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. typedef struct coff_unwind_code {
  30. SLIST_ENTRY(coff_unwind_code) link;
  31. /*@dependent@*/ yasm_symrec *proc; /* Start of procedure */
  32. /*@dependent@*/ yasm_symrec *loc; /* Location of operation */
  33. /* Unwind operation code */
  34. enum {
  35. UWOP_PUSH_NONVOL = 0,
  36. UWOP_ALLOC_LARGE = 1,
  37. UWOP_ALLOC_SMALL = 2,
  38. UWOP_SET_FPREG = 3,
  39. UWOP_SAVE_NONVOL = 4,
  40. UWOP_SAVE_NONVOL_FAR = 5,
  41. UWOP_SAVE_XMM128 = 8,
  42. UWOP_SAVE_XMM128_FAR = 9,
  43. UWOP_PUSH_MACHFRAME = 10
  44. } opcode;
  45. unsigned int info; /* Operation info */
  46. yasm_value off; /* Offset expression (used for some codes) */
  47. } coff_unwind_code;
  48. typedef struct coff_unwind_info {
  49. /*@dependent@*/ yasm_symrec *proc; /* Start of procedure */
  50. /*@dependent@*/ yasm_symrec *prolog; /* End of prologue */
  51. /*@null@*/ /*@dependent@*/ yasm_symrec *ehandler; /* Error handler */
  52. unsigned long framereg; /* Frame register */
  53. yasm_value frameoff; /* Frame offset */
  54. /* Linked list of codes, in decreasing location offset order.
  55. * Inserting at the head of this list during assembly naturally results
  56. * in this sorting.
  57. */
  58. SLIST_HEAD(coff_unwind_code_head, coff_unwind_code) codes;
  59. /* These aren't used until inside of generate. */
  60. yasm_value prolog_size;
  61. yasm_value codes_count;
  62. } coff_unwind_info;
  63. coff_unwind_info *yasm_win64__uwinfo_create(void);
  64. void yasm_win64__uwinfo_destroy(coff_unwind_info *info);
  65. void yasm_win64__unwind_generate(yasm_section *xdata,
  66. /*@only@*/ coff_unwind_info *info,
  67. unsigned long line);
  68. #endif