TempleOSCDV4.12.ISO
This commit is contained in:
1 parent
93ca216483
commit
b84bbff6db
381 files changed
+18356
-18798
No files matched your search
+79
-79
@@ -1,45 +1,45 @@
|
||||
U0 AsmPrsInsFlags(CCmpCtrl *cc,CInst *tempi)
|
||||
U0 AsmPrsInsFlags(CCmpCtrl *cc,CInst *tmpins)
|
||||
{
|
||||
I64 i;
|
||||
while (TRUE) {
|
||||
switch (cc->token) {
|
||||
case TK_IDENT:
|
||||
if ((i=LstMatch(cc->cur_str,"NO\0CB\0CW\0CD\0CP\0IB\0IW\0ID\0"))>=0) {
|
||||
tempi->opcode_modifier=i;
|
||||
tmpins->opcode_modifier=i;
|
||||
break;
|
||||
} else
|
||||
return;
|
||||
case TK_I64:
|
||||
if (cc->cur_i64==16)
|
||||
tempi->flags|=IEF_OP_SIZE16;
|
||||
tmpins->flags|=IEF_OP_SIZE16;
|
||||
else if (cc->cur_i64==32)
|
||||
tempi->flags|=IEF_OP_SIZE32;
|
||||
tmpins->flags|=IEF_OP_SIZE32;
|
||||
else
|
||||
return;
|
||||
break;
|
||||
case '+':
|
||||
tempi->flags|=IEF_PLUS_OPCODE;
|
||||
tmpins->flags|=IEF_PLUS_OPCODE;
|
||||
case '/':
|
||||
if (Lex(cc)==TK_I64 && cc->cur_i64<8)
|
||||
tempi->slash_val=cc->cur_i64;
|
||||
tmpins->slash_val=cc->cur_i64;
|
||||
else if (cc->token==TK_IDENT) {
|
||||
if (!StrCmp(cc->cur_str,"R"))
|
||||
tempi->slash_val=SV_R_REG;
|
||||
tmpins->slash_val=SV_R_REG;
|
||||
else if (!StrCmp(cc->cur_str,"I"))
|
||||
tempi->slash_val=SV_I_REG;
|
||||
tmpins->slash_val=SV_I_REG;
|
||||
else
|
||||
return;
|
||||
} else
|
||||
return;
|
||||
break;
|
||||
case '!': tempi->flags|=IEF_DONT_SWITCH_MODES; break;
|
||||
case '&': tempi->flags|=IEF_DFT; break;
|
||||
case '%': tempi->flags|=IEF_NOT_IN_64_BIT; break;
|
||||
case '=': tempi->flags|=IEF_48_REX; break;
|
||||
case '`': tempi->flags|=IEF_REX_ONLY_R8_R15; break;
|
||||
case '^': tempi->flags|=IEF_REX_XOR_LIKE; break;
|
||||
case '*': tempi->flags|=IEF_STI_LIKE; break;
|
||||
case '$$': tempi->flags|=IEF_ENDING_ZERO; break;
|
||||
case '!': tmpins->flags|=IEF_DONT_SWITCH_MODES; break;
|
||||
case '&': tmpins->flags|=IEF_DFT; break;
|
||||
case '%': tmpins->flags|=IEF_NOT_IN_64_BIT; break;
|
||||
case '=': tmpins->flags|=IEF_48_REX; break;
|
||||
case '`': tmpins->flags|=IEF_REX_ONLY_R8_R15; break;
|
||||
case '^': tmpins->flags|=IEF_REX_XOR_LIKE; break;
|
||||
case '*': tmpins->flags|=IEF_STI_LIKE; break;
|
||||
case '$$': tmpins->flags|=IEF_ENDING_ZERO; break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@@ -50,13 +50,13 @@ U0 AsmPrsInsFlags(CCmpCtrl *cc,CInst *tempi)
|
||||
U0 AsmHashLoad()
|
||||
{//See $LK,"::/Compiler/OpCodes.DD"$.
|
||||
I64 i,j,size,size_max;
|
||||
CInternalType *tempit;
|
||||
CInternalType *tmpit;
|
||||
CCmpCtrl *cc;
|
||||
CHashGeneric *temph;
|
||||
CHashReg *tempr;
|
||||
CHashOpcode *tempo,*tempo2,*tempo_max;
|
||||
CInst *tempi;
|
||||
CHashClass *tempc;
|
||||
CHashGeneric *tmph;
|
||||
CHashReg *tmpr;
|
||||
CHashOpcode *tmpo,*tmpo2,*tmpo_max;
|
||||
CInst *tmpins;
|
||||
CHashClass *tmpc;
|
||||
|
||||
cmp.size_arg_mask[0]=0x3FF0FFFFFE;
|
||||
cmp.size_arg_mask[1]=0x1110111112;
|
||||
@@ -66,7 +66,7 @@ U0 AsmHashLoad()
|
||||
|
||||
cmp.asm_hash=HashTableNew(1024);
|
||||
size_max=offset(CHashOpcode.ins)+sizeof(CInst)<<5;
|
||||
tempo_max=MAlloc(size_max);
|
||||
tmpo_max=MAlloc(size_max);
|
||||
|
||||
cc=CmpCtrlNew(FileRead("OpCodes.DD"),,"OpCodes.DD.Z");
|
||||
cc->htc.hash_table_lst=NULL;
|
||||
@@ -83,33 +83,33 @@ U0 AsmHashLoad()
|
||||
LexExcept(cc,"Expecting identifier at ");
|
||||
switch (i) {
|
||||
case REGT_R8...REGT_XMM:
|
||||
tempr=CAlloc(sizeof(CHashReg));
|
||||
tempr->str=cc->cur_str;
|
||||
tmpr=CAlloc(sizeof(CHashReg));
|
||||
tmpr->str=cc->cur_str;
|
||||
cc->cur_str=NULL;
|
||||
Lex(cc); //skip keyword name
|
||||
if (cc->token!=TK_I64)
|
||||
LexExcept(cc,"Expecting int at ");
|
||||
tempr->type=HTT_REG;
|
||||
tempr->reg_type=i;
|
||||
tempr->reg_num=cc->cur_i64;
|
||||
HashAdd(tempr,cmp.asm_hash);
|
||||
tmpr->type=HTT_REG;
|
||||
tmpr->reg_type=i;
|
||||
tmpr->reg_num=cc->cur_i64;
|
||||
HashAdd(tmpr,cmp.asm_hash);
|
||||
Lex(cc); //Skip INT
|
||||
break;
|
||||
case: //OPCODE
|
||||
if (cc->token!=TK_IDENT)
|
||||
LexExcept(cc,"Expecting opcode at ");
|
||||
MemSet(tempo_max,0,size_max);
|
||||
tempo_max->type=HTT_OPCODE;
|
||||
tempo_max->inst_entry_cnt=0;
|
||||
tempo_max->str=cc->cur_str;
|
||||
MemSet(tmpo_max,0,size_max);
|
||||
tmpo_max->type=HTT_OPCODE;
|
||||
tmpo_max->inst_entry_cnt=0;
|
||||
tmpo_max->str=cc->cur_str;
|
||||
cc->cur_str=0;
|
||||
Lex(cc); //Skip OPCODE
|
||||
while (cc->token && cc->token!=';' && cc->token!=':') {
|
||||
tempi=&tempo_max->ins[tempo_max->inst_entry_cnt];
|
||||
tempi->ins_entry_num=tempo_max->inst_entry_cnt++;
|
||||
tempi->slash_val=SV_NONE; //Not zero!!
|
||||
tmpins=&tmpo_max->ins[tmpo_max->inst_entry_cnt];
|
||||
tmpins->ins_entry_num=tmpo_max->inst_entry_cnt++;
|
||||
tmpins->slash_val=SV_NONE; //Not zero!!
|
||||
while (cc->token==TK_I64) {
|
||||
tempi->opcode[tempi->opcode_cnt++]=cc->cur_i64;
|
||||
tmpins->opcode[tmpins->opcode_cnt++]=cc->cur_i64;
|
||||
Lex(cc);
|
||||
}
|
||||
if (cc->token==',')
|
||||
@@ -117,74 +117,74 @@ U0 AsmHashLoad()
|
||||
else if (cc->token!=';')
|
||||
LexExcept(cc,"Expecting ',' at ");
|
||||
|
||||
AsmPrsInsFlags(cc,tempi);
|
||||
AsmPrsInsFlags(cc,tmpins);
|
||||
|
||||
tempi->uasm_slash_val=tempi->slash_val;
|
||||
if (tempi->flags&IEF_STI_LIKE && tempi->slash_val!=SV_I_REG)
|
||||
tempi->uasm_slash_val=SV_STI_LIKE;
|
||||
tmpins->uasm_slash_val=tmpins->slash_val;
|
||||
if (tmpins->flags&IEF_STI_LIKE && tmpins->slash_val!=SV_I_REG)
|
||||
tmpins->uasm_slash_val=SV_STI_LIKE;
|
||||
|
||||
tempi->arg1=tempi->arg2=tempi->size1=tempi->size2=0;
|
||||
tmpins->arg1=tmpins->arg2=tmpins->size1=tmpins->size2=0;
|
||||
if (cc->token==TK_IDENT) {
|
||||
j=DefineMatch(cc->cur_str,"ST_ARG_TYPES");
|
||||
tempi->arg1=j;
|
||||
tmpins->arg1=j;
|
||||
if (Bt(&cmp.size_arg_mask[1],j))
|
||||
tempi->size1=8;
|
||||
tmpins->size1=8;
|
||||
else if (Bt(&cmp.size_arg_mask[2],j))
|
||||
tempi->size1=16;
|
||||
tmpins->size1=16;
|
||||
else if (Bt(&cmp.size_arg_mask[4],j))
|
||||
tempi->size1=32;
|
||||
tmpins->size1=32;
|
||||
else if (Bt(&cmp.size_arg_mask[8],j))
|
||||
tempi->size1=64;
|
||||
tmpins->size1=64;
|
||||
|
||||
if (Lex(cc)==TK_IDENT) {
|
||||
j=DefineMatch(cc->cur_str,"ST_ARG_TYPES");
|
||||
Lex(cc);
|
||||
tempi->arg2=j;
|
||||
tmpins->arg2=j;
|
||||
if (Bt(&cmp.size_arg_mask[1],j))
|
||||
tempi->size2=8;
|
||||
tmpins->size2=8;
|
||||
else if (Bt(&cmp.size_arg_mask[2],j))
|
||||
tempi->size2=16;
|
||||
tmpins->size2=16;
|
||||
else if (Bt(&cmp.size_arg_mask[4],j))
|
||||
tempi->size2=32;
|
||||
tmpins->size2=32;
|
||||
else if (Bt(&cmp.size_arg_mask[8],j))
|
||||
tempi->size2=64;
|
||||
tmpins->size2=64;
|
||||
}
|
||||
}
|
||||
}
|
||||
size=offset(CHashOpcode.ins)+sizeof(CInst)*tempo_max->inst_entry_cnt;
|
||||
tempo=MAlloc(size);
|
||||
MemCpy(tempo,tempo_max,size);
|
||||
tempo->use_cnt=0;
|
||||
if (HashFind(tempo->str,cmp.asm_hash,HTT_OPCODE))
|
||||
size=offset(CHashOpcode.ins)+sizeof(CInst)*tmpo_max->inst_entry_cnt;
|
||||
tmpo=MAlloc(size);
|
||||
MemCpy(tmpo,tmpo_max,size);
|
||||
tmpo->use_cnt=0;
|
||||
if (HashFind(tmpo->str,cmp.asm_hash,HTT_OPCODE))
|
||||
LexExcept(cc,"Duplicate OPCODE entry ");
|
||||
HashAdd(tempo,cmp.asm_hash);
|
||||
HashAdd(tmpo,cmp.asm_hash);
|
||||
//Parse aliases.
|
||||
if (cc->token==':') {
|
||||
while (Lex(cc)==TK_IDENT) {
|
||||
tempo2=MAllocIdent(tempo);
|
||||
tempo2->str=cc->cur_str;
|
||||
tmpo2=MAllocIdent(tmpo);
|
||||
tmpo2->str=cc->cur_str;
|
||||
cc->cur_str=0;
|
||||
tempo2->oc_flags|=OCF_ALIAS;
|
||||
if (HashFind(tempo2->str,cmp.asm_hash,HTT_OPCODE))
|
||||
tmpo2->oc_flags|=OCF_ALIAS;
|
||||
if (HashFind(tmpo2->str,cmp.asm_hash,HTT_OPCODE))
|
||||
LexExcept(cc,"Duplicate OPCODE ALIAS entry ");
|
||||
HashAdd(tempo2,cmp.asm_hash);
|
||||
HashAdd(tmpo2,cmp.asm_hash);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case: //KEYWORD
|
||||
case: //ASM_KEYWORD
|
||||
temph=CAlloc(sizeof(CHashGeneric));
|
||||
temph->str=cc->cur_str;
|
||||
tmph=CAlloc(sizeof(CHashGeneric));
|
||||
tmph->str=cc->cur_str;
|
||||
cc->cur_str=NULL;
|
||||
Lex(cc); //skip keyword name
|
||||
if (cc->token!=TK_I64)
|
||||
LexExcept(cc,"Expecting int at ");
|
||||
temph->user_data0=cc->cur_i64;
|
||||
tmph->user_data0=cc->cur_i64;
|
||||
if (i==10)
|
||||
temph->type=HTT_KEYWORD;
|
||||
tmph->type=HTT_KEYWORD;
|
||||
else
|
||||
temph->type=HTT_ASM_KEYWORD;
|
||||
HashAdd(temph,cmp.asm_hash);
|
||||
tmph->type=HTT_ASM_KEYWORD;
|
||||
HashAdd(tmph,cmp.asm_hash);
|
||||
Lex(cc); //Skip INT
|
||||
break;
|
||||
}
|
||||
@@ -192,18 +192,18 @@ U0 AsmHashLoad()
|
||||
LexExcept(cc,"Missing ';' at");
|
||||
Lex(cc); //Skip ';'
|
||||
}
|
||||
Free(tempo_max);
|
||||
Free(tmpo_max);
|
||||
CmpCtrlDel(cc);
|
||||
for (i=0;i<NUM_INTERNAL_TYPES;i++) {
|
||||
tempit=&internal_types_table[i];
|
||||
tempc=PrsClassNew;
|
||||
tempc->type=HTT_INTERNAL_TYPE;
|
||||
tempc->raw_type=tempit->type;
|
||||
Bts(&tempc->flags,Cf_INTERNAL_TYPE);
|
||||
tempc->size=tempit->size;
|
||||
tempc->str=AStrNew(tempit->name);
|
||||
HashAdd(tempc,cmp.asm_hash);
|
||||
cmp.internal_types[tempc->raw_type]=tempc;
|
||||
tmpit=&internal_types_table[i];
|
||||
tmpc=PrsClassNew;
|
||||
tmpc->type=HTT_INTERNAL_TYPE;
|
||||
tmpc->raw_type=tmpit->type;
|
||||
Bts(&tmpc->flags,Cf_INTERNAL_TYPE);
|
||||
tmpc->size=tmpit->size;
|
||||
tmpc->str=AStrNew(tmpit->name);
|
||||
HashAdd(tmpc,cmp.asm_hash);
|
||||
cmp.internal_types[tmpc->raw_type]=tmpc;
|
||||
}
|
||||
adam_task->hash_table->next=cmp.asm_hash;
|
||||
}
|
||||
Reference in new issue
Block a user