work save

This commit is contained in:
Roy Qu 2023-02-27 20:08:24 +08:00
parent 9bf6b81493
commit ca0e1b5593
5 changed files with 33 additions and 10 deletions

View File

@ -13,6 +13,14 @@ isEmpty(APP_VERSION) {
APP_VERSION = 2.15 APP_VERSION = 2.15
} }
contains(QMAKE_HOST.arch, x86_64):{
contains(QMAKE_HOST.arch, x86_64):{
DEFINES += ARCH_X86_64=1
} else : {
DEFINES += ARCH_X86=1
}
}
macos: { macos: {
# This package needs to be installed via homebrew before we can compile it # This package needs to be installed via homebrew before we can compile it
INCLUDEPATH += \ INCLUDEPATH += \

View File

@ -2648,8 +2648,7 @@ bool WatchModel::hasChildren(const QModelIndex &parent) const
RegisterModel::RegisterModel(QObject *parent):QAbstractTableModel(parent) RegisterModel::RegisterModel(QObject *parent):QAbstractTableModel(parent)
{ {
QString cpuArch=QSysInfo::currentCpuArchitecture(); #if defined(ARCH_X86_64) || defined(ARCH_X86)
if (cpuArch=="x86_64" || cpuArch=="i386") {
//https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html //https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html
mRegisterDescriptions.insert("rax",tr("64-bit")+" "+tr("Accumulator for operands and results data")); mRegisterDescriptions.insert("rax",tr("64-bit")+" "+tr("Accumulator for operands and results data"));
mRegisterDescriptions.insert("rbx",tr("64-bit")+" "+tr("Pointer to data in the DS segment")); mRegisterDescriptions.insert("rbx",tr("64-bit")+" "+tr("Pointer to data in the DS segment"));
@ -2782,7 +2781,7 @@ RegisterModel::RegisterModel(QObject *parent):QAbstractTableModel(parent)
mRegisterDescriptions.insert("mxscr",tr("SSE status and control")); mRegisterDescriptions.insert("mxscr",tr("SSE status and control"));
} #endif
} }
int RegisterModel::rowCount(const QModelIndex &) const int RegisterModel::rowCount(const QModelIndex &) const

View File

@ -415,17 +415,16 @@ MainWindow::MainWindow(QWidget *parent)
connect(ui->menuProject, &QMenu::aboutToShow, connect(ui->menuProject, &QMenu::aboutToShow,
this, &MainWindow::updateProjectActions); this, &MainWindow::updateProjectActions);
QString cpuArch = QSysInfo::currentCpuArchitecture(); #ifdef ARCH_X86
if (cpuArch == "i386") {
ui->actionIA_32_Assembly_Language_Reference_Manual->setVisible(true); ui->actionIA_32_Assembly_Language_Reference_Manual->setVisible(true);
ui->actionx86_Assembly_Language_Reference_Manual->setVisible(false); ui->actionx86_Assembly_Language_Reference_Manual->setVisible(false);
} else if (cpuArch=="x86_64") { #elif defined(ARCH_X86_64)
ui->actionIA_32_Assembly_Language_Reference_Manual->setVisible(true); ui->actionIA_32_Assembly_Language_Reference_Manual->setVisible(true);
ui->actionx86_Assembly_Language_Reference_Manual->setVisible(true); ui->actionx86_Assembly_Language_Reference_Manual->setVisible(true);
} else { #else
ui->actionIA_32_Assembly_Language_Reference_Manual->setVisible(false); ui->actionIA_32_Assembly_Language_Reference_Manual->setVisible(false);
ui->actionx86_Assembly_Language_Reference_Manual->setVisible(false); ui->actionx86_Assembly_Language_Reference_Manual->setVisible(false);
} #endif
ui->actionEGE_Manual->setVisible(pSettings->environment().language()=="zh_CN"); ui->actionEGE_Manual->setVisible(pSettings->environment().language()=="zh_CN");
ui->actionDocument->setVisible(pSettings->environment().language()=="zh_CN"); ui->actionDocument->setVisible(pSettings->environment().language()=="zh_CN");

View File

@ -5,6 +5,14 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++17 CONFIG += c++17
CONFIG += nokey CONFIG += nokey
CONFIG += staticlib CONFIG += staticlib
contains(QMAKE_HOST.arch, x86_64):{
contains(QMAKE_HOST.arch, x86_64):{
DEFINES += ARCH_X86_64=1
} else : {
DEFINES += ARCH_X86=1
}
}
win32: { win32: {
DEFINES += _WIN32_WINNT=0x0601 DEFINES += _WIN32_WINNT=0x0601

View File

@ -24,6 +24,7 @@ QSet<QString> ASMSyntaxer::InstructionNames;
QMap<QString,QString> ASMSyntaxer::Instructions; QMap<QString,QString> ASMSyntaxer::Instructions;
const QSet<QString> ASMSyntaxer::Registers { const QSet<QString> ASMSyntaxer::Registers {
#if defined(ARCH_X86_64) || defined(ARCH_X86)
"ah","al","ax","eax", "ah","al","ax","eax",
"bh","bl","bx","ebx", "bh","bl","bx","ebx",
"ch","cl","cx","ecx", "ch","cl","cx","ecx",
@ -50,9 +51,11 @@ const QSet<QString> ASMSyntaxer::Registers {
"xmm4","xmm5","xmm6","xmm7", "xmm4","xmm5","xmm6","xmm7",
"xmm8","xmm9","xmm10","xmm11", "xmm8","xmm9","xmm10","xmm11",
"xmm12","xmm13","xmm14","xmm15", "xmm12","xmm13","xmm14","xmm15",
#endif
}; };
const QSet<QString> ASMSyntaxer::ATTRegisters { const QSet<QString> ASMSyntaxer::ATTRegisters {
#if defined(ARCH_X86_64) || defined(ARCH_X86)
"%ah","%al","%ax","%eax", "%ah","%al","%ax","%eax",
"%bh","%bl","%bx","%ebx", "%bh","%bl","%bx","%ebx",
"%ch","%cl","%cx","%ecx", "%ch","%cl","%cx","%ecx",
@ -79,16 +82,20 @@ const QSet<QString> ASMSyntaxer::ATTRegisters {
"%xmm4","%xmm5","%xmm6","%xmm7", "%xmm4","%xmm5","%xmm6","%xmm7",
"%xmm8","%xmm9","%xmm10","%xmm11", "%xmm8","%xmm9","%xmm10","%xmm11",
"%xmm12","%xmm13","%xmm14","%xmm15", "%xmm12","%xmm13","%xmm14","%xmm15",
#endif
}; };
const QSet<QString> ASMSyntaxer::Directives { const QSet<QString> ASMSyntaxer::Directives {
#if defined(ARCH_X86_64) || defined(ARCH_X86)
"section","global","extern","segment", "section","global","extern","segment",
"db","dw","dd","dq","dt","do","dy","dz", "db","dw","dd","dq","dt","do","dy","dz",
"resb","resw","resd","resq","rest","reso","resy","resz", "resb","resw","resd","resq","rest","reso","resy","resz",
"equ","times","word","dword","byte","tword" "equ","times","word","dword","byte","tword"
#endif
}; };
const QSet<QString> ASMSyntaxer::ATTDirectives { const QSet<QString> ASMSyntaxer::ATTDirectives {
#if defined(ARCH_X86_64) || defined(ARCH_X86)
".abort",".align",".altmacro",".ascii", ".abort",".align",".altmacro",".ascii",
".asciz",".attach",".balign",".bss", ".asciz",".attach",".balign",".bss",
".bundle",".byte",".comm",".data", ".bundle",".byte",".comm",".data",
@ -117,6 +124,7 @@ const QSet<QString> ASMSyntaxer::ATTDirectives {
".title", ".tls", ".type", ".uleb128", ".val",".version", ".title", ".tls", ".type", ".uleb128", ".val",".version",
".vtable", ".warning",".weak",".weakref",".word", ".vtable", ".warning",".weak",".weakref",".word",
".zero",".2byte",".4byte",".8byte" ".zero",".2byte",".4byte",".8byte"
#endif
}; };
ASMSyntaxer::ASMSyntaxer(bool isATT): ASMSyntaxer::ASMSyntaxer(bool isATT):
@ -335,6 +343,7 @@ void ASMSyntaxer::initData()
if (Instructions.isEmpty()) { if (Instructions.isEmpty()) {
// https://docs.oracle.com/cd/E19120-01/open.solaris/817-5477/ennbz/index.html // https://docs.oracle.com/cd/E19120-01/open.solaris/817-5477/ennbz/index.html
//Data Transfer Instruction //Data Transfer Instruction
#if defined(ARCH_X86_64) || defined(ARCH_X86)
Instructions.insert("bswap",QObject::tr("byte swap.")); Instructions.insert("bswap",QObject::tr("byte swap."));
Instructions.insert("bswapl",QObject::tr("byte swap.")); Instructions.insert("bswapl",QObject::tr("byte swap."));
Instructions.insert("bswapq",QObject::tr("byte swap.")); Instructions.insert("bswapq",QObject::tr("byte swap."));
@ -1090,7 +1099,7 @@ void ASMSyntaxer::initData()
Instructions.insert("movnti",QObject::tr("non-temporal store of a doubleword from a general-purpose register into memory.")); Instructions.insert("movnti",QObject::tr("non-temporal store of a doubleword from a general-purpose register into memory."));
Instructions.insert("movntpd",QObject::tr("non-temporal store of two packed double-precision floating-point values from an xmm register into memory.")); Instructions.insert("movntpd",QObject::tr("non-temporal store of two packed double-precision floating-point values from an xmm register into memory."));
Instructions.insert("pause",QObject::tr("improves the performance of spin-wait loops.")); Instructions.insert("pause",QObject::tr("improves the performance of spin-wait loops."));
#endif
InstructionNames=QSet<QString>(Instructions.keyBegin(),Instructions.keyEnd()); InstructionNames=QSet<QString>(Instructions.keyBegin(),Instructions.keyEnd());
} }
} }