Skip to content

Commit 44ea019

Browse files
authored
[LoongArch64] Fix the compiling errors for aligned and definiations. (#84971)
1 parent 5834df1 commit 44ea019

File tree

4 files changed

+35
-33
lines changed

4 files changed

+35
-33
lines changed

src/coreclr/debug/di/loongarch64/cordbregisterset.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,14 @@ void CordbRegisterSet::InternalCopyRDToContext(DT_CONTEXT *pInputContext)
282282
*pDest++ = *pSrc++;
283283
}
284284

285-
pInputContext->TP = m_rd->TP;
286-
pInputContext->RA = m_rd->RA;
285+
pInputContext->Tp = m_rd->TP;
286+
pInputContext->Ra = m_rd->RA;
287287
}
288288

289289
if ((pInputContext->ContextFlags & DT_CONTEXT_CONTROL) == DT_CONTEXT_CONTROL)
290290
{
291-
pInputContext->SP = m_rd->SP;
292-
pInputContext->PC = m_rd->PC;
293-
pInputContext->FP = m_rd->FP;
291+
pInputContext->Sp = m_rd->SP;
292+
pInputContext->Pc = m_rd->PC;
293+
pInputContext->Fp = m_rd->FP;
294294
}
295295
}

src/coreclr/debug/inc/dbgtargetcontext.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ static_assert(sizeof(DT_CONTEXT) == sizeof(T_CONTEXT), "DT_CONTEXT size must equ
487487
#define DT_LOONGARCH64_MAX_BREAKPOINTS 8
488488
#define DT_LOONGARCH64_MAX_WATCHPOINTS 2
489489

490-
typedef DECLSPEC_ALIGN(16) struct {
490+
typedef struct DECLSPEC_ALIGN(16) {
491491
//
492492
// Control flags.
493493
//
@@ -498,9 +498,9 @@ typedef DECLSPEC_ALIGN(16) struct {
498498
// Integer registers
499499
//
500500
DWORD64 R0;
501-
DWORD64 RA;
502-
DWORD64 TP;
503-
DWORD64 SP;
501+
DWORD64 Ra;
502+
DWORD64 Tp;
503+
DWORD64 Sp;
504504
DWORD64 A0;
505505
DWORD64 A1;
506506
DWORD64 A2;
@@ -519,7 +519,7 @@ typedef DECLSPEC_ALIGN(16) struct {
519519
DWORD64 T7;
520520
DWORD64 T8;
521521
DWORD64 X0;
522-
DWORD64 FP;
522+
DWORD64 Fp;
523523
DWORD64 S0;
524524
DWORD64 S1;
525525
DWORD64 S2;
@@ -529,12 +529,13 @@ typedef DECLSPEC_ALIGN(16) struct {
529529
DWORD64 S6;
530530
DWORD64 S7;
531531
DWORD64 S8;
532-
DWORD64 PC;
532+
DWORD64 Pc;
533533

534534
//
535535
// Floating Point Registers
536536
//
537537
ULONGLONG F[32];
538+
DWORD Fcsr;
538539
} DT_CONTEXT;
539540

540541
static_assert(sizeof(DT_CONTEXT) == sizeof(T_CONTEXT), "DT_CONTEXT size must equal the T_CONTEXT size");

src/coreclr/debug/inc/loongarch64/primitives.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,31 +85,31 @@ constexpr CorDebugRegister g_JITToCorDbgReg[] =
8585
inline void CORDbgSetIP(DT_CONTEXT *context, LPVOID ip) {
8686
LIMITED_METHOD_CONTRACT;
8787

88-
context->PC = (DWORD64)ip;
88+
context->Pc = (DWORD64)ip;
8989
}
9090

9191
inline LPVOID CORDbgGetSP(const DT_CONTEXT * context) {
9292
LIMITED_METHOD_CONTRACT;
9393

94-
return (LPVOID)(size_t)(context->SP);
94+
return (LPVOID)(size_t)(context->Sp);
9595
}
9696

9797
inline void CORDbgSetSP(DT_CONTEXT *context, LPVOID esp) {
9898
LIMITED_METHOD_CONTRACT;
9999

100-
context->SP = (DWORD64)esp;
100+
context->Sp = (DWORD64)esp;
101101
}
102102

103103
inline LPVOID CORDbgGetFP(const DT_CONTEXT * context) {
104104
LIMITED_METHOD_CONTRACT;
105105

106-
return (LPVOID)(size_t)(context->FP);
106+
return (LPVOID)(size_t)(context->Fp);
107107
}
108108

109109
inline void CORDbgSetFP(DT_CONTEXT *context, LPVOID fp) {
110110
LIMITED_METHOD_CONTRACT;
111111

112-
context->FP = (DWORD64)fp;
112+
context->Fp = (DWORD64)fp;
113113
}
114114

115115

@@ -119,9 +119,9 @@ inline BOOL CompareControlRegisters(const DT_CONTEXT * pCtx1, const DT_CONTEXT *
119119

120120
// TODO-LoongArch64: Sort out frame registers
121121

122-
if ((pCtx1->PC == pCtx2->PC) &&
123-
(pCtx1->SP == pCtx2->SP) &&
124-
(pCtx1->FP == pCtx2->FP))
122+
if ((pCtx1->Pc == pCtx2->Pc) &&
123+
(pCtx1->Sp == pCtx2->Sp) &&
124+
(pCtx1->Fp == pCtx2->Fp))
125125
{
126126
return TRUE;
127127
}
@@ -166,7 +166,7 @@ inline LPVOID CORDbgGetIP(DT_CONTEXT *context)
166166
{
167167
LIMITED_METHOD_CONTRACT;
168168

169-
return (LPVOID)(size_t)(context->PC);
169+
return (LPVOID)(size_t)(context->Pc);
170170
}
171171

172172
inline void CORDbgSetInstructionExImpl(CORDB_ADDRESS_TYPE* address,

src/coreclr/debug/shared/loongarch64/primitives.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,37 +29,38 @@ void CORDbgCopyThreadContext(DT_CONTEXT* pDst, const DT_CONTEXT* pSrc)
2929
{
3030
LOG((LF_CORDB, LL_INFO1000000,
3131
"CP::CTC: RA: pDst=0x%lx, pSrc=0x%lx, Flags=0x%x\n",
32-
pDst->RA, pSrc->RA, DT_CONTEXT_CONTROL));
33-
pDst->RA = pSrc->RA;
32+
pDst->Ra, pSrc->Ra, DT_CONTEXT_CONTROL));
33+
pDst->Ra = pSrc->Ra;
3434

3535
LOG((LF_CORDB, LL_INFO1000000,
3636
"CP::CTC: SP: pDst=0x%lx, pSrc=0x%lx, Flags=0x%x\n",
37-
pDst->SP, pSrc->SP, DT_CONTEXT_CONTROL));
38-
pDst->SP = pSrc->SP;
37+
pDst->Sp, pSrc->Sp, DT_CONTEXT_CONTROL));
38+
pDst->Sp = pSrc->Sp;
3939

4040
LOG((LF_CORDB, LL_INFO1000000,
4141
"CP::CTC: FP: pDst=0x%lx, pSrc=0x%lx, Flags=0x%x\n",
42-
pDst->FP, pSrc->FP, DT_CONTEXT_CONTROL));
43-
pDst->FP = pSrc->FP;
42+
pDst->Fp, pSrc->Fp, DT_CONTEXT_CONTROL));
43+
pDst->Fp = pSrc->Fp;
4444

4545
LOG((LF_CORDB, LL_INFO1000000,
4646
"CP::CTC: PC: pDst=0x%lx, pSrc=0x%lx, Flags=0x%x\n",
47-
pDst->PC, pSrc->PC, DT_CONTEXT_CONTROL));
48-
pDst->PC = pSrc->PC;
47+
pDst->Pc, pSrc->Pc, DT_CONTEXT_CONTROL));
48+
pDst->Pc = pSrc->Pc;
4949
}
5050

5151
if ((dstFlags & srcFlags & DT_CONTEXT_INTEGER) == DT_CONTEXT_INTEGER)
5252
{
53-
CopyContextChunk(&pDst->A0, &pSrc->A0, &pDst->FP,
53+
CopyContextChunk(&pDst->A0, &pSrc->A0, &pDst->Fp,
5454
DT_CONTEXT_INTEGER);
55-
CopyContextChunk(&pDst->S0, &pSrc->S0, &pDst->PC,
55+
CopyContextChunk(&pDst->S0, &pSrc->S0, &pDst->Pc,
5656
DT_CONTEXT_INTEGER);
5757
}
5858

5959
if ((dstFlags & srcFlags & DT_CONTEXT_FLOATING_POINT) == DT_CONTEXT_FLOATING_POINT)
6060
{
6161
CopyContextChunk(&pDst->F[0], &pSrc->F[0], &pDst->F[32],
6262
DT_CONTEXT_FLOATING_POINT);
63+
pDst->Fcsr = pSrc->Fcsr;
6364
}
6465
}
6566

@@ -76,13 +77,13 @@ void SetDebuggerREGDISPLAYFromREGDISPLAY(DebuggerREGDISPLAY* pDRD, REGDISPLAY* p
7677
if ((flags & DT_CONTEXT_CONTROL) == DT_CONTEXT_CONTROL)
7778
{
7879
pDRD->FP = (SIZE_T)CORDbgGetFP(pContext);
79-
pDRD->PC = (SIZE_T)pContext->PC;
80-
pDRD->RA = (SIZE_T)pContext->RA;
80+
pDRD->PC = (SIZE_T)pContext->Pc;
81+
pDRD->RA = (SIZE_T)pContext->Ra;
8182
}
8283

8384
if ((flags & DT_CONTEXT_INTEGER) == DT_CONTEXT_INTEGER)
8485
{
85-
pDRD->TP = pContext->TP;
86+
pDRD->TP = pContext->Tp;
8687
memcpy(&pDRD->A0, &pContext->A0, sizeof(pDRD->A0)*(21 - 4 + 1));
8788
memcpy(&pDRD->S0, &pContext->S0, sizeof(pDRD->S0)* 9);
8889
}

0 commit comments

Comments
 (0)