diff --git a/Zenith-latest-2020-03-05-18_18_25.iso b/Zenith-latest-2020-03-05-20_33_07.iso similarity index 99% rename from Zenith-latest-2020-03-05-18_18_25.iso rename to Zenith-latest-2020-03-05-20_33_07.iso index 030627a3..7d5d2dce 100755 Binary files a/Zenith-latest-2020-03-05-18_18_25.iso and b/Zenith-latest-2020-03-05-20_33_07.iso differ diff --git a/src/Compiler/Asm.CC b/src/Compiler/Asm.CC index 5c0bf88d..4f679084 100755 --- a/src/Compiler/Asm.CC +++ b/src/Compiler/Asm.CC @@ -1,13 +1,15 @@ -Bool ParseAsmImm(CCompCtrl *cc,CAsmArg *arg) +Bool ParseAsmImm(CCompCtrl *cc, CAsmArg *arg) { if (arg->imm_or_off_present) LexExcept(cc,"Already one immediate at "); + arg->imm_or_off_present = TRUE; arg->num.local_asm_undef_hash = NULL; arg->num.global_asm_undef_hash = NULL; cc->asm_undef_hash = NULL; cc->abs_counts = 0; cc->flags &= ~(CCF_UNRESOLVED + CCF_LOCAL); + if (!IsLexExpression2Bin(cc, &arg->num.machine_code)) LexSkipEol(cc); else @@ -21,7 +23,7 @@ Bool ParseAsmImm(CCompCtrl *cc,CAsmArg *arg) else arg->num.global_asm_undef_hash = cc->asm_undef_hash; - cc->asm_undef_hash=NULL; + cc->asm_undef_hash = NULL; } else { @@ -39,11 +41,14 @@ U0 ParseAsmArg(CCompCtrl *cc,CAsmArg *arg,Bool rel) { CHashGeneric *tmph,*tmph1; CHashReg *tmpr; + MemSet(arg, 0, sizeof(CAsmArg)); + arg->seg = REG_NONE; arg->reg1 = REG_NONE; arg->reg2 = REG_NONE; arg->scale = 1; + while (TRUE) { if (cc->token == TK_IDENT) @@ -98,22 +103,22 @@ U0 ParseAsmArg(CCompCtrl *cc,CAsmArg *arg,Bool rel) switch (tmph->user_data0) { case AKW_I8: case AKW_U8: - arg->size=1; + arg->size = 1; break; case AKW_I16: case AKW_U16: - arg->size=2; + arg->size = 2; break; case AKW_I32: case AKW_U32: - arg->size=4; + arg->size = 4; break; case AKW_I64: case AKW_U64: - arg->size=8; + arg->size = 8; break; default: - LexExcept(cc,"syntax error at "); + LexExcept(cc, "syntax error at "); } Lex(cc); //skip keyword } else @@ -146,46 +151,65 @@ pa_asm_direct_imm: { if (tmph = cc->hash_entry) { - if (tmph->type & HTG_TYPE_MASK == HTT_REG && REGT_R16 <= tmph(CHashReg *)->reg_type <= REGT_R64) + if (tmph->type & HTG_TYPE_MASK == HTT_REG && REGT_R16 <= tmph(CHashReg *)->reg_type <= REGT_XMM) { - tmpr=tmph; - arg->reg2_type=tmpr->reg_type; - if (arg->reg1==REG_NONE) { - if (tmpr->reg_num&7==REG_RSP) { - arg->reg1=4; - arg->reg2=tmpr->reg_num; - } else - arg->reg1=tmpr->reg_num; - } else - arg->reg2=tmpr->reg_num; + tmpr = tmph; + arg->reg2_type = tmpr->reg_type; + + if (arg->reg1 == REG_NONE) + { + if (tmpr->reg_num & 7 == REG_RSP) + { + arg->reg1 = 4; + arg->reg2 = tmpr->reg_num; + } + else + arg->reg1 = tmpr->reg_num; + } + else + arg->reg2 = tmpr->reg_num; + Lex(cc); - } else + } + else goto pa_asm_indirect_imm; - } else - goto pa_asm_indirect_imm; - } else if (cc->token=='*') { - Lex(cc); - if (cc->token!=TK_I64) - LexExcept(cc,"Expecting scale factor at "); - arg->scale=cc->cur_i64; - Lex(cc); //skip scale - if (arg->reg2!=REG_NONE) { - SwapI64(&arg->reg1,&arg->reg2); - SwapI64(&arg->reg1_type,&arg->reg2_type); } - } else if (cc->token=='+') { + else + goto pa_asm_indirect_imm; + } + else if (cc->token == '*') + { + Lex(cc); + + if (cc->token != TK_I64) + LexExcept(cc, "Expecting scale factor at "); + + arg->scale = cc->cur_i64; + Lex(cc); //skip scale + + if (arg->reg2 != REG_NONE) + { + SwapI64(&arg->reg1, &arg->reg2); + SwapI64(&arg->reg1_type, &arg->reg2_type); + } + } + else if (cc->token == '+') + { Lex(cc); //skip '+' - } else { + } + else + { pa_asm_indirect_imm: - ParseAsmImm(cc,arg); - arg->num.abs_counts=cc->abs_counts; + ParseAsmImm(cc, arg); + arg->num.abs_counts = cc->abs_counts; } } - if (cc->token!=']') - LexExcept(cc,"Missing ']' at "); + if (cc->token != ']') + LexExcept(cc, "Missing ']' at "); Lex(cc); //skip ']' return; - } else + } + else goto pa_asm_direct_imm; } } @@ -301,124 +325,150 @@ mm_done: return res; } -Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 count,Bool u8_avail) +Bool AsmStoreNum(CCompCtrl *cc, CAsmNum2 *num2, I64 count, Bool u8_avail) { - CAOTCtrl *aotc=cc->aotc; + CAOTCtrl *aotc = cc->aotc; I64 i; CAOTAbsAddr *tmpa; if (!num2->imm_flag) - num2->num.i-=num2->rel; - for (i=0;iU8_count==1) { - if (num2->num.local_asm_undef_hash||num2->num.global_asm_undef_hash) - AsmUnresolvedAdd(cc,num2->num.machine_code,IET_REL_I8+num2->imm_flag, - aotc->rip,num2->rel,num2->num.local_asm_undef_hash, - num2->num.global_asm_undef_hash,cc->lex_include_stack->line_num, - u8_avail); - else if (!num2->imm_flag && !(I8_MIN<=num2->num.i<=I8_MAX)) - LexExcept(cc,"Branch out of range at "); - if (num2->imm_flag) { - if (num2->num.abs_counts.abs_addres&1) { - tmpa=CAlloc(sizeof(CAOTAbsAddr)); - tmpa->next=aotc->abss; - aotc->abss=tmpa; - tmpa->rip=aotc->rip; - tmpa->type=AAT_ADD_U8; - } - } else { - if (num2->num.abs_counts.c_addres&1) { - tmpa=CAlloc(sizeof(CAOTAbsAddr)); - tmpa->next=aotc->abss; - aotc->abss=tmpa; - tmpa->rip=aotc->rip; - tmpa->type=AAT_SUB_U8; + num2->num.i -= num2->rel; + + for (i = 0; i < count; i++) + { + if (num2->u8_count == 1) + { + if (num2->num.local_asm_undef_hash || num2->num.global_asm_undef_hash) + AsmUnresolvedAdd(cc, num2->num.machine_code, IET_REL_I8 + num2->imm_flag, aotc->rip, num2->rel, num2->num.local_asm_undef_hash, + num2->num.global_asm_undef_hash, cc->lex_include_stack->line_num, u8_avail); + else if (!num2->imm_flag && !(I8_MIN <= num2->num.i <= I8_MAX)) + LexExcept(cc, "Branch out of range at "); + + if (num2->imm_flag) + { + if (num2->num.abs_counts.abs_address & 1) + { + tmpa = CAlloc(sizeof(CAOTAbsAddr)); + tmpa->next = aotc->abss; + aotc->abss = tmpa; + tmpa->rip = aotc->rip; + tmpa->type = AAT_ADD_U8; } } - AOTStoreCodeU8(cc,num2->num.i); - } else { - if (num2->U8_count==2) { - if (num2->num.local_asm_undef_hash||num2->num.global_asm_undef_hash) - AsmUnresolvedAdd(cc,num2->num.machine_code,IET_REL_I16+num2->imm_flag, - aotc->rip,num2->rel,num2->num.local_asm_undef_hash, - num2->num.global_asm_undef_hash,cc->lex_include_stack->line_num, - u8_avail); - else if (!num2->imm_flag && !(I16_MIN<=num2->num.i<=I16_MAX)) - LexExcept(cc,"Branch out of range at "); - if (num2->imm_flag) { - if (num2->num.abs_counts.abs_addres&1) { - tmpa=CAlloc(sizeof(CAOTAbsAddr)); - tmpa->next=aotc->abss; - aotc->abss=tmpa; - tmpa->rip=aotc->rip; - tmpa->type=AAT_ADD_U16; - } - } else { - if (num2->num.abs_counts.c_addres&1) { - tmpa=CAlloc(sizeof(CAOTAbsAddr)); - tmpa->next=aotc->abss; - aotc->abss=tmpa; - tmpa->rip=aotc->rip; - tmpa->type=AAT_SUB_U16; - } + else + { + if (num2->num.abs_counts.c_address & 1) + { + tmpa = CAlloc(sizeof(CAOTAbsAddr)); + tmpa->next = aotc->abss; + aotc->abss = tmpa; + tmpa->rip = aotc->rip; + tmpa->type = AAT_SUB_U8; } - AOTStoreCodeU8(cc,num2->num.i.u8[0]); - AOTStoreCodeU8(cc,num2->num.i.u8[1]); - } else if (num2->U8_count==4) { - if (num2->num.local_asm_undef_hash||num2->num.global_asm_undef_hash) - AsmUnresolvedAdd(cc,num2->num.machine_code,IET_REL_I32+num2->imm_flag, - aotc->rip,num2->rel,num2->num.local_asm_undef_hash, - num2->num.global_asm_undef_hash,cc->lex_include_stack->line_num, - u8_avail); - else if (!num2->imm_flag && !(I32_MIN<=num2->num.i<=I32_MAX)) - LexExcept(cc,"Branch out of range at "); - if (num2->imm_flag) { - if (num2->num.abs_counts.abs_addres&1) { - tmpa=CAlloc(sizeof(CAOTAbsAddr)); - tmpa->next=aotc->abss; - aotc->abss=tmpa; - tmpa->rip=aotc->rip; - tmpa->type=AAT_ADD_U32; - } - } else { - if (num2->num.abs_counts.c_addres&1) { - tmpa=CAlloc(sizeof(CAOTAbsAddr)); - tmpa->next=aotc->abss; - aotc->abss=tmpa; - tmpa->rip=aotc->rip; - tmpa->type=AAT_SUB_U32; - } - } - AOTStoreCodeU32(cc,num2->num.i); - } else if (num2->U8_count==8) { - if (num2->num.local_asm_undef_hash||num2->num.global_asm_undef_hash) - AsmUnresolvedAdd(cc,num2->num.machine_code,IET_REL_I64+num2->imm_flag, - aotc->rip,num2->rel,num2->num.local_asm_undef_hash, - num2->num.global_asm_undef_hash,cc->lex_include_stack->line_num, - u8_avail); - if (num2->imm_flag) { - if (num2->num.abs_counts.abs_addres&1) { - tmpa=CAlloc(sizeof(CAOTAbsAddr)); - tmpa->next=aotc->abss; - aotc->abss=tmpa; - tmpa->rip=aotc->rip; - tmpa->type=AAT_ADD_U64; - } - } else { - if (num2->num.abs_counts.c_addres&1) { - tmpa=CAlloc(sizeof(CAOTAbsAddr)); - tmpa->next=aotc->abss; - aotc->abss=tmpa; - tmpa->rip=aotc->rip; - tmpa->type=AAT_SUB_U64; - } - } - AOTStoreCodeU64(cc,num2->num.i); } - if (u8_avail && !num2->num.local_asm_undef_hash && - !num2->num.global_asm_undef_hash && - !num2->imm_flag && -124<=num2->num.i<=123) { - LexWarn(cc,"could use I8 displacement at "); + AOTStoreCodeU8(cc, num2->num.i); + } + else + { + if (num2->u8_count == 2) + { + if (num2->num.local_asm_undef_hash || num2->num.global_asm_undef_hash) + AsmUnresolvedAdd(cc, num2->num.machine_code, IET_REL_I16 + num2->imm_flag, aotc->rip, num2->rel, num2->num.local_asm_undef_hash, + num2->num.global_asm_undef_hash, cc->lex_include_stack->line_num, u8_avail); + else if (!num2->imm_flag && !(I16_MIN <= num2->num.i <= I16_MAX)) + LexExcept(cc, "Branch out of range at "); + + if (num2->imm_flag) + { + if (num2->num.abs_counts.abs_address & 1) + { + tmpa = CAlloc(sizeof(CAOTAbsAddr)); + tmpa->next = aotc->abss; + aotc->abss = tmpa; + tmpa->rip = aotc->rip; + tmpa->type = AAT_ADD_U16; + } + } + else + { + if (num2->num.abs_counts.c_address & 1) + { + tmpa = CAlloc(sizeof(CAOTAbsAddr)); + tmpa->next = aotc->abss; + aotc->abss = tmpa; + tmpa->rip = aotc->rip; + tmpa->type = AAT_SUB_U16; + } + } + AOTStoreCodeU8(cc, num2->num.i.u8[0]); + AOTStoreCodeU8(cc, num2->num.i.u8[1]); + + } + else if (num2->u8_count==4) + { + if (num2->num.local_asm_undef_hash||num2->num.global_asm_undef_hash) + AsmUnresolvedAdd(cc, num2->num.machine_code, IET_REL_I32+num2->imm_flag, aotc->rip, num2->rel, num2->num.local_asm_undef_hash, + num2->num.global_asm_undef_hash, cc->lex_include_stack->line_num, u8_avail); + else if (!num2->imm_flag && !(I32_MIN <= num2->num.i <= I32_MAX)) + LexExcept(cc, "Branch out of range at "); + + if (num2->imm_flag) + { + if (num2->num.abs_counts.abs_address & 1) + { + tmpa = CAlloc(sizeof(CAOTAbsAddr)); + tmpa->next = aotc->abss; + aotc->abss = tmpa; + tmpa->rip = aotc->rip; + tmpa->type = AAT_ADD_U32; + } + } + else + { + if (num2->num.abs_counts.c_address & 1) + { + tmpa = CAlloc(sizeof(CAOTAbsAddr)); + tmpa->next = aotc->abss; + aotc->abss = tmpa; + tmpa->rip = aotc->rip; + tmpa->type = AAT_SUB_U32; + } + } + AOTStoreCodeU32(cc, num2->num.i); + } + else if (num2->u8_count == 8) + { + if (num2->num.local_asm_undef_hash || num2->num.global_asm_undef_hash) + AsmUnresolvedAdd(cc, num2->num.machine_code, IET_REL_I64 + num2->imm_flag, aotc->rip, num2->rel, num2->num.local_asm_undef_hash, + num2->num.global_asm_undef_hash, cc->lex_include_stack->line_num, u8_avail); + + if (num2->imm_flag) + { + if (num2->num.abs_counts.abs_address & 1) + { + tmpa = CAlloc(sizeof(CAOTAbsAddr)); + tmpa->next = aotc->abss; + aotc->abss = tmpa; + tmpa->rip = aotc->rip; + tmpa->type = AAT_ADD_U64; + } + } + else + { + if (num2->num.abs_counts.c_address & 1) + { + tmpa = CAlloc(sizeof(CAOTAbsAddr)); + tmpa->next = aotc->abss; + aotc->abss = tmpa; + tmpa->rip = aotc->rip; + tmpa->type = AAT_SUB_U64; + } + } + AOTStoreCodeU64(cc, num2->num.i); + } + if (u8_avail && !num2->num.local_asm_undef_hash && !num2->num.global_asm_undef_hash && !num2->imm_flag && -124 <= num2->num.i <= 123) + { + LexWarn(cc, "could use I8 displacement at "); return FALSE; } } @@ -437,7 +487,7 @@ Bool ParseAsmInst(CCompCtrl *cc, CHashOpcode *tmpo, I64 argcount) CInst *tmpins; CAsmInst cur, best; - best.U8_count = 255; + best.u8_count = 255; arg1mask = arg2mask = 1; @@ -491,22 +541,22 @@ Bool ParseAsmInst(CCompCtrl *cc, CHashOpcode *tmpo, I64 argcount) case OCM_CB: cur.imm.imm_flag = FALSE; case OCM_IB: - cur.imm.U8_count = 1; + cur.imm.u8_count = 1; break; case OCM_CW: cur.imm.imm_flag = FALSE; case OCM_IW: - cur.imm.U8_count = 2; + cur.imm.u8_count = 2; break; case OCM_CD: cur.imm.imm_flag = FALSE; case OCM_ID: - cur.imm.U8_count = 4; + cur.imm.u8_count = 4; } if (argcount == 1) { - if (best.U8_count != 255 && !found_second_possible && !best.is_default) + if (best.u8_count != 255 && !found_second_possible && !best.is_default) { found_second_possible = TRUE; @@ -546,7 +596,7 @@ Bool ParseAsmInst(CCompCtrl *cc, CHashOpcode *tmpo, I64 argcount) { cur.ModrM = cur.ModrM + 5; MemCopy(&cur.disp.num, &tmpa1->num, sizeof(CAsmNum)); - cur.disp.U8_count = 4; + cur.disp.u8_count = 4; if (aotc->seg_size == 64) cur.disp.imm_flag = FALSE; @@ -586,7 +636,7 @@ Bool ParseAsmInst(CCompCtrl *cc, CHashOpcode *tmpo, I64 argcount) cur.has_REX = TRUE; MemCopy(&cur.disp.num, &tmpa1->num, sizeof(CAsmNum)); - cur.disp.U8_count = 4; + cur.disp.u8_count = 4; } else { @@ -607,7 +657,7 @@ Bool ParseAsmInst(CCompCtrl *cc, CHashOpcode *tmpo, I64 argcount) if (tmpa1->reg2 & 7 == REG_RBP && !tmpa1->imm_or_off_present && tmpa1->indirect) { cur.ModrM |= 0x40; - cur.disp.U8_count = 1; + cur.disp.u8_count = 1; ModrM_complete = TRUE; } } @@ -622,17 +672,17 @@ Bool ParseAsmInst(CCompCtrl *cc, CHashOpcode *tmpo, I64 argcount) if (!cur.disp.num.machine_code && I8_MIN <= cur.disp.num.i <= I8_MAX) { cur.ModrM |= 0x40; - cur.disp.U8_count = 1; + cur.disp.u8_count = 1; } else if (aotc->seg_size == 16) { cur.ModrM |= 0x80; - cur.disp.U8_count = 2; + cur.disp.u8_count = 2; } else { cur.ModrM |= 0x80; - cur.disp.U8_count = 4; + cur.disp.u8_count = 4; } } else if (!tmpa1->indirect) @@ -645,7 +695,7 @@ Bool ParseAsmInst(CCompCtrl *cc, CHashOpcode *tmpo, I64 argcount) if (tmpa1->reg1 & 7 == REG_RBP) { cur.ModrM |= 0x40; - cur.disp.U8_count = 1; + cur.disp.u8_count = 1; } } } @@ -660,7 +710,7 @@ Bool ParseAsmInst(CCompCtrl *cc, CHashOpcode *tmpo, I64 argcount) } else if (argcount == 2) { - if (best.U8_count != 255 && !found_second_possible && !best.is_default) + if (best.u8_count != 255 && !found_second_possible && !best.is_default) { found_second_possible = TRUE; if (!aotc->arg1.size && !aotc->arg2.size) @@ -781,7 +831,7 @@ Bool ParseAsmInst(CCompCtrl *cc, CHashOpcode *tmpo, I64 argcount) if (tmpa1->reg1 >= 20) //RBPu8, RSPu8, RSIu8, RDIu8? cur.has_REX = TRUE; MemCopy(&cur.disp.num, &tmpa1->num, sizeof(CAsmNum)); - cur.disp.U8_count = 4; + cur.disp.u8_count = 4; } else { @@ -802,7 +852,7 @@ Bool ParseAsmInst(CCompCtrl *cc, CHashOpcode *tmpo, I64 argcount) if (tmpa1->reg2 & 7 == REG_RBP && !tmpa1->imm_or_off_present && tmpa1->indirect) { cur.ModrM |= 0x40; - cur.disp.U8_count = 1; + cur.disp.u8_count = 1; ModrM_complete = TRUE; } } @@ -814,7 +864,7 @@ Bool ParseAsmInst(CCompCtrl *cc, CHashOpcode *tmpo, I64 argcount) { cur.ModrM = cur.ModrM & 0xF8 + 5; MemCopy(&cur.disp.num, &tmpa1->num, sizeof(CAsmNum)); - cur.disp.U8_count = 4; + cur.disp.u8_count = 4; if (aotc->seg_size == 64) cur.disp.imm_flag = FALSE; } @@ -827,17 +877,17 @@ Bool ParseAsmInst(CCompCtrl *cc, CHashOpcode *tmpo, I64 argcount) if (!cur.disp.num.machine_code && I8_MIN <= cur.disp.num.i <= I8_MAX) { cur.ModrM |= 0x40; - cur.disp.U8_count = 1; + cur.disp.u8_count = 1; } else if (aotc->seg_size == 16) { cur.ModrM |= 0x80; - cur.disp.U8_count = 2; + cur.disp.u8_count = 2; } else { cur.ModrM |= 0x80; - cur.disp.U8_count = 4; + cur.disp.u8_count = 4; } } else if (!tmpa1->indirect) @@ -850,7 +900,7 @@ Bool ParseAsmInst(CCompCtrl *cc, CHashOpcode *tmpo, I64 argcount) if (tmpa1->reg1 & 7 == REG_RBP) { cur.ModrM |= 0x40; - cur.disp.U8_count = 1; + cur.disp.u8_count = 1; } } } @@ -860,29 +910,29 @@ Bool ParseAsmInst(CCompCtrl *cc, CHashOpcode *tmpo, I64 argcount) { MemCopy(&cur.disp.num, &tmpa1->num, sizeof(CAsmNum)); if (aotc->seg_size == 16) - cur.disp.U8_count = 2; + cur.disp.u8_count = 2; else - cur.disp.U8_count = 4; + cur.disp.u8_count = 4; cur.has_addr_prefix = FALSE; } else if (arg2 & ARGG_MOFFS) { MemCopy(&cur.disp.num, &tmpa2->num, sizeof(CAsmNum)); if (aotc->seg_size == 16) - cur.disp.U8_count = 2; + cur.disp.u8_count = 2; else - cur.disp.U8_count = 4; + cur.disp.u8_count = 4; cur.has_addr_prefix = FALSE; } else if (arg1 & (ARGG_IMM | ARGG_UIMM)) { MemCopy(&cur.imm.num, &tmpa1->num, sizeof(CAsmNum)); - if (arg1 & ARGG_SIZE_1) cur.imm.U8_count = 1; - else if (arg1 & ARGG_SIZE_2) cur.imm.U8_count = 2; - else if (arg1 & ARGG_SIZE_4) cur.imm.U8_count = 4; + if (arg1 & ARGG_SIZE_1) cur.imm.u8_count = 1; + else if (arg1 & ARGG_SIZE_2) cur.imm.u8_count = 2; + else if (arg1 & ARGG_SIZE_4) cur.imm.u8_count = 4; else { - cur.imm.U8_count = 8; + cur.imm.u8_count = 8; cur.REX |= 8; } } @@ -891,37 +941,37 @@ Bool ParseAsmInst(CCompCtrl *cc, CHashOpcode *tmpo, I64 argcount) { MemCopy(&cur.imm.num, &tmpa2->num, sizeof(CAsmNum)); - if (arg2 & ARGG_SIZE_1) cur.imm.U8_count = 1; - else if (arg2 & ARGG_SIZE_2) cur.imm.U8_count = 2; + if (arg2 & ARGG_SIZE_1) cur.imm.u8_count = 1; + else if (arg2 & ARGG_SIZE_2) cur.imm.u8_count = 2; else if (arg2 & ARGG_SIZE_4) { - cur.imm.U8_count = 4; + cur.imm.u8_count = 4; if (tmpins->flags & IEF_REX_ONLY_R8_R15 && arg2 == ARGT_UIMM32) cur.REX &= ~8; } else { - cur.imm.U8_count = 8; + cur.imm.u8_count = 8; cur.REX |= 8; } } } - cur.U8_count = tmpins->opcode_count + cur.disp.U8_count + cur.imm.U8_count; + cur.u8_count = tmpins->opcode_count + cur.disp.u8_count + cur.imm.u8_count; - if (cur.has_ModrM) cur.U8_count++; - if (cur.has_SIB) cur.U8_count++; + if (cur.has_ModrM) cur.u8_count++; + if (cur.has_SIB) cur.u8_count++; if (aotc->seg_size == 64 && cur.REX & 0x40 == 0x40 && (cur.REX != 0x40 || cur.has_REX) && (cur.REX & 7 || !(tmpins->flags & IEF_REX_ONLY_R8_R15 || tmpins->flags & IEF_REX_XOR_LIKE && tmpa1->reg1 == tmpa2->reg1 && cur.ModrM & 0xC0 == 0xC0))) - cur.U8_count++; + cur.u8_count++; - if (cur.U8_count < best.U8_count && !(tmpins->flags & IEF_DONT_SWITCH_MODES && (cur.has_addr_prefix || cur.has_operand_prefix))) + if (cur.u8_count < best.u8_count && !(tmpins->flags & IEF_DONT_SWITCH_MODES && (cur.has_addr_prefix || cur.has_operand_prefix))) MemCopy(&best, &cur, sizeof(CAsmInst)); } } - if (best.U8_count < 255) + if (best.u8_count < 255) { tmpins = best.tmpins; seg = REG_NONE; @@ -955,17 +1005,17 @@ Bool ParseAsmInst(CCompCtrl *cc, CHashOpcode *tmpo, I64 argcount) if (best.has_SIB) AOTStoreCodeU8(cc, best.SIB); - if (best.disp.U8_count) + if (best.disp.u8_count) { - best.disp.rel = aotc->rip + best.disp.U8_count + best.imm.U8_count; + best.disp.rel = aotc->rip + best.disp.u8_count + best.imm.u8_count; if (!AsmStoreNum(cc, &best.disp, 1, u8_avail)) return FALSE; } - if (best.imm.U8_count) + if (best.imm.u8_count) { - best.imm.rel = aotc->rip+best.imm.U8_count; + best.imm.rel = aotc->rip+best.imm.u8_count; if (!AsmStoreNum(cc, &best.imm, 1, u8_avail)) return FALSE; @@ -980,304 +1030,396 @@ Bool ParseAsmInst(CCompCtrl *cc, CHashOpcode *tmpo, I64 argcount) LexExcept(cc, "Invalid instruction at "); } -U0 ParseAsmDefine(CCompCtrl *cc, I64 U8_count) +U0 ParseAsmDefine(CCompCtrl *cc, I64 u8_count) { Bool is_dup; - I64 i,dup_val; + I64 i, dup_val; U8 *ptr; CAsmNum2 num2; - num2.U8_count=U8_count; + num2.u8_count = u8_count; + + while (cc->token && cc->token != ';') + { + num2.num.local_asm_undef_hash = NULL; + num2.num.global_asm_undef_hash = NULL; + + if (cc->token == TK_STR) + { + ptr = cc->cur_str; + i = cc->cur_str_len - 1; - while (cc->token && cc->token!=';') { - num2.num.local_asm_undef_hash=NULL; - num2.num.global_asm_undef_hash=NULL; - if (cc->token==TK_STR) { - ptr=cc->cur_str; - i=cc->cur_str_len-1; while (i--) - AOTStoreCodeU8(cc,*ptr++); + AOTStoreCodeU8(cc, *ptr++); + Lex(cc); //Skip Str - } else { - is_dup=FALSE; - cc->abs_counts=0; - cc->asm_undef_hash=NULL; - cc->flags&=~(CCF_UNRESOLVED+CCF_LOCAL); - if (!IsLexExpression2Bin(cc,&num2.num.machine_code)) + } + else + { + is_dup = FALSE; + cc->abs_counts = 0; + cc->asm_undef_hash = NULL; + cc->flags &= ~(CCF_UNRESOLVED + CCF_LOCAL); + + if (!IsLexExpression2Bin(cc, &num2.num.machine_code)) LexSkipEol(cc); - else { + else + { if (cc->abs_counts.externs) - LexExcept(cc,"Extern Not Allowed at "); - if (cc->flags & CCF_UNRESOLVED) { - if (cc->flags & CCF_LOCAL) { - num2.num.local_asm_undef_hash=cc->asm_undef_hash; - cc->asm_undef_hash=NULL; - } else { - num2.num.global_asm_undef_hash=cc->asm_undef_hash; - cc->asm_undef_hash=NULL; + LexExcept(cc, "Extern not allowed at "); + + if (cc->flags & CCF_UNRESOLVED) + { + if (cc->flags & CCF_LOCAL) + { + num2.num.local_asm_undef_hash = cc->asm_undef_hash; + cc->asm_undef_hash = NULL; } - } else { - i=Call(num2.num.machine_code); + else + { + num2.num.global_asm_undef_hash = cc->asm_undef_hash; + cc->asm_undef_hash = NULL; + } + } + else + { + i = Call(num2.num.machine_code); Free(num2.num.machine_code); } } - if (cc->token==TK_IDENT && cc->hash_entry) { - if (cc->hash_entry->type & HTT_ASM_KEYWORD && - cc->hash_entry->user_data0==AKW_DUP) { - is_dup=TRUE; - if (Lex(cc)!='(') - LexExcept(cc,"Expecting '(' at "); + + if (cc->token == TK_IDENT && cc->hash_entry) + { + if (cc->hash_entry->type & HTT_ASM_KEYWORD && cc->hash_entry->user_data0 == AKW_DUP) + { + is_dup = TRUE; + + if (Lex(cc) != '(') + LexExcept(cc, "Expecting '(' at "); + Lex(cc); //skip ( - dup_val=AsmLexExpression(cc); - if (cc->token!=')') - LexExcept(cc,"Expecting ')' at "); + dup_val = AsmLexExpression(cc); + + if (cc->token != ')') + LexExcept(cc, "Expecting ')' at "); + Lex(cc); //SKIP ) } } - num2.rel=0; - num2.imm_flag=TRUE; - num2.num.abs_counts=cc->abs_counts; - if (is_dup) { + num2.rel = 0; + num2.imm_flag = TRUE; + num2.num.abs_counts = cc->abs_counts; + if (is_dup) + { if (num2.num.local_asm_undef_hash || num2.num.global_asm_undef_hash) - LexExcept(cc,"Undefined DUP count at "); - num2.num.i=dup_val; - AsmStoreNum(cc,&num2,i,FALSE); - } else { - num2.num.i=i; - AsmStoreNum(cc,&num2,1,FALSE); + LexExcept(cc, "Undefined DUP count at "); + num2.num.i = dup_val; + AsmStoreNum(cc, &num2, i, FALSE); + } + else + { + num2.num.i = i; + AsmStoreNum(cc, &num2, 1, FALSE); } } if (cc->token==',') Lex(cc); } if (cc->token!=';') - LexExcept(cc,"Missing ';' at"); + LexExcept(cc, "Missing ';' at "); + Lex(cc); } U0 ParseBinFile(CCompCtrl *cc) { - I64 i,size; - U8 *buf,*st; - if (cc->token!=TK_STR) - LexExcept(cc,"Expecting string at "); - st=ExtDefault(cc->cur_str,"BIN"); - buf=FileRead(st,&size); + I64 i, size; + U8 *buf, *st; + + if (cc->token != TK_STR) + LexExcept(cc, "Expecting string at "); + + st = ExtDefault(cc->cur_str, "BIN"); + buf = FileRead(st, &size); Free(st); - for (i=0;iaotc; - I64 i,j,k,argcount, - old_flags=cc->flags & CCF_ASM_EXPRESSIONS; + CAOTCtrl *aotc = cc->aotc; + I64 i, j, k, argcount, old_flags = cc->flags & CCF_ASM_EXPRESSIONS; CHashOpcode *tmpo; CHashExport *tmpex; U8 *next_last_label; CCodeMisc *g_lb; - aotc->seg_size=64; - cc->flags|=CCF_ASM_EXPRESSIONS; - if (!(comp_flags&CMPF_ONE_ASM_INS)) { - if (cc->token!='{') - LexExcept(cc,"Expecting '{' at "); + aotc->seg_size = 64; + cc->flags |= CCF_ASM_EXPRESSIONS; + + if (!(comp_flags & CMPF_ONE_ASM_INS)) + { + if (cc->token != '{') + LexExcept(cc, "Expecting '{' at "); + Lex(cc); } - while (cc->token && cc->token!='}') { + + while (cc->token && cc->token!='}') + { AsmLineList(cc); - if (cc->token==TK_IDENT && cc->hash_entry) { - if (cc->hash_entry->type&HTT_ASM_KEYWORD) { - i=cc->hash_entry->user_data0; + + if (cc->token == TK_IDENT && cc->hash_entry) + { + if (cc->hash_entry->type & HTT_ASM_KEYWORD) + { + i = cc->hash_entry->user_data0; Lex(cc); //skip keyword - switch (i) { + + switch (i) + { case AKW_IMPORT: - while (cc->token && cc->token!=';') { - if (cc->token!=TK_IDENT) - LexExcept(cc,"Expecting identifier at "); - else { - tmpex=NULL; - tmpex=CAlloc(sizeof(CHashExport)); - tmpex->str=cc->cur_str; - cc->cur_str=0; - tmpex->type=HTT_EXPORT_SYS_SYM|HTF_UNRESOLVED; - HashAdd(tmpex,cc->htc.global_hash_table); - tmpex->type|=HTF_IMPORT; - if (Lex(cc)==',') + while (cc->token && cc->token != ';') + { + if (cc->token != TK_IDENT) + LexExcept(cc, "Expecting identifier at "); + else + { + tmpex = NULL; + tmpex = CAlloc(sizeof(CHashExport)); + tmpex->str = cc->cur_str; + cc->cur_str = NULL; + tmpex->type = HTT_EXPORT_SYS_SYM|HTF_UNRESOLVED; + HashAdd(tmpex, cc->htc.global_hash_table); + tmpex->type |= HTF_IMPORT; + if (Lex(cc) == ',') Lex(cc); //skip ',' } } - if (cc->token!=';') - LexExcept(cc,"Missing ';' at"); + + if (cc->token != ';') + LexExcept(cc, "Missing ';' at"); Lex(cc); //skip ';'; break; case AKW_ORG: if (cc->htc.local_var_list) - LexExcept(cc,"ORG not allowed in fun asm blk "); - if (aotc->org!=INVALID_PTR) - LexExcept(cc,"Just one org allowed "); + LexExcept(cc, "ORG not allowed in function asm blk "); + + if (aotc->org != INVALID_PTR) + LexExcept(cc, "Only one ORG allowed "); + if (aotc->rip) - LexExcept(cc,"ORG must be at beginning "); - aotc->org=AsmLexExpression(cc); + LexExcept(cc, "ORG must be at beginning "); + + aotc->org = AsmLexExpression(cc); break; case AKW_ALIGN: if (cc->htc.local_var_list) - LexExcept(cc,"ALIGN not allowed in fun asm blk "); - i=AsmLexExpression(cc); - j=Bsf(i); - if (!i || j!=Bsr(i)) - LexExcept(cc,"ALIGN must be power of two at "); - if (!(cc->flags&CCF_AOT_COMPILE) && i>8) - LexExcept(cc,"In JIT mode, max ALIGN is 8 "); - if (j>aotc->max_align_bits) aotc->max_align_bits=j; - i=CeilU64(aotc->rip,i); + LexExcept(cc, "ALIGN not allowed in function asm blk "); + + i = AsmLexExpression(cc); + j = Bsf(i); + if (!i || j != Bsr(i)) + LexExcept(cc, "ALIGN must be power of two at "); + + if (!(cc->flags & CCF_AOT_COMPILE) && i > 8) + LexExcept(cc, "In JIT mode, max ALIGN is 8 "); + + if (j > aotc->max_align_bits) + aotc->max_align_bits = j; + + i = CeilU64(aotc->rip, i); + if (cc->token!=',') - LexExcept(cc,"Expecting ',' at "); + LexExcept(cc, "Expecting ',' at "); + Lex(cc); - k=AsmLexExpression(cc); - for (j=aotc->rip;jrip; j < i; j++) + AOTStoreCodeU8(cc, k); break; case AKW_DU8: - ParseAsmDefine(cc,1); + ParseAsmDefine(cc, 1); break; case AKW_DU16: - ParseAsmDefine(cc,2); + ParseAsmDefine(cc, 2); break; case AKW_DU32: - ParseAsmDefine(cc,4); + ParseAsmDefine(cc, 4); break; case AKW_DU64: - ParseAsmDefine(cc,8); + ParseAsmDefine(cc, 8); break; case AKW_BINFILE: ParseBinFile(cc); break; case AKW_LIST: - aotc->list=TRUE; + aotc->list = TRUE; break; case AKW_NOLIST: - aotc->list=FALSE; + aotc->list = FALSE; break; case AKW_USE16: - aotc->seg_size=16; + aotc->seg_size = 16; break; case AKW_USE32: - aotc->seg_size=32; + aotc->seg_size = 32; break; case AKW_USE64: - aotc->seg_size=64; + aotc->seg_size = 64; break; default: - LexExcept(cc,"Syntax error at "); + LexExcept(cc, "Syntax error at "); } - } else if (cc->hash_entry->type & HTT_OPCODE) { - tmpo=cc->hash_entry; + } + else if (cc->hash_entry->type & HTT_OPCODE) + { + tmpo = cc->hash_entry; Lex(cc); //skip opcode - argcount=0; - if (tmpo->ins[0].arg1) { + argcount = 0; + + if (tmpo->ins[0].arg1) + { argcount++; - if (ARGt_REL8<=tmpo->ins[0].arg1<=ARGt_REL32) - ParseAsmArg(cc,&aotc->arg1,TRUE); + + if (1 << tmpo->ins[0].arg1 & ARGG_REL) + ParseAsmArg(cc, &aotc->arg1, TRUE); else - ParseAsmArg(cc,&aotc->arg1,FALSE); - if (tmpo->ins[0].arg2) { + ParseAsmArg(cc, &aotc->arg1, FALSE); + + if (tmpo->ins[0].arg2) + { argcount++; - if (cc->token!=',') - LexExcept(cc,"Expecting ',' at "); - else { + + if (cc->token != ',') + LexExcept(cc, "Expecting ',' at "); + else + { Lex(cc); //skip ',' - if (ARGt_REL8<=tmpo->ins[0].arg2<=ARGt_REL32) - ParseAsmArg(cc,&aotc->arg2,TRUE); + + if (1 << tmpo->ins[0].arg2 & ARGG_REL) + ParseAsmArg(cc, &aotc->arg2, TRUE); else - ParseAsmArg(cc,&aotc->arg2,FALSE); + ParseAsmArg(cc, &aotc->arg2, FALSE); } } } - ParseAsmInst(cc,tmpo,argcount); - } else if (cc->hash_entry->type & HTT_EXPORT_SYS_SYM) { - if (Btr(&cc->hash_entry->type,HTf_UNRESOLVED)) { - if (cc->hash_entry->type & HTF_LOCAL) { - cc->hash_entry(CHashExport *)->val=aotc->rip; - if (Lex(cc)!=':') - LexExcept(cc,"Expecting ':' at "); + ParseAsmInst(cc, tmpo, argcount); + } + else if (cc->hash_entry->type & HTT_EXPORT_SYS_SYM) + { + if (Btr(&cc->hash_entry->type, HTf_UNRESOLVED)) + { + if (cc->hash_entry->type & HTF_LOCAL) + { + cc->hash_entry(CHashExport *)->val = aotc->rip; + + if (Lex(cc) != ':') + LexExcept(cc, "Expecting ':' at "); + Lex(cc); - } else { + } + else + { if (cc->hash_entry->type & HTF_IMPORT) - LexExcept(cc,"attempt to define import at "); - cc->hash_entry(CHashExport *)->val=aotc->rip; - next_last_label=cc->hash_entry->str; + LexExcept(cc, "Attempt to define import at "); + + cc->hash_entry(CHashExport *)->val = aotc->rip; + next_last_label = cc->hash_entry->str; Lex(cc); //Skip cur_str - if (cc->token!=':' && cc->token!=TK_DBL_COLON) - LexExcept(cc,"Expecting ':' at "); - if (cc->token==TK_DBL_COLON) { - cc->hash_entry->type|=HTF_EXPORT; - HashSrcFileSet(cc,cc->hash_entry); + + if (cc->token != ':' && cc->token != TK_DBL_COLON) + LexExcept(cc, "Expecting ':' at "); + + if (cc->token == TK_DBL_COLON) + { + cc->hash_entry->type |= HTF_EXPORT; + HashSrcFileSet(cc, cc->hash_entry); AOTLocalsResolve(cc); - aotc->last_label=next_last_label; + aotc->last_label = next_last_label; } Lex(cc); } - } else if (cc->hash_entry(CHashExport *)->val==aotc->rip) { - Lex(cc); //Skip cur_str - if (cc->token!=':' && cc->token!=TK_DBL_COLON) - LexExcept(cc,"Expecting ':' at "); - Lex(cc); - } else - LexExcept(cc,"Redefinition at "); - } else - LexExcept(cc,"Syntax error at "); - } else if (cc->token==TK_IDENT) { - tmpex=CAlloc(sizeof(CHashExport)); - tmpex->str=cc->cur_str; - cc->cur_str=0; - tmpex->type=HTT_EXPORT_SYS_SYM; - tmpex->val=aotc->rip; - Lex(cc); //Skip cur_str - if (cc->token!=':' && cc->token!=TK_DBL_COLON) - LexExcept(cc,"Expecting ':' at "); - else { - if (*tmpex->str=='@' && tmpex->str[1]=='@') { - if (cc->token==TK_DBL_COLON) - LexExcept(cc,"No local glbl exports at "); - HashAdd(tmpex,cc->htc.local_hash_table); - } else - HashAdd(tmpex,cc->htc.global_hash_table); - if (cc->htc.local_var_list) {//AsmBlk in fun? Also add goto-like label. - if (!(g_lb=COCGoToLabelFind(cc,tmpex->str))) { - g_lb=COCMiscNew(cc,CMT_ASM_LABEL); - g_lb->str=StrNew(tmpex->str); - } else if (g_lb->flags&CMF_DEFINED) - LexExcept(cc,"Duplicate goto label at "); - g_lb->type=CMT_ASM_LABEL; - g_lb->flags|=CMF_DEFINED; - g_lb->rip=aotc->rip; - g_lb->use_count++; //Disable warning on unused labels. - ICAdd(cc,IC_LABEL,g_lb,0); } - if (cc->token==TK_DBL_COLON) { - tmpex->type|=HTF_EXPORT; - HashSrcFileSet(cc,tmpex); + else if (cc->hash_entry(CHashExport *)->val == aotc->rip) + { + Lex(cc); //Skip cur_str + if (cc->token != ':' && cc->token != TK_DBL_COLON) + LexExcept(cc, "Expecting ':' at "); + Lex(cc); + } + else + LexExcept(cc, "Redefinition at "); + } + else + LexExcept(cc, "Syntax error at "); + } + else if (cc->token == TK_IDENT) + { + tmpex = CAlloc(sizeof(CHashExport)); + tmpex->str = cc->cur_str; + cc->cur_str = NULL; + tmpex->type = HTT_EXPORT_SYS_SYM; + tmpex->val = aotc->rip; + Lex(cc); //Skip cur_str + if (cc->token!=':' && cc->token != TK_DBL_COLON) + LexExcept(cc, "Expecting ':' at "); + else + { + if (*tmpex->str == '@' && tmpex->str[1] == '@') + { + if (cc->token == TK_DBL_COLON) + LexExcept(cc, "No local global exports at "); + HashAdd(tmpex, cc->htc.local_hash_table); + } + else + HashAdd(tmpex, cc->htc.global_hash_table); + + if (cc->htc.local_var_list) + {//AsmBlk in fun? Also add goto-like label. + if (!(g_lb = COCGoToLabelFind(cc, tmpex->str))) + { + g_lb = COCMiscNew(cc, CMT_ASM_LABEL); + g_lb->str = StrNew(tmpex->str); + } + else if (g_lb->flags & CMF_DEFINED) + LexExcept(cc, "Duplicate goto label at "); + + g_lb->type = CMT_ASM_LABEL; + g_lb->flags |= CMF_DEFINED; + g_lb->rip = aotc->rip; + g_lb->use_count++; //Disable warning on unused labels. + ICAdd(cc, IC_LABEL, g_lb, 0); + } + if (cc->token==TK_DBL_COLON) + { + tmpex->type |= HTF_EXPORT; + HashSrcFileSet(cc, tmpex); AOTLocalsResolve(cc); aotc->last_label=tmpex->str; } + Lex(cc); } - } else if (cc->token==';') + } + else if (cc->token == ';') Lex(cc); else - LexExcept(cc,"Syntax error at "); - if (comp_flags&CMPF_ONE_ASM_INS && (cc->token!=TK_IDENT || - !(tmpo=cc->hash_entry) || - !(tmpo->type&(HTT_OPCODE|HTT_ASM_KEYWORD)))) + LexExcept(cc, "Syntax error at "); + + if (comp_flags & CMPF_ONE_ASM_INS && (cc->token!=TK_IDENT || !(tmpo = cc->hash_entry) || !(tmpo->type & (HTT_OPCODE | HTT_ASM_KEYWORD)))) break; } AOTLocalsResolve(cc); - aotc->list=FALSE; - cc->flags&=cc->flags&~CCF_ASM_EXPRESSIONS|old_flags; + aotc->list = FALSE; + cc->flags &= cc->flags & ~CCF_ASM_EXPRESSIONS | old_flags; } diff --git a/src/Compiler/ParseExp.CC b/src/Compiler/ParseExp.CC index 35ac2fe9..e0fc02a8 100755 --- a/src/Compiler/ParseExp.CC +++ b/src/Compiler/ParseExp.CC @@ -151,7 +151,7 @@ pe_check_binary_ops2: if (stack_op.u16[0]==IC_DEREF && tmpc->ptr_stars_count) tmpc--; else if (stack_op.u16[0]==IC_ADDR) { - cc->abs_counts.c_addres++; + cc->abs_counts.c_address++; if (intermediate_code_table[tmpi->ic_code].type==IST_DEREF) OptFree(tmpi); tmpc++; @@ -644,12 +644,12 @@ I64 ParseUnaryTerm(CCompCtrl *cc,CParseStack *ps,CMemberList **_local_var, ICAdd(cc,IC_ABS_ADDR, tmpf->exe_addr,comp.internal_types[RT_PTR]); if (cc->flags&CCF_ASM_EXPRESSIONS) - cc->abs_counts.abs_addres++; + cc->abs_counts.abs_address++; } else ICAdd(cc,IC_IMM_I64, tmpf->exe_addr,comp.internal_types[RT_PTR]); } - cc->abs_counts.c_addres++; + cc->abs_counts.c_address++; Lex(cc); return PE_MAYBE_MODIFIERS; } @@ -657,7 +657,7 @@ I64 ParseUnaryTerm(CCompCtrl *cc,CParseStack *ps,CMemberList **_local_var, tmpex=tmpc; if (cc->flags&CCF_ASM_EXPRESSIONS && !(cc->flags&CCF_AOT_COMPILE) && tmpex->type&HTF_IMM) { - cc->abs_counts.c_addres++; + cc->abs_counts.c_address++; ICAdd(cc,IC_IMM_I64, tmpex->val,comp.internal_types[RT_PTR]); Lex(cc); @@ -706,7 +706,7 @@ I64 ParseUnaryTerm(CCompCtrl *cc,CParseStack *ps,CMemberList **_local_var, break; case '$$': if (cc->flags & CCF_ASM_EXPRESSIONS) { - cc->abs_counts.abs_addres++; + cc->abs_counts.abs_address++; if (cc->flags&CCF_AOT_COMPILE) ICAdd(cc,IC_ABS_ADDR,cc->aotc->rip,comp.internal_types[RT_PTR]); else @@ -833,7 +833,7 @@ pu_export_sys_sym: if (PREC_TERM>*max_prec) *max_prec=PREC_TERM; if (!(tmpex->type & (HTF_IMM|HTF_IMPORT))) - cc->abs_counts.abs_addres++; + cc->abs_counts.abs_address++; if (tmpex->type & HTF_UNRESOLVED) { if (!(cc->flags&CCF_ASM_EXPRESSIONS)) LexExcept(cc,"Illegal forward ref at "); @@ -853,7 +853,7 @@ pu_export_sys_sym: ICAdd(cc,IC_ABS_ADDR,tmpex->val,comp.internal_types[RT_PTR]); else { if (tmpex->type&HTF_IMM) - cc->abs_counts.c_addres++; + cc->abs_counts.c_address++; ICAdd(cc,IC_IMM_I64,tmpex->val,comp.internal_types[RT_PTR]); } } diff --git a/src/Home/K.CC b/src/Home/K.CC index ce600a70..453a2a30 100755 --- a/src/Home/K.CC +++ b/src/Home/K.CC @@ -1,4 +1,4 @@ -In("CC\n\n1\n\n6\n\n\n"); +In("CC\n\n1\n\n5\n\n\n"); BootHDIns; "\n\nSuccessful? "; if(YorN) diff --git a/src/Kernel/KStart32.CC b/src/Kernel/KStart32.CC index 1bbe4bf8..63fce40d 100755 --- a/src/Kernel/KStart32.CC +++ b/src/Kernel/KStart32.CC @@ -91,8 +91,8 @@ CORE0_32BIT_INIT:: //Entry point for $LK,"BootRAM",A="MN:BootRAM"$. MOV ESP, BOOT_RAM_LIMIT //Tmp Stack //Patch abs addresses - MOV ECX, U32 CPatchTableAbsAddr.abs_addres_count[ESI] - LEA ESI, U32 CPatchTableAbsAddr.abs_addres[ESI] + MOV ECX, U32 CPatchTableAbsAddr.abs_address_count[ESI] + LEA ESI, U32 CPatchTableAbsAddr.abs_address[ESI] @@05: LODSD ADD EAX, EDI ADD U32 [EAX],EDI diff --git a/src/Kernel/KernelA.HH b/src/Kernel/KernelA.HH index 8c849149..73a2ba35 100755 --- a/src/Kernel/KernelA.HH +++ b/src/Kernel/KernelA.HH @@ -440,9 +440,9 @@ class CBinFile class CPatchTableAbsAddr { U8 eit_abs_addr; //$LK,"IET_ABS_ADDR",A="MN:IET_ABS_ADDR"$ - U32 abs_addres_count; + U32 abs_address_count; U8 zero; - U32 abs_addres[1]; + U32 abs_address[1]; }; //$LK,"CAOTImportExport",A="MN:CAOTImportExport"$ Types. Used in PatchTable. @@ -1940,8 +1940,8 @@ class CAOTBinBlk I64 class CAbsCountsI64 { - U16 abs_addres, //Only odd/even matters. Count of absolute addres in an exp. - c_addres; //Only odd/even matters. Count of C addres in an exp. + U16 abs_address, //Only odd/even matters. Count of absolute address in an exp. + c_address; //Only odd/even matters. Count of C address in an exp. U32 externs; //Only nonzero matters. Some regions have externs banned. }; @@ -1962,7 +1962,7 @@ class CAsmNum class CAsmNum2 { CAsmNum num; - I64 U8_count,rel; + I64 u8_count,rel; Bool imm_flag; }; @@ -1970,7 +1970,7 @@ class CAsmInst { CInst *tmpins; CAsmNum2 imm,disp; - I64 U8_count,last_opcode_U8, + I64 u8_count,last_opcode_U8, REX,ModrM,SIB; Bool has_REX,has_ModrM,has_SIB, has_addr_prefix,