|
// Copyright (c) 2023 Chubak Bidpaa |
|
// Permission is hereby granted, free of charge, to any person obtaining |
|
// a copy of this software and associated documentation files (the |
|
// "Software"), to deal in the Software without restriction, including |
|
// without limitation the rights to use, copy, modify, merge, publish, |
|
// distribute, sublicense, and/or sell copies of the Software, and to |
|
// permit persons to whom the Software is furnished to do so, subject to |
|
// the following conditions: |
|
// The above copyright notice and this permission notice shall be |
|
// included in all copies or substantial portions of the Software. |
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
|
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
|
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
|
|
#define LIT_NZERO $0 |
|
|
|
#define LIT_NP01 $1 |
|
#define LIT_NP02 $2 |
|
#define LIT_NP04 $4 |
|
#define LIT_NP08 $8 |
|
#define LIT_NP16 $16 |
|
#define LIT_NP32 $32 |
|
#define LIT_NP64 $64 |
|
|
|
#define LIT_NN01 $-1 |
|
#define LIT_NN02 $-2 |
|
#define LIT_NN04 $-4 |
|
#define LIT_NN08 $-8 |
|
#define LIT_NN16 $-16 |
|
#define LIT_NN32 $-32 |
|
#define LIT_NN64 $-64 |
|
|
|
#define LIT_NPXF2 $0xff |
|
#define LIT_NPXF4 $0xffff |
|
#define LIT_NPXF6 $0xffffff |
|
#define LIT_NPXF8 $0xffffffff |
|
#define LIT_NPXF10 $0xffffffffff |
|
#define LIT_NPXF12 $0xffffffffffff |
|
#define LIT_NPXF14 $0xffffffffffffff |
|
#define LIT_NPXF16 $0xffffffffffffffff |
|
|
|
#define LIT_NNX802 $-0x80 |
|
#define LIT_NNX804 $-0x8000 |
|
#define LIT_NNX806 $-0x800000 |
|
#define LIT_NNX808 $-0x80000000 |
|
#define LIT_NNX8010 $-0x8000000000 |
|
#define LIT_NNX8012 $-0x800000000000 |
|
#define LIT_NNX8014 $-0x80000000000000 |
|
#define LIT_NNX8016 $-0x8000000000000000 |
|
|
|
#define IDT_OPORRS or |
|
#define IDT_OPORRU or |
|
#define IDT_OPPOPP pop |
|
#define IDT_OPTEST tst |
|
#define IDT_OPMOVE mov |
|
#define IDT_OPADDU add |
|
#define IDT_OPSUBU sub |
|
#define IDT_OPANDU and |
|
#define IDT_OPXORU xor |
|
#define IDT_OPORRN not |
|
#define IDT_OPLSHL shl |
|
#define IDT_OPLSHR shr |
|
#define IDT_OPLROR ror |
|
#define IDT_OPCOMP cmp |
|
#define IDT_opdTR ret |
|
#define IDT_OPADDS add |
|
#define IDT_OPSUBS sub |
|
#define IDT_OPANDS and |
|
#define IDT_OPXORS xor |
|
#define IDT_OPMOVN not |
|
#define IDT_OPJUMP jmp |
|
#define IDT_OPMOVZ movz |
|
#define IDT_OPPUSH push |
|
#define IDT_OPXCHG xchg |
|
#define IDT_OPLDBY movlb |
|
#define IDT_OPSTBY movlb |
|
#define IDT_OPLDHW movlh |
|
#define IDT_OPSTHW movlh |
|
#define IDT_OPLDFW movlw |
|
#define IDT_OPSTFW movlw |
|
#define IDT_OPLDRP movld |
|
#define IDT_OPSTRP movld |
|
#define IDT_OPLDDW movld |
|
#define IDT_OPSTDW movld |
|
#define IDT_OPSYSC syscall |
|
|
|
#define IDT_CONDEQ je |
|
#define IDT_CONDLT jl |
|
#define IDT_CONDGT jg |
|
#define IDT_CONDOV jo |
|
#define IDT_CONDNG js |
|
#define IDT_CONDCS jc |
|
#define IDT_CONDHI ja |
|
#define IDT_CONDNE jne |
|
#define IDT_CONDLE jle |
|
#define IDT_CONDGE jge |
|
#define IDT_CONDPS jns |
|
#define IDT_CONDNV jno |
|
#define IDT_CONDCC jnc |
|
|
|
#define REG_DSYCNR %rax |
|
#define REG_opePTR %rsp |
|
#define REG_DBPPTR %rbp |
|
#define REG_DARG01 %rdi |
|
#define REG_DARG02 %rsi |
|
#define REG_DARG03 %rdx |
|
#define REG_DARG04 %r10 |
|
#define REG_DARG05 %r8 |
|
#define REG_DARG06 %r9 |
|
#define REG_DSRETR %rax |
|
#define REG_DCLB01 %r11 |
|
#define REG_DCSV01 %rbx |
|
#define REG_DCSV02 %r12 |
|
#define REG_DCSV03 %r13 |
|
#define REG_DCSV04 %r14 |
|
#define REG_DCSV05 %r15 |
|
|
|
#define REG_WSYCNR %eax |
|
#define REG_WSTPTR %esp |
|
#define REG_WBPPTR %ebp |
|
#define REG_WARG01 %edi |
|
#define REG_WARG02 %esi |
|
#define REG_WARG03 %edx |
|
#define REG_WARG05 %r8d |
|
#define REG_WARG06 %r9d |
|
#define REG_WSRETR %eax |
|
#define REG_WCSV01 %ebx |
|
#define REG_WCSV02 %r12d |
|
#define REG_WCSV03 %r13d |
|
#define REG_WCSV04 %r14d |
|
#define REG_WCSV05 %r15d |
|
#define REG_WCLB01 %r11d |
|
|
|
#define REG_BSYCNR %ax |
|
#define REG_BARG01 %di |
|
#define REG_BARG02 %si |
|
#define REG_BARG03 %dx |
|
#define REG_BSRETR %ax |
|
#define REG_BCSV01 %bx |
|
#define REG_BARG05 %r8b |
|
#define REG_BARG06 %r9b |
|
#define REG_BCSV02 %r12b |
|
#define REG_BCSV03 %r13b |
|
#define REG_BCSV04 %r14b |
|
#define REG_BCSV05 %r15b |
|
#define REG_BCLB01 %r11b |
|
|
|
|
|
.section base_operation_macros |
|
.macro moxnnnnb opd, optr |
|
\optr \opd |
|
.endm |
|
|
|
.macro moxoxnnb opd1, optr1, opd2, optr2 |
|
\optr1 \opd1 |
|
\optr2 \opd2 |
|
.endm |
|
|
|
.macro ooxyvtnb ope, opd, optr, val |
|
mov \opd, \ope |
|
\optr \val, \ope |
|
.endm |
|
|
|
.macro ooxvtnnb opd, val, optr |
|
\optr \val, \opd |
|
.endm |
|
|
|
.macro moxytnnb ope, opd, optr |
|
\optr \opd, \ope |
|
.endm |
|
|
|
.macro moxyvstb ope, opd, optr, val, shoptr, shn |
|
movz \opd, \ope |
|
\optr \val, \ope |
|
\shoptr \shn, \ope |
|
.endm |
|
|
|
|
|
.section single_load_memory_base_macros |
|
.macro mmmlidxp reg, addr, idx, optr |
|
\optr (\addr, \idx, 1), \ope |
|
add \idx, \addr |
|
.endm |
|
|
|
.macro mmmlpidx reg, addr, idx, optr |
|
add \idx, \addr |
|
\optr (\addr, \idx, 1), \ope |
|
.endm |
|
|
|
.macro mmmlofst reg, addr, idx, optr |
|
\optr (\addr, \idx, 1), \ope |
|
.endm |
|
|
|
.section single_store_memory_base_macros |
|
.macro mmmlidxp reg, addr, idx, optr |
|
\optr \ope, (\addr, \idx, 1) |
|
add \idx, \addr |
|
.endm |
|
|
|
.macro mmmlpidx reg, addr, idx, optr |
|
add \idx, \addr |
|
\optr \ope, (\addr, \idx, 1) |
|
.endm |
|
|
|
.macro mmmlofst reg, addr, idx, optr |
|
\optr \ope, (\addr, \idx, 1) |
|
.endm |
|
|
|
.section pair_load_memory_base_macros |
|
.macro mmplidxp reg1, reg2, addr, idx, optr |
|
\optr (\addr, \idx, 1), \ope1 |
|
add \idx, \addr |
|
\optr (\addr, \idx, 1), \ope2 |
|
add \idx, \addr |
|
.endm |
|
|
|
.macro mmplpidx reg1, reg2, addr, idx, optr |
|
add \idx, \addr |
|
\optr (\addr, \idx, 1), \ope1 |
|
add \idx, \addr |
|
\optr (\addr, \idx, 1), \ope2 |
|
.endm |
|
|
|
.altmacro |
|
.macro mmplofst reg1, reg2, addr, idx, optr |
|
\optr (\addr, \idx, 1), \ope1 |
|
\optr (\addr, %idx + %idx, 1), \ope1 |
|
.endm |
|
|
|
.section pair_load_memory_base_macros |
|
.macro mmpsidxp reg1, reg2, addr, idx, optr |
|
\optr \ope1, (\addr, \idx, 1) |
|
add \idx, \addr |
|
\optr \ope2, (\addr, \idx, 1) |
|
add \idx, \addr |
|
.endm |
|
|
|
.macro mmpspidx reg1, reg2, addr, idx, optr |
|
add \idx, \addr |
|
\optr \ope1, (\addr, \idx, 1) |
|
add \idx, \addr |
|
\optr \ope2, (\addr, \idx, 1) |
|
.endm |
|
|
|
.altmacro |
|
.macro mmpsofst reg1, reg2, addr, idx, optr |
|
\optr \ope1, (\addr, \idx, 1) |
|
\optr \ope1, (\addr, %idx + %idx, 1) |
|
.endm |
|
|
|
.section base_stack_macros |
|
.macro mpshbase reg, optr, idx |
|
IDT_OPPUSH \reg |
|
.endm |
|
|
|
.macro mpopbase reg, optr, idx |
|
IDT_OPPOP \reg |
|
.endm |
|
|
|
.section transfer_operation_macros |
|
.macro mtrnmove ope, opd |
|
mOXYTNNB \ope, \opd, IDT_OPMOVE |
|
.endm |
|
|
|
.macro mtrnmovz ope, opd |
|
mOXYTNNB \ope, \opd, IDT_OPMOVZ |
|
.endm |
|
|
|
.macro mtrnmovn ope, opd |
|
mOXYTNNB \ope, \opd, IDT_OPMOVN |
|
.endm |
|
|
|
.section inplace_operation_macros |
|
.macro minpaddu opd, val |
|
oOXVTNNB \opd, \val, IDT_OPADDU |
|
.endm |
|
|
|
.macro minpadds opd, val |
|
oOXVTNNB \opd, \val, IDT_OPADDS |
|
.endm |
|
|
|
.macro minpsubu opd, val |
|
oOXVTNNB \opd, \val, IDT_OPSUBU |
|
.endm |
|
|
|
.macro minpsubs opd, val |
|
oOXVTNNB \opd, \val, IDT_OPSUBS |
|
.endm |
|
|
|
.macro minpandu opd, val |
|
oOXVTNNB \opd, \val, IDT_OPANDU |
|
.endm |
|
|
|
.macro minpands opd, val |
|
oOXVTNNB \opd, \val, IDT_OPADNS |
|
.endm |
|
|
|
.macro minporru opd, val |
|
oOXVTNNB \opd, \val, IDT_OPORRU |
|
.endm |
|
|
|
.macro minporrs opd, val |
|
oOXVTNNB \opd, \val, IDT_OPORRS |
|
.endm |
|
|
|
.macro minpxoru opd, val |
|
oOXVTNNB \opd, \val, IDT_OPXORU |
|
.endm |
|
|
|
.macro minpxors opd, val |
|
oOXVTNNB \opd, \val, IDT_OPXORS |
|
.endm |
|
|
|
.macro minplshl opd, val |
|
oOXVTNNB \opd, \val, IDT_OPLSHL |
|
.endm |
|
|
|
.macro minplshr opd, val |
|
oOXVTNNB \opd, \val, IDT_OPLSHR |
|
.endm |
|
|
|
.macro minplror opd, val |
|
oOXVTNNB \opd, \val, IDT_OPLROR |
|
.endm |
|
|
|
|
|
.section transfer_operation_macros |
|
.macro mtroaddu ope, opd, val |
|
oOXYVTNB \ope, \opd, \val, IDT_OPADDU |
|
.endm |
|
|
|
.macro mtroadds ope, opd, val |
|
oOXYVTNB \ope, \opd, \val, IDT_OPADDS |
|
.endm |
|
|
|
.macro mtrosubu ope, opd, val |
|
oOXYVTNB \ope, \opd, \val, IDT_OPSUBU |
|
.endm |
|
|
|
.macro mtrosubs ope, opd, val |
|
oOXYVTNB \ope, \opd, \val, IDT_OPSUBS |
|
.endm |
|
|
|
.macro mtroandu ope, opd, val |
|
oOXYVTNB \ope, \opd, \val, IDT_OPANDU |
|
.endm |
|
|
|
.macro mtroands ope, opd, val |
|
oOXYVTNB \ope, \opd, \val, IDT_OPADNS |
|
.endm |
|
|
|
.macro mtroorru ope, opd, val |
|
oOXYVTNB \ope, \opd, \val, IDT_OPORRU |
|
.endm |
|
|
|
.macro mtroorrs ope, opd, val |
|
oOXYVTNB \ope, \opd, \val, IDT_OPORRS |
|
.endm |
|
|
|
.macro mtroxoru ope, opd, val |
|
oOXYVTNB \ope, \opd, \val, IDT_OPXORU |
|
.endm |
|
|
|
.macro mtroxors ope, opd, val |
|
oOXYVTNB \ope, \opd, \val, IDT_OPXORS |
|
.endm |
|
|
|
.macro mtrolshl ope, opd, val |
|
oOXYVTNB \ope, \opd, \val, IDT_OPLSHL |
|
.endm |
|
|
|
.macro mtrolshr ope, opd, val |
|
oOXYVTNB \ope, \opd, \val, IDT_OPLSHR |
|
.endm |
|
|
|
.macro mtrolror ope, opd, val |
|
oOXYVTNB \ope, \opd, \val, IDT_OPLROR |
|
.endm |
|
|
|
.section operate_and_shift_left_macros |
|
.macro mshladdu ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPADDU, IDT_OPLSHL, \shn |
|
.endm |
|
|
|
.macro mshladds ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPADDS, IDT_OPLSHL, \shn |
|
.endm |
|
|
|
.macro mshlsubu ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPSUBU, IDT_OPLSHL, \shn |
|
.endm |
|
|
|
.macro mshlsubs ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPSUBS, IDT_OPLSHL, \shn |
|
.endm |
|
|
|
.macro mshlandu ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPANDU, IDT_OPLSHL, \shn |
|
.endm |
|
|
|
.macro mshlands ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPADNS, IDT_OPLSHL, \shn |
|
.endm |
|
|
|
.macro mshlorru ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPORRU, IDT_OPLSHL, \shn |
|
.endm |
|
|
|
.macro mshlorrs ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPORRS, IDT_OPLSHL, \shn |
|
.endm |
|
|
|
.macro mshlxoru ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPXORU, IDT_OPLSHL, \shn |
|
.endm |
|
|
|
.macro mshlxors ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPXORS, IDT_OPLSHL, \shn |
|
.endm |
|
|
|
|
|
.section operate_and_shift_right_macros |
|
.macro mshraddu ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPADDU, IDT_OPSHFR, \shn |
|
.endm |
|
|
|
.macro mshradds ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPADDS, IDT_OPSHFR, \shn |
|
.endm |
|
|
|
.macro mshrsubu ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPSUBU, IDT_OPSHFR, \shn |
|
.endm |
|
|
|
.macro mshrsubs ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPSUBS, IDT_OPSHFR, \shn |
|
.endm |
|
|
|
.macro mshrandu ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPANDU, IDT_OPSHFR, \shn |
|
.endm |
|
|
|
.macro mshrands ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPADNS, IDT_OPSHFR, \shn |
|
.endm |
|
|
|
.macro mshrorru ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPORRU, IDT_OPSHFR, \shn |
|
.endm |
|
|
|
.macro mshrorrs ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPORRS, IDT_OPSHFR, \shn |
|
.endm |
|
|
|
.macro mshrxoru ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPXORU, IDT_OPSHFR, \shn |
|
.endm |
|
|
|
.macro mshrxors ope, opd, val, shn |
|
mOXYVSTB \ope, \opd, \val, IDT_OPXORS, IDT_OPSHFR, \shn |
|
.endm |
|
|
|
|
|
.section post_index_macros |
|
.macro mmemlbip reg, addr |
|
mMMLIDXP \reg, \addr, LIT_NP01, IDT_OPLDBY |
|
.endm |
|
|
|
.macro mmemlhip reg, addr |
|
mMMLIDXP \reg, \addr, LIT_NP02, IDT_OPLDHW |
|
.endm |
|
|
|
.macro mmemlwip reg, addr |
|
mMMLIDXP \reg, \addr, LIT_NP04, IDT_OPLDFW |
|
.endm |
|
|
|
.macro mmemldip reg, addr |
|
mMMLIDXP \reg, \addr, LIT_NP08, IDT_OPLDDW |
|
.endm |
|
|
|
.macro mmemliip reg, addr, idx |
|
mMMLIDXP \reg, \addr, \idx, IDT_OPSTDW |
|
.endm |
|
|
|
.macro mmemsbip reg, addr |
|
mMMSIDXP \reg, \addr, LIT_NN01, IDT_OPSTBY |
|
.endm |
|
|
|
.macro mmemship reg, addr |
|
mMMSIDXP \reg, \addr, LIT_NN02, IDT_OPSTHW |
|
.endm |
|
|
|
.macro mmemswip reg, addr |
|
mMMSIDXP \reg, \addr, LIT_NN04, IDT_OPSTFW |
|
.endm |
|
|
|
.macro mmemsdip reg, addr |
|
mMMSIDXP \reg, \addr, LIT_NN08, IDT_OPSTDW |
|
.endm |
|
|
|
.macro mmemsiip reg, addr, idx |
|
mMMSIDXP \reg, \addr, \idx, IDT_OPSTDW |
|
.endm |
|
|
|
|
|
.section pre_index_macros |
|
.macro mmemlbpi reg, addr |
|
mMMLIDXP \reg, \addr, LIT_NP01, IDT_OPLDBY |
|
.endm |
|
|
|
.macro mmemlhpi reg, addr |
|
mMMLIDXP \reg, \addr, LIT_NP02, IDT_OPLDHW |
|
.endm |
|
|
|
.macro mmemlwpi reg, addr |
|
mMMLIDXP \reg, \addr, LIT_NP04, IDT_OPLDFW |
|
.endm |
|
|
|
.macro mmemldpi reg, addr |
|
mMMLIDXP \reg, \addr, LIT_NP08, IDT_OPLDDW |
|
.endm |
|
|
|
.macro mmemlipi reg, addr, idx |
|
mMMLIDXP \reg, \addr, \idx, IDT_OPLDDW |
|
.endm |
|
|
|
.macro mmemsbpi reg, addr |
|
mMMSIDXP \reg, \addr, LIT_NN01, IDT_OPSTBY |
|
.endm |
|
|
|
.macro mmemshpi reg, addr |
|
mMMSIDXP \reg, \addr, LIT_NN02, IDT_OPSTHW |
|
.endm |
|
|
|
.macro mmemswpi reg, addr |
|
mMMSIDXP \reg, \addr, LIT_NN04, IDT_OPSTFW |
|
.endm |
|
|
|
.macro mmemsdpi reg, addr |
|
mMMSIDXP \reg, \addr, LIT_NN08, IDT_OPSTDW |
|
.endm |
|
|
|
.macro mmemsipi reg, addr, idx |
|
mMMSIDXP \reg, \addr, \idx, IDT_OPSTDW |
|
.endm |
|
|
|
.section offset_macros |
|
.macro mmemlbof reg, addr, idx |
|
mMMLOFST \reg, \addr, \idx, IDT_OPLDBY |
|
.endm |
|
|
|
.macro mmemlhof reg, addr, idx |
|
mMMLOFST \reg, \addr, \idx, IDT_OPLDHW |
|
.endm |
|
|
|
.macro mmemlwof reg, addr, idx |
|
mMMLOFST \reg, \addr, \idx, IDT_OPLDFW |
|
.endm |
|
|
|
.macro mmemldof reg, addr, idx |
|
mMMLOFST \reg, \addr, \idx, IDT_OPLDDW |
|
.endm |
|
|
|
.macro mmemsbof reg, addr, idx |
|
mMMSOFST \reg, \addr, \idx, IDT_OPSTBY |
|
.endm |
|
|
|
.macro mmemshof reg, addr, idx |
|
mMMSOFST \reg, \addr, \idx, IDT_OPSTHW |
|
.endm |
|
|
|
.macro mmemswof reg, addr, idx |
|
mMMSOFST \reg, \addr, \idx, IDT_OPSTFW |
|
.endm |
|
|
|
.macro mmemsdof reg, addr, idx |
|
mMMSOFST \reg, \addr, \idx, IDT_OPSTDW |
|
.endm |
|
|
|
|
|
.section pair_preindex_macros |
|
.macro mmmlpbpi reg1, reg2, addr |
|
mMPLPIDX \reg, \reg2, \addr, LIT_NP02, IDT_OPLDRP |
|
.endm |
|
|
|
.macro mmmlphpi reg1, reg2, addr |
|
mMPLPIDX \reg, \reg2, \addr, LIT_NP04, IDT_OPLDRP |
|
.endm |
|
|
|
.macro mmmlpwpi reg1, reg2, addr |
|
mMPLPIDX \reg, \reg2, \addr, LIT_NP08, IDT_OPLDRP |
|
.endm |
|
|
|
.macro mmmlpdpi reg1, reg2, addr |
|
mMPLPIDX \reg, \reg2, \addr, LIT_NP16, IDT_OPLDRP |
|
.endm |
|
|
|
.macro mmmlpipi reg1, reg2, addr, idx |
|
mMPSPIDX \reg, \reg2, \addr, \idx, IDT_OPLDRP |
|
.endm |
|
|
|
.macro mmmspbpi reg1, reg2, addr |
|
mMPLPIDX \reg, \reg2, \addr, LIT_NP02, IDT_OPSTRP |
|
.endm |
|
|
|
.macro mmmsphpi reg1, reg2, addr |
|
mMPSPIDX \reg, \reg2, \addr, LIT_NP04, IDT_OPSTRP |
|
.endm |
|
|
|
.macro mmmspwpi reg1, reg2, addr |
|
mMPSPIDX \reg, \reg2, \addr, LIT_NP08, IDT_OPSTRP |
|
.endm |
|
|
|
.macro mmmspdpi reg1, reg2, addr |
|
mMPSPIDX \reg, \reg2, \addr, LIT_NP16, IDT_OPSTRP |
|
.endm |
|
|
|
.macro mmmspipi reg1, reg2, addr, idx |
|
mMPSPIDX \reg, \reg2, \addr, \idx, IDT_OPSTRP |
|
.endm |
|
|
|
.section pair_postindex_macros |
|
.macro mmmlpbip reg1, reg2, addr |
|
mMPLIDXP \reg, \reg2, \addr, LIT_NP02, IDT_OPLDRP |
|
.endm |
|
|
|
.macro mmmlphip reg1, reg2, addr |
|
mMPLIDXP \reg, \reg2, \addr, LIT_NP04, IDT_OPLDRP |
|
.endm |
|
|
|
.macro mmmlpwip reg1, reg2, addr |
|
mMPLIDXP \reg, \reg2, \addr, LIT_NP08, IDT_OPLDRP |
|
.endm |
|
|
|
.macro mmmlpdip reg1, reg2, addr |
|
mMPLIDXP \reg, \reg2, \addr, LIT_NP16, IDT_OPLDRP |
|
.endm |
|
|
|
.macro mmmlpiip reg1, reg2, addr, idx |
|
mMPSIDXP \reg, \reg2, \addr, \idx, IDT_OPLDRP |
|
.endm |
|
|
|
.macro mmmspbip reg1, reg2, addr |
|
mMPSIDXP \reg, \reg2, \addr, LIT_NP02, IDT_OPSTRP |
|
.endm |
|
|
|
.macro mmmsphip reg1, reg2, addr |
|
mMPSIDXP \reg, \reg2, \addr, LIT_NP04, IDT_OPSTRP |
|
.endm |
|
|
|
.macro mmmspwip reg1, reg2, addr |
|
mMPSIDXP \reg, \reg2, \addr, LIT_NP08, IDT_OPSTRP |
|
.endm |
|
|
|
.macro mmmspdip reg1, reg2, addr |
|
mMPSIDXP \reg, \reg2, \addr, LIT_NP16, IDT_OPSTRP |
|
.endm |
|
|
|
.macro mmmspiip reg1, reg2, addr, idx |
|
mMPSIDXP \reg, \reg2, \addr, \idx, IDT_OPSTRP |
|
.endm |
|
|
|
|
|
.section pair_offset_macros |
|
.macro mmmlpofs reg1, reg2, addr, idx |
|
mMPLOFST \reg, \reg2, \addr, \idx, IDT_OPLDRP |
|
.endm |
|
|
|
.macro mmmspofs reg1, reg2, addr, idx |
|
mMPSOFST \reg, \reg2, \addr, \idx, IDT_OPSTRP |
|
.endm |
|
|
|
.section stack_push_macros |
|
.macro mpshbyte reg |
|
mPSHBASE \reg, IDT_OPSTBY, LIT_NN01 |
|
.endm |
|
|
|
.macro mpshhwrd reg |
|
mPSHBASE \reg, IDT_OPSTHW, LIT_NN02 |
|
.endm |
|
|
|
.macro mpshfwrd reg |
|
mPSHBASE \reg, IDT_OPSTFW, LIT_NN04 |
|
.endm |
|
|
|
.macro mpshdwrd reg |
|
mPSHBASE \reg, IDT_OPSTDW, LIT_NN08 |
|
.endm |
|
|
|
.section stack_pop_macros |
|
.macro mpopbyte reg |
|
mPOPBASE \reg, IDT_OPLDBY, LIT_NP01 |
|
.endm |
|
|
|
.macro mpophwrd reg |
|
mPOPBASE \reg, IDT_OPLDHW, LIT_NP02 |
|
.endm |
|
|
|
.macro mpopfwrd reg |
|
mPOPBASE \reg, IDT_OPLDFW, LIT_NP04 |
|
.endm |
|
|
|
.macro mpopdwrd reg |
|
mPOPBASE \reg, IDT_OPLDDW, LIT_NP08 |
|
.endm |
|
|
|
.section branch_compare_macros |
|
.macro mjmp2lbl label |
|
mOXNNNNB \label, IDT_OPJUMP |
|
.endm |
|
|
|
.macro mcmpregs reg1, reg2 |
|
mOXYTNNB \reg1, \reg2, IDT_OPCOMP |
|
.endm |
|
|
|
.macro mtstpair reg1, reg2 |
|
mOXYTNNB \reg1, \reg2, IDT_OPTEST |
|
.endm |
|
|
|
.macro mtstself reg |
|
mOXYTNNB \reg, \reg, IDT_OPTEST |
|
.endm |
|
|
|
.section single_condition_branch_macros |
|
.macro msjcndeq label |
|
mOXNNNNB \label, IDT_CONDEQ |
|
.endm |
|
|
|
.macro msjcndne label |
|
mOXNNNNB \label, IDT_CONDNE |
|
.endm |
|
|
|
.macro msjcndlt label |
|
mOXNNNNB \label, IDT_CONDLT |
|
.endm |
|
|
|
.macro msjcndgt label |
|
mOXNNNNB \label, IDT_CONDGT |
|
.endm |
|
|
|
.macro msjcndle label |
|
mOXNNNNB \label, IDT_CONDLE |
|
.endm |
|
|
|
.macro msjcndge label |
|
mOXNNNNB \label, IDT_CONDGE |
|
.endm |
|
|
|
.macro msjcndng label |
|
mOXNNNNB \label, IDT_CONDNG |
|
.endm |
|
|
|
.macro msjcndps label |
|
mOXNNNNB \label, IDT_CONDPS |
|
.endm |
|
|
|
.macro msjcndov label |
|
mOXNNNNB \label, IDT_CONDOV |
|
.endm |
|
|
|
.macro msjcndnv label |
|
mOXNNNNB \label, IDT_CONDNV |
|
.endm |
|
|
|
.macro msjcndcs label |
|
mOXNNNNB \label, IDT_CONDCS |
|
.endm |
|
|
|
.macro msjcndcc label |
|
mOXNNNNB \label, IDT_CONDCC |
|
.endm |
|
|
|
.macro msjcndhi label |
|
mOXNNNNB \label, IDT_CONDHI |
|
.endm |
|
|
|
.section dual_condition_branch_macros |
|
.macro mpjceqne label1, label2 |
|
mOXOXNNB \label1, IDT_CONDEQ, \label2, IDT_CONDNE |
|
.endm |
|
|
|
.macro mpjceqlt label1, label2 |
|
mOXOXNNB \label1, IDT_CONDEQ, \label2, IDT_CONDLT |
|
.endm |
|
|
|
.macro mpjceqgt label1, label2 |
|
mOXOXNNB \label1, IDT_CONDEQ, \label2, IDT_CONDGT |
|
.endm |
|
|
|
.macro mpjceqle label1, label2 |
|
mOXOXNNB \label1, IDT_CONDEQ, \label2, IDT_CONDLE |
|
.endm |
|
|
|
.macro mpjceqge label1, label2 |
|
mOXOXNNB \label1, IDT_CONDEQ, \label2, IDT_CONDGE |
|
.endm |
|
|
|
.macro mpjceqng label1, label2 |
|
mOXOXNNB \label1, IDT_CONDEQ, \label2, IDT_CONDNG |
|
.endm |
|
|
|
.macro mpjceqps label1, label2 |
|
mOXOXNNB \label1, IDT_CONDEQ, \label2, IDT_CONDPS |
|
.endm |
|
|
|
.macro mpjceqov label1, label2 |
|
mOXOXNNB \label1, IDT_CONDEQ, \label2, IDT_CONDOV |
|
.endm |
|
|
|
.macro mpjceqnv label1, label2 |
|
mOXOXNNB \label1, IDT_CONDEQ, \label2, IDT_CONDNV |
|
.endm |
|
|
|
.macro mpjceqcs label1, label2 |
|
mOXOXNNB \label1, IDT_CONDEQ, \label2, IDT_CONDCS |
|
.endm |
|
|
|
.macro mpjceqcc label1, label2 |
|
mOXOXNNB \label1, IDT_CONDEQ, \label2, IDT_CONDCC |
|
.endm |
|
|
|
.macro mpjceqhi label1, label2 |
|
mOXOXNNB \label1, IDT_CONDEQ, \label2, IDT_CONDHI |
|
.endm |
|
|
|
.macro mpjcnelt label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNE, \label2, IDT_CONDLT |
|
.endm |
|
|
|
.macro mpjcnegt label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNE, \label2, IDT_CONDGT |
|
.endm |
|
|
|
.macro mpjcnele label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNE, \label2, IDT_CONDLE |
|
.endm |
|
|
|
.macro mpjcnege label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNE, \label2, IDT_CONDGE |
|
.endm |
|
|
|
.macro mpjcneng label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNE, \label2, IDT_CONDNG |
|
.endm |
|
|
|
.macro mpjcneps label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNE, \label2, IDT_CONDPS |
|
.endm |
|
|
|
.macro mpjcneov label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNE, \label2, IDT_CONDOV |
|
.endm |
|
|
|
.macro mpjcnenv label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNE, \label2, IDT_CONDNV |
|
.endm |
|
|
|
.macro mpjcnecs label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNE, \label2, IDT_CONDCS |
|
.endm |
|
|
|
.macro mpjcnecc label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNE, \label2, IDT_CONDCC |
|
.endm |
|
|
|
.macro mpjcnehi label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNE, \label2, IDT_CONDHI |
|
.endm |
|
|
|
.macro mpjcltgt label1, label2 |
|
mOXOXNNB \label1, IDT_CONDLT, \label2, IDT_CONDGT |
|
.endm |
|
|
|
.macro mpjcltle label1, label2 |
|
mOXOXNNB \label1, IDT_CONDLT, \label2, IDT_CONDLE |
|
.endm |
|
|
|
.macro mpjcltge label1, label2 |
|
mOXOXNNB \label1, IDT_CONDLT, \label2, IDT_CONDGE |
|
.endm |
|
|
|
.macro mpjcltng label1, label2 |
|
mOXOXNNB \label1, IDT_CONDLT, \label2, IDT_CONDNG |
|
.endm |
|
|
|
.macro mpjcltps label1, label2 |
|
mOXOXNNB \label1, IDT_CONDLT, \label2, IDT_CONDPS |
|
.endm |
|
|
|
.macro mpjcltov label1, label2 |
|
mOXOXNNB \label1, IDT_CONDLT, \label2, IDT_CONDOV |
|
.endm |
|
|
|
.macro mpjcltnv label1, label2 |
|
mOXOXNNB \label1, IDT_CONDLT, \label2, IDT_CONDNV |
|
.endm |
|
|
|
.macro mpjcltcs label1, label2 |
|
mOXOXNNB \label1, IDT_CONDLT, \label2, IDT_CONDCS |
|
.endm |
|
|
|
.macro mpjcltcc label1, label2 |
|
mOXOXNNB \label1, IDT_CONDLT, \label2, IDT_CONDCC |
|
.endm |
|
|
|
.macro mpjclthi label1, label2 |
|
mOXOXNNB \label1, IDT_CONDLT, \label2, IDT_CONDHI |
|
.endm |
|
|
|
.macro mpjcgtle label1, label2 |
|
mOXOXNNB \label1, IDT_CONDGT, \label2, IDT_CONDLE |
|
.endm |
|
|
|
.macro mpjcgtge label1, label2 |
|
mOXOXNNB \label1, IDT_CONDGT, \label2, IDT_CONDGE |
|
.endm |
|
|
|
.macro mpjcgtng label1, label2 |
|
mOXOXNNB \label1, IDT_CONDGT, \label2, IDT_CONDNG |
|
.endm |
|
|
|
.macro mpjcgtps label1, label2 |
|
mOXOXNNB \label1, IDT_CONDGT, \label2, IDT_CONDPS |
|
.endm |
|
|
|
.macro mpjcgtov label1, label2 |
|
mOXOXNNB \label1, IDT_CONDGT, \label2, IDT_CONDOV |
|
.endm |
|
|
|
.macro mpjcgtnv label1, label2 |
|
mOXOXNNB \label1, IDT_CONDGT, \label2, IDT_CONDNV |
|
.endm |
|
|
|
.macro mpjcgtcs label1, label2 |
|
mOXOXNNB \label1, IDT_CONDGT, \label2, IDT_CONDCS |
|
.endm |
|
|
|
.macro mpjcgtcc label1, label2 |
|
mOXOXNNB \label1, IDT_CONDGT, \label2, IDT_CONDCC |
|
.endm |
|
|
|
.macro mpjcgthi label1, label2 |
|
mOXOXNNB \label1, IDT_CONDGT, \label2, IDT_CONDHI |
|
.endm |
|
|
|
.macro mpjclege label1, label2 |
|
mOXOXNNB \label1, IDT_CONDLE, \label2, IDT_CONDGE |
|
.endm |
|
|
|
.macro mpjcleng label1, label2 |
|
mOXOXNNB \label1, IDT_CONDLE, \label2, IDT_CONDNG |
|
.endm |
|
|
|
.macro mpjcleps label1, label2 |
|
mOXOXNNB \label1, IDT_CONDLE, \label2, IDT_CONDPS |
|
.endm |
|
|
|
.macro mpjcleov label1, label2 |
|
mOXOXNNB \label1, IDT_CONDLE, \label2, IDT_CONDOV |
|
.endm |
|
|
|
.macro mpjclenv label1, label2 |
|
mOXOXNNB \label1, IDT_CONDLE, \label2, IDT_CONDNV |
|
.endm |
|
|
|
.macro mpjclecs label1, label2 |
|
mOXOXNNB \label1, IDT_CONDLE, \label2, IDT_CONDCS |
|
.endm |
|
|
|
.macro mpjclecc label1, label2 |
|
mOXOXNNB \label1, IDT_CONDLE, \label2, IDT_CONDCC |
|
.endm |
|
|
|
.macro mpjclehi label1, label2 |
|
mOXOXNNB \label1, IDT_CONDLE, \label2, IDT_CONDHI |
|
.endm |
|
|
|
.macro mpjcgeng label1, label2 |
|
mOXOXNNB \label1, IDT_CONDGE, \label2, IDT_CONDNG |
|
.endm |
|
|
|
.macro mpjcgeps label1, label2 |
|
mOXOXNNB \label1, IDT_CONDGE, \label2, IDT_CONDPS |
|
.endm |
|
|
|
.macro mpjcgeov label1, label2 |
|
mOXOXNNB \label1, IDT_CONDGE, \label2, IDT_CONDOV |
|
.endm |
|
|
|
.macro mpjcgenv label1, label2 |
|
mOXOXNNB \label1, IDT_CONDGE, \label2, IDT_CONDNV |
|
.endm |
|
|
|
.macro mpjcgecs label1, label2 |
|
mOXOXNNB \label1, IDT_CONDGE, \label2, IDT_CONDCS |
|
.endm |
|
|
|
.macro mpjcgecc label1, label2 |
|
mOXOXNNB \label1, IDT_CONDGE, \label2, IDT_CONDCC |
|
.endm |
|
|
|
.macro mpjcgehi label1, label2 |
|
mOXOXNNB \label1, IDT_CONDGE, \label2, IDT_CONDHI |
|
.endm |
|
|
|
.macro mpjcngps label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNG, \label2, IDT_CONDPS |
|
.endm |
|
|
|
.macro mpjcngov label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNG, \label2, IDT_CONDOV |
|
.endm |
|
|
|
.macro mpjcngnv label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNG, \label2, IDT_CONDNV |
|
.endm |
|
|
|
.macro mpjcngcs label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNG, \label2, IDT_CONDCS |
|
.endm |
|
|
|
.macro mpjcngcc label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNG, \label2, IDT_CONDCC |
|
.endm |
|
|
|
.macro mpjcnghi label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNG, \label2, IDT_CONDHI |
|
.endm |
|
|
|
.macro mpjcpsov label1, label2 |
|
mOXOXNNB \label1, IDT_CONDPS, \label2, IDT_CONDOV |
|
.endm |
|
|
|
.macro mpjcpsnv label1, label2 |
|
mOXOXNNB \label1, IDT_CONDPS, \label2, IDT_CONDNV |
|
.endm |
|
|
|
.macro mpjcpscs label1, label2 |
|
mOXOXNNB \label1, IDT_CONDPS, \label2, IDT_CONDCS |
|
.endm |
|
|
|
.macro mpjcpscc label1, label2 |
|
mOXOXNNB \label1, IDT_CONDPS, \label2, IDT_CONDCC |
|
.endm |
|
|
|
.macro mpjcpshi label1, label2 |
|
mOXOXNNB \label1, IDT_CONDPS, \label2, IDT_CONDHI |
|
.endm |
|
|
|
.macro mpjcovnv label1, label2 |
|
mOXOXNNB \label1, IDT_CONDOV, \label2, IDT_CONDNV |
|
.endm |
|
|
|
.macro mpjcovcs label1, label2 |
|
mOXOXNNB \label1, IDT_CONDOV, \label2, IDT_CONDCS |
|
.endm |
|
|
|
.macro mpjcovcc label1, label2 |
|
mOXOXNNB \label1, IDT_CONDOV, \label2, IDT_CONDCC |
|
.endm |
|
|
|
.macro mpjcovhi label1, label2 |
|
mOXOXNNB \label1, IDT_CONDOV, \label2, IDT_CONDHI |
|
.endm |
|
|
|
.macro mpjcnvcs label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNV, \label2, IDT_CONDCS |
|
.endm |
|
|
|
.macro mpjcnvcc label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNV, \label2, IDT_CONDCC |
|
.endm |
|
|
|
.macro mpjcnvhi label1, label2 |
|
mOXOXNNB \label1, IDT_CONDNV, \label2, IDT_CONDHI |
|
.endm |
|
|
|
.macro mpjccscc label1, label2 |
|
mOXOXNNB \label1, IDT_CONDCS, \label2, IDT_CONDCC |
|
.endm |
|
|
|
.macro mpjccshi label1, label2 |
|
mOXOXNNB \label1, IDT_CONDCS, \label2, IDT_CONDHI |
|
.endm |
|
|
|
.macro mpjccchi label1, label2 |
|
mOXOXNNB \label1, IDT_CONDCC, \label2, IDT_CONDHI |
|
.endm |
|
|
|
|
|
.section subroutine_macros |
|
.macro msrstart |
|
mPSHDWRD REG_DBPPTR |
|
mtrnMOVE REG_DBPPTR, REG_DSPPTR |
|
.endm |
|
|
|
.macro msrretrn |
|
mPOPDWRD REG_BPNPTR |
|
IDT_opdTR |
|
.endm |
|
|
|
.macro msyscall |
|
IDT_OPSYSC |
|
.endm |
|
|
|
.section misc_macros |
|
.macro mregzero reg |
|
mINPXORU \reg, \reg |
|
.endm |
|
|
|
.macro mxchngrg reg1, reg2, temp |
|
IDT_OPXCHG \reg1, \reg2 |
|
.endm |