145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/* 245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * CodeView debugging format - type information 345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * Copyright (C) 2006-2007 Peter Johnson 545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * Redistribution and use in source and binary forms, with or without 745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * modification, are permitted provided that the following conditions 845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * are met: 945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 1. Redistributions of source code must retain the above copyright 1045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * notice, this list of conditions and the following disclaimer. 1145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 2. Redistributions in binary form must reproduce the above copyright 1245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * notice, this list of conditions and the following disclaimer in the 1345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * documentation and/or other materials provided with the distribution. 1445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 3. Neither the name of the author nor the names of other contributors 1545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * may be used to endorse or promote products derived from this 1645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * software without specific prior written permission. 1745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 1845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 1945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 2245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * POSSIBILITY OF SUCH DAMAGE. 2945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 3045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include <util.h> 3145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 3245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include <libyasm.h> 3345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 3445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include "cv-dbgfmt.h" 3545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 3645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgenum cv_reservedtype { 3745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Bitfields representation - type */ 3845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_TYPE_SPECIAL = 0x00<<4, /* Special */ 3945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_TYPE_SIGNED = 0x01<<4, /* Signed integral value */ 4045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_TYPE_UNSIGNED = 0x02<<4, /* Unsigned integral value */ 4145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_TYPE_BOOLEAN = 0x03<<4, /* Boolean */ 4245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_TYPE_REAL = 0x04<<4, /* Real */ 4345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_TYPE_COMPLEX = 0x05<<4, /* Complex */ 4445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_TYPE_SPECIAL2 = 0x06<<4, /* Special2 */ 4545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_TYPE_REALINT = 0x07<<4, /* Really int value */ 4645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 4745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* "size" of CV_TYPE_SPECIAL */ 4845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_SPECIAL_NOTYPE = 0x00<<0, /* No type */ 4945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_SPECIAL_ABS = 0x01<<0, /* Absolute symbol */ 5045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_SPECIAL_SEG = 0x02<<0, /* Segment */ 5145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_SPECIAL_VOID = 0x03<<0, /* Void */ 5245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_SPECIAL_CURRENCY = 0x04<<0, /* Basic 8-byte currency value */ 5345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_SPECIAL_NEARBSTR = 0x05<<0, /* Near Basic string */ 5445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_SPECIAL_FARBSTR = 0x06<<0, /* Far Basic string */ 5545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 5645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Size of CV_TYPE_SIGNED, CV_TYPE_UNSIGNED, and CV_TYPE_BOOLEAN */ 5745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_INTEGER_1BYTE = 0x00<<0, /* 1 byte */ 5845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_INTEGER_2BYTE = 0x01<<0, /* 2 byte */ 5945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_INTEGER_4BYTE = 0x02<<0, /* 4 byte */ 6045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_INTEGER_8BYTE = 0x03<<0, /* 8 byte */ 6145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 6245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Size of CV_TYPE_REAL and CV_TYPE_COMPLEX */ 6345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_REAL_32BIT = 0x00<<0, /* 32 bit */ 6445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_REAL_64BIT = 0x01<<0, /* 64 bit */ 6545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_REAL_80BIT = 0x02<<0, /* 80 bit */ 6645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_REAL_128BIT = 0x03<<0, /* 128 bit */ 6745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_REAL_48BIT = 0x04<<0, /* 48 bit */ 6845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 6945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* "size" of CV_TYPE_SPECIAL2 */ 7045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_SPECIAL2_BIT = 0x00<<0, /* Bit */ 7145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_SPECIAL2_PASCHAR = 0x01<<0, /* Pascal CHAR */ 7245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 7345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Size of CV_TYPE_REALINT */ 7445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_REALINT_CHAR = 0x00<<0, /* Char */ 7545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_REALINT_WCHAR = 0x01<<0, /* Wide character */ 7645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_REALINT_S2BYTE = 0x02<<0, /* 2-byte signed integer */ 7745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_REALINT_U2BYTE = 0x03<<0, /* 2-byte unsigned integer */ 7845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_REALINT_S4BYTE = 0x04<<0, /* 4-byte signed integer */ 7945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_REALINT_U4BYTE = 0x05<<0, /* 4-byte unsigned integer */ 8045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_REALINT_S8BYTE = 0x06<<0, /* 8-byte signed integer */ 8145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_REALINT_U8BYTE = 0x07<<0, /* 8-byte unsigned integer */ 8245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 8345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Mode */ 8445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_MODE_DIRECT = 0x00<<8, /* Direct; not a pointer */ 8545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_MODE_NEAR = 0x01<<8, /* Near pointer */ 8645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_MODE_FAR = 0x02<<8, /* Far pointer */ 8745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_MODE_HUGE = 0x03<<8, /* Huge pointer */ 8845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_MODE_NEAR32 = 0x04<<8, /* 32-bit near pointer */ 8945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_MODE_FAR32 = 0x05<<8, /* 32-bit far pointer */ 9045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_MODE_NEAR64 = 0x06<<8, /* 64-bit near pointer */ 9145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 9245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Pure primitive type listing - based on above bitfields */ 9345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 9445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Special Types */ 9545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_NOTYPE = 0x0000, /* Uncharacterized type (no type) */ 9645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_ABS = 0x0001, /* Absolute symbol */ 9745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_SEGMENT = 0x0002, /* Segment type */ 9845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_VOID = 0x0003, /* Void */ 9945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PVOID = 0x0103, /* Near pointer to void */ 10045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFVOID = 0x0203, /* Far pointer to void */ 10145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHVOID = 0x0303, /* Huge pointer to void */ 10245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PVOID = 0x0403, /* 32-bit near pointer to void */ 10345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFVOID = 0x0503, /* 32-bit far pointer to void */ 10445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_CURRENCY = 0x0004, /* Basic 8-byte currency value */ 10545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_NBASICSTR = 0x0005, /* Near Basic string */ 10645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_FBASICSTR = 0x0006, /* Far Basic string */ 10745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_BIT = 0x0060, /* Bit */ 10845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PASCHAR = 0x0061, /* Pascal CHAR */ 10945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Character Types */ 11045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_CHAR = 0x0010, /* 8-bit signed */ 11145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_UCHAR = 0x0020, /* 8-bit unsigned */ 11245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PCHAR = 0x0110, /* Near pointer to 8-bit signed */ 11345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PUCHAR = 0x0120, /* Near pointer to 8-bit unsigned */ 11445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFCHAR = 0x0210, /* Far pointer to 8-bit signed */ 11545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFUCHAR = 0x0220, /* Far pointer to 8-bit unsigned */ 11645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHCHAR = 0x0310, /* Huge pointer to 8-bit signed */ 11745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHUCHAR = 0x0320, /* Huge pointer to 8-bit unsigned */ 11845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PCHAR = 0x0410, /* 16:32 near pointer to 8-bit signed */ 11945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PUCHAR = 0x0420, /* 16:32 near pointer to 8-bit unsigned */ 12045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFCHAR = 0x0510, /* 16:32 far pointer to 8-bit signed */ 12145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFUCHAR = 0x0520, /* 16:32 far pointer to 8-bit unsigned */ 12245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Real Character Types */ 12345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_RCHAR = 0x0070, /* Real char */ 12445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PRCHAR = 0x0170, /* Near pointer to a real char */ 12545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFRCHAR = 0x0270, /* Far pointer to a real char */ 12645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHRCHAR = 0x0370, /* Huge pointer to a real char */ 12745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PRCHAR = 0x0470, /* 16:32 near pointer to a real char */ 12845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFRCHAR = 0x0570, /* 16:32 far pointer to a real char */ 12945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Wide Character Types */ 13045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_WCHAR = 0x0071, /* Wide char */ 13145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PWCHAR = 0x0171, /* Near pointer to a wide char */ 13245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFWCHAR = 0x0271, /* Far pointer to a wide char */ 13345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHWCHAR = 0x0371, /* Huge pointer to a wide char */ 13445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PWCHAR = 0x0471, /* 16:32 near pointer to a wide char */ 13545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFWCHAR = 0x0571, /* 16:32 far pointer to a wide char */ 13645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Real 16-bit Integer Types */ 13745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_INT2 = 0x0072, /* Real 16-bit signed int */ 13845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_UINT2 = 0x0073, /* Real 16-bit unsigned int */ 13945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PINT2 = 0x0172, /* Near pointer to 16-bit signed int */ 14045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PUINT2 = 0x0173, /* Near pointer to 16-bit unsigned int */ 14145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFINT2 = 0x0272, /* Far pointer to 16-bit signed int */ 14245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFUINT2 = 0x0273, /* Far pointer to 16-bit unsigned int */ 14345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHINT2 = 0x0372, /* Huge pointer to 16-bit signed int */ 14445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHUINT2 = 0x0373, /* Huge pointer to 16-bit unsigned int */ 14545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PINT2 = 0x0472, /* 16:32 near pointer to 16-bit signed int */ 14645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PUINT2 = 0x0473, /* 16:32 near pointer to 16-bit unsigned int */ 14745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFINT2 = 0x0572, /* 16:32 far pointer to 16-bit signed int */ 14845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFUINT2 = 0x0573, /* 16:32 far pointer to 16-bit unsigned int */ 14945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* 16-bit Short Types */ 15045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_SHORT = 0x0011, /* 16-bit signed */ 15145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_USHORT = 0x0021, /* 16-bit unsigned */ 15245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PSHORT = 0x0111, /* Near pointer to 16-bit signed */ 15345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PUSHORT = 0x0121, /* Near pointer to 16-bit unsigned */ 15445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFSHORT = 0x0211, /* Far pointer to 16-bit signed */ 15545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFUSHORT = 0x0221, /* Far pointer to 16-bit unsigned */ 15645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHSHORT = 0x0311, /* Huge pointer to 16-bit signed */ 15745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHUSHORT = 0x0321, /* Huge pointer to 16-bit unsigned */ 15845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PSHORT = 0x0411, /* 16:32 near pointer to 16-bit signed */ 15945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PUSHORT = 0x0421, /* 16:32 near pointer to 16-bit unsigned */ 16045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFSHORT = 0x0511, /* 16:32 far pointer to 16-bit signed */ 16145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFUSHORT = 0x0521, /* 16:32 far pointer to 16-bit unsigned */ 16245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Real 32-bit Integer Types */ 16345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_INT4 = 0x0074, /* Real 32-bit signed int */ 16445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_UINT4 = 0x0075, /* Real 32-bit unsigned int */ 16545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PINT4 = 0x0174, /* Near pointer to 32-bit signed int */ 16645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PUINT4 = 0x0175, /* Near pointer to 32-bit unsigned int */ 16745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFINT4 = 0x0274, /* Far pointer to 32-bit signed int */ 16845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFUINT4 = 0x0275, /* Far pointer to 32-bit unsigned int */ 16945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHINT4 = 0x0374, /* Huge pointer to 32-bit signed int */ 17045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHUINT4 = 0x0375, /* Huge pointer to 32-bit unsigned int */ 17145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PINT4 = 0x0474, /* 16:32 near pointer to 32-bit signed int */ 17245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PUINT4 = 0x0475, /* 16:32 near pointer to 32-bit unsigned int */ 17345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFINT4 = 0x0574, /* 16:32 far pointer to 32-bit signed int */ 17445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFUINT4 = 0x0575, /* 16:32 far pointer to 32-bit unsigned int */ 17545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* 32-bit Long Types */ 17645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_LONG = 0x0012, /* 32-bit signed */ 17745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_ULONG = 0x0022, /* 32-bit unsigned */ 17845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PLONG = 0x0112, /* Near pointer to 32-bit signed */ 17945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PULONG = 0x0122, /* Near pointer to 32-bit unsigned */ 18045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFLONG = 0x0212, /* Far pointer to 32-bit signed */ 18145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFULONG = 0x0222, /* Far pointer to 32-bit unsigned */ 18245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHLONG = 0x0312, /* Huge pointer to 32-bit signed */ 18345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHULONG = 0x0322, /* Huge pointer to 32-bit unsigned */ 18445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PLONG = 0x0412, /* 16:32 near pointer to 32-bit signed */ 18545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PULONG = 0x0422, /* 16:32 near pointer to 32-bit unsigned */ 18645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFLONG = 0x0512, /* 16:32 far pointer to 32-bit signed */ 18745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFULONG = 0x0522, /* 16:32 far pointer to 32-bit unsigned */ 18845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Real 64-bit int Types */ 18945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_INT8 = 0x0076, /* 64-bit signed int */ 19045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_UINT8 = 0x0077, /* 64-bit unsigned int */ 19145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PINT8 = 0x0176, /* Near pointer to 64-bit signed int */ 19245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PUINT8 = 0x0177, /* Near pointer to 64-bit unsigned int */ 19345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFINT8 = 0x0276, /* Far pointer to 64-bit signed int */ 19445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFUINT8 = 0x0277, /* Far pointer to 64-bit unsigned int */ 19545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHINT8 = 0x0376, /* Huge pointer to 64-bit signed int */ 19645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHUINT8 = 0x0377, /* Huge pointer to 64-bit unsigned int */ 19745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PINT8 = 0x0476, /* 16:32 near pointer to 64-bit signed int */ 19845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PUINT8 = 0x0477, /* 16:32 near pointer to 64-bit unsigned int */ 19945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFINT8 = 0x0576, /* 16:32 far pointer to 64-bit signed int */ 20045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFUINT8 = 0x0577, /* 16:32 far pointer to 64-bit unsigned int */ 20145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* 64-bit Integral Types */ 20245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_QUAD = 0x0013, /* 64-bit signed */ 20345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_UQUAD = 0x0023, /* 64-bit unsigned */ 20445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PQUAD = 0x0113, /* Near pointer to 64-bit signed */ 20545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PUQUAD = 0x0123, /* Near pointer to 64-bit unsigned */ 20645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFQUAD = 0x0213, /* Far pointer to 64-bit signed */ 20745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFUQUAD = 0x0223, /* Far pointer to 64-bit unsigned */ 20845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHQUAD = 0x0313, /* Huge pointer to 64-bit signed */ 20945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHUQUAD = 0x0323, /* Huge pointer to 64-bit unsigned */ 21045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PQUAD = 0x0413, /* 16:32 near pointer to 64-bit signed */ 21145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PUQUAD = 0x0423, /* 16:32 near pointer to 64-bit unsigned */ 21245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFQUAD = 0x0513, /* 16:32 far pointer to 64-bit signed */ 21345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFUQUAD = 0x0523, /* 16:32 far pointer to 64-bit unsigned */ 21445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* 32-bit Real Types */ 21545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_REAL32 = 0x0040, /* 32-bit real */ 21645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PREAL32 = 0x0140, /* Near pointer to 32-bit real */ 21745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFREAL32 = 0x0240, /* Far pointer to 32-bit real */ 21845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHREAL32 = 0x0340, /* Huge pointer to 32-bit real */ 21945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PREAL32 = 0x0440, /* 16:32 near pointer to 32-bit real */ 22045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFREAL32 = 0x0540, /* 16:32 far pointer to 32-bit real */ 22145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* 48-bit Real Types */ 22245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_REAL48 = 0x0044, /* 48-bit real */ 22345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PREAL48 = 0x0144, /* Near pointer to 48-bit real */ 22445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFREAL48 = 0x0244, /* Far pointer to 48-bit real */ 22545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHREAL48 = 0x0344, /* Huge pointer to 48-bit real */ 22645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PREAL48 = 0x0444, /* 16:32 near pointer to 48-bit real */ 22745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFREAL48 = 0x0544, /* 16:32 far pointer to 48-bit real */ 22845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* 64-bit Real Types */ 22945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_REAL64 = 0x0041, /* 64-bit real */ 23045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PREAL64 = 0x0141, /* Near pointer to 64-bit real */ 23145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFREAL64 = 0x0241, /* Far pointer to 64-bit real */ 23245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHREAL64 = 0x0341, /* Huge pointer to 64-bit real */ 23345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PREAL64 = 0x0441, /* 16:32 near pointer to 64-bit real */ 23445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFREAL64 = 0x0541, /* 16:32 far pointer to 64-bit real */ 23545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* 80-bit Real Types */ 23645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_REAL80 = 0x0042, /* 80-bit real */ 23745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PREAL80 = 0x0142, /* Near pointer to 80-bit real */ 23845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFREAL80 = 0x0242, /* Far pointer to 80-bit real */ 23945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHREAL80 = 0x0342, /* Huge pointer to 80-bit real */ 24045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PREAL80 = 0x0442, /* 16:32 near pointer to 80-bit real */ 24145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFREAL80 = 0x0542, /* 16:32 far pointer to 80-bit real */ 24245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* 128-bit Real Types */ 24345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_REAL128 = 0x0043, /* 128-bit real */ 24445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PREAL128 = 0x0143, /* Near pointer to 128-bit real */ 24545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFREAL128 = 0x0243, /* Far pointer to 128-bit real */ 24645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHREAL128 = 0x0343, /* Huge pointer to 128-bit real */ 24745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PREAL128 = 0x0443, /* 16:32 near pointer to 128-bit real */ 24845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFREAL128 = 0x0543, /* 16:32 far pointer to 128-bit real */ 24945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* 32-bit Complex Types */ 25045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_CPLX32 = 0x0050, /* 32-bit complex */ 25145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PCPLX32 = 0x0150, /* Near pointer to 32-bit complex */ 25245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFCPLX32 = 0x0250, /* Far pointer to 32-bit complex */ 25345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHCPLX32 = 0x0350, /* Huge pointer to 32-bit complex */ 25445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PCPLX32 = 0x0450, /* 16:32 near pointer to 32-bit complex */ 25545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFCPLX32 = 0x0550, /* 16:32 far pointer to 32-bit complex */ 25645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* 64-bit Complex Types */ 25745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_CPLX64 = 0x0051, /* 64-bit complex */ 25845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PCPLX64 = 0x0151, /* Near pointer to 64-bit complex */ 25945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFCPLX64 = 0x0251, /* Far pointer to 64-bit complex */ 26045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHCPLX64 = 0x0351, /* Huge pointer to 64-bit complex */ 26145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PCPLX64 = 0x0451, /* 16:32 near pointer to 64-bit complex */ 26245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFCPLX64 = 0x0551, /* 16:32 far pointer to 64-bit complex */ 26345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* 80-bit Complex Types */ 26445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_CPLX80 = 0x0052, /* 80-bit complex */ 26545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PCPLX80 = 0x0152, /* Near pointer to 80-bit complex */ 26645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFCPLX80 = 0x0252, /* Far pointer to 80-bit complex */ 26745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHCPLX80 = 0x0352, /* Huge pointer to 80-bit complex */ 26845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PCPLX80 = 0x0452, /* 16:32 near pointer to 80-bit complex */ 26945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFCPLX80 = 0x0552, /* 16:32 far pointer to 80-bit complex */ 27045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* 128-bit Complex Types */ 27145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_CPLX128 = 0x0053, /* 128-bit complex */ 27245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PCPLX128 = 0x0153, /* Near pointer to 128-bit complex */ 27345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFCPLX128 = 0x0253, /* Far pointer to 128-bit complex */ 27445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHCPLX128 = 0x0353, /* Huge pointer to 128-bit real */ 27545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PCPLX128 = 0x0453, /* 16:32 near pointer to 128-bit complex */ 27645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFCPLX128 = 0x0553, /* 16:32 far pointer to 128-bit complex */ 27745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Boolean Types */ 27845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_BOOL08 = 0x0030, /* 8-bit Boolean */ 27945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_BOOL16 = 0x0031, /* 16-bit Boolean */ 28045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_BOOL32 = 0x0032, /* 32-bit Boolean */ 28145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_BOOL64 = 0x0033, /* 64-bit Boolean */ 28245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PBOOL08 = 0x0130, /* Near pointer to 8-bit Boolean */ 28345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PBOOL16 = 0x0131, /* Near pointer to 16-bit Boolean */ 28445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PBOOL32 = 0x0132, /* Near pointer to 32-bit Boolean */ 28545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PBOOL64 = 0x0133, /* Near pointer to 64-bit Boolean */ 28645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFBOOL08 = 0x0230, /* Far pointer to 8-bit Boolean */ 28745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFBOOL16 = 0x0231, /* Far pointer to 16-bit Boolean */ 28845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFBOOL32 = 0x0232, /* Far pointer to 32-bit Boolean */ 28945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PFBOOL64 = 0x0233, /* Far pointer to 64-bit Boolean */ 29045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHBOOL08 = 0x0330, /* Huge pointer to 8-bit Boolean */ 29145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHBOOL16 = 0x0331, /* Huge pointer to 16-bit Boolean */ 29245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHBOOL32 = 0x0332, /* Huge pointer to 32-bit Boolean */ 29345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_PHBOOL64 = 0x0333, /* Huge pointer to 64-bit Boolean */ 29445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PBOOL08 = 0x0430, /* 16:32 near pointer to 8-bit Boolean */ 29545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PBOOL16 = 0x0431, /* 16:32 near pointer to 16-bit Boolean */ 29645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PBOOL32 = 0x0432, /* 16:32 near pointer to 32-bit Boolean */ 29745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PBOOL64 = 0x0433, /* 16:32 near pointer to 64-bit Boolean */ 29845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFBOOL08 = 0x0530, /* 16:32 far pointer to 8-bit Boolean */ 29945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFBOOL16 = 0x0531, /* 16:32 far pointer to 16-bit Boolean */ 30045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFBOOL32 = 0x0532, /* 16:32 far pointer to 32-bit Boolean */ 30145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_T_32PFBOOL64 = 0x0533, /* 16:32 far pointer to 64-bit Boolean */ 30245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 30345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Non-primitive types are stored in the TYPES section (generated in 30445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * cv-type.c) and start at this index (e.g. 0x1000 is the first type 30545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * in TYPES, 0x1001 the second, etc. 30645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 30745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_FIRST_NONPRIM = 0x1000 30845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}; 30945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 31045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgenum cv_leaftype { 31145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Leaf indices for type records that can be referenced from symbols */ 31245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_MODIFIER = 0x0001, /* Type Modifier */ 31345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_POINTER = 0x0002, /* Pointer */ 31445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_ARRAY = 0x0003, /* Simple Array */ 31545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_CLASS = 0x0004, /* Classes */ 31645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_STRUCTURE = 0x0005, /* Structures */ 31745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_UNION = 0x0006, /* Unions */ 31845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_ENUM = 0x0007, /* Enumeration */ 31945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_PROCEDURE = 0x0008, /* Procedure */ 32045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_MFUNCTION = 0x0009, /* Member Function */ 32145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_VTSHAPE = 0x000a, /* Virtual Function Table Shape */ 32245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_BARRAY = 0x000d, /* Basic Array */ 32345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_LABEL = 0x000e, /* Label */ 32445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_NULL = 0x000f, /* Null */ 32545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_DIMARRAY = 0x0011, /* Multiply Dimensioned Array */ 32645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_VFTPATH = 0x0012, /* Path to Virtual Function Table */ 32745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_PRECOMP = 0x0013, /* Reference Precompiled Types */ 32845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_ENDPRECOMP = 0x0014, /* End of Precompiled Types */ 32945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 33045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* CodeView 5.0 version */ 33145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_MODIFIER = 0x1001, /* Type Modifier */ 33245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_POINTER = 0x1002, /* Pointer */ 33345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_ARRAY = 0x1003, /* Simple Array */ 33445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_CLASS = 0x1004, /* Classes */ 33545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_STRUCTURE = 0x1005, /* Structures */ 33645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_UNION = 0x1006, /* Unions */ 33745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_ENUM = 0x1007, /* Enumeration */ 33845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_PROCEDURE = 0x1008, /* Procedure */ 33945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_MFUNCTION = 0x1009, /* Member Function */ 34045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_VTSHAPE = 0x000a, /* Virtual Function Table Shape */ 34145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_BARRAY = 0x100d, /* Basic Array */ 34245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_LABEL = 0x000e, /* Label */ 34345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_NULL = 0x000f, /* Null */ 34445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_DIMARRAY = 0x100c, /* Multiply Dimensioned Array */ 34545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_VFTPATH = 0x100d, /* Path to Virtual Function Table */ 34645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_PRECOMP = 0x100e, /* Reference Precompiled Types */ 34745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_ENDPRECOMP = 0x0014, /* End of Precompiled Types */ 34845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_TYPESERVER = 0x0016, /* Reference Typeserver */ 34945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 35045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Leaf indices for type records that can be referenced from other type 35145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * records 35245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 35345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_SKIP = 0x0200, /* Skip */ 35445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_ARGLIST = 0x0201, /* Argument List */ 35545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_DEFARG = 0x0202, /* Default Argument */ 35645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_LIST = 0x0203, /* Arbitrary List */ 35745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_FIELDLIST = 0x0204, /* Field List */ 35845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_DERIVED = 0x0205, /* Derived Classes */ 35945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_BITFIELD = 0x0206, /* Bit Fields */ 36045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_METHODLIST = 0x0207, /* Method List */ 36145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_DIMCONU = 0x0208, /* Dimensioned Array with Constant Upper Bound */ 36245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_DIMCONLU = 0x0209, /* Dimensioned Array with Constant Lower and Upper Bounds */ 36345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_DIMVARU = 0x020a, /* Dimensioned Array with Variable Upper Bound */ 36445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_DIMVARLU = 0x020b, /* Dimensioned Array with Variable Lower and Upper Bounds */ 36545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_REFSYM = 0x020c, /* Referenced Symbol */ 36645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 36745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* CodeView 5.0 version */ 36845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_SKIP = 0x1200, /* Skip */ 36945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_ARGLIST = 0x1201, /* Argument List */ 37045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_DEFARG = 0x1202, /* Default Argument */ 37145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_FIELDLIST = 0x1203, /* Field List */ 37245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_DERIVED = 0x1204, /* Derived Classes */ 37345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_BITFIELD = 0x1205, /* Bit Fields */ 37445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_METHODLIST = 0x1206, /* Method List */ 37545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_DIMCONU = 0x1207, /* Dimensioned Array with Constant Upper Bound */ 37645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_DIMCONLU = 0x1208, /* Dimensioned Array with Constant Lower and Upper Bounds */ 37745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_DIMVARU = 0x1209, /* Dimensioned Array with Variable Upper Bound */ 37845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_DIMVARLU = 0x120a, /* Dimensioned Array with Variable Lower and Upper Bounds */ 37945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_REFSYM = 0x020c, /* Referenced Symbol */ 38045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 38145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Leaf indices for fields of complex lists */ 38245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_BCLASS = 0x0400, /* Real Base Class */ 38345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_VBCLASS = 0x0401, /* Direct Virtual Base Class */ 38445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_IVBCLASS = 0x0402, /* Indirect Virtual Base Class */ 38545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_ENUMERATE = 0x0403, /* Enumeration Name and Value */ 38645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_FRIENDFCN = 0x0404, /* Friend Function */ 38745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_INDEX = 0x0405, /* Index To Another Type Record */ 38845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_MEMBER = 0x0406, /* Data Member */ 38945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_STMEMBER = 0x0407, /* Static Data Member */ 39045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_METHOD = 0x0408, /* Method */ 39145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_NESTTYPE = 0x0409, /* Nested Type Definition */ 39245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_VFUNCTAB = 0x040a, /* Virtual Function Table Pointer */ 39345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_FRIENDCLS = 0x040b, /* Friend Class */ 39445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_ONEMETHOD = 0x040c, /* One Method */ 39545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV4_LF_VFUNCOFF = 0x040d, /* Virtual Function Offset */ 39645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 39745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* CodeView 5.0 version */ 39845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_BCLASS = 0x1400, /* Real Base Class */ 39945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_VBCLASS = 0x1401, /* Direct Virtual Base Class */ 40045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_IVBCLASS = 0x1402, /* Indirect Virtual Base Class */ 40145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_ENUMERATE = 0x0403, /* Enumeration Name and Value */ 40245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_FRIENDFCN = 0x1403, /* Friend Function */ 40345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_INDEX = 0x1404, /* Index To Another Type Record */ 40445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_MEMBER = 0x1405, /* Data Member */ 40545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_STMEMBER = 0x1406, /* Static Data Member */ 40645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_METHOD = 0x1407, /* Method */ 40745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_NESTTYPE = 0x1408, /* Nested Type Definition */ 40845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_VFUNCTAB = 0x1409, /* Virtual Function Table Pointer */ 40945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_FRIENDCLS = 0x140a, /* Friend Class */ 41045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_ONEMETHOD = 0x140b, /* One Method */ 41145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_VFUNCOFF = 0x140c, /* Virtual Function Offset */ 41245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_NESTTYPEEX = 0x140d, /* Nested Type Extended Definition */ 41345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV5_LF_MEMBERMODIFY = 0x140e, /* Member Modification */ 41445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* XXX: CodeView 5.0 spec also lists 0x040f as LF_MEMBERMODIFY? */ 41545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 41645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Leaf indices for numeric fields of symbols and type records */ 41745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_NUMERIC = 0x8000, 41845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_CHAR = 0x8000, /* Signed Char (8-bit) */ 41945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_SHORT = 0x8001, /* Signed Short (16-bit) */ 42045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_USHORT = 0x8002, /* Unsigned Short (16-bit) */ 42145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_LONG = 0x8003, /* Signed Long (32-bit) */ 42245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_ULONG = 0x8004, /* Unsigned Long (32-bit) */ 42345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_REAL32 = 0x8005, /* 32-bit Float */ 42445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_REAL64 = 0x8006, /* 64-bit Float */ 42545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_REAL80 = 0x8007, /* 80-bit Float */ 42645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_REAL128 = 0x8008, /* 128-bit Float */ 42745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_QUADWORD = 0x8009, /* Signed Quad Word (64-bit) */ 42845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_UQUADWORD = 0x800a, /* Unsigned Quad Word (64-bit) */ 42945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_REAL48 = 0x800b, /* 48-bit Float */ 43045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_COMPLEX32 = 0x800c, /* 32-bit Complex */ 43145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_COMPLEX64 = 0x800d, /* 64-bit Complex */ 43245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_COMPLEX80 = 0x800e, /* 80-bit Complex */ 43345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_COMPLEX128 = 0x800f, /* 128-bit Complex */ 43445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_VARSTRING = 0x8010, /* Variable-length String */ 43545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 43645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Leaf padding bytes */ 43745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_PAD0 = 0xf0, 43845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_PAD1 = 0xf1, 43945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_PAD2 = 0xf2, 44045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_PAD3 = 0xf3, 44145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_PAD4 = 0xf4, 44245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_PAD5 = 0xf5, 44345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_PAD6 = 0xf6, 44445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_PAD7 = 0xf7, 44545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_PAD8 = 0xf8, 44645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_PAD9 = 0xf9, 44745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_PAD10 = 0xfa, 44845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_PAD11 = 0xfb, 44945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_PAD12 = 0xfc, 45045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_PAD13 = 0xfc, 45145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_PAD14 = 0xfe, 45245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org CV_LF_PAD15 = 0xff 45345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}; 45445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 45545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/* Leaves use a bit of meta-programming to encode formats: each character 45645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * of format represents the output generated, as follows: 45745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 'b' : 1 byte value (integer) 45845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 'h' : 2 byte value (integer) 45945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 'w' : 4 byte value (integer) 46045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 'L' : subleaf, recurses into cv_leaf (pointer) 46145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 'T' : 4 byte type index, pulls cv_type.index from cv_type (pointer) 46245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 'S' : length-prefixed string (pointer) 46345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 46445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgtypedef struct cv_leaf { 46545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org enum cv_leaftype type; 46645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org const char *format; /* format of args */ 46745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org union { 46845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org unsigned long i; 46945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void *p; 47045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org } args[6]; 47145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} cv_leaf; 47245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 47345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgtypedef struct cv_type { 47445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org unsigned long indx; /* type # (must be same as output order) */ 47545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org size_t num_leaves; 47645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@null@*/ /*@only@*/ cv_leaf **leaves; 47745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} cv_type; 47845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 47945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/* Bytecode callback function prototypes */ 48045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic void cv_type_bc_destroy(void *contents); 48145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic void cv_type_bc_print(const void *contents, FILE *f, int indent_level); 48245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic int cv_type_bc_calc_len 48345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (yasm_bytecode *bc, yasm_bc_add_span_func add_span, void *add_span_data); 48445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic int cv_type_bc_tobytes 485d65182f1818d1c19e6f3866ab6e68a262fad5185hbono@chromium.org (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, 48645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_output_value_func output_value, 48745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@null@*/ yasm_output_reloc_func output_reloc); 48845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 48945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/* Bytecode callback structures */ 49045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic const yasm_bytecode_callback cv_type_bc_callback = { 49145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org cv_type_bc_destroy, 49245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org cv_type_bc_print, 49345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_bc_finalize_common, 49445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org NULL, 49545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org cv_type_bc_calc_len, 49645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_bc_expand_common, 49745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org cv_type_bc_tobytes, 49845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 0 49945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}; 50045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 50145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic cv_type *cv_type_create(unsigned long indx); 50245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic void cv_type_append_leaf(cv_type *type, /*@keep@*/ cv_leaf *leaf); 50345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 50445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 50545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic cv_leaf * 50645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcv_leaf_create_label(int is_far) 50745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{ 50845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org cv_leaf *leaf = yasm_xmalloc(sizeof(cv_leaf)); 50945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org leaf->type = CV5_LF_LABEL; 51045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org leaf->format = "h"; 51145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org leaf->args[0].i = is_far ? 4 : 0; 51245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org return leaf; 51345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} 51445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 51545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgyasm_section * 51645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgyasm_cv__generate_type(yasm_object *object) 51745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{ 51845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org int new; 51945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org unsigned long indx = CV_FIRST_NONPRIM; 52045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_section *debug_type; 52145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_bytecode *bc; 52245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org cv_type *type; 52345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 52445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org debug_type = 52545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_object_get_general(object, ".debug$T", 1, 0, 0, &new, 0); 52645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 52745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Add label type */ 52845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org type = cv_type_create(indx++); 52945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org cv_type_append_leaf(type, cv_leaf_create_label(0)); 53045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org bc = yasm_bc_create_common(&cv_type_bc_callback, type, 0); 53145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_bc_finalize(bc, yasm_cv__append_bc(debug_type, bc)); 53245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_bc_calc_len(bc, NULL, NULL); 53345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 53445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org return debug_type; 53545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} 53645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 53745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic void 53845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcv_leaf_destroy(cv_leaf *leaf) 53945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{ 54045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org const char *ch = leaf->format; 54145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org int arg = 0; 54245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 54345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org while (*ch) { 54445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org switch (*ch) { 54545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 'b': 54645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 'h': 54745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 'w': 54845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org arg++; 54945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org break; /* nothing to destroy */ 55045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 'L': 55145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org cv_leaf_destroy((cv_leaf *)leaf->args[arg++].p); 55245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org break; 55345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 'T': 55445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org arg++; /* nothing to destroy */ 55545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org break; 55645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 'S': 55745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_xfree(leaf->args[arg++].p); 55845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org break; 55945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org default: 56045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_internal_error(N_("unknown leaf format character")); 56145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org } 56245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org ch++; 56345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org } 56445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} 56545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 56645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic unsigned long 56745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcv_leaf_size(const cv_leaf *leaf) 56845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{ 56945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org const char *ch = leaf->format; 57045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org unsigned long len = 2; /* leaf type */ 57145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org unsigned long slen; 57245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org int arg = 0; 57345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 57445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org while (*ch) { 57545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org switch (*ch) { 57645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 'b': 57745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org len++; 57845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org arg++; 57945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org break; 58045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 'h': 58145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org len += 2; 58245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org arg++; 58345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org break; 58445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 'w': 58545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org len += 4; 58645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org arg++; 58745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org break; 58845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 'L': 58945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org len += cv_leaf_size((const cv_leaf *)leaf->args[arg++].p); 59045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org break; 59145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 'T': 59245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org len += 4; /* XXX: will be 2 in CV4 */ 59345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org arg++; 59445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org break; 59545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 'S': 59645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org len += 1; /* XXX: is this 1 or 2? */ 59745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org slen = (unsigned long)strlen((const char *)leaf->args[arg++].p); 59845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org len += slen <= 0xff ? slen : 0xff; 59945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org break; 60045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org default: 60145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_internal_error(N_("unknown leaf format character")); 60245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org } 60345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org ch++; 60445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org } 60545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 60645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org return len; 60745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} 60845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 60945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic void 61045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcv_leaf_tobytes(const cv_leaf *leaf, yasm_bytecode *bc, yasm_arch *arch, 61145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org unsigned char **bufp, yasm_intnum *cval) 61245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{ 61345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org unsigned char *buf = *bufp; 61445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org const char *ch = leaf->format; 61545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org size_t len; 61645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org int arg = 0; 61745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 61845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* leaf type */ 61945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_intnum_set_uint(cval, leaf->type); 62045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_arch_intnum_tobytes(arch, cval, buf, 2, 16, 0, bc, 0); 62145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org buf += 2; 62245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 62345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org while (*ch) { 62445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org switch (*ch) { 62545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 'b': 62645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org YASM_WRITE_8(buf, leaf->args[arg].i); 62745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org arg++; 62845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org break; 62945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 'h': 63045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_intnum_set_uint(cval, leaf->args[arg++].i); 63145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_arch_intnum_tobytes(arch, cval, buf, 2, 16, 0, bc, 0); 63245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org buf += 2; 63345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org break; 63445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 'w': 63545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_intnum_set_uint(cval, leaf->args[arg++].i); 63645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_arch_intnum_tobytes(arch, cval, buf, 4, 32, 0, bc, 0); 63745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org buf += 4; 63845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org break; 63945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 'L': 64045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org cv_leaf_tobytes((const cv_leaf *)leaf->args[arg++].p, bc, arch, 64145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org &buf, cval); 64245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org break; 64345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 'T': 64445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_intnum_set_uint(cval, 64545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org ((const cv_type *)leaf->args[arg++].p)->indx); 64645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_arch_intnum_tobytes(arch, cval, buf, 4, 32, 0, bc, 0); 64745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org buf += 4; /* XXX: will be 2 in CV4 */ 64845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org break; 64945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 'S': 65045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org len = strlen((const char *)leaf->args[arg].p); 65145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org len = len <= 0xff ? len : 0xff; 65245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org YASM_WRITE_8(buf, len); 65345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org memcpy(buf, (const char *)leaf->args[arg].p, len); 65445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org buf += len; 65545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org arg++; 65645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org break; 65745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org default: 65845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_internal_error(N_("unknown leaf format character")); 65945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org } 66045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org ch++; 66145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org } 66245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 66345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org *bufp = buf; 66445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} 66545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 66645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic cv_type * 66745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcv_type_create(unsigned long indx) 66845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{ 66945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org cv_type *type = yasm_xmalloc(sizeof(cv_type)); 67045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 67145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org type->indx = indx; 67245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org type->num_leaves = 0; 67345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org type->leaves = NULL; 67445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 67545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org return type; 67645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} 67745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 67845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic void 67945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcv_type_append_leaf(cv_type *type, /*@keep@*/ cv_leaf *leaf) 68045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{ 68145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org type->num_leaves++; 68245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 68345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* This is inefficient for large numbers of leaves, but that won't happen 68445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * until we add structure support. 68545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 68645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org type->leaves = yasm_xrealloc(type->leaves, 68745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org type->num_leaves*sizeof(cv_leaf *)); 68845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 68945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org type->leaves[type->num_leaves-1] = leaf; 69045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} 69145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 69245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic void 69345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcv_type_bc_destroy(void *contents) 69445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{ 69545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org cv_type *type = (cv_type *)contents; 69645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org size_t i; 69745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 69845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org for (i=0; i<type->num_leaves; i++) 69945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org cv_leaf_destroy(type->leaves[i]); 70045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org if (type->leaves) 70145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_xfree(type->leaves); 70245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_xfree(contents); 70345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} 70445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 70545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic void 70645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcv_type_bc_print(const void *contents, FILE *f, int indent_level) 70745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{ 70845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* TODO */ 70945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} 71045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 71145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic int 71245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcv_type_bc_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, 71345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void *add_span_data) 71445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{ 71545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org cv_type *type = (cv_type *)bc->contents; 71645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org size_t i; 71745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 71845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org if (type->indx == CV_FIRST_NONPRIM) 71945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org bc->len = 4+2; 72045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org else 72145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org bc->len = 2; 72245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 72345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org for (i=0; i<type->num_leaves; i++) 72445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org bc->len += cv_leaf_size(type->leaves[i]); 72545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 72645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Pad to multiple of 4 */ 72745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org if (bc->len & 0x3) 72845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org bc->len += 4-(bc->len & 0x3); 72945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 73045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org return 0; 73145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} 73245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 73345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic int 734d65182f1818d1c19e6f3866ab6e68a262fad5185hbono@chromium.orgcv_type_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, 735d65182f1818d1c19e6f3866ab6e68a262fad5185hbono@chromium.org unsigned char *bufstart, void *d, 73645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_output_value_func output_value, 73745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_output_reloc_func output_reloc) 73845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{ 73945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_object *object = yasm_section_get_object(bc->section); 74045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org cv_type *type = (cv_type *)bc->contents; 74145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org unsigned char *buf = *bufp; 74245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_intnum *cval; 74345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org size_t i; 74445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org unsigned long reclen = bc->len - 2; 74545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 74645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org cval = yasm_intnum_create_uint(4); /* version */ 74745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org if (type->indx == CV_FIRST_NONPRIM) { 74845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_arch_intnum_tobytes(object->arch, cval, buf, 4, 32, 0, bc, 1); 74945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org buf += 4; 75045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org reclen -= 4; 75145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org } 75245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 75345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Total length of record (following this field) - 2 bytes */ 75445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_intnum_set_uint(cval, reclen); 75545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_arch_intnum_tobytes(object->arch, cval, buf, 2, 16, 0, bc, 1); 75645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org buf += 2; 75745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 75845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Leaves */ 75945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org for (i=0; i<type->num_leaves; i++) 76045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org cv_leaf_tobytes(type->leaves[i], bc, object->arch, &buf, cval); 76145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 76245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /* Pad to multiple of 4 */ 76345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org switch ((buf-(*bufp)) & 0x3) { 76445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 3: 76545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org YASM_WRITE_8(buf, CV_LF_PAD3); 76645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 2: 76745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org YASM_WRITE_8(buf, CV_LF_PAD2); 76845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 1: 76945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org YASM_WRITE_8(buf, CV_LF_PAD1); 77045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org case 0: 77145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org break; 77245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org } 77345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 77445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org *bufp = buf; 77545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 77645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_intnum_destroy(cval); 77745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org return 0; 77845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} 779