Add alignas specifiers for OSContext, OSSpinLock, OSThread.

This commit is contained in:
James Benton 2018-09-14 08:56:48 +01:00
parent f9fb0d8f24
commit 7c9120db96
8 changed files with 14 additions and 7 deletions

View File

@ -16,7 +16,7 @@ typedef struct OSContext OSContext;
#define OS_CONTEXT_TAG 0x4F53436F6E747874ull
struct OSContext
struct WUT_ALIGNAS(8) OSContext
{
//! Should always be set to the value OS_CONTEXT_TAG.
uint64_t tag;

View File

@ -54,7 +54,7 @@ WUT_CHECK_OFFSET(MEMBlockHeapBlock, 0x0c, prev);
WUT_CHECK_OFFSET(MEMBlockHeapBlock, 0x10, next);
WUT_CHECK_SIZE(MEMBlockHeapBlock, 0x14);
struct MEMBlockHeap
struct WUT_PACKED MEMBlockHeap
{
MEMHeapHeader header;

View File

@ -56,7 +56,7 @@ WUT_CHECK_OFFSET(MEMExpHeapBlockList, 0x00, head);
WUT_CHECK_OFFSET(MEMExpHeapBlockList, 0x04, tail);
WUT_CHECK_SIZE(MEMExpHeapBlockList, 0x08);
struct MEMExpHeap
struct WUT_PACKED MEMExpHeap
{
MEMHeapHeader header;
MEMExpHeapBlockList freeList;

View File

@ -35,7 +35,7 @@ WUT_CHECK_OFFSET(MEMFrmHeapState, 0x08, tail);
WUT_CHECK_OFFSET(MEMFrmHeapState, 0x0C, previous);
WUT_CHECK_SIZE(MEMFrmHeapState, 0x10);
struct MEMFrmHeap
struct WUT_PACKED MEMFrmHeap
{
MEMHeapHeader header;
void *head;

View File

@ -22,7 +22,7 @@ struct MEMUnitHeapFreeBlock
WUT_CHECK_OFFSET(MEMUnitHeapFreeBlock, 0x00, next);
WUT_CHECK_SIZE(MEMUnitHeapFreeBlock, 0x04);
struct MEMUnitHeap
struct WUT_PACKED MEMUnitHeap
{
MEMHeapHeader header;
MEMUnitHeapFreeBlock *freeBlocks;

View File

@ -14,7 +14,7 @@ extern "C" {
typedef struct OSSpinLock OSSpinLock;
struct OSSpinLock
struct WUT_ALIGNAS(16) OSSpinLock
{
uint32_t owner;
WUT_UNKNOWN_BYTES(0x4);

View File

@ -117,7 +117,7 @@ WUT_CHECK_SIZE(OSFastMutexQueue, 0x08);
#define OS_THREAD_TAG 0x74487244u
#pragma pack(push, 1)
struct OSThread
struct WUT_ALIGNAS(8) OSThread
{
OSContext context;

View File

@ -31,3 +31,10 @@
// Marks a struct as packed
#define WUT_PACKED __attribute__((__packed__))
// Sets alignment for a struct
#if defined(__alignas_is_defined) || defined(__cplusplus)
#define WUT_ALIGNAS(x) alignas(x)
#elif defined(__GNUC__) || defined(__clang__)
#define WUT_ALIGNAS(x) __attribute__((__aligned__(x)))
#endif