minoca / os

Minoca operating system
Other
2.71k stars 231 forks source link

Packing alignment for structure in the style msvc #143

Closed Alexcolom closed 6 years ago

Alexcolom commented 6 years ago

Hi Evan, Please consider the possibility of making changes associated with the compatibility with msvc to the repository. Sincerely, Alexander.

evangreen commented 6 years ago

Hi Alexander. Thanks for submitting this. It looks pretty good, I confirm that you got all the structures. A couple of notes:

  1. Can you set your name and email correctly in the commit? This will involve setting your name and email using something like git config --global user.name "My Name' (and user.email similarly). You'll be making some changes in my next request, so you can simply squash your upcoming commit with this one, which should fix up the author field.

  2. Can you use the more compact #pragma pack(push, 1) form, and make sure there are blank lines before and after the pragmas? Here's an example


/*++

Structure Description:

    This structure defines the format for the raw stabs in the .stab section.
    These structures were generated by the compiler/linker. It's important that
    members of this structure not be padded.

Members:

    StringIndex - Stores the index from the start of the .stabstr section
        where the string for this stab is located.

    Type - Stores the stab type, one of the STAB_* definitions
         (eg. STAB_LOCAL_SYMBOL).

    Other - Usually 0.

    Description - Stores a description of the stab. This field has various
        uses, for example in a STAB_SOURCE_LINE, the description field holds
        the line number.

    Value - Stores the value of the symbol. In many cases, this is a virtual
        address.

--*/

#pragma pack(push, 1)

typedef struct _RAW_STAB {
    ULONG StringIndex;
    UCHAR Type;
    UCHAR Other;
    USHORT Description;
    ULONG Value;
} PACKED RAW_STAB, *PRAW_STAB;

#pragma pack(pop)

// some other code