mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2025-06-07 08:14:48 +00:00
stk -> stack, CNT -> COUNT
This commit is contained in:
parent
2478dfde96
commit
e85b29e5be
Binary file not shown.
@ -140,7 +140,7 @@ to know if something is const.;-)This
|
||||
just compiles with the val at compile
|
||||
time, an advantage of just-in-time over
|
||||
AOT binaries.ZenithOS has a limited
|
||||
stk size, so don't get in the habit.
|
||||
stack size, so don't get in the habit.
|
||||
$LK,"MAlloc",A="MN:MAlloc"$() would probably be the better choice.
|
||||
*/
|
||||
MPCtrl1 job[mp_count];
|
||||
|
@ -73,7 +73,7 @@ U0 ParseAsmArg(CCompCtrl *cc,CAsmArg *arg,Bool rel)
|
||||
} else
|
||||
Lex(cc); //skip ":"
|
||||
break;
|
||||
case REGT_FSTK:
|
||||
case REGT_FSTACK:
|
||||
case REGT_MM:
|
||||
case REGT_XMM:
|
||||
arg->size=8;
|
||||
@ -189,7 +189,7 @@ I64 AsmMakeArgMask(CCompCtrl *cc,CAsmArg *arg)
|
||||
}
|
||||
goto mm_done;
|
||||
}
|
||||
if (arg->reg1_type==REGT_FSTK) {
|
||||
if (arg->reg1_type==REGT_FSTACK) {
|
||||
if (arg->reg1)
|
||||
res=1<<ARGT_STI;
|
||||
else
|
||||
@ -278,7 +278,7 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 count,Bool U8_avail)
|
||||
if (num2->num.local_asm_undef_hash||num2->num.glbl_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.glbl_asm_undef_hash,cc->lex_include_stk->line_num,
|
||||
num2->num.glbl_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 ");
|
||||
@ -305,7 +305,7 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 count,Bool U8_avail)
|
||||
if (num2->num.local_asm_undef_hash||num2->num.glbl_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.glbl_asm_undef_hash,cc->lex_include_stk->line_num,
|
||||
num2->num.glbl_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 ");
|
||||
@ -332,7 +332,7 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 count,Bool U8_avail)
|
||||
if (num2->num.local_asm_undef_hash||num2->num.glbl_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.glbl_asm_undef_hash,cc->lex_include_stk->line_num,
|
||||
num2->num.glbl_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 ");
|
||||
@ -358,7 +358,7 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 count,Bool U8_avail)
|
||||
if (num2->num.local_asm_undef_hash||num2->num.glbl_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.glbl_asm_undef_hash,cc->lex_include_stk->line_num,
|
||||
num2->num.glbl_asm_undef_hash,cc->lex_include_stack->line_num,
|
||||
U8_avail);
|
||||
if (num2->imm_flag) {
|
||||
if (num2->num.abs_counts.abs_addres&1) {
|
||||
@ -464,8 +464,8 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcount)
|
||||
found_second_possible=TRUE;
|
||||
if (!aotc->arg1.size)
|
||||
PrintWarn("no size specified at %s,%04d\n",
|
||||
cc->lex_include_stk->full_name,
|
||||
cc->lex_include_stk->line_num-1);
|
||||
cc->lex_include_stack->full_name,
|
||||
cc->lex_include_stack->line_num-1);
|
||||
}
|
||||
if (tmpins->flags & IEF_PLUS_OPCODE) {
|
||||
if (tmpins->slash_val==SV_R_REG) {
|
||||
@ -475,7 +475,7 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcount)
|
||||
if (tmpa1->reg1>=20) //RBPu8,RSPu8,RSIu8,RDIu8?
|
||||
cur.has_REX=TRUE;
|
||||
} else {//SV_I_REG
|
||||
if (tmpa1->reg1_type==REGT_FSTK)
|
||||
if (tmpa1->reg1_type==REGT_FSTACK)
|
||||
cur.last_opcode_U8+=tmpa1->reg1;
|
||||
}
|
||||
}
|
||||
@ -574,8 +574,8 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcount)
|
||||
found_second_possible=TRUE;
|
||||
if (!aotc->arg1.size && !aotc->arg2.size)
|
||||
PrintWarn("no size specified at %s,%04d\n",
|
||||
cc->lex_include_stk->full_name,
|
||||
cc->lex_include_stk->line_num-1);
|
||||
cc->lex_include_stack->full_name,
|
||||
cc->lex_include_stack->line_num-1);
|
||||
}
|
||||
if (tmpins->flags & IEF_PLUS_OPCODE) {
|
||||
if (tmpins->slash_val==SV_R_REG) {
|
||||
@ -593,9 +593,9 @@ Bool ParseAsmInst(CCompCtrl *cc,CHashOpcode *tmpo,I64 argcount)
|
||||
cur.has_REX=TRUE;
|
||||
}
|
||||
} else {//SV_I_REG
|
||||
if (tmpa1->reg1_type==REGT_FSTK)
|
||||
if (tmpa1->reg1_type==REGT_FSTACK)
|
||||
cur.last_opcode_U8|=tmpa1->reg1;
|
||||
if (tmpa2->reg1_type==REGT_FSTK)
|
||||
if (tmpa2->reg1_type==REGT_FSTACK)
|
||||
cur.last_opcode_U8|=tmpa2->reg1;
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ U0 AsmHashLoad()
|
||||
while (cc->token) {
|
||||
if (cc->token!=TK_IDENT)
|
||||
LexExcept(cc,"Expecting identifier at ");
|
||||
i=ListMatch(cc->cur_str,"NONE\0R8\0R16\0R32\0R64\0SEG\0FSTK\0"
|
||||
i=ListMatch(cc->cur_str,"NONE\0R8\0R16\0R32\0R64\0SEG\0FSTACK\0"
|
||||
"MM\0XMM\0OPCODE\0KEYWORD\0ASM_KEYWORD\0");
|
||||
if (i<=0)
|
||||
LexExcept(cc,"Unknown Statement");
|
||||
|
@ -147,7 +147,7 @@ I64 AsmLexExpression(CCompCtrl *cc)
|
||||
U0 AsmLineList(CCompCtrl *cc)
|
||||
{
|
||||
CAOTCtrl *aotc=cc->aotc;
|
||||
CLexFile *tmpf=cc->lex_include_stk;
|
||||
CLexFile *tmpf=cc->lex_include_stack;
|
||||
CDocEntry *doc_e=tmpf->line_start,*doc_e2;
|
||||
if (aotc->list && aotc->list_last_lfn==tmpf && doc_e) {
|
||||
if (doc_e2=aotc->list_last_line) {
|
||||
|
@ -155,7 +155,7 @@ U0 ICAddSubEctImm(CIntermediateCode *tmpi,CICType t1,I64 r1,I64 d1,
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case MDf_STK:
|
||||
case MDf_STACK:
|
||||
ICAddSubEctImm(tmpi,MDF_REG+RT_I64,REG_RAX,0,t2,r2,d2,d,op,rip);
|
||||
ICPushRegs(tmpi,1<<REG_RAX);
|
||||
return;
|
||||
|
@ -443,7 +443,7 @@ U0 ICAssignPostIncDec(CIntermediateCode *tmpi,I64 op,I64 rip)
|
||||
if (tmpi->res.type.mode)
|
||||
ICMov(tmpi,tmpi->res.type,tmpi->res.reg,tmpi->res.disp,
|
||||
tmpi->arg2.type,tmpi->arg2.reg,tmpi->arg2.disp,rip);
|
||||
if (tmpc1->size!=1 || tmpi->arg1.type&MDF_STK)
|
||||
if (tmpc1->size!=1 || tmpi->arg1.type&MDF_STACK)
|
||||
ICAddSubEctImm(tmpi,tmpi->arg1.type,tmpi->arg1.reg,tmpi->arg1.disp,
|
||||
MDF_REG+RT_I64,r,0,tmpc1->size,op.u16[3],rip);
|
||||
else
|
||||
|
@ -217,7 +217,7 @@ U0 ICBrBitOps(CIntermediateCode *tmpi,I64 rip,
|
||||
if (tmpi->ic_flags&ICF_SWAP && !(arg2->type&MDF_REG) &&
|
||||
(!(arg2->type&MDF_IMM) ||arg2->disp>63)||
|
||||
!(tmpi->ic_flags&ICF_SWAP) && arg2->type&MDF_IMM &&
|
||||
arg2->disp<64 || arg2->type&MDF_STK) {
|
||||
arg2->disp<64 || arg2->type&MDF_STACK) {
|
||||
ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,arg2->type,arg2->reg,arg2->disp,rip2);
|
||||
t2=MDF_REG+RT_I64;
|
||||
r2=REG_RCX;
|
||||
@ -233,7 +233,7 @@ U0 ICBrBitOps(CIntermediateCode *tmpi,I64 rip,
|
||||
if (!(tmpi->ic_flags&ICF_SWAP) && !(arg1->type&MDF_REG) &&
|
||||
(!(arg1->type&MDF_IMM) || arg1->disp>63) ||
|
||||
tmpi->ic_flags&ICF_SWAP && arg1->type&MDF_IMM &&
|
||||
arg1->disp<64 || arg1->type&MDF_STK) {
|
||||
arg1->disp<64 || arg1->type&MDF_STACK) {
|
||||
ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,arg1->type,arg1->reg,arg1->disp,rip2);
|
||||
t1=MDF_REG+RT_I64;
|
||||
r1=REG_RDX;
|
||||
@ -539,7 +539,7 @@ U0 ICSwap(CIntermediateCode *tmpi,I64 rip2)
|
||||
U0 ICAndEqu(CIntermediateCode *tmpi,I64 rip2)
|
||||
{
|
||||
I64 i,bit;
|
||||
if (tmpi->arg2.type&MDF_IMM && !(tmpi->arg1.type&MDF_STK) &&
|
||||
if (tmpi->arg2.type&MDF_IMM && !(tmpi->arg1.type&MDF_STACK) &&
|
||||
tmpi->ic_flags&ICF_RES_NOT_USED) {
|
||||
i=~tmpi->arg2.disp;
|
||||
bit=Bsf(i);
|
||||
@ -560,7 +560,7 @@ U0 ICAndEqu(CIntermediateCode *tmpi,I64 rip2)
|
||||
U0 ICOrEqu(CIntermediateCode *tmpi,I64 rip2)
|
||||
{
|
||||
I64 i,bit;
|
||||
if (tmpi->arg2.type&MDF_IMM && !(tmpi->arg1.type&MDF_STK) &&
|
||||
if (tmpi->arg2.type&MDF_IMM && !(tmpi->arg1.type&MDF_STACK) &&
|
||||
tmpi->ic_flags&ICF_RES_NOT_USED) {
|
||||
i=tmpi->arg2.disp;
|
||||
bit=Bsf(i);
|
||||
@ -581,7 +581,7 @@ U0 ICOrEqu(CIntermediateCode *tmpi,I64 rip2)
|
||||
U0 ICXorEqu(CIntermediateCode *tmpi,I64 rip2)
|
||||
{
|
||||
I64 i,bit;
|
||||
if (tmpi->arg2.type&MDF_IMM && !(tmpi->arg1.type&MDF_STK) &&
|
||||
if (tmpi->arg2.type&MDF_IMM && !(tmpi->arg1.type&MDF_STACK) &&
|
||||
tmpi->ic_flags&ICF_RES_NOT_USED) {
|
||||
i=tmpi->arg2.disp;
|
||||
bit=Bsf(i);
|
||||
|
@ -376,7 +376,7 @@ U0 ICFOp(CCompCtrl *cc,CIntermediateCode *tmpi,I64 op,U8 *buf2,I64 rip)
|
||||
}
|
||||
} else {
|
||||
if (alt) {
|
||||
if (!(arg2->type&MDF_STK)) {
|
||||
if (!(arg2->type&MDF_STACK)) {
|
||||
if (arg1->type.raw_type>=RT_I64 && arg1->type&MDG_DISP_SIB_RIP) {
|
||||
t1=arg1->type;
|
||||
r1=arg1->reg;
|
||||
@ -424,7 +424,7 @@ U0 ICFOp(CCompCtrl *cc,CIntermediateCode *tmpi,I64 op,U8 *buf2,I64 rip)
|
||||
t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
|
||||
}
|
||||
} else {
|
||||
if (!(arg1->type&MDF_STK)) {
|
||||
if (!(arg1->type&MDF_STACK)) {
|
||||
if (arg2->type.raw_type>=RT_I64 && arg2->type&MDG_DISP_SIB_RIP) {
|
||||
t2=arg2->type;
|
||||
r2=arg2->reg;
|
||||
|
@ -38,7 +38,7 @@ U0 ICFOpEqu(CCompCtrl *cc,CIntermediateCode *tmpi,I64 op,U8 *buf2,I64 rip)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (tmpi->arg1_type_pointed_to!=RT_F64 || arg1->type&MDF_STK) {
|
||||
if (tmpi->arg1_type_pointed_to!=RT_F64 || arg1->type&MDF_STACK) {
|
||||
ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,arg2->type,
|
||||
arg2->reg,arg2->disp,rip);
|
||||
ICMov(tmpi,MDF_REG+RT_I64,REG_RDX,0,
|
||||
@ -141,7 +141,7 @@ U0 ICFOpEqu(CCompCtrl *cc,CIntermediateCode *tmpi,I64 op,U8 *buf2,I64 rip)
|
||||
t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=0;
|
||||
rsp_size+=8;
|
||||
} else {
|
||||
if (tmpi->arg1_type_pointed_to!=RT_F64 || arg1->type&MDF_STK) {
|
||||
if (tmpi->arg1_type_pointed_to!=RT_F64 || arg1->type&MDF_STACK) {
|
||||
ICMov(tmpi,MDF_REG+RT_I64,REG_RAX,0,arg2->type,
|
||||
arg2->reg,arg2->disp,rip);
|
||||
ICMov(tmpi,MDF_REG+RT_I64,REG_RCX,0,arg1->type,
|
||||
@ -274,7 +274,7 @@ U0 ICFCmpAndBranch(CCompCtrl *cc,CIntermediateCode *tmpi,I64 rip,
|
||||
}
|
||||
} else {
|
||||
if (alt) {
|
||||
if (!(arg2->type&MDF_STK)) {
|
||||
if (!(arg2->type&MDF_STACK)) {
|
||||
if (tmpi->ic_flags&ICF_POP_CMP) {
|
||||
t1=MDF_SIB+RT_I64; r1=REG_RSP+REG_RSP<<8; d1=0;
|
||||
rsp_size+=8;
|
||||
@ -331,7 +331,7 @@ U0 ICFCmpAndBranch(CCompCtrl *cc,CIntermediateCode *tmpi,I64 rip,
|
||||
t2=MDF_SIB+RT_I64; r2=REG_RSP+REG_RSP<<8; d2=0;
|
||||
}
|
||||
} else {
|
||||
if (!(arg1->type&MDF_STK)) {
|
||||
if (!(arg1->type&MDF_STACK)) {
|
||||
if (arg2->type.raw_type>=RT_I64 && arg2->type&MDG_DISP_SIB_RIP) {
|
||||
t2=arg2->type;
|
||||
r2=arg2->reg;
|
||||
|
@ -329,7 +329,7 @@ U0 ICPush(CIntermediateCode *tmpi,CICType t1,I64 r1,I64 d1,I64 rip)
|
||||
ICU8(tmpi,0x50+REG_RBX);
|
||||
}
|
||||
return;
|
||||
case MDf_STK:
|
||||
case MDf_STACK:
|
||||
return;
|
||||
case MDf_DISP:
|
||||
case MDf_SIB:
|
||||
@ -378,7 +378,7 @@ U0 ICPop(CIntermediateCode *tmpi,CICType t1,I64 r1,I64 d1,I64 rip)
|
||||
} else
|
||||
ICSlashOp(tmpi,t1,r1,d1,SLASH_OP_POP,rip);
|
||||
break;
|
||||
case MDf_STK:
|
||||
case MDf_STACK:
|
||||
case MDf_IMM:
|
||||
ICU8(tmpi,0x58+REG_RBX);
|
||||
ICMov(tmpi,t1,r1,d1,MDF_REG+RT_I64,REG_RBX,0,rip);
|
||||
@ -503,7 +503,7 @@ U0 ICMov(CIntermediateCode *tmpi,
|
||||
ICU16(tmpi,i+r1<<8);
|
||||
ICU64(tmpi,d2);
|
||||
}
|
||||
} else if (t2&MDF_STK)
|
||||
} else if (t2&MDF_STACK)
|
||||
ICPop(tmpi,t1,r1,d1,rip);
|
||||
else {
|
||||
if (r1==r2 && t2&MDF_REG)
|
||||
@ -537,7 +537,7 @@ U0 ICMov(CIntermediateCode *tmpi,
|
||||
ICModr2(tmpi,i,,d2,rip);
|
||||
}
|
||||
break;
|
||||
case MDf_STK:
|
||||
case MDf_STACK:
|
||||
if (tmpi->ic_flags&ICF_PUSH_CMP)
|
||||
ICPopRegs(tmpi,1<<REG_RBX);
|
||||
if (t1.raw_type<t2.raw_type)
|
||||
@ -575,7 +575,7 @@ U0 ICMov(CIntermediateCode *tmpi,
|
||||
break;
|
||||
}
|
||||
move_done:
|
||||
if (!((t1|t2)&(MDF_STK|MDF_RIP_DISP32))) {
|
||||
if (!((t1|t2)&(MDF_STACK|MDF_RIP_DISP32))) {
|
||||
tmpil1=tmpi;
|
||||
if (tmpi->ic_last_start<0 && (tmpil1=OptLag1(tmpi)) &&
|
||||
tmpil1->ic_last_start<0)
|
||||
@ -670,7 +670,7 @@ U0 ICLea(CIntermediateCode *tmpi,CICType t1,I64 r1,I64 d1,
|
||||
ICU24(tmpi,i.u8[2]<<16+0x8D00+i.u8[1]);
|
||||
ICModr2(tmpi,i,,d2,rip);
|
||||
break;
|
||||
case MDf_STK:
|
||||
case MDf_STACK:
|
||||
if (t2&MDF_RIP_DISP32) {
|
||||
ICU8(tmpi,0x68);
|
||||
ICU32(tmpi,d2);
|
||||
|
@ -24,8 +24,8 @@ U8 *LexPutLine(CCompCtrl *cc,U8 *start)
|
||||
I64 ch;
|
||||
U8 *ptr;
|
||||
if (!start) return NULL;
|
||||
if (cc->lex_include_stk->flags&LFSF_DOC)
|
||||
return DocPutLine(cc->lex_include_stk->doc,start);
|
||||
if (cc->lex_include_stack->flags&LFSF_DOC)
|
||||
return DocPutLine(cc->lex_include_stack->doc,start);
|
||||
else {
|
||||
ptr=start;
|
||||
while (ch=*ptr++) {
|
||||
@ -50,16 +50,16 @@ U8 *LexPutLine(CCompCtrl *cc,U8 *start)
|
||||
U0 LexPutPos(CCompCtrl *cc)
|
||||
{//Print token, line link and, then, $LK,"LexPutLine",A="MN:LexPutLine"$().
|
||||
LexPutToken(cc);
|
||||
FixSet(cc->lex_include_stk->full_name,cc->lex_include_stk->line_num);
|
||||
FixSet(cc->lex_include_stack->full_name,cc->lex_include_stack->line_num);
|
||||
if (IsRaw)
|
||||
"%s,%d ",cc->lex_include_stk->full_name,cc->lex_include_stk->line_num;
|
||||
"%s,%d ",cc->lex_include_stack->full_name,cc->lex_include_stack->line_num;
|
||||
else {
|
||||
PutFileLink(cc->lex_include_stk->full_name,,cc->lex_include_stk->line_num);
|
||||
PutFileLink(cc->lex_include_stack->full_name,,cc->lex_include_stack->line_num);
|
||||
ZenithErr("%s,%d\n",
|
||||
cc->lex_include_stk->full_name,cc->lex_include_stk->line_num);
|
||||
cc->lex_include_stack->full_name,cc->lex_include_stack->line_num);
|
||||
'' CH_SPACE;
|
||||
}
|
||||
LexPutLine(cc,cc->lex_include_stk->line_start);
|
||||
LexPutLine(cc,cc->lex_include_stack->line_start);
|
||||
}
|
||||
|
||||
U0 LexWarn(CCompCtrl *cc,U8 *str=NULL)
|
||||
@ -110,7 +110,7 @@ U0 UnusedExternWarning(CCompCtrl *cc,CHashClass *tmpc)
|
||||
U0 ParenWarning(CCompCtrl *cc)
|
||||
{
|
||||
if (Bt(&cc->opts,OPTf_WARN_PAREN) &&
|
||||
!(cc->lex_include_stk->flags&LFSF_DEFINE))
|
||||
!(cc->lex_include_stack->flags&LFSF_DEFINE))
|
||||
LexWarn(cc,"Unnecessary parenthesis ");
|
||||
}
|
||||
|
||||
@ -147,8 +147,8 @@ U0 ICArgPut(CICArg *a,I64 type_pointed_to)
|
||||
"%Z %Z ",a->type.raw_type,"ST_RAW_TYPES",
|
||||
Bsr(a->type>>8)+1,"ST_TY_TYPES";
|
||||
switch (Bsr(a->type)) {
|
||||
case MDf_STK:
|
||||
"STK";
|
||||
case MDf_STACK:
|
||||
"STACK";
|
||||
break;
|
||||
case MDf_IMM:
|
||||
"#%X",a->disp;
|
||||
|
@ -32,10 +32,10 @@ extern U0 ParseStreamBlk(CCompCtrl *cc);
|
||||
extern CHashClass *ParseType(CCompCtrl *cc,CHashClass **_tmpc1,
|
||||
I64 *_mode,CMemberList *tmpm,U8 **_ident,CHashFun **_fun_ptr,
|
||||
CHashExport **_tmpex,CArrayDim *tmpad,I64 fsp_flags);
|
||||
extern I64 ParseUnaryModifier(CCompCtrl *cc,CPrsStk *ps,
|
||||
extern I64 ParseUnaryModifier(CCompCtrl *cc,CPrsStack *ps,
|
||||
CMemberList **_local_var,CArrayDim **_tmpad,I64 *unary_post_prec);
|
||||
extern I64 ParseUnaryTerm(
|
||||
CCompCtrl *cc,CPrsStk *ps,CMemberList **_local_var,CArrayDim **_tmpad,
|
||||
CCompCtrl *cc,CPrsStack *ps,CMemberList **_local_var,CArrayDim **_tmpad,
|
||||
I64 *max_prec,I64 *unary_pre_prec,I64 *paren_prec);
|
||||
extern U0 ParseVarInit2(CCompCtrl *cc,U8 **_dst,CHashClass *tmpc,
|
||||
CArrayDim *tmpad,U8 *data_addr_rip,U8 **_base,Bool data_heap,I64 pass);
|
||||
|
@ -210,7 +210,7 @@ U0 CompLoadDefines()
|
||||
"I8\0U8\0I16\0U16\0I32\0U32\0I64\0U64\0F64\0String\0");
|
||||
DefineListLoad("ST_INT_SIZE_TYPES",
|
||||
"I8\0U8\0I16\0U16\0I32\0U32\0I64\0U64\0");
|
||||
DefineListLoad("ST_TY_TYPES","NULL\0STK\0IMM\0REG\0DISP\0SIB\0RIP\0");
|
||||
DefineListLoad("ST_TY_TYPES","NULL\0STACK\0IMM\0REG\0DISP\0SIB\0RIP\0");
|
||||
DefineListLoad("ST_U8_REGS","AL\0CL\0DL\0BL\0AH\0CH\0DH\0BH\0"
|
||||
"R8u8\0R9u8\0R10u8\0R11u8\0R12u8\0R13u8\0R14u8\0R15u8\0");
|
||||
DefineListLoad("ST_U8_REX_REGS","AL\0CL\0DL\0BL\0RSPu8\0RBPu8\0RSIu8\0RDIu8\0"
|
||||
@ -233,7 +233,7 @@ U0 CompLoadDefines()
|
||||
"SS\0DS\0ES\0FS\0GS\0CS\0ST0\0STI\0"
|
||||
"MM\0MM32\0MM64\0XMM\0XMM32\0XMM64\0XMM128\0XMM0\0");
|
||||
DefineListLoad("ST_SEG_REGS","ES\0CS\0SS\0DS\0FS\0GS\0");
|
||||
DefineListLoad("ST_FSTK_REGS","ST0\0ST1\0ST2\0ST3\0ST4\0ST5\0ST6\0ST7\0");
|
||||
DefineListLoad("ST_FSTACK_REGS","ST0\0ST1\0ST2\0ST3\0ST4\0ST5\0ST6\0ST7\0");
|
||||
}
|
||||
|
||||
U0 CompFillTables()
|
||||
|
@ -82,7 +82,7 @@ U0 StreamPrint(U8 *fmt,...)
|
||||
U0 StreamDir()
|
||||
{
|
||||
U8 *dirname;
|
||||
if (dirname=DirFile(Fs->last_cc->lex_include_stk->full_name)) {
|
||||
if (dirname=DirFile(Fs->last_cc->lex_include_stack->full_name)) {
|
||||
StreamPrint("\"%s\"",dirname);
|
||||
Free(dirname);
|
||||
}
|
||||
@ -148,9 +148,9 @@ U8 *CmdLinePrompt()
|
||||
if (IsDebugMode&&IsRaw)
|
||||
RawDr;
|
||||
|
||||
LBts(&Fs->task_flags,TASKf_CMD_LINE_PMT);
|
||||
LBts(&Fs->task_flags,TASKf_CMD_LINE_PROMPT);
|
||||
st=GetStr(,,GSF_SHIFT_ESC_EXIT);
|
||||
LBtr(&Fs->task_flags,TASKf_CMD_LINE_PMT);
|
||||
LBtr(&Fs->task_flags,TASKf_CMD_LINE_PROMPT);
|
||||
|
||||
i=StrLen(st);
|
||||
res=MAlloc(i+1+2);
|
||||
|
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -1,18 +1,18 @@
|
||||
CLexFile *LexFilePush(CCompCtrl *cc)
|
||||
{//#include file push.
|
||||
CLexFile *res=CAlloc(sizeof(CLexFile));
|
||||
if (res->next=cc->lex_include_stk)
|
||||
if (res->next=cc->lex_include_stack)
|
||||
res->depth=res->next->depth+1;
|
||||
else
|
||||
res->depth=-1; //Include depth starts with -1.
|
||||
return cc->lex_include_stk=res;
|
||||
return cc->lex_include_stack=res;
|
||||
}
|
||||
|
||||
CLexFile *LexFilePop(CCompCtrl *cc)
|
||||
{//#include file pop.
|
||||
CLexFile *tmpf;
|
||||
if (tmpf=cc->lex_include_stk) {
|
||||
if ((cc->lex_include_stk=tmpf->next) || !(cc->flags & CCF_DONT_FREE_BUF)) {
|
||||
if (tmpf=cc->lex_include_stack) {
|
||||
if ((cc->lex_include_stack=tmpf->next) || !(cc->flags & CCF_DONT_FREE_BUF)) {
|
||||
if (tmpf->flags & LFSF_DOC) {
|
||||
if (tmpf->doc)
|
||||
DocDel(tmpf->doc);
|
||||
@ -22,7 +22,7 @@ CLexFile *LexFilePop(CCompCtrl *cc)
|
||||
Free(tmpf->full_name);
|
||||
Free(tmpf);
|
||||
}
|
||||
return cc->lex_include_stk;
|
||||
return cc->lex_include_stack;
|
||||
}
|
||||
|
||||
CCompCtrl *CompCtrlNew(U8 *buf=NULL,I64 flags=0,U8 *filename=NULL)
|
||||
@ -48,7 +48,7 @@ CCompCtrl *CompCtrlNew(U8 *buf=NULL,I64 flags=0,U8 *filename=NULL)
|
||||
tmpf->full_name=FileNameAbs(filename);
|
||||
else
|
||||
tmpf->full_name=StrNew(blkdev.tmp_filename);
|
||||
if (flags & CCF_PMT)
|
||||
if (flags & CCF_PROMPT)
|
||||
buf=CAlloc(8);
|
||||
tmpf->buf=tmpf->buf_ptr=tmpf->line_start=cc->cur_buf_ptr=buf;
|
||||
tmpf->line_num=1;
|
||||
@ -58,7 +58,7 @@ CCompCtrl *CompCtrlNew(U8 *buf=NULL,I64 flags=0,U8 *filename=NULL)
|
||||
U0 CompCtrlDel(CCompCtrl *cc)
|
||||
{//Free CCompCtrl.
|
||||
while (LexFilePop(cc));
|
||||
LinkedListDel(cc->lex_prs_stk);
|
||||
LinkedListDel(cc->lex_prs_stack);
|
||||
LinkedListDel(cc->htc.next);
|
||||
Free(cc->ps);
|
||||
Free(cc->cur_str);
|
||||
@ -69,7 +69,7 @@ U0 CompCtrlDel(CCompCtrl *cc)
|
||||
|
||||
I64 CompCtrlSize(CCompCtrl *cc)
|
||||
{//Mem size of CCompCtrl and its members.
|
||||
CLexFile *tmpf=cc->lex_include_stk;
|
||||
CLexFile *tmpf=cc->lex_include_stack;
|
||||
I64 res=0;
|
||||
while (tmpf) {
|
||||
if (tmpf->next || !(cc->flags & CCF_DONT_FREE_BUF)) {
|
||||
@ -119,7 +119,7 @@ lgc_start1:
|
||||
switch [cc->last_U16=*src++] {
|
||||
case 0:
|
||||
lgc_here:
|
||||
tmpf=cc->lex_include_stk;
|
||||
tmpf=cc->lex_include_stack;
|
||||
if (tmpf->flags & LFSF_DOC) {
|
||||
doc=tmpf->doc;
|
||||
doc_e=tmpf->cur_entry;
|
||||
@ -214,7 +214,7 @@ lgc_start2:
|
||||
goto lgc_start1;
|
||||
tmpf->cur_entry=doc->head.last; //When take next, will still be end.
|
||||
}
|
||||
tmpf=cc->lex_include_stk;
|
||||
tmpf=cc->lex_include_stack;
|
||||
if (tmpf->next) {
|
||||
tmpf=LexFilePop(cc);
|
||||
cc->cur_buf_ptr=tmpf->buf_ptr;
|
||||
@ -222,10 +222,10 @@ lgc_start2:
|
||||
if (!(cc->last_U16=tmpf->last_U16))
|
||||
goto lgc_start1;
|
||||
} else {
|
||||
if (cc->flags & CCF_PMT) {
|
||||
if (cc->flags & CCF_PROMPT) {
|
||||
Free(tmpf->buf);
|
||||
ptr=CmdLinePrompt;
|
||||
if (StrCmp(ptr,"\n") && !cc->pmt_line++ && !StrCmp(ptr,"?\n") &&
|
||||
if (StrCmp(ptr,"\n") && !cc->prompt_line++ && !StrCmp(ptr,"?\n") &&
|
||||
cc->flags & CCF_QUESTION_HELP) {
|
||||
Free(ptr);
|
||||
ptr=StrNew("Help;;\n");
|
||||
@ -242,7 +242,7 @@ lgc_start2:
|
||||
case CH_CURSOR:
|
||||
goto lgc_start1;
|
||||
case '\n':
|
||||
tmpf=cc->lex_include_stk;
|
||||
tmpf=cc->lex_include_stack;
|
||||
if (!(tmpf->flags & LFSF_DOC)) {
|
||||
tmpf->line_num++;
|
||||
cmp.compiled_lines++;
|
||||
@ -444,7 +444,7 @@ I64 Lex(CCompCtrl *cc)
|
||||
CHash *tmph;
|
||||
Bool str_done,in_str,neg_e;
|
||||
U8 *fbuf,*buf2,*buf3,buf[STR_LEN];
|
||||
cc->last_line_num=cc->lex_include_stk->line_num;
|
||||
cc->last_line_num=cc->lex_include_stack->line_num;
|
||||
while (TRUE) {
|
||||
lex_cont:
|
||||
switch [ch=LexGetChar(cc)] {
|
||||
@ -504,7 +504,7 @@ lex_ident:
|
||||
if (j & HTT_DEFINE_STR && !(cc->flags & CCF_NO_DEFINES)) {
|
||||
LexIncludeStr(cc,
|
||||
tmph->str,StrNew(tmph(CHashDefineStr *)->data),FALSE);
|
||||
cc->lex_include_stk->flags|=LFSF_DEFINE;
|
||||
cc->lex_include_stack->flags|=LFSF_DEFINE;
|
||||
} else {
|
||||
cc->hash_entry=tmph;
|
||||
Free(cc->cur_str);
|
||||
|
@ -1,6 +1,6 @@
|
||||
U0 LexBackupLastChar(CCompCtrl *cc)
|
||||
{
|
||||
CLexFile *tmpf=cc->lex_include_stk;
|
||||
CLexFile *tmpf=cc->lex_include_stack;
|
||||
tmpf->buf_ptr=cc->cur_buf_ptr;
|
||||
if (cc->flags & CCF_USE_LAST_U16) {
|
||||
tmpf->last_U16=cc->last_U16;
|
||||
@ -13,32 +13,32 @@ U0 LexPush(CCompCtrl *cc)
|
||||
{//Create token-stream save point.
|
||||
CLexFile *tmpf;
|
||||
LexBackupLastChar(cc);
|
||||
if (cc->lex_include_stk->last_U16)
|
||||
if (cc->lex_include_stack->last_U16)
|
||||
cc->flags|=CCF_USE_LAST_U16;
|
||||
tmpf=MAllocIdent(cc->lex_include_stk);
|
||||
tmpf->next=cc->lex_prs_stk;
|
||||
cc->lex_prs_stk=tmpf;
|
||||
tmpf=MAllocIdent(cc->lex_include_stack);
|
||||
tmpf->next=cc->lex_prs_stack;
|
||||
cc->lex_prs_stack=tmpf;
|
||||
}
|
||||
|
||||
U0 LexPopRestore(CCompCtrl *cc)
|
||||
{//Restore token-stream saved-point.
|
||||
//Bad things can happen if you cross an #include file boundary.
|
||||
CLexFile *tmpf=cc->lex_prs_stk;
|
||||
CLexFile *tmpf=cc->lex_prs_stack;
|
||||
cc->cur_buf_ptr=tmpf->buf_ptr;
|
||||
if (cc->last_U16=tmpf->last_U16)
|
||||
cc->flags|=CCF_USE_LAST_U16;
|
||||
else
|
||||
cc->flags&=~CCF_USE_LAST_U16;
|
||||
MemCpy(cc->lex_include_stk(U8 *)+sizeof(U8 *),tmpf(U8 *)+sizeof(U8 *),
|
||||
MemCpy(cc->lex_include_stack(U8 *)+sizeof(U8 *),tmpf(U8 *)+sizeof(U8 *),
|
||||
sizeof(CLexFile)-sizeof(U8 *));
|
||||
cc->lex_prs_stk=tmpf->next;
|
||||
cc->lex_prs_stack=tmpf->next;
|
||||
Free(tmpf);
|
||||
}
|
||||
|
||||
U0 LexPopNoRestore(CCompCtrl *cc)
|
||||
{//Don't restore token-stream saved-point.
|
||||
CLexFile *tmpf=cc->lex_prs_stk;
|
||||
cc->lex_prs_stk=tmpf->next;
|
||||
CLexFile *tmpf=cc->lex_prs_stack;
|
||||
cc->lex_prs_stack=tmpf->next;
|
||||
Free(tmpf);
|
||||
}
|
||||
|
||||
|
@ -110,14 +110,14 @@ SEG DS 3;
|
||||
SEG FS 4;
|
||||
SEG GS 5;
|
||||
|
||||
FSTK ST0 0;
|
||||
FSTK ST1 1;
|
||||
FSTK ST2 2;
|
||||
FSTK ST3 3;
|
||||
FSTK ST4 4;
|
||||
FSTK ST5 5;
|
||||
FSTK ST6 6;
|
||||
FSTK ST7 7;
|
||||
FSTACK ST0 0;
|
||||
FSTACK ST1 1;
|
||||
FSTACK ST2 2;
|
||||
FSTACK ST3 3;
|
||||
FSTACK ST4 4;
|
||||
FSTACK ST5 5;
|
||||
FSTACK ST6 6;
|
||||
FSTACK ST7 7;
|
||||
|
||||
MM MM0 0;
|
||||
MM MM1 1;
|
||||
|
@ -22,10 +22,10 @@ U0 OptSetNOP1(CIntermediateCode *tmpi)
|
||||
tmpi->res.type =MDF_NULL+tmpi->res.type.raw_type;
|
||||
}
|
||||
|
||||
U0 OptSetNOP2(CIntermediateCode *tmpi,I64 stk_delta=1)
|
||||
U0 OptSetNOP2(CIntermediateCode *tmpi,I64 stack_delta=1)
|
||||
{
|
||||
tmpi->ic_code=IC_NOP2;
|
||||
tmpi->ic_data=stk_delta;
|
||||
tmpi->ic_data=stack_delta;
|
||||
tmpi->arg1.type=MDF_NULL+tmpi->arg1.type.raw_type;
|
||||
tmpi->res.type =MDF_NULL+tmpi->res.type.raw_type;
|
||||
}
|
||||
|
@ -33,9 +33,9 @@ args.
|
||||
CIntermediateCode *tmpi,*tmpi1,*tmpi2,*tmpi3,*tmpi_push,
|
||||
*last_with_class=NULL;
|
||||
CCodeMisc *lb,*lb1,*lb2;
|
||||
CPrsStk *ps;
|
||||
CPrsStack *ps;
|
||||
if (!(ps=cc->ps))
|
||||
ps=cc->ps=MAlloc(sizeof(CPrsStk));
|
||||
ps=cc->ps=MAlloc(sizeof(CPrsStack));
|
||||
ps->ptr=0;
|
||||
ps->ptr2=0;
|
||||
tmpi=cc->coc.coc_head.next;
|
||||
@ -1279,7 +1279,7 @@ args.
|
||||
tmpi=tmpi->next;
|
||||
}
|
||||
if (ps->ptr>2) {
|
||||
"Pass:%d Stk:%08X\n",cc->pass,ps->ptr;
|
||||
"Pass:%d Stack:%08X\n",cc->pass,ps->ptr;
|
||||
LexExcept(cc,"Compiler Optimization Error at ");
|
||||
}
|
||||
//This is for determining type conversions for passing args to funs.
|
||||
|
@ -9,7 +9,7 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
|
||||
COptMemberVar *mv=NULL;
|
||||
CAOT *tmpaot;
|
||||
CAOTImportExport *tmpie;
|
||||
CPrsStk *ps=cc->ps;
|
||||
CPrsStack *ps=cc->ps;
|
||||
ps->ptr=0;
|
||||
ps->ptr2=0;
|
||||
|
||||
@ -29,8 +29,8 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
|
||||
if (0<=tmpm->reg<REG_REGS_NUM) {
|
||||
if (Bts(&used_reg_mask,tmpm->reg))
|
||||
PrintWarn("Reg in use\n $$LK,\"FL:%s,%d\"$$'%s' in '%s'\n",
|
||||
cc->lex_include_stk->full_name,
|
||||
cc->lex_include_stk->line_num,tmpm->str,cc->htc.fun->str);
|
||||
cc->lex_include_stack->full_name,
|
||||
cc->lex_include_stack->line_num,tmpm->str,cc->htc.fun->str);
|
||||
reg_offsets[tmpm->reg].offset=tmpm->offset;
|
||||
reg_offsets[tmpm->reg].m=tmpm;
|
||||
} else if (tmpc->raw_type!=RT_F64 && tmpm->reg!=REG_NONE ||
|
||||
@ -42,8 +42,8 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
|
||||
mv[member_count++].m=tmpm;
|
||||
} else if (tmpm->reg==REG_ALLOC)
|
||||
PrintWarn("Can't reg var\n $$LK,\"FL:%s,%d\"$$'%s' in '%s'\n",
|
||||
cc->lex_include_stk->full_name,
|
||||
cc->lex_include_stk->line_num,tmpm->str,cc->htc.fun->str);
|
||||
cc->lex_include_stack->full_name,
|
||||
cc->lex_include_stack->line_num,tmpm->str,cc->htc.fun->str);
|
||||
tmpm=tmpm->next;
|
||||
}
|
||||
} else
|
||||
@ -73,8 +73,8 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
|
||||
tmpc2=cmp.internal_types[RT_I64];
|
||||
else
|
||||
tmpc2=tmpi->t.arg2_class;
|
||||
tmpi->arg2.type=MDF_STK+CompRawType(tmpc2);
|
||||
tmpi->ic_flags|=ICF_ARG2_WAS_STK;
|
||||
tmpi->arg2.type=MDF_STACK+CompRawType(tmpc2);
|
||||
tmpi->ic_flags|=ICF_ARG2_WAS_STACK;
|
||||
case IS_1_ARG:
|
||||
tmpi1=ParsePop(ps);
|
||||
if (tmpi1->ic_flags&ICF_RES_TO_F64)
|
||||
@ -83,16 +83,16 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
|
||||
tmpc1=cmp.internal_types[RT_I64];
|
||||
else
|
||||
tmpc1=tmpi->t.arg1_class;
|
||||
tmpi->arg1.type=MDF_STK+CompRawType(tmpc1);
|
||||
tmpi->arg1.type=MDF_STACK+CompRawType(tmpc1);
|
||||
tmpi->arg1_type_pointed_to=CompRawTypePointed(tmpc1);
|
||||
tmpi->ic_flags|=ICF_ARG1_WAS_STK;
|
||||
tmpi->ic_flags|=ICF_ARG1_WAS_STACK;
|
||||
break;
|
||||
case IS_0_ARG: //nobound switch
|
||||
break;
|
||||
}
|
||||
if (intermediate_code_table[code].res_count) {
|
||||
tmpi->res.type=MDF_STK+CompRawType(tmpc);
|
||||
tmpi->ic_flags|=ICF_RES_WAS_STK;
|
||||
tmpi->res.type=MDF_STACK+CompRawType(tmpc);
|
||||
tmpi->ic_flags|=ICF_RES_WAS_STACK;
|
||||
ParsePush(ps,tmpi);
|
||||
}
|
||||
switch [code] {
|
||||
@ -547,8 +547,8 @@ R12 and R13 as non-pointer register variables, such as index variables i,j,k.
|
||||
} else {
|
||||
if (mv[i].m->reg==REG_ALLOC)
|
||||
PrintWarn("Can't reg var\n $$LK,\"FL:%s,%d\"$$'%s' in '%s'\n",
|
||||
cc->lex_include_stk->full_name,
|
||||
cc->lex_include_stk->line_num,mv[i].m->str,cc->htc.fun->str);
|
||||
cc->lex_include_stack->full_name,
|
||||
cc->lex_include_stack->line_num,mv[i].m->str,cc->htc.fun->str);
|
||||
}
|
||||
}
|
||||
if (j>0) {
|
||||
@ -576,8 +576,8 @@ R12 and R13 as non-pointer register variables, such as index variables i,j,k.
|
||||
tmpm->member_class->type&HTT_INTERNAL_TYPE)
|
||||
PrintWarn("Using 64-bit reg var.\n "
|
||||
"$$LK,\"FL:%s,%d\"$$'%s' in '%s'\n",
|
||||
cc->lex_include_stk->full_name,
|
||||
cc->lex_include_stk->line_num,
|
||||
cc->lex_include_stack->full_name,
|
||||
cc->lex_include_stack->line_num,
|
||||
tmpm->str,cc->htc.fun->str);
|
||||
}
|
||||
}
|
||||
@ -604,8 +604,8 @@ R12 and R13 as non-pointer register variables, such as index variables i,j,k.
|
||||
tmpm->member_class->type&HTT_INTERNAL_TYPE)
|
||||
PrintWarn("Using 64-bit reg var.\n "
|
||||
"$$LK,\"FL:%s,%d\"$$'%s' in '%s'\n",
|
||||
cc->lex_include_stk->full_name,
|
||||
cc->lex_include_stk->line_num,
|
||||
cc->lex_include_stack->full_name,
|
||||
cc->lex_include_stack->line_num,
|
||||
tmpm->str,cc->htc.fun->str);
|
||||
}
|
||||
}
|
||||
@ -615,7 +615,7 @@ R12 and R13 as non-pointer register variables, such as index variables i,j,k.
|
||||
Free(mv);
|
||||
}
|
||||
if (ps->ptr>2) {
|
||||
"Pass:%d Stk:%08X\n",cc->pass,ps->ptr;
|
||||
"Pass:%d Stack:%08X\n",cc->pass,ps->ptr;
|
||||
LexExcept(cc,"Compiler Optimization Error at ");
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ Bool OptIC4(CIntermediateCode *tmpi)
|
||||
if (!(tmpil2=OptLag1(tmpil1)))
|
||||
return FALSE;
|
||||
|
||||
if (tmpil2->res.type&MDF_STK && !(tmpil2->ic_flags&ICF_PUSH_RES)) {
|
||||
if (tmpil1->ic_code==IC_ADD_CONST && tmpil1->arg1.type&MDF_STK) {
|
||||
if (tmpil2->res.type&MDF_STACK && !(tmpil2->ic_flags&ICF_PUSH_RES)) {
|
||||
if (tmpil1->ic_code==IC_ADD_CONST && tmpil1->arg1.type&MDF_STACK) {
|
||||
if ((tmpil2->ic_code==IC_REG || tmpil2->ic_code==IC_MOV) &&
|
||||
tmpil2->arg1.type&MDF_REG) {
|
||||
i=tmpil1->ic_data;
|
||||
@ -45,7 +45,7 @@ Bool OptIC4(CIntermediateCode *tmpi)
|
||||
}
|
||||
}
|
||||
if (tmpil2->ic_code==IC_MOV || tmpil2->ic_code==IC_REG) {
|
||||
if (tmpil1->arg2.type&MDF_STK) {
|
||||
if (tmpil1->arg2.type&MDF_STACK) {
|
||||
if (tmpil2->ic_flags & ICF_RES_TO_INT) {
|
||||
if (tmpil2->arg1.type&MDF_IMM)
|
||||
tmpil2->arg1.disp=tmpil2->arg1.disp(F64);
|
||||
@ -66,7 +66,7 @@ Bool OptIC4(CIntermediateCode *tmpi)
|
||||
OptSetNOP2(tmpil2);
|
||||
return TRUE;
|
||||
}
|
||||
if (tmpil1->arg1.type&MDF_STK) {
|
||||
if (tmpil1->arg1.type&MDF_STACK) {
|
||||
if (tmpil2->ic_flags & ICF_RES_TO_INT) {
|
||||
if (tmpil2->arg1.type&MDF_IMM)
|
||||
tmpil2->arg1.disp=tmpil2->arg1.disp(F64);
|
||||
@ -94,7 +94,7 @@ Bool OptIC4(CIntermediateCode *tmpi)
|
||||
}
|
||||
if (tmpil1->ic_code==IC_DEREF) {
|
||||
if (tmpil2->ic_code==IC_ADD_CONST && tmpil2->arg1.type&MDF_REG &&
|
||||
tmpil1->arg1.type&MDF_STK) {
|
||||
tmpil1->arg1.type&MDF_STACK) {
|
||||
i=tmpil2->ic_data;
|
||||
if (I32_MIN<=i<=I32_MAX &&
|
||||
!Bt(&cmp.non_ptr_vars_mask,tmpil2->arg1.reg)) {
|
||||
@ -107,7 +107,7 @@ Bool OptIC4(CIntermediateCode *tmpi)
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
if (tmpil2->ic_code==IC_LEA && tmpil1->arg1.type&MDF_STK) {
|
||||
if (tmpil2->ic_code==IC_LEA && tmpil1->arg1.type&MDF_STACK) {
|
||||
tmpil1->ic_flags|=tmpil2->ic_flags;
|
||||
tmpil1->ic_code=IC_MOV;
|
||||
tmpil1->arg1.type=tmpil2->arg1.type&MDG_MASK+
|
||||
@ -138,7 +138,7 @@ U0 OptPass4(CCompCtrl *cc,COptReg *reg_offsets,I64 *_type)
|
||||
I64 code,i;
|
||||
Bool dead_code=FALSE;
|
||||
CCodeMisc *lb;
|
||||
CPrsStk *ps=cc->ps;
|
||||
CPrsStack *ps=cc->ps;
|
||||
ps->ptr=0;
|
||||
ps->ptr2=0;
|
||||
|
||||
@ -386,7 +386,7 @@ p4_sib:
|
||||
tmpi->arg1.disp=tmpi1->arg1.disp;
|
||||
OptSetNOP2(tmpi1);
|
||||
}
|
||||
if (tmpi->res.type&MDF_STK && tmpi2->arg2.type&MDF_STK &&
|
||||
if (tmpi->res.type&MDF_STACK && tmpi2->arg2.type&MDF_STACK &&
|
||||
code!=IC_ASSIGN_PP && code!=IC_ASSIGN_MM) {
|
||||
tmpi->res.type=tmpi->arg1.type;
|
||||
tmpi->res.reg=tmpi->arg1.reg;
|
||||
@ -452,8 +452,8 @@ p4_sib:
|
||||
case IC_LBTC:
|
||||
if (!(tmpi->ic_flags&ICF_BY_VAL)) {
|
||||
if (tmpi2->ic_code==IC_ADDR) {
|
||||
if (tmpi2->arg1.type&MDF_STK &&
|
||||
tmpi2->res.type&MDF_STK) {
|
||||
if (tmpi2->arg1.type&MDF_STACK &&
|
||||
tmpi2->res.type&MDF_STACK) {
|
||||
if (tmpil2=OptLag1(tmpi2)) {
|
||||
if (tmpil2->ic_code==IC_LEA) {
|
||||
if (tmpil2->arg1.type&(MDF_IMM|MDG_REG_DISP_SIB_RIP)) {
|
||||
@ -501,7 +501,7 @@ p4_sib:
|
||||
tmpi->arg2.reg=REG_RIP;
|
||||
OptFree(tmpil2);
|
||||
}
|
||||
} else if (tmpi2->ic_code==IC_MOV && tmpi2->res.type&MDF_STK &&
|
||||
} else if (tmpi2->ic_code==IC_MOV && tmpi2->res.type&MDF_STACK &&
|
||||
tmpi2->arg1.type==MDF_IMM+RT_I64 &&
|
||||
0<=tmpi2->arg1.disp<=I32_MAX &&
|
||||
!(tmpi2->ic_flags&ICF_NO_RIP)) {
|
||||
@ -543,8 +543,8 @@ p4_sib:
|
||||
if (tmpi->ic_flags&ICF_RES_NOT_USED) {
|
||||
tmpil1->ic_flags|=ICF_RES_NOT_USED;
|
||||
tmpil1->res.type=MDF_NULL+tmpil1->res.type.raw_type;
|
||||
} else if (tmpi->arg1.type&MDF_STK &&
|
||||
tmpil1->res.type&MDF_STK) {
|
||||
} else if (tmpi->arg1.type&MDF_STACK &&
|
||||
tmpil1->res.type&MDF_STACK) {
|
||||
tmpi->arg1.type=MDF_REG+tmpi->arg1.type.raw_type;
|
||||
tmpi->arg1.disp=0;
|
||||
tmpil1->res.type=MDF_REG+tmpil1->res.type.raw_type;
|
||||
@ -683,7 +683,7 @@ p4_sib:
|
||||
tmpi=tmpi_next;
|
||||
}
|
||||
if (ps->ptr>2) {
|
||||
"Pass:%d Stk:%08X\n",cc->pass,ps->ptr;
|
||||
"Pass:%d Stack:%08X\n",cc->pass,ps->ptr;
|
||||
LexExcept(cc,"Compiler Optimization Error at ");
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ U0 OptPass5(CCompCtrl *cc)
|
||||
{
|
||||
CIntermediateCode *tmpi,*tmpi1;
|
||||
I64 code,i;
|
||||
CPrsStk *ps=cc->ps;
|
||||
CPrsStack *ps=cc->ps;
|
||||
ps->ptr=0;
|
||||
ps->ptr2=0;
|
||||
|
||||
@ -26,7 +26,7 @@ U0 OptPass5(CCompCtrl *cc)
|
||||
if (Bt(&tmpi->ic_data,i))
|
||||
ps->ptr--;
|
||||
}
|
||||
if (tmpi->arg2.type&MDF_STK) {
|
||||
if (tmpi->arg2.type&MDF_STACK) {
|
||||
tmpi1=ParsePop(ps);
|
||||
if (tmpi1->ic_code==IC_MOV || tmpi1->ic_code==IC_REG) {
|
||||
if (tmpi1->ic_flags & ICF_RES_TO_INT) {
|
||||
@ -50,7 +50,7 @@ U0 OptPass5(CCompCtrl *cc)
|
||||
}
|
||||
}
|
||||
|
||||
if (tmpi->arg1.type&MDF_STK) {
|
||||
if (tmpi->arg1.type&MDF_STACK) {
|
||||
tmpi1=ParsePop(ps);
|
||||
if (tmpi1->ic_code==IC_MOV || tmpi1->ic_code==IC_REG) {
|
||||
if (tmpi1->ic_flags & ICF_RES_TO_INT) {
|
||||
@ -77,14 +77,14 @@ U0 OptPass5(CCompCtrl *cc)
|
||||
OptSetNOP2(tmpi1);
|
||||
}
|
||||
}
|
||||
if (tmpi->res.type&MDF_STK &&
|
||||
if (tmpi->res.type&MDF_STACK &&
|
||||
!(tmpi->ic_flags&ICF_RES_NOT_USED))
|
||||
ParsePush(ps,tmpi);
|
||||
}
|
||||
tmpi=tmpi->next;
|
||||
}
|
||||
if (ps->ptr>2) {
|
||||
"Pass:%d Stk:%08X\n",cc->pass,ps->ptr;
|
||||
"Pass:%d Stack:%08X\n",cc->pass,ps->ptr;
|
||||
LexExcept(cc,"Compiler Optimization Error at ");
|
||||
}
|
||||
}
|
||||
|
@ -4,11 +4,11 @@ Bool OptIC6(CIntermediateCode *tmpi)
|
||||
if (tmpi->ic_code<IC_IMM_I64 || !(tmpil1=OptLag1(tmpi)))
|
||||
return FALSE;
|
||||
if (tmpil1->ic_code==IC_ADD_CONST && tmpi->ic_code==IC_DEREF &&
|
||||
tmpi->ic_flags&ICF_ARG1_WAS_STK && tmpi->arg1.type&MDF_REG &&
|
||||
tmpi->ic_flags&ICF_ARG1_WAS_STACK && tmpi->arg1.type&MDF_REG &&
|
||||
tmpil1->res.type&MDF_REG && I32_MIN<=tmpil1->ic_data<=I32_MAX &&
|
||||
!Bt(&cmp.non_ptr_vars_mask,tmpil1->arg1.reg)) {
|
||||
if (tmpil1->arg1.type&MDF_REG) {
|
||||
tmpi->ic_flags=tmpi->ic_flags&~ICF_ARG1_WAS_STK | tmpil1->ic_flags;
|
||||
tmpi->ic_flags=tmpi->ic_flags&~ICF_ARG1_WAS_STACK | tmpil1->ic_flags;
|
||||
tmpi->ic_code=IC_MOV;
|
||||
tmpi->arg1.type=MDF_DISP+tmpi->arg1_type_pointed_to;
|
||||
tmpi->arg1.reg=tmpil1->arg1.reg;
|
||||
@ -25,86 +25,86 @@ Bool OptIC6(CIntermediateCode *tmpi)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
U0 OptPass6Lag(CCompCtrl *cc,CPrsStk *ps,CIntermediateCode *tmpi,
|
||||
I64 *_stk_ptr,I64 reg_stk_size,I64 *_clobbered_reg_mask)
|
||||
U0 OptPass6Lag(CCompCtrl *cc,CPrsStack *ps,CIntermediateCode *tmpi,
|
||||
I64 *_stack_ptr,I64 reg_stack_size,I64 *_clobbered_reg_mask)
|
||||
{
|
||||
I64 stk_ptr=*_stk_ptr,code,
|
||||
clobbered_stk_tmp_mask,clobbered_reg_mask=*_clobbered_reg_mask;
|
||||
I64 stack_ptr=*_stack_ptr,code,
|
||||
clobbered_stack_tmp_mask,clobbered_reg_mask=*_clobbered_reg_mask;
|
||||
CHashFun *tmpf;
|
||||
code=tmpi->ic_code;
|
||||
if (tmpi->ic_flags&ICF_PASS_TRACE && Bt(&cc->saved_pass_trace,6)) {
|
||||
"%2d:",stk_ptr;
|
||||
"%2d:",stack_ptr;
|
||||
ICPut(cc,tmpi);
|
||||
}
|
||||
if (code==IC_CALL_START) {
|
||||
if (reg_stk_size==1 && stk_ptr>0)
|
||||
clobbered_stk_tmp_mask=REGG_STK_TMP;
|
||||
if (reg_stack_size==1 && stack_ptr>0)
|
||||
clobbered_stack_tmp_mask=REGG_STACK_TMP;
|
||||
else
|
||||
clobbered_stk_tmp_mask=0;
|
||||
clobbered_stack_tmp_mask=0;
|
||||
if (tmpf=tmpi->ic_data) {
|
||||
if (Bt(&tmpf->flags,Ff_INTERNAL))
|
||||
clobbered_stk_tmp_mask=0;
|
||||
clobbered_stack_tmp_mask=0;
|
||||
else {
|
||||
clobbered_stk_tmp_mask&=tmpf->clobbered_reg_mask;
|
||||
clobbered_stack_tmp_mask&=tmpf->clobbered_reg_mask;
|
||||
clobbered_reg_mask|=tmpf->clobbered_reg_mask;
|
||||
}
|
||||
}
|
||||
tmpi->ic_data=clobbered_stk_tmp_mask;
|
||||
ParsePush(ps,stk_ptr);
|
||||
ParsePush(ps,clobbered_stk_tmp_mask);
|
||||
tmpi->ic_data=clobbered_stack_tmp_mask;
|
||||
ParsePush(ps,stack_ptr);
|
||||
ParsePush(ps,clobbered_stack_tmp_mask);
|
||||
} else if (code==IC_CALL_END) {
|
||||
tmpi->ic_data=ParsePop(ps);
|
||||
stk_ptr=ParsePop(ps);
|
||||
stack_ptr=ParsePop(ps);
|
||||
} else if (code==IC_CALL_END2) {
|
||||
ps->ptr--;
|
||||
stk_ptr=ParsePop(ps);
|
||||
stack_ptr=ParsePop(ps);
|
||||
}
|
||||
if (intermediate_code_table[code].arg_count==IS_V_ARG)
|
||||
stk_ptr-=tmpi->ic_data>>3;
|
||||
if (tmpi->arg2.type&MDF_STK) {
|
||||
stk_ptr--;
|
||||
if (stk_ptr<reg_stk_size) {
|
||||
stack_ptr-=tmpi->ic_data>>3;
|
||||
if (tmpi->arg2.type&MDF_STACK) {
|
||||
stack_ptr--;
|
||||
if (stack_ptr<reg_stack_size) {
|
||||
tmpi->arg2.type=MDF_REG+tmpi->arg2.type.raw_type;
|
||||
tmpi->arg2.reg=Bsf(REGG_STK_TMP);
|
||||
tmpi->arg2.reg=Bsf(REGG_STACK_TMP);
|
||||
tmpi->arg2.disp=0;
|
||||
}
|
||||
}
|
||||
if (tmpi->arg1.type&MDF_STK) {
|
||||
stk_ptr--;
|
||||
if (stk_ptr<reg_stk_size) {
|
||||
if (tmpi->arg1.type&MDF_STACK) {
|
||||
stack_ptr--;
|
||||
if (stack_ptr<reg_stack_size) {
|
||||
tmpi->arg1.type=MDF_REG+tmpi->arg1.type.raw_type;
|
||||
tmpi->arg1.reg=Bsf(REGG_STK_TMP);
|
||||
tmpi->arg1.reg=Bsf(REGG_STACK_TMP);
|
||||
tmpi->arg1.disp=0;
|
||||
}
|
||||
}
|
||||
if (tmpi->res.type&MDF_STK && !(tmpi->ic_flags & ICF_PUSH_RES)) {
|
||||
stk_ptr++;
|
||||
if (stk_ptr<=reg_stk_size) {
|
||||
if (tmpi->res.type&MDF_STACK && !(tmpi->ic_flags & ICF_PUSH_RES)) {
|
||||
stack_ptr++;
|
||||
if (stack_ptr<=reg_stack_size) {
|
||||
tmpi->res.type=MDF_REG+tmpi->res.type.raw_type;
|
||||
tmpi->res.reg=Bsf(REGG_STK_TMP);
|
||||
clobbered_reg_mask|=REGG_STK_TMP;
|
||||
tmpi->res.reg=Bsf(REGG_STACK_TMP);
|
||||
clobbered_reg_mask|=REGG_STACK_TMP;
|
||||
tmpi->res.disp=0;
|
||||
}
|
||||
}
|
||||
while (OptIC6(tmpi));
|
||||
if (tmpi->res.type.raw_type!=RT_F64 && !(tmpi->ic_flags&ICF_USE_F64))
|
||||
tmpi->ic_flags|=ICF_USE_INT;
|
||||
*_stk_ptr=stk_ptr;
|
||||
*_stack_ptr=stack_ptr;
|
||||
*_clobbered_reg_mask=clobbered_reg_mask;
|
||||
}
|
||||
|
||||
U0 OptPass6(CCompCtrl *cc)
|
||||
{
|
||||
CIntermediateCode *tmpi,*tmpi_next,*tmpil1,*tmpil2,*old_tmpil2;
|
||||
I64 stk_ptr=0,reg_stk_size,clobbered_reg_mask=REGG_CLOBBERED;
|
||||
CPrsStk *ps=cc->ps;
|
||||
I64 stack_ptr=0,reg_stack_size,clobbered_reg_mask=REGG_CLOBBERED;
|
||||
CPrsStack *ps=cc->ps;
|
||||
ps->ptr=0;
|
||||
ps->ptr2=0;
|
||||
if (Bt(&cc->opts,OPTf_NO_REG_VAR) || cc->flags&CCF_NO_REG_OPT)
|
||||
reg_stk_size=0;
|
||||
reg_stack_size=0;
|
||||
else
|
||||
reg_stk_size=1;
|
||||
#assert REGG_STK_TMP==1<<9
|
||||
reg_stack_size=1;
|
||||
#assert REGG_STACK_TMP==1<<9
|
||||
tmpi=cc->coc.coc_head.next;
|
||||
old_tmpil2=NULL;
|
||||
tmpil1=tmpil2=&cmp.ic_nop;
|
||||
@ -113,8 +113,8 @@ U0 OptPass6(CCompCtrl *cc)
|
||||
if (tmpil1->ic_code>IC_NOP2)
|
||||
tmpil2=tmpil1;
|
||||
tmpil1=tmpi;
|
||||
if (tmpi->arg2.type&MDF_STK) {
|
||||
if (tmpil2->res.type&MDF_STK &&
|
||||
if (tmpi->arg2.type&MDF_STACK) {
|
||||
if (tmpil2->res.type&MDF_STACK &&
|
||||
!(tmpil2->ic_flags&ICF_PUSH_RES)) {
|
||||
if (tmpi->ic_code==IC_ASSIGN && tmpi->ic_flags&ICF_BY_VAL &&
|
||||
tmpi->ic_flags&ICF_RES_NOT_USED &&
|
||||
@ -128,8 +128,8 @@ U0 OptPass6(CCompCtrl *cc)
|
||||
tmpil2->res.reg =tmpi->arg1.reg;
|
||||
tmpil2->res.disp =tmpi->arg1.disp;
|
||||
tmpil2->ic_flags=tmpil2->ic_flags
|
||||
&~(ICF_RES_NOT_USED|ICF_RES_WAS_STK)
|
||||
|tmpi->ic_flags&~(ICF_BY_VAL|ICF_ARG1_WAS_STK|ICF_ARG2_WAS_STK);
|
||||
&~(ICF_RES_NOT_USED|ICF_RES_WAS_STACK)
|
||||
|tmpi->ic_flags&~(ICF_BY_VAL|ICF_ARG1_WAS_STACK|ICF_ARG2_WAS_STACK);
|
||||
old_tmpil2=NULL;
|
||||
OptSetNOP1(tmpi);
|
||||
} else {
|
||||
@ -141,7 +141,7 @@ U0 OptPass6(CCompCtrl *cc)
|
||||
tmpil2->res.disp=0;
|
||||
}
|
||||
}
|
||||
} else if (tmpi->arg1.type&MDF_STK && tmpil2->res.type&MDF_STK &&
|
||||
} else if (tmpi->arg1.type&MDF_STACK && tmpil2->res.type&MDF_STACK &&
|
||||
!(tmpil2->ic_flags&ICF_PUSH_RES)) {
|
||||
tmpi->arg1.type=MDF_REG+tmpi->arg1.type.raw_type;
|
||||
tmpi->arg1.disp=0;
|
||||
@ -156,10 +156,10 @@ U0 OptPass6(CCompCtrl *cc)
|
||||
}
|
||||
}
|
||||
if (tmpi->ic_flags & ICF_PUSH_RES)
|
||||
tmpi->res.type==MDF_STK+tmpi->res.type.raw_type;
|
||||
tmpi->res.type==MDF_STACK+tmpi->res.type.raw_type;
|
||||
if (old_tmpil2!=tmpil2) {
|
||||
if (tmpil2->ic_code>IC_NOP2)
|
||||
OptPass6Lag(cc,ps,tmpil2,&stk_ptr,reg_stk_size,&clobbered_reg_mask);
|
||||
OptPass6Lag(cc,ps,tmpil2,&stack_ptr,reg_stack_size,&clobbered_reg_mask);
|
||||
old_tmpil2=tmpil2;
|
||||
}
|
||||
}
|
||||
@ -169,11 +169,11 @@ U0 OptPass6(CCompCtrl *cc)
|
||||
tmpi=tmpi_next;
|
||||
}
|
||||
if (ps->ptr>2) {
|
||||
"Pass:%d Stk:%08X\n",cc->pass,ps->ptr;
|
||||
"Pass:%d Stack:%08X\n",cc->pass,ps->ptr;
|
||||
LexExcept(cc,"Compiler Optimization Error at ");
|
||||
}
|
||||
if (cc->htc.fun) {
|
||||
cc->htc.fun->used_reg_mask&=~REGG_STK_TMP;
|
||||
cc->htc.fun->used_reg_mask&=~REGG_STACK_TMP;
|
||||
cc->htc.fun->used_reg_mask|=clobbered_reg_mask;
|
||||
cc->htc.fun->clobbered_reg_mask=clobbered_reg_mask;
|
||||
if (Bt(&cc->flags,CCf_PASS_TRACE_PRESENT) &&
|
||||
|
@ -388,7 +388,7 @@ cc->pass==10 is final pass, code is placed into buf.
|
||||
if (cc->htc.fun) {
|
||||
if (Bt(&cc->htc.fun->flags,Ff_INTERRUPT))
|
||||
ICPopRegs(tmpi,REGG_CLOBBERED|cc->htc.fun->used_reg_mask&
|
||||
(REGG_LOCAL_VARS|REGG_LOCAL_NON_PTR_VARS|REGG_STK_TMP));
|
||||
(REGG_LOCAL_VARS|REGG_LOCAL_NON_PTR_VARS|REGG_STACK_TMP));
|
||||
else
|
||||
ICPopRegs(tmpi,cc->htc.fun->used_reg_mask&
|
||||
(REGG_LOCAL_VARS|REGG_LOCAL_NON_PTR_VARS));
|
||||
@ -702,7 +702,7 @@ cc->pass==10 is final pass, code is placed into buf.
|
||||
if (cc->htc.fun) {
|
||||
if (Bt(&cc->htc.fun->flags,Ff_INTERRUPT))
|
||||
ICPushRegs(tmpi,REGG_CLOBBERED|cc->htc.fun->used_reg_mask&
|
||||
(REGG_LOCAL_VARS|REGG_LOCAL_NON_PTR_VARS|REGG_STK_TMP));
|
||||
(REGG_LOCAL_VARS|REGG_LOCAL_NON_PTR_VARS|REGG_STACK_TMP));
|
||||
else {
|
||||
if (sys_var_init_flag && i)
|
||||
ICLocalVarInit(tmpi);
|
||||
|
@ -12,11 +12,11 @@
|
||||
#define PE_POP_ALL1 11
|
||||
#define PE_POP_ALL2 12
|
||||
|
||||
CIntermediateCode *ParseAddOp(CCompCtrl *cc,I64 stk_op,CHashClass *tmpc)
|
||||
CIntermediateCode *ParseAddOp(CCompCtrl *cc,I64 stack_op,CHashClass *tmpc)
|
||||
{
|
||||
CIntermediateCode *tmpi=cc->coc.coc_head.last;
|
||||
Bool div_sizeof=FALSE;
|
||||
switch (stk_op.u16[0]) {
|
||||
switch (stack_op.u16[0]) {
|
||||
case IC_ADD:
|
||||
if (tmpc->ptr_stars_count && !tmpi->ic_class->ptr_stars_count &&
|
||||
tmpi->ic_class->raw_type!=RT_F64) {
|
||||
@ -45,8 +45,8 @@ CIntermediateCode *ParseAddOp(CCompCtrl *cc,I64 stk_op,CHashClass *tmpc)
|
||||
}
|
||||
break;
|
||||
}
|
||||
tmpi=ICAdd(cc,stk_op,0,tmpc);
|
||||
if (stk_op.u8[3]&ECF_HAS_PUSH_CMP) {
|
||||
tmpi=ICAdd(cc,stack_op,0,tmpc);
|
||||
if (stack_op.u8[3]&ECF_HAS_PUSH_CMP) {
|
||||
tmpi->ic_flags|=ICF_POP_CMP;
|
||||
ICAdd(cc,IC_NOP1,0,cmp.internal_types[RT_I64]);
|
||||
ICAdd(cc,IC_AND_AND,0,cmp.internal_types[RT_I64],ICF_POP_CMP);
|
||||
@ -62,9 +62,9 @@ CIntermediateCode *ParseAddOp(CCompCtrl *cc,I64 stk_op,CHashClass *tmpc)
|
||||
return tmpi;
|
||||
}
|
||||
|
||||
U0 ParseExpression2(CCompCtrl *cc,I64 *_max_prec,CPrsStk *ps)
|
||||
U0 ParseExpression2(CCompCtrl *cc,I64 *_max_prec,CPrsStack *ps)
|
||||
{
|
||||
I64 i,cur_op,stk_op,state,max_prec=PREC_NULL,unary_pre_prec,paren_prec,
|
||||
I64 i,cur_op,stack_op,state,max_prec=PREC_NULL,unary_pre_prec,paren_prec,
|
||||
unary_post_prec,left_prec=PREC_MAX;
|
||||
CIntermediateCode *tmpi;
|
||||
CHashClass *tmpc;
|
||||
@ -130,42 +130,42 @@ pe_check_binary_ops1:
|
||||
|
||||
case PE_CHECK_BINARY_OPS2:
|
||||
pe_check_binary_ops2:
|
||||
stk_op=ParsePop(ps);
|
||||
stack_op=ParsePop(ps);
|
||||
tmpc=ParsePop(ps);
|
||||
if (!(0<stk_op.u8[2]<=PREC_UNARY_PRE+ASSOC_MASK))
|
||||
if (!(0<stack_op.u8[2]<=PREC_UNARY_PRE+ASSOC_MASK))
|
||||
goto pe_do_binary_op;
|
||||
|
||||
case PE_DO_UNARY_OP:
|
||||
if (cur_op.u16[0]==IC_POWER &&
|
||||
stk_op.u16[0]==IC_UNARY_MINUS) {
|
||||
stack_op.u16[0]==IC_UNARY_MINUS) {
|
||||
Lex(cc); //skip ` op
|
||||
left_prec=cur_op.i8[2];
|
||||
ParsePush(ps,tmpc);
|
||||
ParsePush(ps,stk_op);
|
||||
ParsePush(ps,stack_op);
|
||||
ParsePush(ps,cc->coc.coc_head.last->ic_class);
|
||||
ParsePush(ps,cur_op);
|
||||
goto pe_unary_term1;
|
||||
} else {
|
||||
tmpi=cc->coc.coc_head.last;
|
||||
tmpc=tmpi->ic_class;
|
||||
if (stk_op.u16[0]==IC_DEREF && tmpc->ptr_stars_count)
|
||||
if (stack_op.u16[0]==IC_DEREF && tmpc->ptr_stars_count)
|
||||
tmpc--;
|
||||
else if (stk_op.u16[0]==IC_ADDR) {
|
||||
else if (stack_op.u16[0]==IC_ADDR) {
|
||||
cc->abs_counts.c_addres++;
|
||||
if (intermediate_code_table[tmpi->ic_code].type==IST_DEREF)
|
||||
OptFree(tmpi);
|
||||
tmpc++;
|
||||
}
|
||||
tmpc=OptClassFwd(tmpc);
|
||||
if (stk_op)
|
||||
ICAdd(cc,stk_op,0,tmpc);
|
||||
if (stack_op)
|
||||
ICAdd(cc,stack_op,0,tmpc);
|
||||
goto pe_check_binary_ops2;
|
||||
}
|
||||
|
||||
case PE_DO_BINARY_OP:
|
||||
pe_do_binary_op:
|
||||
ParsePush(ps,tmpc);
|
||||
ParsePush(ps,stk_op);
|
||||
ParsePush(ps,stack_op);
|
||||
if (!cur_op)
|
||||
goto pe_pop_all1;
|
||||
|
||||
@ -210,20 +210,20 @@ pe_do_binary_op:
|
||||
|
||||
case PE_POP_HIGHER:
|
||||
pe_pop_higher:
|
||||
stk_op=ParsePop(ps); //pop ops of higher prec
|
||||
stack_op=ParsePop(ps); //pop ops of higher prec
|
||||
tmpc=ParsePop(ps);
|
||||
if (!stk_op)
|
||||
if (!stack_op)
|
||||
goto pe_push_lower;
|
||||
else if (cur_op.u8[2]&~ASSOC_MASK==stk_op.u8[2]&~ASSOC_MASK) {
|
||||
else if (cur_op.u8[2]&~ASSOC_MASK==stack_op.u8[2]&~ASSOC_MASK) {
|
||||
if (cur_op.u8[2]&ASSOCF_RIGHT)
|
||||
goto pe_push_lower;
|
||||
} else if (cur_op.u8[2]&~ASSOC_MASK<=stk_op.u8[2]&~ASSOC_MASK)
|
||||
} else if (cur_op.u8[2]&~ASSOC_MASK<=stack_op.u8[2]&~ASSOC_MASK)
|
||||
goto pe_push_lower;
|
||||
|
||||
tmpi=ParseAddOp(cc,stk_op,tmpc);
|
||||
tmpi=ParseAddOp(cc,stack_op,tmpc);
|
||||
|
||||
if (intermediate_code_table[cur_op.u16[0]].type==IST_CMP &&
|
||||
intermediate_code_table[stk_op.u16[0]].type==IST_CMP) {
|
||||
intermediate_code_table[stack_op.u16[0]].type==IST_CMP) {
|
||||
tmpi->ic_flags|=ICF_PUSH_CMP;
|
||||
ICAdd(cc,IC_NOP1,0,cmp.internal_types[RT_I64]);
|
||||
ICAdd(cc,IC_PUSH_CMP,0,tmpc);
|
||||
@ -235,7 +235,7 @@ pe_pop_higher:
|
||||
case PE_PUSH_LOWER:
|
||||
pe_push_lower:
|
||||
ParsePush(ps,tmpc);
|
||||
ParsePush(ps,stk_op);
|
||||
ParsePush(ps,stack_op);
|
||||
ParsePush(ps,cc->coc.coc_head.last->ic_class);
|
||||
ParsePush(ps,cur_op);
|
||||
goto pe_unary_term1;
|
||||
@ -248,11 +248,11 @@ pe_pop_all1:
|
||||
ParenWarning(cc);
|
||||
case PE_POP_ALL2:
|
||||
pe_pop_all2:
|
||||
stk_op=ParsePop(ps);
|
||||
stack_op=ParsePop(ps);
|
||||
tmpc=ParsePop(ps);
|
||||
if (!stk_op.u16[0])
|
||||
if (!stack_op.u16[0])
|
||||
goto pe_done;
|
||||
ParseAddOp(cc,stk_op,tmpc);
|
||||
ParseAddOp(cc,stack_op,tmpc);
|
||||
goto pe_pop_all2;
|
||||
}
|
||||
}
|
||||
@ -261,15 +261,15 @@ pe_done:
|
||||
*_max_prec=max_prec;
|
||||
}
|
||||
|
||||
Bool ParseExpression(CCompCtrl *cc,I64 *_max_prec,Bool end_exp,CPrsStk *_ps=NULL)
|
||||
Bool ParseExpression(CCompCtrl *cc,I64 *_max_prec,Bool end_exp,CPrsStack *_ps=NULL)
|
||||
{
|
||||
Bool res=TRUE;
|
||||
I64 old_flags=cc->flags;
|
||||
CPrsStk *ps;
|
||||
CPrsStack *ps;
|
||||
if (_ps)
|
||||
ps=_ps;
|
||||
else {
|
||||
ps=MAlloc(sizeof(CPrsStk));
|
||||
ps=MAlloc(sizeof(CPrsStack));
|
||||
ps->ptr=0;
|
||||
ps->ptr2=0;
|
||||
}
|
||||
@ -380,7 +380,7 @@ U0 ParseOffsetOf(CCompCtrl *cc)
|
||||
ICAdd(cc,IC_IMM_I64,i,cmp.internal_types[RT_I64]);
|
||||
}
|
||||
|
||||
I64 ParseFunCall(CCompCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf)
|
||||
I64 ParseFunCall(CCompCtrl *cc,CPrsStack *ps,Bool indirect,CHashFun *tmpf)
|
||||
{
|
||||
I64 i,argc_count,default_val;
|
||||
Bool is_first_arg=TRUE,needs_right_paren,is_print,is_putchars,
|
||||
@ -590,7 +590,7 @@ I64 ParseFunCall(CCompCtrl *cc,CPrsStk *ps,Bool indirect,CHashFun *tmpf)
|
||||
return PE_UNARY_MODIFIERS;
|
||||
}
|
||||
|
||||
I64 ParseUnaryTerm(CCompCtrl *cc,CPrsStk *ps,CMemberList **_local_var,
|
||||
I64 ParseUnaryTerm(CCompCtrl *cc,CPrsStack *ps,CMemberList **_local_var,
|
||||
CArrayDim **_tmpad,I64 *max_prec,I64 *unary_pre_prec,I64 *paren_prec)
|
||||
{
|
||||
I64 i,j;
|
||||
@ -732,7 +732,7 @@ I64 ParseUnaryTerm(CCompCtrl *cc,CPrsStk *ps,CMemberList **_local_var,
|
||||
else {
|
||||
if (PREC_TERM>*max_prec)
|
||||
*max_prec=PREC_TERM;
|
||||
if (cc->lex_include_stk->flags&LFSF_DEFINE)
|
||||
if (cc->lex_include_stack->flags&LFSF_DEFINE)
|
||||
paren_warn=FALSE;
|
||||
else
|
||||
paren_warn=TRUE;
|
||||
@ -957,7 +957,7 @@ pu_export_sys_sym:
|
||||
LexExcept(cc,"Missing expression at ");
|
||||
}
|
||||
|
||||
I64 ParseUnaryModifier(CCompCtrl *cc,CPrsStk *ps,CMemberList **_local_var,
|
||||
I64 ParseUnaryModifier(CCompCtrl *cc,CPrsStack *ps,CMemberList **_local_var,
|
||||
CArrayDim **_tmpad,I64 *unary_post_prec)
|
||||
{
|
||||
CHashClass *tmpc,*tmpc1;
|
||||
|
@ -1,24 +1,24 @@
|
||||
U0 ParsePush(CPrsStk *ps,I64 val)
|
||||
U0 ParsePush(CPrsStack *ps,I64 val)
|
||||
{
|
||||
ps->stk[++ps->ptr]=val;
|
||||
ps->stack[++ps->ptr]=val;
|
||||
}
|
||||
|
||||
I64 ParsePop(CPrsStk *ps)
|
||||
I64 ParsePop(CPrsStack *ps)
|
||||
{
|
||||
return ps->stk[ps->ptr--];
|
||||
return ps->stack[ps->ptr--];
|
||||
}
|
||||
|
||||
U0 ParsePush2(CPrsStk *ps,I64 val)
|
||||
U0 ParsePush2(CPrsStack *ps,I64 val)
|
||||
{
|
||||
ps->stk2[++ps->ptr2]=val;
|
||||
ps->stack2[++ps->ptr2]=val;
|
||||
}
|
||||
|
||||
I64 ParsePop2(CPrsStk *ps)
|
||||
I64 ParsePop2(CPrsStack *ps)
|
||||
{
|
||||
return ps->stk2[ps->ptr2--];
|
||||
return ps->stack2[ps->ptr2--];
|
||||
}
|
||||
|
||||
U0 ParsePopDeref(CPrsStk *ps)
|
||||
U0 ParsePopDeref(CPrsStack *ps)
|
||||
{
|
||||
I64 i=ParsePop(ps);
|
||||
CHashClass *tmpc=ParsePop(ps);
|
||||
|
@ -81,7 +81,7 @@ CHashFun *ParseFunJoin(CCompCtrl *cc,CHashClass *tmp_return,
|
||||
} else
|
||||
tmpf=NULL;
|
||||
if (tmpf) {
|
||||
tmpf->used_reg_mask=REGG_CLOBBERED+REGG_SAVED+REGG_STK_TMP;
|
||||
tmpf->used_reg_mask=REGG_CLOBBERED+REGG_SAVED+REGG_STACK_TMP;
|
||||
Free(tmpf->src_link);
|
||||
tmpf->src_link=NULL;
|
||||
Free(tmpf->idx);
|
||||
@ -95,8 +95,8 @@ CHashFun *ParseFunJoin(CCompCtrl *cc,CHashClass *tmp_return,
|
||||
} else {
|
||||
tmpf=ParseFunNew;
|
||||
header_return=NULL;
|
||||
tmpf->used_reg_mask=REGG_CLOBBERED+REGG_SAVED+REGG_STK_TMP;
|
||||
tmpf->clobbered_reg_mask=REGG_CLOBBERED+REGG_STK_TMP;
|
||||
tmpf->used_reg_mask=REGG_CLOBBERED+REGG_SAVED+REGG_STACK_TMP;
|
||||
tmpf->clobbered_reg_mask=REGG_CLOBBERED+REGG_STACK_TMP;
|
||||
tmpf->str=name;
|
||||
if (cc->flags&CCF_AOT_COMPILE)
|
||||
tmpf->exe_addr=aotc->rip;
|
||||
@ -144,8 +144,8 @@ U0 ParseFun(CCompCtrl *cc,CHashClass *tmp_return,U8 *name,I64 fsp_flags)
|
||||
I64 i,j,size,*r;
|
||||
Bool old_trace;
|
||||
|
||||
cc->fun_lex_file=cc->lex_include_stk;
|
||||
cc->min_line=cc->max_line=cc->lex_include_stk->line_num;
|
||||
cc->fun_lex_file=cc->lex_include_stack;
|
||||
cc->min_line=cc->max_line=cc->lex_include_stack->line_num;
|
||||
|
||||
cc->flags&=~CCF_NO_REG_OPT;
|
||||
cc->htc.local_var_list=cc->htc.fun=ParseFunJoin(cc,tmp_return,name,fsp_flags);
|
||||
@ -195,11 +195,11 @@ U0 ParseFun(CCompCtrl *cc,CHashClass *tmp_return,U8 *name,I64 fsp_flags)
|
||||
if (tmpm->flags & MLF_NO_UNUSED_WARN) {
|
||||
if (tmpm->use_count>1&&StrCmp(tmpm->str,"_anon_"))
|
||||
PrintWarn("Unneeded no_warn\n $$LK,\"FL:%s,%d\"$$'%s' in '%s'\n",
|
||||
cc->lex_include_stk->full_name,cc->lex_include_stk->line_num,
|
||||
cc->lex_include_stack->full_name,cc->lex_include_stack->line_num,
|
||||
tmpm->str,cc->htc.fun->str);
|
||||
} else if (!tmpm->use_count && GetOption(OPTf_WARN_UNUSED_VAR))
|
||||
PrintWarn("Unused var\n $$LK,\"FL:%s,%d\"$$'%s' in '%s'\n",
|
||||
cc->lex_include_stk->full_name,cc->lex_include_stk->line_num,
|
||||
cc->lex_include_stack->full_name,cc->lex_include_stack->line_num,
|
||||
tmpm->str,cc->htc.fun->str);
|
||||
tmpm=tmpm->next;
|
||||
}
|
||||
@ -924,8 +924,8 @@ Bool ParseStatement(CCompCtrl *cc,I64 try_count=0,
|
||||
Lex(cc);
|
||||
while (cc->token!='}' && cc->token!=TK_EOF)
|
||||
ParseStatement(cc,try_count,lb_break);
|
||||
if (cc->lex_include_stk==cc->fun_lex_file)
|
||||
cc->max_line=cc->lex_include_stk->line_num;
|
||||
if (cc->lex_include_stack==cc->fun_lex_file)
|
||||
cc->max_line=cc->lex_include_stack->line_num;
|
||||
if (Lex(cc)!=',') goto sm_done;
|
||||
} else if (cc->token==';') {
|
||||
if (cmp_flags&CMPF_PRS_SEMICOLON)
|
||||
|
@ -583,7 +583,7 @@ U0 Ui(U8 *buf,U8 **_rip,I64 seg_size=64,I64 *_jmp_dst=NULL,Bool just_ins=FALSE)
|
||||
case ARGT_STI:
|
||||
rip--;
|
||||
CatPrint(arg1_st,"%Z",*rip++ - tmpins->opcode[tmpins->opcode_count-1],
|
||||
"ST_FSTK_REGS");
|
||||
"ST_FSTACK_REGS");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -622,7 +622,7 @@ U0 Ui(U8 *buf,U8 **_rip,I64 seg_size=64,I64 *_jmp_dst=NULL,Bool just_ins=FALSE)
|
||||
case ARGT_STI:
|
||||
rip--;
|
||||
CatPrint(arg2_st,"%Z",*rip++ -tmpins->opcode[tmpins->opcode_count-1],
|
||||
"ST_FSTK_REGS");
|
||||
"ST_FSTACK_REGS");
|
||||
break;
|
||||
}
|
||||
if (tmpins->flags&IEF_ENDING_ZERO)
|
||||
|
@ -153,7 +153,7 @@ $FG,5$$TX+CX,"TODO: Too Hard, or Not Worth Doing."$$FG$
|
||||
|
||||
* Log-to-file is inefficient because we load and save whole file.
|
||||
|
||||
* $LK,"ICMov",A="MN:ICMov"$() $LK,"PUSH_CMP",A="FF:::/Compiler/BackLib.HC,PUSH_CMP"$ and $LK,"MDf_STK",A="MN:MDf_STK"$? Perhaps, it's okay.
|
||||
* $LK,"ICMov",A="MN:ICMov"$() $LK,"PUSH_CMP",A="FF:::/Compiler/BackLib.HC,PUSH_CMP"$ and $LK,"MDf_STACK",A="MN:MDf_STACK"$? Perhaps, it's okay.
|
||||
|
||||
* Short FAT32 ~ names.
|
||||
|
||||
@ -356,7 +356,7 @@ $FG,5$$TX+CX,"Inspirational Ideas"$$FG$
|
||||
|
||||
* More $LK,"Controls",A="MN:CCtrl"$?
|
||||
|
||||
* Compiler: More use of more floating-point stk?
|
||||
* Compiler: More use of more floating-point stack?
|
||||
|
||||
* Compiler: More aggressive in $LK,"CompF2PushPop",A="MN:CompF2PushPop"$() with types besides MOV and F64.
|
||||
|
||||
|
@ -9,7 +9,7 @@ U0 TOSDebugDistro1()
|
||||
DefinePrint("TOS_DBG_DISTRO","0x%X",
|
||||
CeilI64(SYS_KERNEL_END+SLOP,BLK_SIZE));
|
||||
DefinePrint("TOS_DBG_DISTRO_END", "0x%X",FloorI64(
|
||||
(BOOT_RAM_LIMIT-(BOOT_STK_SIZE+DVD_BOOT_LOADER_SIZE))>>4<<4-
|
||||
(BOOT_RAM_LIMIT-(BOOT_STACK_SIZE+DVD_BOOT_LOADER_SIZE))>>4<<4-
|
||||
(bfh(I64)-SYS_KERNEL_END)-SLOP,BLK_SIZE));
|
||||
DefinePrint("CFG_DBG_DISTRO_FILE","\"/Tmp/DebugDistro.BIN\"");
|
||||
} TOSDebugDistro1;
|
||||
|
@ -13,7 +13,7 @@ asm {
|
||||
|
||||
_BEEPS::
|
||||
//You can always clobber RAX,RBX,RCX,RDX,R8,R9. The compiler expects that.
|
||||
//See $LK,"REGG_CLOBBERED",A="MN:REGG_CLOBBERED"$ and $LK,"REGG_STK_TMP",A="MN:REGG_STK_TMP"$.
|
||||
//See $LK,"REGG_CLOBBERED",A="MN:REGG_CLOBBERED"$ and $LK,"REGG_STACK_TMP",A="MN:REGG_STACK_TMP"$.
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
MOV RCX,U64 SF_ARG1[RBP] //$LK,"SF_ARG1",A="FF:::/Kernel/KernelA.HH,SF_ARG1"$
|
||||
|
@ -19,7 +19,7 @@ JIFFIES_MESSAGE: DU8 "Jiffies:",0;
|
||||
|
||||
_BEEPS2::
|
||||
//You can clobber RAX,RBX,RCX,RDX,R8,R9. The compiler expects that.
|
||||
//See $LK,"REGG_CLOBBERED",A="MN:REGG_CLOBBERED"$ and $LK,"REGG_STK_TMP",A="MN:REGG_STK_TMP"$.
|
||||
//See $LK,"REGG_CLOBBERED",A="MN:REGG_CLOBBERED"$ and $LK,"REGG_STACK_TMP",A="MN:REGG_STACK_TMP"$.
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
MOV RCX,U64 SF_ARG1[RBP] //$LK,"SF_ARG1",A="FF:::/Kernel/KernelA.HH,SF_ARG1"$
|
||||
|
@ -7,7 +7,7 @@
|
||||
asm {
|
||||
_BUZZ_FIZZ::
|
||||
PUSH RBP
|
||||
MOV RBP,RSP //Always set-up stk frame. (Stack Gets Traced)
|
||||
MOV RBP,RSP //Always set-up stack frame. (Stack Gets Traced)
|
||||
PUSH RSI //See $LK,"REGG_LOCAL_VARS",A="MN:REGG_LOCAL_VARS"$ & $LK,"REGG_LOCAL_NON_PTR_VARS",A="MN:REGG_LOCAL_NON_PTR_VARS"$
|
||||
PUSH RDI
|
||||
MOV RSI,FIZZ_SPAN-RANGE_START%FIZZ_SPAN+1
|
||||
|
@ -18,16 +18,16 @@ U0 DrawIt(CTask *task,CDC *)
|
||||
TextPrint(task,0,1,ATTR>>8,"Solve maze starting at right click.");
|
||||
}
|
||||
|
||||
#define STK_SIZE 2048
|
||||
#define STACK_SIZE 2048
|
||||
//We would put these as local vars
|
||||
//in SolveMaze() but the system stk size
|
||||
//in SolveMaze() but the system stack size
|
||||
//is limited, so it's a bad habit.The heap
|
||||
//is the normal ZenithOS technique, but
|
||||
//it's a pain in this case.
|
||||
I64 stk_ptr,
|
||||
stk_x [STK_SIZE],
|
||||
stk_y [STK_SIZE],
|
||||
stk_dir[STK_SIZE];
|
||||
I64 stack_ptr,
|
||||
stack_x [STACK_SIZE],
|
||||
stack_y [STACK_SIZE],
|
||||
stack_dir[STACK_SIZE];
|
||||
|
||||
//Four directions:
|
||||
// 0=Up,1=right,2=down,3=left
|
||||
@ -37,10 +37,10 @@ I64 dir_x[4]={ 0,+1, 0,-1}, // Could use $LK,"gr_x_offsets2",A="MN:gr_x_offsets
|
||||
U0 SolveMaze(I64 x,I64 y)
|
||||
{
|
||||
I64 dir=0;
|
||||
stk_ptr=0;
|
||||
stk_x[stk_ptr]=x;
|
||||
stk_y[stk_ptr]=y;
|
||||
stk_dir[stk_ptr++]=dir;
|
||||
stack_ptr=0;
|
||||
stack_x[stack_ptr]=x;
|
||||
stack_y[stack_ptr]=y;
|
||||
stack_dir[stack_ptr++]=dir;
|
||||
while (TRUE) {
|
||||
if (!(0<=x<MinI64(Fs->win_width,TEXT_COLS)) ||
|
||||
!(0<=y<MinI64(Fs->win_height,TEXT_ROWS)) ) {
|
||||
@ -56,17 +56,17 @@ U0 SolveMaze(I64 x,I64 y)
|
||||
x-=dir_x[dir];
|
||||
y-=dir_y[dir];
|
||||
if (++dir==4) {
|
||||
if (--stk_ptr<0) return;
|
||||
x=stk_x[stk_ptr];
|
||||
y=stk_y[stk_ptr];
|
||||
dir=stk_dir[stk_ptr];
|
||||
if (--stack_ptr<0) return;
|
||||
x=stack_x[stack_ptr];
|
||||
y=stack_y[stack_ptr];
|
||||
dir=stack_dir[stack_ptr];
|
||||
}
|
||||
} else {
|
||||
dir=0;
|
||||
stk_x[stk_ptr]=x;
|
||||
stk_y[stk_ptr]=y;
|
||||
stk_dir[stk_ptr++]=dir;
|
||||
if (stk_ptr==STK_SIZE) return;
|
||||
stack_x[stack_ptr]=x;
|
||||
stack_y[stack_ptr]=y;
|
||||
stack_dir[stack_ptr++]=dir;
|
||||
if (stack_ptr==STACK_SIZE) return;
|
||||
Sleep(100);
|
||||
if (ScanChar)
|
||||
throw;
|
||||
|
@ -116,5 +116,5 @@ TreeCommonAncestor;
|
||||
/*Be careful with recursive routines in ZenithOS
|
||||
because the stack does not grow and will overflow.
|
||||
|
||||
See $LK,"::/Demo/StkGrow.HC"$.
|
||||
See $LK,"::/Demo/StackGrow.HC"$.
|
||||
*/
|
||||
|
@ -53,7 +53,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
}
|
||||
}
|
||||
|
||||
U0 FESave(Bool pmt)
|
||||
U0 FESave(Bool prompt)
|
||||
{
|
||||
U8 old_draw_it=Fs->draw_it;
|
||||
CDoc *doc=DocNew;
|
||||
@ -67,7 +67,7 @@ U0 FESave(Bool pmt)
|
||||
DocPrint(doc,"\n");
|
||||
}
|
||||
Fs->draw_it=NULL;
|
||||
DocWrite(doc,pmt);
|
||||
DocWrite(doc,prompt);
|
||||
Fs->draw_it=old_draw_it;
|
||||
DocDel(doc);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ I64 TopDisk(I64 pole)
|
||||
return -1;
|
||||
}
|
||||
|
||||
I64 PosInStk(I64 pole,I64 disk)
|
||||
I64 PosInStack(I64 pole,I64 disk)
|
||||
{
|
||||
I64 res=0,i;
|
||||
for (i=DISKS_NUM-1;i>disk;i--)
|
||||
@ -35,7 +35,7 @@ U0 SetDisksRestXY()
|
||||
for (i=0;i<DISKS_NUM;i++) {
|
||||
disks_x[i]=poles_x[disks_pole[i]];
|
||||
disks_y[i]=Fs->pix_height-PEDESTAL_HEIGHT
|
||||
-(DISK_HEIGHT+1)/2-1-(DISK_HEIGHT+1)*PosInStk(disks_pole[i],i);
|
||||
-(DISK_HEIGHT+1)/2-1-(DISK_HEIGHT+1)*PosInStack(disks_pole[i],i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ U0 MoveDisks(I64 src_pole,I64 dst_pole,I64 num)
|
||||
disks_pole[top]=dst_pole;
|
||||
for (y=disks_y[top];
|
||||
y<Fs->pix_height-PEDESTAL_HEIGHT-(DISK_HEIGHT+1)/2-1
|
||||
-(DISK_HEIGHT+1)*PosInStk(dst_pole,top);y++) {
|
||||
-(DISK_HEIGHT+1)*PosInStack(dst_pole,top);y++) {
|
||||
disks_y[top]=y;
|
||||
MySleep;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ $ID,2$For this mini compiler, some things you should know about 64-bit asm:
|
||||
|
||||
* Putting a 0x48, known as the REX byte, in front of an inst makes it 64-bit size.
|
||||
|
||||
* "PUSH EAX", "POP EAX" and "XOR EAX,EAX" will behave as 64-bit even without REX because the stk is always 64 bit and because the XOR clears the upper 32-bits.
|
||||
* "PUSH EAX", "POP EAX" and "XOR EAX,EAX" will behave as 64-bit even without REX because the stack is always 64 bit and because the XOR clears the upper 32-bits.
|
||||
|
||||
It is okay in ZenithOS to change RAX, RBX, RCX, RDX, R8 and R9 without restoring them to their original values.
|
||||
$ID,-2$$WW,0$*/
|
||||
|
@ -9,13 +9,13 @@ fault, switches to ring 3, and generates
|
||||
a fault to switch back.
|
||||
*/
|
||||
|
||||
U8 *old_stk,*new_rip;
|
||||
U8 *old_stack,*new_rip;
|
||||
|
||||
asm {
|
||||
INT_TO_RING0:: //Set to handle general protection 0xD fault temporarily.
|
||||
INC U64 [SYS_PROGRESS1]
|
||||
PUSH U32 CGDT.ds //STKSEG
|
||||
MOV RAX,U64 [&old_stk]
|
||||
PUSH U32 CGDT.ds //STACKSEG
|
||||
MOV RAX,U64 [&old_stack]
|
||||
PUSH RAX
|
||||
PUSH U32 0 //FLAGS--interrupts off
|
||||
PUSH U32 CGDT.cs64
|
||||
@ -36,7 +36,7 @@ U0 Ring3Demo()
|
||||
LTR AX
|
||||
|
||||
asm {
|
||||
MOV U64 [&old_stk],RSP
|
||||
MOV U64 [&old_stack],RSP
|
||||
|
||||
LEA RAX,[R3_CALLBACK]
|
||||
MOV U64 [&new_rip],RAX
|
||||
@ -45,8 +45,8 @@ U0 Ring3Demo()
|
||||
MOV DS,AX
|
||||
MOV ES,AX
|
||||
|
||||
PUSH U32 CGDT.ds_ring3+3 //STKSEG
|
||||
PUSH U64 [&old_stk]
|
||||
PUSH U32 CGDT.ds_ring3+3 //STACKSEG
|
||||
PUSH U64 [&old_stack]
|
||||
PUSH U32 0 //FLAGS--interrupts off
|
||||
PUSH U32 CGDT.cs64_ring3+3
|
||||
LEA RAX,[R3_START]
|
||||
|
@ -7,14 +7,14 @@ if you misuse it and it will crash.
|
||||
$LK,"U",A="MN:U"$() to see what code was generated.
|
||||
*/
|
||||
|
||||
#define CNT 0x1000000
|
||||
#define COUNT 0x1000000
|
||||
|
||||
I64 glbl;
|
||||
|
||||
U0 MPUnlockedInc(I64)
|
||||
{
|
||||
I64 i;
|
||||
for (i=0;i<CNT;i++)
|
||||
for (i=0;i<COUNT;i++)
|
||||
glbl++;
|
||||
}
|
||||
|
||||
@ -26,13 +26,13 @@ U0 UnlockedInc()
|
||||
tmpm1=JobQueue(&MPUnlockedInc,NULL,1,0);
|
||||
JobResGet(tmpm0);
|
||||
JobResGet(tmpm1);
|
||||
"Correct Count:%X Actual Count:%X\n",CNT*2,glbl;
|
||||
"Correct Count:%X Actual Count:%X\n",COUNT*2,glbl;
|
||||
}
|
||||
|
||||
U0 MPLockedInc(I64)
|
||||
{
|
||||
I64 i;
|
||||
for (i=0;i<CNT;i++)
|
||||
for (i=0;i<COUNT;i++)
|
||||
lock //Can be used without {}
|
||||
glbl++;
|
||||
}
|
||||
@ -45,7 +45,7 @@ U0 LockedInc()
|
||||
tmpm1=JobQueue(&MPLockedInc,NULL,1,0);
|
||||
JobResGet(tmpm0);
|
||||
JobResGet(tmpm1);
|
||||
"Correct Count:%X Actual Count:%X\n",CNT*2,glbl;
|
||||
"Correct Count:%X Actual Count:%X\n",COUNT*2,glbl;
|
||||
}
|
||||
|
||||
UnlockedInc;
|
||||
|
@ -174,3 +174,4 @@ U0 Morse()
|
||||
}
|
||||
|
||||
Morse;
|
||||
|
@ -1,11 +1,11 @@
|
||||
//Pass the task structure you
|
||||
//wish to spy upon.
|
||||
|
||||
U0 SpyStkRep(CTask *task)
|
||||
U0 SpyStackRep(CTask *task)
|
||||
{
|
||||
CDoc *doc=DocDblBufStart;
|
||||
while (!ScanChar && TaskValidate(task)) {
|
||||
StkRep(task);
|
||||
StackRep(task);
|
||||
'\n';
|
||||
"$$BK,1$$PRESS A KEY$$BK,0$$\n";
|
||||
DocDblBufSwap;
|
||||
@ -44,11 +44,11 @@ U0 Spy()
|
||||
'\n';
|
||||
task=GetI64("Task Addr: ",0);
|
||||
if (TaskValidate(task)) {
|
||||
"\n\n\t$$BT,\"StkRep\",LM=\"1\n\"$$\n\n\n"
|
||||
"\n\n\t$$BT,\"StackRep\",LM=\"1\n\"$$\n\n\n"
|
||||
"\n\n\t$$BT,\"CallerRep\",LM=\"2\n\"$$\n\n\n";
|
||||
i=GetI64("",0);
|
||||
if (i==1)
|
||||
SpyStkRep(task);
|
||||
SpyStackRep(task);
|
||||
else if (i==2)
|
||||
SpyCallerRep(task);
|
||||
else
|
||||
|
@ -1,7 +1,7 @@
|
||||
I64 Recurse(I64 n)
|
||||
{
|
||||
if (n)
|
||||
return 1+CallStkGrow(0x800,0x1000000,&Recurse,n-1);
|
||||
return 1+CallStackGrow(0x800,0x1000000,&Recurse,n-1);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@ -26,7 +26,7 @@ I64 Recurse3(I64 n,I64 lo,I64 hi)
|
||||
|
||||
#define DEPTH (2*1024*1024)
|
||||
|
||||
U0 StkGrowDemo()
|
||||
U0 StackGrowDemo()
|
||||
{
|
||||
F64 t0;
|
||||
|
||||
@ -38,16 +38,16 @@ U0 StkGrowDemo()
|
||||
//Recurse2's stack is 16 because you have 1 arg,
|
||||
//a return addr and no local variables.
|
||||
t0=tS;
|
||||
"%X:%X\n",DEPTH,CallStkGrow(DEPTH*16+0x800,DEPTH*16+0x800,&Recurse2,DEPTH);
|
||||
"%X:%X\n",DEPTH,CallStackGrow(DEPTH*16+0x800,DEPTH*16+0x800,&Recurse2,DEPTH);
|
||||
"Time:%7.5fs\n",tS-t0;
|
||||
|
||||
//$LK,"CallStkGrow",A="MN:CallStkGrow"$() works with multiple args.
|
||||
//$LK,"CallStackGrow",A="MN:CallStackGrow"$() works with multiple args.
|
||||
t0=tS;
|
||||
"%X:%X\n",DEPTH,CallStkGrow(DEPTH*32+0x800,DEPTH*32+0x800,
|
||||
"%X:%X\n",DEPTH,CallStackGrow(DEPTH*32+0x800,DEPTH*32+0x800,
|
||||
&Recurse3,DEPTH,1000,2000);
|
||||
"Time:%7.5fs\n",tS-t0;
|
||||
}
|
||||
|
||||
StkGrowDemo;
|
||||
StackGrowDemo;
|
||||
|
||||
//Be careful because you can fragment memory.
|
@ -233,8 +233,8 @@ Bool IsKeeper(LogStruct *tmplg,CDate dstart,CDate dend)
|
||||
Bool IPNumTreeAdd(LogStruct **_head,LogStruct *tmplg)
|
||||
{
|
||||
LogStruct *head;
|
||||
if (UnusedStk<0x200) {
|
||||
PrintErr("Stk Overflow");
|
||||
if (UnusedStack<0x200) {
|
||||
PrintErr("Stack Overflow");
|
||||
throw;
|
||||
}
|
||||
if (head=*_head) {
|
||||
@ -256,8 +256,8 @@ U0 LinkTreeAdd(LinkStruct **_root,LogStruct *tmplg)
|
||||
{
|
||||
I64 i;
|
||||
LinkStruct *root,*tmplk;
|
||||
if (UnusedStk<0x200) {
|
||||
PrintErr("Stk Overflow");
|
||||
if (UnusedStack<0x200) {
|
||||
PrintErr("Stack Overflow");
|
||||
throw;
|
||||
}
|
||||
if (root=*_root) {
|
||||
@ -279,8 +279,8 @@ U0 FileTreeAdd(LinkStruct **_root,LogStruct *tmplg)
|
||||
{
|
||||
I64 i;
|
||||
LinkStruct *root,*tmplk;
|
||||
if (UnusedStk<0x200) {
|
||||
PrintErr("Stk Overflow");
|
||||
if (UnusedStack<0x200) {
|
||||
PrintErr("Stack Overflow");
|
||||
throw;
|
||||
}
|
||||
if (root=*_root) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
$WW,1$$FG,5$$TX+CX,"Debugging Overview"$$FG$
|
||||
|
||||
* You can enter the debugger with $LK,"Debug",A="MN:Debug"$() or $FG,2$<CTRL-ALT-d>$FG$. You might enter the debugger through a fault. Enter $LK,"G",A="MN:G"$() or $LK,"G2",A="MN:G2"$() to continue execution. Place a call to $LK,"Debug",A="MN:Debug"$() in your code at fatal error points to enter the debugger. If you see a stk dump, record the label+offset and unassemble, $LK,"U",A="MN:U"$(). $LK,"U",A="MN:U"$($LK,"_RIP",A="MN:_RIP"$);
|
||||
* You can enter the debugger with $LK,"Debug",A="MN:Debug"$() or $FG,2$<CTRL-ALT-d>$FG$. You might enter the debugger through a fault. Enter $LK,"G",A="MN:G"$() or $LK,"G2",A="MN:G2"$() to continue execution. Place a call to $LK,"Debug",A="MN:Debug"$() in your code at fatal error points to enter the debugger. If you see a stack dump, record the label+offset and unassemble, $LK,"U",A="MN:U"$(). $LK,"U",A="MN:U"$($LK,"_RIP",A="MN:_RIP"$);
|
||||
|
||||
* $LK,"U",A="MN:U"$(&FunName+offset) to unassemble mem or $LK,"Uf",A="MN:Uf"$("FunName") to unassemble a function. $LK,"U",A="MN:U"$($LK,"_RIP",A="MN:_RIP"$-16);
|
||||
|
||||
@ -14,7 +14,7 @@ $WW,1$$FG,5$$TX+CX,"Debugging Overview"$$FG$
|
||||
|
||||
* $LK,"Dm",A="MN:Dm"$(), $LK,"DocDm",A="MN:DocDm"$(), $LK,"RawDm",A="MN:RawDm"$() to do 16 column hex dump mem with addresses showing.
|
||||
|
||||
* $LK,"Da",A="MN:Da"$() to do one column address dump (for stk, etc.) with symbolic addresses.
|
||||
* $LK,"Da",A="MN:Da"$() to do one column address dump (for stack, etc.) with symbolic addresses.
|
||||
|
||||
* $LK,"Dr",A="MN:Dr"$() dumps regs. You can display and modify regs in the debugger with var-like labels, $FG,4$_RAX$FG$, $FG,4$_RBX$FG$, etc.
|
||||
|
||||
|
@ -168,7 +168,7 @@ $LK,"::/Demo/DolDoc/TreeDemo.HC"$
|
||||
$LK,"::/Demo/Exceptions.HC"$
|
||||
$LK,"::/Demo/Disk/SerializeTree.HC"$
|
||||
$LK,"::/Demo/MemDemo.HC"$
|
||||
$LK,"::/Demo/StkGrow.HC"$
|
||||
$LK,"::/Demo/StackGrow.HC"$
|
||||
$LK,"::/Demo/DolDoc/TextDemo.HC"$
|
||||
$LK,"::/Demo/DolDoc/CursorMove.HC"$
|
||||
$LK,"::/Demo/DolDoc/DemoDoc.DD"$
|
||||
|
@ -1,8 +1,8 @@
|
||||
$HL,1$$WW,0$#define __DATE__ #exe{StreamPrint("\"%D\"",Now);}
|
||||
#define __TIME__ #exe{StreamPrint("\"%T\"",Now);}
|
||||
#define __LINE__ #exe{StreamPrint("%d",Fs->last_cc->lex_include_stk->line_num);}
|
||||
#define __CMD_LINE__ #exe{StreamPrint("%d",Fs->last_cc->flags&CCF_CMD_LINE && Fs->last_cc->lex_include_stk->depth<1);}
|
||||
#define __FILE__ #exe{StreamPrint("\"%s\"",Fs->last_cc->lex_include_stk->full_name);}
|
||||
#define __LINE__ #exe{StreamPrint("%d",Fs->last_cc->lex_include_stack->line_num);}
|
||||
#define __CMD_LINE__ #exe{StreamPrint("%d",Fs->last_cc->flags&CCF_CMD_LINE && Fs->last_cc->lex_include_stack->depth<1);}
|
||||
#define __FILE__ #exe{StreamPrint("\"%s\"",Fs->last_cc->lex_include_stack->full_name);}
|
||||
#define __DIR__ #exe{StreamDir;}
|
||||
|
||||
See $LK,"::/Demo/Directives.HC"$.$HL,0$$WW,1$
|
||||
|
@ -138,7 +138,7 @@ $FG,2$Src$FG$ Source
|
||||
$FG,2$Srv$FG$ Servant
|
||||
$FG,2$Stat$FG$ Status, Statistic
|
||||
$FG,2$Std$FG$ Standard
|
||||
$FG,2$Stk$FG$ Stack
|
||||
$FG,2$Stack$FG$ Stack
|
||||
$FG,2$Statement$FG$ Statement
|
||||
$FG,2$Str$FG$ String
|
||||
$FG,2$Sym$FG$ Symbol
|
||||
|
@ -52,7 +52,7 @@ $FG,5$$TX+CX,"Application Policies"$$FG$
|
||||
|
||||
$FG,5$$TX+CX,"Programming Guidelines"$$FG$
|
||||
|
||||
* Virtual mem/Paging is not used -- it is identity mapped in $FG,2$x86_64$FG$ mode. The stk does not grow, so alloc enough when the task (process) is $LK,"Spawn",A="MN:Spawn"$ed and use the heap for most things. (The $FG,2$heap$FG$ refers to $LK,"MAlloc",A="MN:MAlloc"$() and $LK,"Free",A="MN:Free"$().)
|
||||
* Virtual mem/Paging is not used -- it is identity mapped in $FG,2$x86_64$FG$ mode. The stack does not grow, so alloc enough when the task (process) is $LK,"Spawn",A="MN:Spawn"$ed and use the heap for most things. (The $FG,2$heap$FG$ refers to $LK,"MAlloc",A="MN:MAlloc"$() and $LK,"Free",A="MN:Free"$().)
|
||||
|
||||
* You can $LK,"Free",A="MN:Free"$($FG,2$NULL$FG$)$FG$.
|
||||
|
||||
@ -116,7 +116,7 @@ See $LK,"::/Doc/Asm.DD"$.
|
||||
|
||||
* When interacting with $LK,"HolyC",A="FI:::/Doc/HolyC.DD"$ compiled code, preserve $FG,2$RBP, RSI, RDI, R10-R15$FG$ because the compiler uses these for reg vars. You are free to clobber $FG,2$RAX, RBX, RCX, RDX$FG$, $FG,2$R8$FG$ and $FG,2$R9$FG$. See $LK,"Compiler Reg Masks",A="MN:REGG_LOCAL_VARS"$, $LK,"PUSH_C_REGS",A="MN:PUSH_C_REGS"$ and $LK,"POP_C_REGS",A="MN:POP_C_REGS"$
|
||||
|
||||
* I recommend using the standard stk frame for functions because $LK,"Caller",A="MN:Caller"$() is used to display the call stk, such as for the wallpaper.
|
||||
* I recommend using the standard stack frame for functions because $LK,"Caller",A="MN:Caller"$() is used to display the call stack, such as for the wallpaper.
|
||||
$FG,2$ PUSH RBP
|
||||
MOV RBP,RSP
|
||||
SUB RSP,nnnn
|
||||
|
Binary file not shown.
@ -239,7 +239,7 @@ $FG$$ID,-2$
|
||||
|
||||
* You CAN $LK,"Free",A="MN:Free"$() a $FG,2$NULL$FG$ ptr. Useful variants of $LK,"MAlloc",A="MN:MAlloc"$() can be found $LK,"Here",A="MN:CAlloc"$. Each task has a heap and you can $FG,2$MAlloc$FG$ and $FG,2$Free$FG$ off-of other task's heaps, or make an independent heap with $LK,"HeapCtrlInit",A="MN:HeapCtrlInit"$(). See $LK,"HeapLog",A="MN:HeapLog"$() for an example.
|
||||
|
||||
* The stk does not grow because virtual mem is not used. I recommend allocating large local vars from the heap. You can change $LK,"MEM_DEFAULT_STK",A="MN:MEM_DEFAULT_STK"$ and recompile $FG,2$Kernel$FG$ or request more when doing a $LK,"Spawn",A="MN:Spawn"$(). You can use $LK,"CallStkGrow",A="MN:CallStkGrow"$(), but it's odd. See $LK,"::/Demo/StkGrow.HC"$.
|
||||
* The stack does not grow because virtual mem is not used. I recommend allocating large local vars from the heap. You can change $LK,"MEM_DEFAULT_STACK",A="MN:MEM_DEFAULT_STACK"$ and recompile $FG,2$Kernel$FG$ or request more when doing a $LK,"Spawn",A="MN:Spawn"$(). You can use $LK,"CallStackGrow",A="MN:CallStackGrow"$(), but it's odd. See $LK,"::/Demo/StackGrow.HC"$.
|
||||
|
||||
* Only one base class is allowed.
|
||||
|
||||
|
@ -14,6 +14,6 @@ $LK,"OPTf_WARN_DUP_TYPES",A="MN:OPTf_WARN_DUP_TYPES"$ warning if dup local var t
|
||||
|
||||
$LK,"OPTf_WARN_HEADER_MISMATCH",A="MN:OPTf_WARN_HEADER_MISMATCH"$ warning if fun header does not match.
|
||||
|
||||
$LK,"OPTf_NO_REG_VAR",A="MN:OPTf_NO_REG_VAR"$ forces all function local vars to the stk not regs. Applied to functions.
|
||||
$LK,"OPTf_NO_REG_VAR",A="MN:OPTf_NO_REG_VAR"$ forces all function local vars to the stack not regs. Applied to functions.
|
||||
|
||||
$LK,"OPTf_NO_BUILTIN_CONST",A="MN:OPTf_NO_BUILTIN_CONST"$ Disable 10-byte float consts for ã, log2_10, log10_2, loge_2. Applied to functions.
|
||||
|
@ -4,7 +4,7 @@ $WW,1$* You run a risk of problems if you do file operations on the same files s
|
||||
|
||||
* When using $FG,2$FAT32$FG$, ZenithOS does not generate unique short-entry names, the ones with the $FG,2$~$FG$s. Not all $FG,2$FAT32$FG$ filenames are valid ZenithOS names and it will complain. Do not access $FG,2$FAT32$FG$ drives not dedicated to ZenithOS. Disable them with $LK,"DriveEnable",A="MN:DriveEnable"$(OFF), or they will generate error messages. $FG,2$FAT32$FG$ involves a long and short name for each file.
|
||||
|
||||
* The stk does not grow because virtual mem is not used. I recommend allocating large local vars from the heap. You can change $LK,"MEM_DEFAULT_STK",A="MN:MEM_DEFAULT_STK"$ and recompile $FG,2$Kernel$FG$ or request more when doing a $LK,"Spawn",A="MN:Spawn"$().
|
||||
* The stack does not grow because virtual mem is not used. I recommend allocating large local vars from the heap. You can change $LK,"MEM_DEFAULT_STACK",A="MN:MEM_DEFAULT_STACK"$ and recompile $FG,2$Kernel$FG$ or request more when doing a $LK,"Spawn",A="MN:Spawn"$().
|
||||
|
||||
* The syntax highlighting occassionally glitches. The compiler doesn't.
|
||||
|
||||
|
@ -113,7 +113,7 @@ $WW,1$
|
||||
|
||||
* Using $FG,2$try$FG$/$FG,2$catch$FG$ in a function will force all local vars to $FG,2$noreg$FG$.
|
||||
|
||||
* An unused gap on the stk is left for $FG,2$reg$FG$ vars.
|
||||
* An unused gap on the stack is left for $FG,2$reg$FG$ vars.
|
||||
|
||||
* Note: $FG,2$static$FG$ function vars do not go on the data heap, no matter the setting of the $LK,"OPTf_GLBLS_ON_DATA_HEAP",A="MN:OPTf_GLBLS_ON_DATA_HEAP"$$FG$. They may in the future.
|
||||
|
||||
|
@ -43,7 +43,7 @@ $FG,2$Merge(\"C:/*\",\"D:/*\",\"+r+d\");$FG$ to check my changes.
|
||||
|
||||
* Many data structures have a $FG,2$user_data$FG$ member. Those are available for you to store a data item, for convenience. $LK,"CTask",A="MN:CTask"$, $LK,"CDocEntry",A="MN:CDocEntry"$ and $LK,"CDirEntry",A="MN:CDirEntry"$ have them. You shouldn't encounter conflicts with ZenithOS using them.
|
||||
|
||||
* If, for some strange reason, you wanted to reduce mem usage, make a smaller disk cache when you recompile the kernel; disabling $FG,2$AutoComplete$FG$; Specify smaller stk sizes when doing $LK,"Spawn",A="MN:Spawn"$(), chang $LK,"MEM_DEFAULT_STK",A="MN:MEM_DEFAULT_STK"$, and using $LK,"DocMax",A="MN:DocMax"$() to reduce the cmd line buffer size.
|
||||
* If, for some strange reason, you wanted to reduce mem usage, make a smaller disk cache when you recompile the kernel; disabling $FG,2$AutoComplete$FG$; Specify smaller stack sizes when doing $LK,"Spawn",A="MN:Spawn"$(), chang $LK,"MEM_DEFAULT_STACK",A="MN:MEM_DEFAULT_STACK"$, and using $LK,"DocMax",A="MN:DocMax"$() to reduce the cmd line buffer size.
|
||||
|
||||
* Filenames ending in "$FG,2$$FG$" will be automatically compressed and uncompressed when read or written. The compression method is not supported by other operating systems. You can store files uncompressed by $LK,"Move",A="MN:Move"$()ing them to a filename not ending in "$FG,2$$FG$". See $LK,"::/Doc/TOSZ.DD"$ if you want to uncompress while in $FG,2$Linux$FG$.
|
||||
|
||||
|
13
src/Home/MakeHome.HC
Executable file
13
src/Home/MakeHome.HC
Executable file
@ -0,0 +1,13 @@
|
||||
Cd(__DIR__);;
|
||||
|
||||
//If these are not present in /Home, it uses the version in the root dir. You
|
||||
//can make your own, modified, version of these files in your /Home directory.
|
||||
#include "~/HomeLocalize"
|
||||
#include "/Zenith/Boot/MakeBoot"
|
||||
#include "/Zenith/Utils/MakeUtils"
|
||||
#include "~/HomeWrappers"
|
||||
MapFileLoad("::/Kernel/Kernel");
|
||||
MapFileLoad("::/Compiler/Compiler");
|
||||
#include "~/HomeKeyPlugIns"
|
||||
#include "~/HomeSys"
|
||||
Cd("..");;
|
BIN
src/Kernel.BIN.C
BIN
src/Kernel.BIN.C
Binary file not shown.
@ -131,13 +131,13 @@ Bool ATARepExitAllApplications()
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
public I64 ATARep(Bool pmt=TRUE,Bool just_ide=FALSE,CATARep **_head=NULL)
|
||||
public I64 ATARep(Bool prompt=TRUE,Bool just_ide=FALSE,CATARep **_head=NULL)
|
||||
{//Report possible ATA devices by probing. Hard disks and CD/DVDs.
|
||||
I64 d1,d2,i,j,k,count=0,unlock_flags=0,num_hints=0;
|
||||
#assert BLKDEVS_NUM<=64
|
||||
if (_head) *_head=NULL;
|
||||
|
||||
if (pmt && ATARepExitAllApplications)
|
||||
if (prompt && ATARepExitAllApplications)
|
||||
return 0;
|
||||
|
||||
for (i=0;i<BLKDEVS_NUM;i++)
|
||||
|
@ -171,10 +171,10 @@ U0 ArcExpandBuf(CArcCtrl *c)
|
||||
dst_ptr=c->dst_buf+c->dst_pos;
|
||||
dst_limit=c->dst_buf+c->dst_size;
|
||||
|
||||
while (dst_ptr<dst_limit && c->stk_ptr!=c->stk_base)
|
||||
*dst_ptr++ = * -- c->stk_ptr;
|
||||
while (dst_ptr<dst_limit && c->stack_ptr!=c->stack_base)
|
||||
*dst_ptr++ = * -- c->stack_ptr;
|
||||
|
||||
if (c->stk_ptr==c->stk_base && dst_ptr<dst_limit) {
|
||||
if (c->stack_ptr==c->stack_base && dst_ptr<dst_limit) {
|
||||
if (c->saved_basecode==U32_MAX) {
|
||||
lastcode=BFieldExtU32(c->src_buf,c->src_pos,
|
||||
c->next_bits_in_use);
|
||||
@ -189,15 +189,15 @@ U0 ArcExpandBuf(CArcCtrl *c)
|
||||
c->next_bits_in_use);
|
||||
c->src_pos+=c->next_bits_in_use;
|
||||
if (c->cur_entry==&c->compress[basecode]) {
|
||||
*c->stk_ptr++=c->last_ch;
|
||||
*c->stack_ptr++=c->last_ch;
|
||||
code=lastcode;
|
||||
} else
|
||||
code=basecode;
|
||||
while (code>=c->min_table_entry) {
|
||||
*c->stk_ptr++=c->compress[code].ch;
|
||||
*c->stack_ptr++=c->compress[code].ch;
|
||||
code=c->compress[code].basecode;
|
||||
}
|
||||
*c->stk_ptr++=code;
|
||||
*c->stack_ptr++=code;
|
||||
c->last_ch=code;
|
||||
|
||||
c->entry_used=TRUE;
|
||||
@ -209,8 +209,8 @@ U0 ArcExpandBuf(CArcCtrl *c)
|
||||
tmp1->next=tmp;
|
||||
|
||||
ArcEntryGet(c);
|
||||
while (dst_ptr<dst_limit && c->stk_ptr!=c->stk_base)
|
||||
*dst_ptr++ = * -- c->stk_ptr;
|
||||
while (dst_ptr<dst_limit && c->stack_ptr!=c->stack_base)
|
||||
*dst_ptr++ = * -- c->stack_ptr;
|
||||
lastcode=basecode;
|
||||
}
|
||||
c->saved_basecode=lastcode;
|
||||
@ -223,8 +223,8 @@ CArcCtrl *ArcCtrlNew(Bool expand,I64 compression_type=CT_8_BIT)
|
||||
CArcCtrl *c;
|
||||
c=CAlloc(sizeof(CArcCtrl));
|
||||
if (expand) {
|
||||
c->stk_base=MAlloc(1<<ARC_BITS_MAX);
|
||||
c->stk_ptr=c->stk_base;
|
||||
c->stack_base=MAlloc(1<<ARC_BITS_MAX);
|
||||
c->stack_ptr=c->stack_base;
|
||||
}
|
||||
if (compression_type==CT_7_BIT)
|
||||
c->min_bits=7;
|
||||
@ -243,7 +243,7 @@ CArcCtrl *ArcCtrlNew(Bool expand,I64 compression_type=CT_8_BIT)
|
||||
|
||||
U0 ArcCtrlDel(CArcCtrl *c)
|
||||
{//Free archive ctrl struct.
|
||||
Free(c->stk_base);
|
||||
Free(c->stack_base);
|
||||
Free(c);
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ I64 JobResGet(CJob *rqst=NULL)
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 TaskWait(CTask *task=NULL,Bool cmd_line_pmt=FALSE)
|
||||
U0 TaskWait(CTask *task=NULL,Bool cmd_line_prompt=FALSE)
|
||||
{//Wait for idle.
|
||||
CTask *task1;
|
||||
CJob *tmpc1;
|
||||
@ -231,7 +231,7 @@ U0 TaskWait(CTask *task=NULL,Bool cmd_line_pmt=FALSE)
|
||||
tmpc1=&task1->srv_ctrl.next_waiting;
|
||||
if (task1==Fs || !TaskValidate(task1) ||
|
||||
tmpc1==tmpc1->next && Bt(&task1->task_flags,TASKf_IDLE) &&
|
||||
(!cmd_line_pmt || Bt(&task1->task_flags,TASKf_CMD_LINE_PMT)))
|
||||
(!cmd_line_prompt || Bt(&task1->task_flags,TASKf_CMD_LINE_PROMPT)))
|
||||
break;
|
||||
Yield;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ U0 QueueVectU8Put(CQueueVectU8 *v,I64 idx,U8 ch)
|
||||
|
||||
while (TRUE) {
|
||||
tmpv=v->last;
|
||||
if (tmpv->node_count>=QUE_VECT_U8_CNT) {
|
||||
if (tmpv->node_count>=QUE_VECT_U8_COUNT) {
|
||||
tmpv=MAlloc(sizeof(CQueueVectU8));
|
||||
tmpv->node_count=0;
|
||||
QueueInsert(tmpv,v->last);
|
||||
|
@ -28,14 +28,14 @@ Bool CheckCodePtr(U8 *ptr)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Bool CheckOnStk(U8 *ptr,CTask *task=NULL)
|
||||
{//Check if addr is valid stk addr.
|
||||
Bool CheckOnStack(U8 *ptr,CTask *task=NULL)
|
||||
{//Check if addr is valid stack addr.
|
||||
Bool res=FALSE;
|
||||
PUSHFD
|
||||
CLI
|
||||
if (task) {
|
||||
if (&task->stk->stk_base<=ptr<=
|
||||
(&task->stk->stk_base)(U8 *)+task->stk->stk_size)
|
||||
if (&task->stack->stack_base<=ptr<=
|
||||
(&task->stack->stack_base)(U8 *)+task->stack->stack_size)
|
||||
res=TRUE;
|
||||
} else if (mem_heap_base<=ptr<=mem_heap_limit)
|
||||
res=TRUE;
|
||||
@ -43,16 +43,16 @@ Bool CheckOnStk(U8 *ptr,CTask *task=NULL)
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 UnusedStk(CTask *task=NULL)
|
||||
{//Count of usused bytes in task's stk.
|
||||
I64 UnusedStack(CTask *task=NULL)
|
||||
{//Count of usused bytes in task's stack.
|
||||
I64 res;
|
||||
if (!task) task=Fs;
|
||||
PUSHFD
|
||||
CLI
|
||||
if (task==Fs)
|
||||
res=GetRSP()(U8 *)-(&task->stk->stk_base)(U8 *);
|
||||
res=GetRSP()(U8 *)-(&task->stack->stack_base)(U8 *);
|
||||
else
|
||||
res=task->rsp(U8 *)-(&task->stk->stk_base)(U8 *);
|
||||
res=task->rsp(U8 *)-(&task->stack->stack_base)(U8 *);
|
||||
POPFD
|
||||
return res;
|
||||
}
|
||||
@ -65,7 +65,7 @@ U8 *Caller(I64 num=1)
|
||||
if (rbp>=*rbp)
|
||||
return NULL;
|
||||
rbp=*rbp;
|
||||
if (!CheckOnStk(rbp,Fs))
|
||||
if (!CheckOnStack(rbp,Fs))
|
||||
return NULL;
|
||||
}
|
||||
ptr=rbp+1;
|
||||
@ -73,7 +73,7 @@ U8 *Caller(I64 num=1)
|
||||
}
|
||||
|
||||
U8 *TaskCaller(CTask *task=NULL,I64 num=0,Bool saved_context=FALSE)
|
||||
{//Fetches addr of Nth caller on task's stk.
|
||||
{//Fetches addr of Nth caller on task's stack.
|
||||
U8 **ptr,**rbp,**rsp;
|
||||
if (!task) task=Fs;
|
||||
if (!saved_context && task==Fs)
|
||||
@ -83,7 +83,7 @@ U8 *TaskCaller(CTask *task=NULL,I64 num=0,Bool saved_context=FALSE)
|
||||
rbp=task->rbp;
|
||||
rsp=task->rsp;
|
||||
if (num) {
|
||||
while (CheckOnStk(rbp,task)) {
|
||||
while (CheckOnStack(rbp,task)) {
|
||||
ptr=rbp+1;
|
||||
if (! --num)
|
||||
return *ptr;
|
||||
@ -99,12 +99,12 @@ U8 *TaskCaller(CTask *task=NULL,I64 num=0,Bool saved_context=FALSE)
|
||||
return task->rip;
|
||||
}
|
||||
}
|
||||
#define STK_REP_LEN 32
|
||||
#define STACK_REP_LEN 32
|
||||
|
||||
U0 StkRep(CTask *task=NULL)
|
||||
{//Reports whats on the stk.
|
||||
U0 StackRep(CTask *task=NULL)
|
||||
{//Reports whats on the stack.
|
||||
I64 i,j,addr,
|
||||
**rbp,**rsp,*my_rsp[STK_REP_LEN];
|
||||
**rbp,**rsp,*my_rsp[STACK_REP_LEN];
|
||||
CHashTable *old_hash=Fs->hash_table;
|
||||
if (!task) task=Fs;
|
||||
if (!TaskValidate(task))
|
||||
@ -123,15 +123,15 @@ U0 StkRep(CTask *task=NULL)
|
||||
addr=*rsp;
|
||||
else
|
||||
addr=task->rip;
|
||||
MemCpy(my_rsp,rsp,STK_REP_LEN*sizeof(U8 *));
|
||||
MemCpy(my_rsp,rsp,STACK_REP_LEN*sizeof(U8 *));
|
||||
POPFD
|
||||
Fs->hash_table=task->hash_table;
|
||||
for (i=0;i<STK_REP_LEN;i++) {
|
||||
for (i=0;i<STACK_REP_LEN;i++) {
|
||||
"%08X [RSP+%04X]: %016X ",rsp+i,
|
||||
i*sizeof(U8 *),my_rsp[i];
|
||||
while (TRUE) {
|
||||
if (!(&task->stk->stk_base<=rbp<
|
||||
(&task->stk->stk_base)(U8 *)+task->stk->stk_size))
|
||||
if (!(&task->stack->stack_base<=rbp<
|
||||
(&task->stack->stack_base)(U8 *)+task->stack->stack_size))
|
||||
break;
|
||||
j=rbp-rsp;
|
||||
if (j>=i)
|
||||
@ -160,7 +160,7 @@ U0 CallerRep(U8 **rbp=NULL,CTask *task=NULL)
|
||||
rbp=task->rbp;
|
||||
}
|
||||
"CallerRep:\n";
|
||||
while (CheckOnStk(rbp,task)) {
|
||||
while (CheckOnStack(rbp,task)) {
|
||||
ptr=rbp+1;
|
||||
"%08X:%08tX:%P\n",ptr,*ptr,*ptr;
|
||||
if (rbp>=*rbp)
|
||||
@ -459,7 +459,7 @@ U0 G(U8 *ip=INVALID_PTR,CTask *task=NULL)
|
||||
if (task==Fs) {
|
||||
if (IsDebugMode && task->next_cc!=&task->next_cc) {
|
||||
"Exit Debug\n";
|
||||
Btr(&task->last_cc->flags,CCf_PMT);
|
||||
Btr(&task->last_cc->flags,CCf_PROMPT);
|
||||
}
|
||||
} else
|
||||
Exit;
|
||||
@ -488,7 +488,7 @@ public U0 S(U8 *ip=INVALID_PTR,CTask *task=NULL) //Single-step.
|
||||
if (task==Fs) {
|
||||
if (IsDebugMode) {
|
||||
if (task->next_cc!=&task->next_cc)
|
||||
Btr(&task->last_cc->flags,CCf_PMT);
|
||||
Btr(&task->last_cc->flags,CCf_PROMPT);
|
||||
}
|
||||
} else
|
||||
Exit;
|
||||
@ -507,7 +507,7 @@ U0 DebugHelp()
|
||||
">ClassRep(Fs,\"CTask\",1);\t//Dump current task record.\n"
|
||||
">ClassRep(Fs,,1);\t\t//(It knows lastclass.)\n"
|
||||
">CallerRep;\t\t\t//Stack trace report.\n"
|
||||
">Da(_RSP);\t\t\t//Dump stk.\n"
|
||||
">Da(_RSP);\t\t\t//Dump stack.\n"
|
||||
">Dr;\t\t\t\t//Dump Regs.\n"
|
||||
">1+2*3+&Print;\t\t\t//Show calculation res.\n"
|
||||
">*(0x70000)(I64 *)=0x123456789;\t//Assign value to 0x70000-0x70007.\n"
|
||||
|
@ -118,7 +118,7 @@ U0 SysDefinesLoad()
|
||||
DefineListLoad("ST_INT_NAMES","Divide Error\0SingleStep\0NMI\0Breakpoint\0"
|
||||
"Overflow\0BOUND Range Exceeded\0Invalid Opcode\0No Math Coprocessor\0"
|
||||
"Double Fault\0Coprocessor Segment Fault\0Invalid TASK\0"
|
||||
"Segment Not Present\0Stk Segment Fault\0General Protection\0"
|
||||
"Segment Not Present\0Stack Segment Fault\0General Protection\0"
|
||||
"Page Fault\0\0Math Fault\0Alignment Check\0Machine Check\0"
|
||||
"SIMD Exception\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
"\0\0\0\0\0\0\0\0\0\0\0MP Crash\0Wake\0Debug\0");
|
||||
|
@ -53,7 +53,7 @@ U0 PutExcept(Bool catch_it=TRUE)
|
||||
|
||||
#exe {Option(OPTf_NO_REG_VAR,ON);};
|
||||
|
||||
class CTryStk
|
||||
class CTryStack
|
||||
{
|
||||
I64 rbp;
|
||||
I64 ret_rip;
|
||||
@ -67,7 +67,7 @@ U0 SysTry(U8 *catch_start,U8 *untry_start)
|
||||
CExcept *tmpt=MAlloc(sizeof(CExcept));
|
||||
tmpt->handler_catch=catch_start;
|
||||
tmpt->handler_untry=untry_start;
|
||||
tmpt->rsp=rbp(U8 *)+sizeof(CTryStk);
|
||||
tmpt->rsp=rbp(U8 *)+sizeof(CTryStack);
|
||||
tmpt->rbp=*rbp;
|
||||
tmpt->rflags=GetRFlags;
|
||||
SaveExceptRegs(tmpt);
|
||||
|
@ -94,7 +94,7 @@ extern U0 RedSeaInit(CDrive *dv);
|
||||
extern Bool RedSeaValidate(U8 drv_let);
|
||||
extern CTask *SpawnQueue(U0 (*fp_addr)(U8 *data),U8 *data=NULL,
|
||||
U8 *task_name=NULL,I64 target_cpu,CTask *parent=NULL, //NULL means zenith
|
||||
I64 stk_size=0,I64 flags=1<<JOBf_ADD_TO_QUE);
|
||||
I64 stack_size=0,I64 flags=1<<JOBf_ADD_TO_QUE);
|
||||
extern U8 *StrPrint(U8 *dst,U8 *fmt,...);
|
||||
extern U0 StrPrintFunSeg(U8 *buf,I64 addr,I64 field_len,I64 flags);
|
||||
extern Bool Suspend(CTask *task=NULL,Bool state=TRUE);
|
||||
@ -102,7 +102,7 @@ extern CJob *TaskMessage(CTask *_srv,CTask *master,
|
||||
I64 message_code,I64 arg1,I64 arg2,I64 flags);
|
||||
extern U0 TaskResetAwaitingMessage(CTask *task=NULL);
|
||||
extern Bool TaskValidate(CTask *task);
|
||||
extern U0 TaskWait(CTask *task=NULL,Bool cmd_line_pmt=FALSE);
|
||||
extern U0 TaskWait(CTask *task=NULL,Bool cmd_line_prompt=FALSE);
|
||||
extern CTask *User(U8 *fmt=NULL,...);
|
||||
extern U0 UserTaskCont();
|
||||
extern U0 XTalk(CTask *task,U8 *fmt,...);
|
||||
|
@ -153,7 +153,7 @@ CHashGeneric *HashGenericAdd(U8 *name,I64 type,
|
||||
|
||||
U0 HashSrcFileSet(CCompCtrl *cc,CHashSrcSym *h,I64 line_num_offset=0)
|
||||
{//Set $LK,"CHashSrcSym",A="MN:CHashSrcSym"$ link and help_index by cur cc pos.
|
||||
CLexFile *tmpf=cc->lex_include_stk;
|
||||
CLexFile *tmpf=cc->lex_include_stack;
|
||||
I64 line_num=tmpf->line_num+line_num_offset;
|
||||
if (line_num<1) line_num=1;
|
||||
Free(h->src_link);
|
||||
|
@ -153,7 +153,7 @@ interrupt U0 IntDivZero()
|
||||
mp_count=1;
|
||||
dbg.mp_crash->cpu_num=Gs->num;
|
||||
dbg.mp_crash->task=Fs;
|
||||
MOV RAX,U64 8[RBP] //Get RIP off of stk.
|
||||
MOV RAX,U64 8[RBP] //Get RIP off of stack.
|
||||
dbg.mp_crash->rip=GetRAX;
|
||||
dbg.mp_crash->message="Div Zero";
|
||||
dbg.mp_crash->message_num=0;
|
||||
|
@ -79,7 +79,7 @@ I64 SysTimerRead()
|
||||
|
||||
I64 HPET()
|
||||
{ //Get high precision event timer.
|
||||
return *(dev.uncached_alias+HPET_MAIN_CNT)(I64 *);
|
||||
return *(dev.uncached_alias+HPET_MAIN_COUNT)(I64 *);
|
||||
}
|
||||
|
||||
I64 TimeCal()
|
||||
|
@ -55,9 +55,9 @@ GDT_TR_RING3: DU8 MP_PROCESSORS_NUM*16 DUP(0);
|
||||
CORE0_16BIT_INIT::
|
||||
//EAX is $LK,"SYS_BOOT_SRC",A="FF:::/Kernel/KStart16.HC,[SYS_BOOT_SRC]"$. (Val passed from boot blk, $LK,"BootHD",A="FF:::/Zenith/Boot/BootHD.HC,BOOT_SRC_HARDDRV"$, $LK,"BootDVD",A="FF:::/Zenith/Boot/BootDVD.HC,BOOT_SRC_DVD"$, & $LK,"BootRAM",A="FF:::/Zenith/Boot/BootRAM.HC,BOOT_SRC_RAM"$.)
|
||||
MOV ECX,EAX
|
||||
MOV AX,(BOOT_RAM_LIMIT-BOOT_STK_SIZE)/16
|
||||
MOV AX,(BOOT_RAM_LIMIT-BOOT_STACK_SIZE)/16
|
||||
MOV SS,AX
|
||||
MOV SP,BOOT_STK_SIZE
|
||||
MOV SP,BOOT_STACK_SIZE
|
||||
PUSH ECX //Will be $LK,"SYS_BOOT_SRC",A="FF:::/Kernel/KStart16.HC,[SYS_BOOT_SRC]"$. See $LK,"BootHD",A="FF:::/Zenith/Boot/BootHD.HC,BOOT_SRC_HARDDRV"$, $LK,"BootDVD",A="FF:::/Zenith/Boot/BootDVD.HC,BOOT_SRC_DVD"$ & $LK,"BootRAM",A="FF:::/Zenith/Boot/BootRAM.HC,BOOT_SRC_RAM"$.
|
||||
PUSH EBX
|
||||
|
||||
|
@ -62,9 +62,9 @@ SYS_PROGRESS4_DESC:: DU8 PROGRESS_DESC_LEN DUP(0);
|
||||
|
||||
SYS_FOCUS_TASK:: DU64 0;
|
||||
SYS_CPU_STRUCTS:: DU64 0;
|
||||
SYS_MP_CNT:: DU64 1;
|
||||
SYS_MP_CNT_INITIAL:: DU64 1;
|
||||
SYS_MP_CNT_LOCK:: DU64 1;
|
||||
SYS_MP_COUNT:: DU64 1;
|
||||
SYS_MP_COUNT_INITIAL:: DU64 1;
|
||||
SYS_MP_COUNT_LOCK:: DU64 1;
|
||||
|
||||
ALIGN DEFAULT_CACHE_LINE_WIDTH,OC_NOP
|
||||
SYS_CACHE_LINE_WIDTH:: DU64 DEFAULT_CACHE_LINE_WIDTH;
|
||||
@ -90,7 +90,7 @@ CORE0_32BIT_INIT:: //Entry point for $LK,"BootRAM",A="MN:BootRAM"$.
|
||||
MOV FS,AX
|
||||
MOV GS,AX
|
||||
MOV SS,AX
|
||||
MOV ESP,BOOT_RAM_LIMIT //Tmp Stk
|
||||
MOV ESP,BOOT_RAM_LIMIT //Tmp Stack
|
||||
|
||||
//Patch abs addresses
|
||||
MOV ECX,U32 CPatchTableAbsAddr.abs_addres_count[ESI]
|
||||
|
@ -31,7 +31,7 @@ USE64
|
||||
|
||||
BTS U32 [SYS_RUN_LEVEL],RLf_16MEG_ZENITH_HEAP_CTRL
|
||||
|
||||
PUSH MEM_ZENITH_STK
|
||||
PUSH MEM_ZENITH_STACK
|
||||
PUSH U32 SYS_FIXED_AREA+CSysFixedArea.zenith
|
||||
CALL &TaskInit
|
||||
CALL SET_FS_BASE
|
||||
@ -72,8 +72,8 @@ USE64
|
||||
|
||||
//************************************
|
||||
SYS_RAM_REBOOT:: //This gets copied high. $LK,"SYS_RAM_REBOOT",A="FF:::/Zenith/Boot/BootRAM.HC,SYS_RAM_REBOOT:2"$
|
||||
PUSH U32 CGDT.ds //stk seg
|
||||
PUSH U32 BOOT_RAM_LIMIT //stk
|
||||
PUSH U32 CGDT.ds //stack seg
|
||||
PUSH U32 BOOT_RAM_LIMIT //stack
|
||||
PUSH U32 0 //flags
|
||||
PUSH U32 CGDT.cs32
|
||||
LEA RAX,[@@10]
|
||||
|
@ -97,29 +97,29 @@ Bool IsSuspended(CTask *task=NULL)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CTaskStk *TaskStkNew(I64 stk_size,CTask *task)
|
||||
CTaskStack *TaskStackNew(I64 stack_size,CTask *task)
|
||||
{
|
||||
CTaskStk *tmps=MAlloc(stk_size+offset(CTaskStk.stk_base),task);
|
||||
tmps->next_stk=NULL;
|
||||
tmps->stk_ptr=NULL;
|
||||
tmps->stk_size=MSize(tmps)-offset(CTaskStk.stk_base);
|
||||
CTaskStack *tmps=MAlloc(stack_size+offset(CTaskStack.stack_base),task);
|
||||
tmps->next_stack=NULL;
|
||||
tmps->stack_ptr=NULL;
|
||||
tmps->stack_size=MSize(tmps)-offset(CTaskStack.stack_base);
|
||||
return tmps;
|
||||
}
|
||||
|
||||
#exe {Option(OPTf_NO_REG_VAR,ON);};
|
||||
argpop I64 CallStkGrow(I64 stk_size_threshold,I64 stk_size,
|
||||
argpop I64 CallStackGrow(I64 stack_size_threshold,I64 stack_size,
|
||||
/*argpop*/I64 (*fp_addr)(...),...)
|
||||
{//Grow stk in call with any fixed num of args.
|
||||
//See $LK,"::/Demo/StkGrow.HC"$.
|
||||
CTaskStk *tmps,*tmps2,**_stk;
|
||||
I64 res,*rsp,*rsp2,*old_stk;
|
||||
{//Grow stack in call with any fixed num of args.
|
||||
//See $LK,"::/Demo/StackGrow.HC"$.
|
||||
CTaskStack *tmps,*tmps2,**_stack;
|
||||
I64 res,*rsp,*rsp2,*old_stack;
|
||||
|
||||
if (UnusedStk>=stk_size_threshold) {
|
||||
if (UnusedStack>=stack_size_threshold) {
|
||||
|
||||
asm {
|
||||
LEAVE
|
||||
POP RAX //return addr
|
||||
ADD RSP,16 //pop threshold,stk_size
|
||||
ADD RSP,16 //pop threshold,stack_size
|
||||
POP RBX // *f
|
||||
ADD RSP,8 //pop ARGC
|
||||
PUSH RAX
|
||||
@ -128,14 +128,14 @@ argpop I64 CallStkGrow(I64 stk_size_threshold,I64 stk_size,
|
||||
|
||||
} else {
|
||||
|
||||
tmps2=TaskStkNew(stk_size,Fs);
|
||||
tmps2->next_stk=tmps=Fs->stk;
|
||||
rsp2=(&tmps2->stk_base)(U8 *)+tmps2->stk_size;
|
||||
old_stk=rsp=&argv[argc];
|
||||
tmps2=TaskStackNew(stack_size,Fs);
|
||||
tmps2->next_stack=tmps=Fs->stack;
|
||||
rsp2=(&tmps2->stack_base)(U8 *)+tmps2->stack_size;
|
||||
old_stack=rsp=&argv[argc];
|
||||
while (argc-->0)
|
||||
*--rsp2=*--rsp;
|
||||
_stk=&Fs->stk;
|
||||
tmps->stk_ptr=rsp=GetRSP;
|
||||
_stack=&Fs->stack;
|
||||
tmps->stack_ptr=rsp=GetRSP;
|
||||
asm {
|
||||
IMPORT _FREE; //We are in a function, not at glbl scope.
|
||||
//The compiler treats these in isolation.
|
||||
@ -144,8 +144,8 @@ argpop I64 CallStkGrow(I64 stk_size_threshold,I64 stk_size,
|
||||
POP RDX //flags
|
||||
CLI
|
||||
MOV RBX,U64 &tmps2[RBP]
|
||||
MOV RAX,&_stk[RBP]
|
||||
MOV U64 [RAX],RBX //Fs->stk=tmps2
|
||||
MOV RAX,&_stack[RBP]
|
||||
MOV U64 [RAX],RBX //Fs->stack=tmps2
|
||||
MOV RSP,U64 &rsp2[RBP]
|
||||
PUSH RDX
|
||||
POPFD
|
||||
@ -157,8 +157,8 @@ argpop I64 CallStkGrow(I64 stk_size_threshold,I64 stk_size,
|
||||
POP RDX //flags
|
||||
CLI
|
||||
MOV RBX,U64 &tmps[RBP]
|
||||
MOV RAX,&_stk[RBP]
|
||||
MOV U64 [RAX],RBX //Fs->stk=tmps
|
||||
MOV RAX,&_stack[RBP]
|
||||
MOV U64 [RAX],RBX //Fs->stack=tmps
|
||||
MOV RSP,U64 &rsp[RBP]
|
||||
PUSH RDX
|
||||
POPFD
|
||||
@ -166,7 +166,7 @@ argpop I64 CallStkGrow(I64 stk_size_threshold,I64 stk_size,
|
||||
PUSH U64 &tmps2[RBP]
|
||||
CALL _FREE
|
||||
|
||||
MOV RDX,U64 &old_stk[RBP]
|
||||
MOV RDX,U64 &old_stack[RBP]
|
||||
MOV RBX,U64 8[RBP]
|
||||
MOV RAX,U64 &res[RBP]
|
||||
MOV RBP,U64 [RBP]
|
||||
@ -179,9 +179,9 @@ argpop I64 CallStkGrow(I64 stk_size_threshold,I64 stk_size,
|
||||
;
|
||||
#exe {Option(OPTf_NO_REG_VAR,OFF);};
|
||||
|
||||
I64 TaskInit(CTask *task,I64 stk_size)
|
||||
I64 TaskInit(CTask *task,I64 stack_size)
|
||||
{//Returns Fs of task
|
||||
CTaskStk *tmps;
|
||||
CTaskStack *tmps;
|
||||
|
||||
QueueInit(&task->code_heap->next_mem_blk);
|
||||
task->code_heap->last_mergable=NULL;
|
||||
@ -214,10 +214,10 @@ I64 TaskInit(CTask *task,I64 stk_size)
|
||||
|
||||
task->hash_table=HashTableNew(TASK_HASH_TABLE_SIZE,task);
|
||||
|
||||
if (!stk_size)
|
||||
stk_size=MEM_DEFAULT_STK;
|
||||
task->stk=tmps=TaskStkNew(stk_size,task);
|
||||
task->rsp=(&tmps->stk_base)(U8 *)+tmps->stk_size;
|
||||
if (!stack_size)
|
||||
stack_size=MEM_DEFAULT_STACK;
|
||||
task->stack=tmps=TaskStackNew(stack_size,task);
|
||||
task->rsp=(&tmps->stack_base)(U8 *)+tmps->stack_size;
|
||||
|
||||
task->text_attr =WHITE<<4+BLUE;
|
||||
task->border_src =BDS_CONST;
|
||||
@ -242,7 +242,7 @@ I64 TaskInit(CTask *task,I64 stk_size)
|
||||
CTask *Spawn(U0 (*fp_start_addr)(U8 *data),U8 *data=NULL,U8 *task_name=NULL,
|
||||
I64 target_cpu=-1, //-1 for current CPU. See $LK,"multi-core",A="FI:::/Demo/MultiCore/LoadTest.HC"$.
|
||||
CTask *parent=NULL, //NULL means zenith
|
||||
I64 stk_size=0, //0=default
|
||||
I64 stack_size=0, //0=default
|
||||
I64 flags=1<<JOBf_ADD_TO_QUE)
|
||||
{//Create task on core running at address.
|
||||
//Alloc $LK,"CTask",A="MN:CTask"$ structure from code heap so addr will be short.
|
||||
@ -250,7 +250,7 @@ CTask *Spawn(U0 (*fp_start_addr)(U8 *data),U8 *data=NULL,U8 *task_name=NULL,
|
||||
CTask *task;
|
||||
if (target_cpu>=0)
|
||||
return SpawnQueue(fp_start_addr,data,task_name,target_cpu,
|
||||
parent,stk_size,flags);
|
||||
parent,stack_size,flags);
|
||||
task=CAlloc(sizeof(CTask),zenith_task->code_heap);
|
||||
task->task_signature=TASK_SIGNATURE_VAL;
|
||||
if (!task_name) task_name="Unnamed Task";
|
||||
@ -263,7 +263,7 @@ CTask *Spawn(U0 (*fp_start_addr)(U8 *data),U8 *data=NULL,U8 *task_name=NULL,
|
||||
task->data_heap=HeapCtrlInit(,task,sys_data_bp);
|
||||
else
|
||||
task->data_heap=task->code_heap;
|
||||
TaskInit(task,stk_size);
|
||||
TaskInit(task,stack_size);
|
||||
task->rip=fp_start_addr;
|
||||
task->rsp(U8 *)-=8;
|
||||
*task->rsp=data;
|
||||
@ -313,9 +313,9 @@ I64 ExeCmdLine(CCompCtrl *cc)
|
||||
if (Fs->title_src==TTS_CUR_LEX) {
|
||||
ptr2=&Fs->task_title;
|
||||
ptr3=ptr2+STR_LEN-1;
|
||||
if (cc->lex_include_stk->flags & LFSF_DOC) {
|
||||
doc_e=cc->lex_include_stk->cur_entry;
|
||||
doc=cc->lex_include_stk->doc;
|
||||
if (cc->lex_include_stack->flags & LFSF_DOC) {
|
||||
doc_e=cc->lex_include_stack->cur_entry;
|
||||
doc=cc->lex_include_stack->doc;
|
||||
while (doc_e!=doc && ptr2<ptr3) {
|
||||
switch (doc_e->type_u8) {
|
||||
case DOCT_TEXT:
|
||||
@ -332,7 +332,7 @@ I64 ExeCmdLine(CCompCtrl *cc)
|
||||
}
|
||||
if (ptr2<ptr3) *ptr2=0;
|
||||
} else
|
||||
if ((ptr=cc->lex_include_stk->line_start) && *ptr)
|
||||
if ((ptr=cc->lex_include_stack->line_start) && *ptr)
|
||||
MemCpy(ptr2,ptr,STR_LEN-1);
|
||||
}
|
||||
cc->flags&=~CCF_HAS_MISC_DATA;
|
||||
@ -345,7 +345,7 @@ I64 ExeCmdLine(CCompCtrl *cc)
|
||||
Fs->answer_type=type;
|
||||
Fs->answer_time=tS-t0;
|
||||
Fs->new_answer=TRUE;
|
||||
cc->pmt_line=0;
|
||||
cc->prompt_line=0;
|
||||
}
|
||||
if (!(cc->flags&CCF_HAS_MISC_DATA))
|
||||
Free(machine_code);
|
||||
@ -387,12 +387,12 @@ U0 UserTaskCont()
|
||||
CDoc *doc;
|
||||
Bool cont=TRUE;
|
||||
do {
|
||||
cc=CompCtrlNew(,CCF_CMD_LINE|CCF_PMT|CCF_QUESTION_HELP);
|
||||
cc=CompCtrlNew(,CCF_CMD_LINE|CCF_PROMPT|CCF_QUESTION_HELP);
|
||||
QueueInsert(cc,Fs->last_cc);
|
||||
try {
|
||||
Lex(cc);
|
||||
ExeCmdLine(cc);
|
||||
cont=Bt(&cc->flags,CCf_PMT);
|
||||
cont=Bt(&cc->flags,CCf_PROMPT);
|
||||
QueueRemove(cc);
|
||||
CompCtrlDel(cc);
|
||||
} catch {
|
||||
|
File diff suppressed because one or more lines are too long
@ -160,12 +160,12 @@ public class CD3 //Three dimensional F64 pt
|
||||
};
|
||||
|
||||
#help_index "Data Types/Queue Vector"
|
||||
#define QUE_VECT_U8_CNT 512
|
||||
#define QUE_VECT_U8_COUNT 512
|
||||
public class CQueueVectU8
|
||||
{
|
||||
CQueueVectU8 *next,*last;
|
||||
I64 total_count,node_count,min_idx;
|
||||
U8 body[QUE_VECT_U8_CNT];
|
||||
U8 body[QUE_VECT_U8_COUNT];
|
||||
};
|
||||
|
||||
#help_index "Data Types/Fifo"
|
||||
@ -553,7 +553,7 @@ class CAP16BitInit
|
||||
//High Performance Event Timer
|
||||
#define HPET_GCAP_ID (0xFED00000+0x00)
|
||||
#define HPET_GEN_CONF (0xFED00000+0x10)
|
||||
#define HPET_MAIN_CNT (0xFED00000+0xF0)
|
||||
#define HPET_MAIN_COUNT (0xFED00000+0xF0)
|
||||
|
||||
public class CCountsGlobals
|
||||
{
|
||||
@ -746,7 +746,7 @@ public class CHashGeneric:CHash
|
||||
#define REGT_R32 3
|
||||
#define REGT_R64 4
|
||||
#define REGT_SEG 5
|
||||
#define REGT_FSTK 6
|
||||
#define REGT_FSTACK 6
|
||||
#define REGT_MM 7
|
||||
#define REGT_XMM 8
|
||||
|
||||
@ -909,7 +909,7 @@ public class CHashGlobalVar:CHashSrcSym
|
||||
#define DOCT_PAGE_BREAK 4
|
||||
#define DOCT_CURSOR 5
|
||||
#define DOCT_MARKER 6
|
||||
#define DOCT_PMT 7
|
||||
#define DOCT_PROMPT 7
|
||||
#define DOCT_CLEAR 8
|
||||
#define DOCT_PAGE_LEN 9
|
||||
#define DOCT_LEFT_MARGIN 10
|
||||
@ -1142,7 +1142,7 @@ public class CDocBin
|
||||
#define DOC_COLOR_MACRO LTBLUE
|
||||
#define DOC_COLOR_ANCHOR DKGRAY
|
||||
#define DOC_COLOR_TREE PURPLE
|
||||
#define DOC_COLOR_PMT GREEN
|
||||
#define DOC_COLOR_PROMPT GREEN
|
||||
#define DOC_COLOR_COMMENT GREEN
|
||||
#define DOC_COLOR_BIN LTGREEN
|
||||
#define DOC_COLOR_STR BROWN
|
||||
@ -1244,7 +1244,7 @@ class CEdFindText
|
||||
match_case format "$$CB,\"Match Case\"$$\n",
|
||||
whole_labels format "$$CB,\"Whole Labels\"$$\n",
|
||||
local_var format "$$CB,\"Rename Local Var\"$$\n",
|
||||
pmt,pad;
|
||||
prompt,pad;
|
||||
I64 filter_lines format "$$DA,A=\"Filter Lines:%d\"$$\n";
|
||||
};
|
||||
|
||||
@ -1580,7 +1580,7 @@ public class CAutoCompleteDictGlobals
|
||||
#define RTF_UNSIGNED 1
|
||||
#define RTG_MASK 0xFF
|
||||
|
||||
#define MDf_STK 8
|
||||
#define MDf_STACK 8
|
||||
#define MDf_IMM 9
|
||||
#define MDf_REG 10
|
||||
#define MDf_DISP 11
|
||||
@ -1588,7 +1588,7 @@ public class CAutoCompleteDictGlobals
|
||||
#define MDf_RIP_DISP32 13
|
||||
|
||||
#define MDF_NULL 0x0000
|
||||
#define MDF_STK 0x0100
|
||||
#define MDF_STACK 0x0100
|
||||
#define MDF_IMM 0x0200
|
||||
#define MDF_REG 0x0400
|
||||
#define MDF_DISP 0x0800
|
||||
@ -1614,9 +1614,9 @@ public class CAutoCompleteDictGlobals
|
||||
#define ICF_SHORT_JMP 0x000001000
|
||||
#define ICF_PUSH_RES 0x000002000
|
||||
#define ICF_PASS_TRACE 0x000004000
|
||||
#define ICF_RES_WAS_STK 0x000008000
|
||||
#define ICF_ARG1_WAS_STK 0x000010000
|
||||
#define ICF_ARG2_WAS_STK 0x000020000
|
||||
#define ICF_RES_WAS_STACK 0x000008000
|
||||
#define ICF_ARG1_WAS_STACK 0x000010000
|
||||
#define ICF_ARG2_WAS_STACK 0x000020000
|
||||
#define ICF_PUSH_CMP 0x000040000 //for 50<i<j<=100 exps
|
||||
#define ICF_POP_CMP 0x000080000 //for 50<i<j<=100 exps
|
||||
#define ICF_SWAP 0x000100000
|
||||
@ -1686,12 +1686,12 @@ class CIntermediateCode:CIntermediateCodeBase
|
||||
#assert !($$&7)
|
||||
};
|
||||
|
||||
class CPrsStk
|
||||
class CPrsStack
|
||||
{
|
||||
I64 ptr,
|
||||
stk[255],
|
||||
stack[255],
|
||||
ptr2,
|
||||
stk2[255];
|
||||
stack2[255];
|
||||
};
|
||||
|
||||
#define CMT_LABEL 0
|
||||
@ -1800,7 +1800,7 @@ POP R8 POP RDI POP RSI POP RBP POP RBX POP RDX POP RCX POP RAX
|
||||
|
||||
#define REGG_CLOBBERED 0x013F //RAX,RCX,RDX,RBX,R8
|
||||
#define REGG_SAVED 0x0030 //RBP,RSP
|
||||
#define REGG_STK_TMP 0x0200 //R9
|
||||
#define REGG_STACK_TMP 0x0200 //R9
|
||||
#define REGG_LOCAL_VARS 0xCCC0 //RSI,RDI,R10,R11,R14,R15
|
||||
#define REGG_LOCAL_NON_PTR_VARS 0x3000 //R12,R13
|
||||
|
||||
@ -2035,11 +2035,11 @@ class CCodeCtrl
|
||||
#define __DATE__ #exe{StreamPrint("\"%D\"",Now);}
|
||||
#define __TIME__ #exe{StreamPrint("\"%T\"",Now);}
|
||||
#define __LINE__ #exe{StreamPrint("%d",\
|
||||
Fs->last_cc->lex_include_stk->line_num);}
|
||||
Fs->last_cc->lex_include_stack->line_num);}
|
||||
#define __CMD_LINE__ #exe{StreamPrint("%d",Fs->last_cc->flags&CCF_CMD_LINE &&\
|
||||
Fs->last_cc->lex_include_stk->depth<1);}
|
||||
Fs->last_cc->lex_include_stack->depth<1);}
|
||||
#define __FILE__ #exe{StreamPrint("\"%s\"",\
|
||||
Fs->last_cc->lex_include_stk->full_name);}
|
||||
Fs->last_cc->lex_include_stack->full_name);}
|
||||
#define __DIR__ #exe{StreamDir;}
|
||||
|
||||
#define LFSF_DOC 1
|
||||
@ -2135,8 +2135,8 @@ class CLexHashTableContext
|
||||
|
||||
//CompCtrl flags
|
||||
#define CCF_CMD_LINE 0x001
|
||||
#define CCF_PMT 0x002
|
||||
#define CCf_PMT 1
|
||||
#define CCF_PROMPT 0x002
|
||||
#define CCf_PROMPT 1
|
||||
#define CCF_QUESTION_HELP 0x004
|
||||
#define CCF_DONT_FREE_BUF 0x008
|
||||
#define CCF_NO_DEFINES 0x010
|
||||
@ -2200,8 +2200,8 @@ public class CCompCtrl
|
||||
CMemberList *local_var_entry;
|
||||
CCodeMisc *lb_leave;
|
||||
U8 *cur_buf_ptr;
|
||||
CLexFile *lex_include_stk,
|
||||
*lex_prs_stk,
|
||||
CLexFile *lex_include_stack,
|
||||
*lex_prs_stack,
|
||||
*fun_lex_file;
|
||||
CStreamBlk *next_stream_blk,*last_stream_blk;
|
||||
CAOT *aot;
|
||||
@ -2216,9 +2216,9 @@ public class CCompCtrl
|
||||
dont_push_float,pad[4];
|
||||
|
||||
CCodeCtrl coc;
|
||||
CPrsStk *ps;
|
||||
CPrsStack *ps;
|
||||
CAOTCtrl *aotc;
|
||||
I64 aot_depth,pmt_line;
|
||||
I64 aot_depth,prompt_line;
|
||||
#assert !($$&7)
|
||||
};
|
||||
|
||||
@ -2231,7 +2231,7 @@ public class CCompGlobals
|
||||
U32 *dual_U16_tokens1,*dual_U16_tokens2,*dual_U16_tokens3,
|
||||
*binary_ops;
|
||||
I64 num_reg_vars,num_non_ptr_vars,
|
||||
stk_tmps_mask,reg_vars_mask,non_ptr_vars_mask;
|
||||
stack_tmps_mask,reg_vars_mask,non_ptr_vars_mask;
|
||||
U8 *to_reg_vars_map,*non_ptr_vars_map;
|
||||
I64 size_arg_mask[9],
|
||||
compiled_lines;
|
||||
@ -2837,10 +2837,10 @@ class CMemRange
|
||||
//We add 2 pags, so a request is not rounded-up to next power of two.
|
||||
#define MEM_EXTRA_HASH2_PAGS 2
|
||||
|
||||
#define MEM_ZENITH_STK (MEM_PAG_SIZE*512) //Like 16384*MEM_PAG_SIZE
|
||||
#define MEM_SETH_STK (MEM_PAG_SIZE*512)
|
||||
#define MEM_INTERRUPT_STK (MEM_PAG_SIZE*512)
|
||||
#define MEM_DEFAULT_STK (MEM_PAG_SIZE*512)
|
||||
#define MEM_ZENITH_STACK (MEM_PAG_SIZE*512) //Like 16384*MEM_PAG_SIZE
|
||||
#define MEM_SETH_STACK (MEM_PAG_SIZE*512)
|
||||
#define MEM_INTERRUPT_STACK (MEM_PAG_SIZE*512)
|
||||
#define MEM_DEFAULT_STACK (MEM_PAG_SIZE*512)
|
||||
|
||||
#define TASK_HASH_TABLE_SIZE (1<<10)
|
||||
|
||||
@ -3230,7 +3230,7 @@ public class CTaskSettings
|
||||
#define TASKf_KILL_TASK 1
|
||||
#define TASKf_SUSPENDED 2
|
||||
#define TASKf_IDLE 3
|
||||
#define TASKf_CMD_LINE_PMT 4
|
||||
#define TASKf_CMD_LINE_PROMPT 4
|
||||
#define TASKf_INPUT_FILTER_TASK 5
|
||||
#define TASKf_FILTER_INPUT 6
|
||||
#define TASKf_HAS_SONG 7
|
||||
@ -3254,11 +3254,11 @@ public class CTaskSettings
|
||||
#define TASK_SIGNATURE_VAL 'TskS'
|
||||
#define TASK_NAME_LEN 32
|
||||
#define TASK_EXCEPT_CALLERS 8
|
||||
class CTaskStk
|
||||
class CTaskStack
|
||||
{
|
||||
CTaskStk *next_stk;
|
||||
I64 stk_size,stk_ptr;
|
||||
U0 stk_base;
|
||||
CTaskStack *next_stack;
|
||||
I64 stack_size,stack_ptr;
|
||||
U0 stack_base;
|
||||
};
|
||||
|
||||
#define DYING_JIFFIES ToI64(JIFFY_FREQ/5)
|
||||
@ -3315,7 +3315,7 @@ public class CTask //The Fs segment reg points to current CTask.
|
||||
text_attr,border_attr;
|
||||
U16 win_z_num,pad;
|
||||
|
||||
CTaskStk *stk;
|
||||
CTaskStack *stack;
|
||||
|
||||
CExcept *next_except,*last_except;
|
||||
I64 except_rbp, //throw routine's RBP
|
||||
@ -3403,7 +3403,7 @@ public class CCPU //The Gs segment reg points to current CCPU.
|
||||
CTaskDying *next_dying,*last_dying;
|
||||
I64 kill_jiffy;
|
||||
CTSS *tss;
|
||||
I64 start_stk[16];
|
||||
I64 start_stack[16];
|
||||
#assert !($$&7)
|
||||
};
|
||||
|
||||
@ -3703,7 +3703,7 @@ public class CArcCtrl
|
||||
I64 min_bits,min_table_entry;
|
||||
CArcEntry *cur_entry,*next_entry;
|
||||
I64 cur_bits_in_use,next_bits_in_use;
|
||||
U8 *stk_ptr,*stk_base;
|
||||
U8 *stack_ptr,*stack_base;
|
||||
I64 free_idx,free_limit,
|
||||
saved_basecode,
|
||||
entry_used,
|
||||
@ -3834,7 +3834,7 @@ public class CDebugGlobals
|
||||
//Boot related
|
||||
#define BOOT_RAM_BASE 0x07C00
|
||||
#define BOOT_RAM_LIMIT 0x97000
|
||||
#define BOOT_STK_SIZE BLK_SIZE
|
||||
#define BOOT_STACK_SIZE BLK_SIZE
|
||||
|
||||
#define BOOT_SRC_NULL 0
|
||||
#define BOOT_SRC_ROM 1
|
||||
|
@ -236,9 +236,9 @@ public _extern SYS_PROGRESSES
|
||||
#help_index "MultiCore"
|
||||
#help_file "::/Doc/MultiCore"
|
||||
public _extern SYS_CPU_STRUCTS CCPU *cpu_structs; //$LK,"Gs",A="MN:Gs"$ points to cur $LK,"CCPU",A="MN:CCPU"$.
|
||||
public _extern SYS_MP_CNT I64 mp_count; //Count of cores
|
||||
_extern SYS_MP_CNT_INITIAL I64 mp_count_initial; //only used during $LK,"Core0StartMP",A="MN:Core0StartMP"$
|
||||
_extern SYS_MP_CNT_LOCK I64 mp_count_lock;
|
||||
public _extern SYS_MP_COUNT I64 mp_count; //Count of cores
|
||||
_extern SYS_MP_COUNT_INITIAL I64 mp_count_initial; //only used during $LK,"Core0StartMP",A="MN:Core0StartMP"$
|
||||
_extern SYS_MP_COUNT_LOCK I64 mp_count_lock;
|
||||
_extern SYS_SEMAS CSema sys_semas[SEMA_SEMAS_NUM];
|
||||
|
||||
#help_index "MultiCore;Processor"
|
||||
@ -253,8 +253,8 @@ public _intern IC_GET_RAX I64 GetRAX(); //Get RAX register value.
|
||||
public _intern IC_GET_RBP U8 *GetRBP(); //Get RBP register value.
|
||||
public _intern IC_GET_RFLAGS I64 GetRFlags(); //Get RFlags register value.
|
||||
public _intern IC_GET_RSP U8 *GetRSP(); //Get RSP register value.
|
||||
public _intern IC_POP I64 Pop(); //Pop value from stk.
|
||||
public _intern IC_PUSH U0 Push(I64 d); //Push value on stk.
|
||||
public _intern IC_POP I64 Pop(); //Pop value from stack.
|
||||
public _intern IC_PUSH U0 Push(I64 d); //Push value on stack.
|
||||
public _intern IC_SET_RAX U0 SetRAX(I64 d); //Set RAX register value.
|
||||
public _intern IC_SET_RBP U0 SetRBP(U8 *d); //Set RBP register value.
|
||||
public _intern IC_SET_RFLAGS U0 SetRFlags(I64 d); //Set RFlags register value.
|
||||
|
@ -14,7 +14,7 @@ public extern U8 *rev_bits_table,*set_bits_table;
|
||||
public extern U0 Reboot();
|
||||
|
||||
#help_index "Call"
|
||||
public argpop extern I64 CallStkGrow(I64 stk_size_threshold,I64 stk_size,
|
||||
public argpop extern I64 CallStackGrow(I64 stack_size_threshold,I64 stack_size,
|
||||
/*argpop*/I64 (*fp_addr)(...),...);
|
||||
//fp_addr can have any fixed number of arguments.
|
||||
|
||||
@ -164,7 +164,7 @@ public extern U0 QueueVectU8Put(CQueueVectU8 *v,I64 idx,U8 ch);
|
||||
#help_index "Debugging"
|
||||
public extern U8 *Caller(I64 num=1);
|
||||
public extern Bool CheckCodePtr(U8 *ptr);
|
||||
public extern Bool CheckOnStk(U8 *ptr,CTask *task=NULL);
|
||||
public extern Bool CheckOnStack(U8 *ptr,CTask *task=NULL);
|
||||
public extern Bool CheckPtr(U8 *ptr);
|
||||
public extern Bool IsSingleUser();
|
||||
public extern Bool IsSysDebug();
|
||||
@ -172,7 +172,7 @@ public extern Bool SingleUser(Bool val);
|
||||
public extern Bool SysDebug(Bool val);
|
||||
public extern U8 *TaskCaller(CTask *task=NULL,
|
||||
I64 num=0,Bool saved_context=FALSE);
|
||||
public extern I64 UnusedStk(CTask *task=NULL);
|
||||
public extern I64 UnusedStack(CTask *task=NULL);
|
||||
public extern CDebugGlobals dbg;
|
||||
|
||||
#help_index "Debugging/Debugger"
|
||||
@ -202,7 +202,7 @@ public extern U0 D(U8 *addr,I64 count=0x80,Bool show_offset=TRUE);
|
||||
public extern U0 Da(U8 **addr,I64 count=0x10);
|
||||
public extern U0 Dm(U8 *addr,I64 count=0x80);
|
||||
public extern U0 Dr(CTask *task=NULL);
|
||||
public extern U0 StkRep(CTask *task=NULL);
|
||||
public extern U0 StackRep(CTask *task=NULL);
|
||||
extern I64 *TaskRegAddr(CTask *task,I64 reg_num);
|
||||
|
||||
#help_index "Debugging/FunSeg"
|
||||
@ -632,7 +632,7 @@ public extern U0 MPNMInt();
|
||||
extern CTask *SpawnQueue(U0 (*fp_addr)(U8 *data),U8 *data=NULL,
|
||||
U8 *task_name=NULL,I64 target_cpu,
|
||||
CTask *parent=NULL, //NULL means zenith
|
||||
I64 stk_size=0,I64 flags=1<<JOBf_ADD_TO_QUE);
|
||||
I64 stack_size=0,I64 flags=1<<JOBf_ADD_TO_QUE);
|
||||
|
||||
#help_index "MultiCore;Boot"
|
||||
public extern U0 MPHalt();
|
||||
@ -656,7 +656,7 @@ public _extern SYS_PCI_SERVICES
|
||||
U32 sys_pci_services;//Far call routine in the BIOS
|
||||
|
||||
#help_index "PCI;Info;File/System;Devices"
|
||||
public extern I64 ATARep(Bool pmt=TRUE,
|
||||
public extern I64 ATARep(Bool prompt=TRUE,
|
||||
Bool just_ide=FALSE,CATARep **_head=NULL);
|
||||
|
||||
#help_index "Processor"
|
||||
@ -698,7 +698,7 @@ extern U0 TaskKillDying();
|
||||
public extern U0 TaskQueueIns(CTask *task,CTask *pred=NULL);
|
||||
public extern U0 TaskQueueRemove(CTask *task);
|
||||
public extern Bool TaskValidate(CTask *task);
|
||||
public extern U0 TaskWait(CTask *task=NULL,Bool cmd_line_pmt=FALSE);
|
||||
public extern U0 TaskWait(CTask *task=NULL,Bool cmd_line_prompt=FALSE);
|
||||
public extern CTask *User(U8 *fmt=NULL,...);
|
||||
public extern U0 UserCmdLine();
|
||||
public _extern _YIELD U0 Yield();
|
||||
@ -725,7 +725,7 @@ public extern U0 WinDerivedValsUpdate(CTask *task);
|
||||
public extern CTask *Spawn(U0 (*fp_addr)(U8 *data),U8 *data=NULL,
|
||||
U8 *task_name=NULL,I64 target_cpu=-1, //-1 means current CPU
|
||||
CTask *parent=NULL, //NULL means zenith
|
||||
I64 stk_size=0,I64 flags=1<<JOBf_ADD_TO_QUE);
|
||||
I64 stack_size=0,I64 flags=1<<JOBf_ADD_TO_QUE);
|
||||
|
||||
#help_index "Time/CPU Cycles;Time/HPET;Time/Jiffies"
|
||||
public extern CCountsGlobals counts;
|
||||
|
@ -35,14 +35,14 @@ AP_32BIT_INIT:
|
||||
MOV SS,AX
|
||||
|
||||
@@05: LOCK
|
||||
BTS U32 [SYS_MP_CNT_LOCK],0
|
||||
BTS U32 [SYS_MP_COUNT_LOCK],0
|
||||
JC @@05
|
||||
|
||||
MOV ESI,U32 [SYS_MP_CNT_INITIAL]
|
||||
MOV ESI,U32 [SYS_MP_COUNT_INITIAL]
|
||||
LOCK
|
||||
INC U32 [SYS_MP_CNT_INITIAL]
|
||||
INC U32 [SYS_MP_COUNT_INITIAL]
|
||||
LOCK
|
||||
BTR U32 [SYS_MP_CNT_LOCK],0
|
||||
BTR U32 [SYS_MP_COUNT_LOCK],0
|
||||
|
||||
CMP ESI,MP_PROCESSORS_NUM
|
||||
JAE I32 _SYS_HLT
|
||||
@ -50,7 +50,7 @@ AP_32BIT_INIT:
|
||||
IMUL2 ESI,sizeof(CCPU)
|
||||
ADD ESI,U32 [SYS_CPU_STRUCTS]
|
||||
|
||||
LEA ESP,U32 CCPU.start_stk+sizeof(CCPU.start_stk)[ESI]
|
||||
LEA ESP,U32 CCPU.start_stack+sizeof(CCPU.start_stack)[ESI]
|
||||
PUSH U32 RFLAGG_START
|
||||
POPFD
|
||||
PUSH U32 0 //Return from next call will be 64-bit
|
||||
@ -80,11 +80,11 @@ CTSS *TSSNew(I64 cpu_num)
|
||||
tss->io_map_offset=offset(CTSS.io_map);
|
||||
MemSet(tss->io_map,0xFF,0x10000/8);
|
||||
|
||||
tss->st0=MAlloc(MEM_INTERRUPT_STK);
|
||||
tss->st0=MAlloc(MEM_INTERRUPT_STACK);
|
||||
tss->rsp0=tss->st0(U8 *)+MSize(tss->st0);
|
||||
tss->st1=MAlloc(MEM_INTERRUPT_STK);
|
||||
tss->st1=MAlloc(MEM_INTERRUPT_STACK);
|
||||
tss->rsp1=tss->st1(U8 *)+MSize(tss->st1);
|
||||
tss->st2=MAlloc(MEM_INTERRUPT_STK);
|
||||
tss->st2=MAlloc(MEM_INTERRUPT_STACK);
|
||||
tss->rsp2=tss->st2(U8 *)+MSize(tss->st2);
|
||||
|
||||
tss->tr =offset(CGDT.tr)+cpu_num*16;
|
||||
@ -246,11 +246,11 @@ CJob *JobQueue(I64 (*fp_addr)(U8 *data),U8 *data=NULL,
|
||||
|
||||
CTask *SpawnQueue(U0 (*fp_addr)(U8 *data),U8 *data=NULL,U8 *task_name=NULL,
|
||||
I64 target_cpu, CTask *parent=NULL, //NULL means zenith
|
||||
I64 stk_size=0,I64 flags=1<<JOBf_ADD_TO_QUE)
|
||||
I64 stack_size=0,I64 flags=1<<JOBf_ADD_TO_QUE)
|
||||
{
|
||||
CTask *res;
|
||||
CJob *tmpc=JobQueue(fp_addr,data,target_cpu,
|
||||
flags,JOBT_SPAWN_TASK,task_name,parent,stk_size);
|
||||
flags,JOBT_SPAWN_TASK,task_name,parent,stack_size);
|
||||
CJobCtrl *ctrl;
|
||||
|
||||
while (!Bt(&tmpc->flags,JOBf_DONE)) {
|
||||
@ -335,7 +335,7 @@ U0 Core0StartMP()
|
||||
|
||||
for (i=1;i<my_mp_count;i++) {
|
||||
StrPrint(buf,"Seth Task CPU%02X",i);
|
||||
task=Spawn(&CoreAPSethInit,NULL,buf,,,MEM_SETH_STK,0);
|
||||
task=Spawn(&CoreAPSethInit,NULL,buf,,,MEM_SETH_STACK,0);
|
||||
task->rflags=RFLAGG_START;
|
||||
//$LK,"CTask",A="MN:CTask"$ alloced off this core's seth_task's heap (Which is Zenith)
|
||||
CPUStructInit(i,&cpu_structs[i],task);
|
||||
|
@ -85,8 +85,8 @@ _FAR_CALL32::
|
||||
PUSH U64 FS:CTask.addr[RAX]
|
||||
PUSH U64 GS:CCPU.addr[RAX]
|
||||
MOV U64 [C32_RSP],RSP
|
||||
PUSH U32 CGDT.ds //STKSEG
|
||||
PUSH U32 BOOT_RAM_LIMIT //STK
|
||||
PUSH U32 CGDT.ds //STACKSEG
|
||||
PUSH U32 BOOT_RAM_LIMIT //STACK
|
||||
PUSH U32 0 //FLAGS--interrupts off
|
||||
PUSH U32 CGDT.cs32
|
||||
LEA RAX,[@@15]
|
||||
|
@ -62,7 +62,7 @@ TASK_CONTEXT_SAVE::
|
||||
POP U64 CTask.rsi[RSI]
|
||||
MOV U64 CTask.rax[RSI],RAX
|
||||
|
||||
/*Divert the stk to the Task memory
|
||||
/*Divert the stack to the Task memory
|
||||
and push onto it and divert it back.
|
||||
It's a little faster.
|
||||
*/
|
||||
@ -195,8 +195,8 @@ RESTORE_RSI_TASK2:
|
||||
BTR U32 GS:CCPU.cpu_flags[RAX],CPUf_RAN_A_TASK
|
||||
JC @@20 //Jmp if had chance for IRQ already
|
||||
MOV RAX,U64 GS:CCPU.idle_task[RAX]
|
||||
MOV RSP,U64 CTask.stk[RAX]
|
||||
ADD RSP,MEM_DEFAULT_STK+CTaskStk.stk_base //Reset to top
|
||||
MOV RSP,U64 CTask.stack[RAX]
|
||||
ADD RSP,MEM_DEFAULT_STACK+CTaskStack.stack_base //Reset to top
|
||||
CALL SET_FS_BASE
|
||||
STI //Restore idle task so we can unmask IRQs.
|
||||
HLT
|
||||
|
@ -173,7 +173,7 @@ U0 DoInstructions()
|
||||
XTalk(task, "Ed(\"::/Doc/Install.DD\");\n");
|
||||
}
|
||||
|
||||
Bool DoInstall(Bool pmt_reboot)
|
||||
Bool DoInstall(Bool prompt_reboot)
|
||||
{
|
||||
I64 res=FALSE,vm_install;
|
||||
"\n\n\n\n\nAre you installing inside VMware, QEMU, VirtualBox "
|
||||
@ -193,9 +193,9 @@ Bool DoInstall(Bool pmt_reboot)
|
||||
RegularInstallWiz();
|
||||
res=TRUE;
|
||||
} else
|
||||
pmt_reboot=FALSE;
|
||||
prompt_reboot=FALSE;
|
||||
}
|
||||
if (pmt_reboot) {
|
||||
if (prompt_reboot) {
|
||||
"Reboot Now ";
|
||||
if (YorN)
|
||||
Reboot;
|
||||
@ -203,10 +203,10 @@ Bool DoInstall(Bool pmt_reboot)
|
||||
return res;
|
||||
}
|
||||
|
||||
Bool OSInstall(Bool pmt_reboot=TRUE)
|
||||
Bool OSInstall(Bool prompt_reboot=TRUE)
|
||||
{
|
||||
DoInstructions;
|
||||
return DoInstall(pmt_reboot);
|
||||
return DoInstall(prompt_reboot);
|
||||
}
|
||||
|
||||
#if __CMD_LINE__
|
||||
|
@ -1673,7 +1673,7 @@ U0 OSTestSuite()
|
||||
TS("MenuSprite");DoMenuSprite;
|
||||
TS("SuggestedSpelling"); DoSuggestedSpelling;
|
||||
TS("WordSearch"); TSFileChar("::/Demo/WordSearch");
|
||||
TS("StkGrow"); TSFile("::/Demo/StkGrow");
|
||||
TS("StackGrow"); TSFile("::/Demo/StackGrow");
|
||||
TS("MemDemo"); TSFile("::/Demo/MemDemo");
|
||||
TS("WaterFowl"); TSFileChar("::/Demo/Sound/WaterFowl");
|
||||
TS("AsmHelloWorld"); TSFile("::/Demo/Asm/AsmHelloWorld");
|
||||
|
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
#define BOOT_HIGH_LOC_DVD ((BOOT_RAM_LIMIT-\
|
||||
(BOOT_STK_SIZE+DVD_BOOT_LOADER_SIZE))>>4)
|
||||
(BOOT_STACK_SIZE+DVD_BOOT_LOADER_SIZE))>>4)
|
||||
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC_DVD","%08X",BOOT_HIGH_LOC_DVD<<4);
|
||||
@ -16,7 +16,7 @@ BDVD_START::
|
||||
|
||||
CLI
|
||||
MOV SS,AX
|
||||
MOV SP,BOOT_STK_SIZE+DVD_BOOT_LOADER_SIZE
|
||||
MOV SP,BOOT_STACK_SIZE+DVD_BOOT_LOADER_SIZE
|
||||
STI
|
||||
|
||||
CALL BDVD_GET_RIP
|
||||
@ -56,7 +56,7 @@ BDVD_NOT64_MESSAGE:
|
||||
//These get patched.
|
||||
BDVD_BLK_LO:: DU16 0;
|
||||
BDVD_BLK_HI:: DU16 0;
|
||||
BDVD_BLK_CNT:: DU16 0;
|
||||
BDVD_BLK_COUNT:: DU16 0;
|
||||
BDVD_SHIFT_BLKS:: DU16 0;
|
||||
BDVD_PROGRESS_STEP:: DU32 0;
|
||||
BDVD_PROGRESS_VAL:: DU32 0;
|
||||
@ -101,7 +101,7 @@ BDVD_MAIN::
|
||||
MOV AX,BOOT_RAM_BASE/16
|
||||
MOV ES,AX
|
||||
XOR ECX,ECX
|
||||
MOV CX,U16 [BDVD_BLK_CNT-BDVD_START]
|
||||
MOV CX,U16 [BDVD_BLK_COUNT-BDVD_START]
|
||||
|
||||
MOV EAX,(80-7-9)*65536 //80 columns
|
||||
XOR EDX,EDX
|
||||
@ -153,7 +153,7 @@ BDVD_MAIN::
|
||||
PUSH DS
|
||||
MOV BX,U16 [BDVD_SHIFT_BLKS-BDVD_START]
|
||||
SHL BX,BLK_SIZE_BITS-4
|
||||
MOV CX,U16 [BDVD_BLK_CNT-BDVD_START]
|
||||
MOV CX,U16 [BDVD_BLK_COUNT-BDVD_START]
|
||||
MOV AX,BOOT_RAM_BASE/16
|
||||
MOV ES,AX
|
||||
ADD AX,BX
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define MODULE_SIZE 1*BLK_SIZE
|
||||
#define BOOT_HIGH_LOC_HD ((BOOT_RAM_LIMIT-\
|
||||
(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
(BOOT_STACK_SIZE+MODULE_SIZE))>>4)
|
||||
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC_HD","%08X",BOOT_HIGH_LOC_HD<<4);
|
||||
@ -18,7 +18,7 @@ BHD_CODE::
|
||||
|
||||
CLI
|
||||
MOV SS,AX
|
||||
MOV SP,BOOT_STK_SIZE+MODULE_SIZE
|
||||
MOV SP,BOOT_STACK_SIZE+MODULE_SIZE
|
||||
STI
|
||||
|
||||
CALL BHD_GET_RIP
|
||||
@ -45,7 +45,7 @@ BHD_GET_RIP:
|
||||
BHD_BIOS_DRV_NUM: DU8 0;
|
||||
|
||||
//Gets patched by $LK,"BootHDIns",A="MN:BootHDIns"$().
|
||||
BHD_BLK_CNT:: DU16 0;
|
||||
BHD_BLK_COUNT:: DU16 0;
|
||||
|
||||
BHD_DAP: DU8 16,0,1,0; //One blk at a time
|
||||
BHD_DAP_BUF: DU16 0,0;
|
||||
@ -59,7 +59,7 @@ BHD_HISTART:
|
||||
MOV AX,BOOT_RAM_BASE/16
|
||||
MOV ES,AX
|
||||
XOR ECX,ECX
|
||||
MOV CX,U16 [BHD_BLK_CNT-BHD_START]
|
||||
MOV CX,U16 [BHD_BLK_COUNT-BHD_START]
|
||||
|
||||
@@05: PUSH CX //Blk count
|
||||
|
||||
|
@ -16,7 +16,7 @@ U0 CompComp()
|
||||
|
||||
U0 MakeAll()
|
||||
{
|
||||
CompComp;
|
||||
CompComp;
|
||||
if (Comp("/Kernel/Kernel","Kernel",,':'))
|
||||
throw;
|
||||
}
|
||||
@ -46,7 +46,7 @@ public U0 BootHDIns(U8 drv_let=0)
|
||||
br.jump_and_nop[1]=offset(CFAT32Boot.code)-2;
|
||||
#assert offset(CFAT32Boot.code)>=offset(CRedSeaBoot.code)
|
||||
br.jump_and_nop[2]=OC_NOP;
|
||||
*BHD_BLK_CNT(U16 *)=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
*BHD_BLK_COUNT(U16 *)=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
*BHD_DAP_BLK(I64 *)=Clus2Blk(dv,de.clus);
|
||||
for (i=0;i<BHD_END-BHD_CODE;i++)
|
||||
br.code[i]=BHD_CODE(U8 *)[i];
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define MODULE_SIZE 1*BLK_SIZE
|
||||
#define BOOT_HIGH_LOC_MHD ((BOOT_RAM_LIMIT-\
|
||||
(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
(BOOT_STACK_SIZE+MODULE_SIZE))>>4)
|
||||
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC_MHD","%08X",BOOT_HIGH_LOC_MHD<<4);
|
||||
@ -15,7 +15,7 @@ BMHD_CODE::
|
||||
|
||||
CLI
|
||||
MOV SS,AX
|
||||
MOV SP,BOOT_STK_SIZE+MODULE_SIZE
|
||||
MOV SP,BOOT_STACK_SIZE+MODULE_SIZE
|
||||
STI
|
||||
|
||||
PUSHFW
|
||||
@ -59,7 +59,7 @@ BMHD_GET_RIP:
|
||||
BMHD_BIOS_DRV_NUM: DU8 0;
|
||||
BMHD_OLD_CS_RIP: DU16 0,0;
|
||||
//Gets patched by $LK,"BootHDIns",A="MN:BootHDIns"$().
|
||||
BMHD_BLK_CNT:: DU16 0;
|
||||
BMHD_BLK_COUNT:: DU16 0;
|
||||
|
||||
BMHD_DAP: DU8 16,0,1,0; //One blk at a time
|
||||
BMHD_DAP_BUF: DU16 0,0;
|
||||
@ -73,7 +73,7 @@ BMHD_HISTART:
|
||||
MOV AX,BOOT_RAM_BASE/16
|
||||
MOV ES,AX
|
||||
XOR ECX,ECX
|
||||
MOV CX,U16 [BMHD_BLK_CNT-BMHD_START]
|
||||
MOV CX,U16 [BMHD_BLK_COUNT-BMHD_START]
|
||||
|
||||
@@05: PUSH CX //Blk count
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define MODULE_SIZE 2*BLK_SIZE
|
||||
#define BOOT_HIGH_LOC_MHD2 ((BOOT_RAM_LIMIT-\
|
||||
(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
(BOOT_STACK_SIZE+MODULE_SIZE))>>4)
|
||||
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC_MHD2","%08X",BOOT_HIGH_LOC_MHD2<<4);
|
||||
|
@ -126,7 +126,7 @@ public Bool BootMHDIns(U8 drv_let,U8 *drv_list=NULL)
|
||||
"No Boot Loader Image\n";
|
||||
else {
|
||||
Free(de.full_name);
|
||||
*BMHD_BLK_CNT(U16 *)=(size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
*BMHD_BLK_COUNT(U16 *)=(size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
*BMHD_DAP_BLK(I64 *)=Clus2Blk(dv,de.clus);
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bd);
|
||||
|
@ -33,11 +33,11 @@ U0 RedSeaISO9660Stage1(U8 *iso_filename,U8 *stage2_filename)
|
||||
if (FileFind(stage2_filename,&de) && (out_file=FOpen(iso_filename,"wc+"))) {
|
||||
MemCpy(stage1_buf,BDVD_START,BDVD_END-BDVD_START);
|
||||
*(BDVD_BLK_LO -BDVD_START+stage1_buf)(U32 *)=de.clus>>2;
|
||||
*(BDVD_BLK_CNT -BDVD_START+stage1_buf)(U16 *)=
|
||||
*(BDVD_BLK_COUNT -BDVD_START+stage1_buf)(U16 *)=
|
||||
(de.size+DVD_BLK_SIZE-1)>>(BLK_SIZE_BITS+2);
|
||||
*(BDVD_SHIFT_BLKS -BDVD_START+stage1_buf)(U16 *)=de.clus&3;
|
||||
if (de.clus&3)
|
||||
*(BDVD_BLK_CNT -BDVD_START+stage1_buf)(U16 *)+=1;
|
||||
*(BDVD_BLK_COUNT -BDVD_START+stage1_buf)(U16 *)+=1;
|
||||
FBlkWrite(out_file,stage1_buf,
|
||||
20<<2+1<<2,DVD_BOOT_LOADER_SIZE/BLK_SIZE);
|
||||
FClose(out_file);
|
||||
|
@ -15,7 +15,7 @@ class CTemplateCS
|
||||
CTemplateCS *CtrlSliderGet()
|
||||
{
|
||||
CTemplateCSSlider *tmps;
|
||||
U8 *st,pmt[STR_LEN];
|
||||
U8 *st,prompt[STR_LEN];
|
||||
CTemplateCS *res=CAlloc(sizeof(CTemplateCS));
|
||||
|
||||
"$$PURPLE$$Ctrl Slider$$FG$$\n\n";
|
||||
@ -27,8 +27,8 @@ CTemplateCS *CtrlSliderGet()
|
||||
|
||||
res->next_slider=res->last_slider=&res->next_slider;
|
||||
while (TRUE) {
|
||||
StrPrint(pmt,"Slider #%d Name:",res->num_sliders+1);
|
||||
st=GetStr(pmt);
|
||||
StrPrint(prompt,"Slider #%d Name:",res->num_sliders+1);
|
||||
st=GetStr(prompt);
|
||||
if (!*st) {
|
||||
Free(st);
|
||||
break;
|
||||
|
@ -77,7 +77,7 @@ I64 EdRILex(CRILex *rx)
|
||||
rx->is_not_cont=TRUE;
|
||||
if (rx->was_new_line && (rx->cc1->token!=':' || i==KW_CASE ||
|
||||
i==KW_DEFAULT || i==KW_START || i==KW_END)) {
|
||||
tmpf=rx->cc2->lex_include_stk;
|
||||
tmpf=rx->cc2->lex_include_stack;
|
||||
while (tmpf->next)
|
||||
tmpf=tmpf->next;
|
||||
QueueVectU8Put(rx->indent,tmpf->cur_entry->y,rx->depth+rx->one_shot);
|
||||
@ -247,13 +247,13 @@ CQueueVectU8 *EdRICode(CDoc *doc)
|
||||
CRILex *rx=CAlloc(sizeof(CRILex));
|
||||
|
||||
rx->cc1=CompCtrlNew(,CCF_KEEP_NEW_LINES|CCF_DONT_FREE_BUF,doc->filename.name);
|
||||
Free(rx->cc1->lex_include_stk->full_name);
|
||||
LexAttachDoc(rx->cc1,rx->cc1->lex_include_stk,doc,,
|
||||
Free(rx->cc1->lex_include_stack->full_name);
|
||||
LexAttachDoc(rx->cc1,rx->cc1->lex_include_stack,doc,,
|
||||
doc->cur_entry,doc->cur_col);
|
||||
|
||||
rx->cc2=CompCtrlNew(,CCF_KEEP_NEW_LINES|CCF_DONT_FREE_BUF,doc->filename.name);
|
||||
Free(rx->cc2->lex_include_stk->full_name);
|
||||
LexAttachDoc(rx->cc2,rx->cc2->lex_include_stk,doc,,
|
||||
Free(rx->cc2->lex_include_stack->full_name);
|
||||
LexAttachDoc(rx->cc2,rx->cc2->lex_include_stack,doc,,
|
||||
doc->cur_entry,doc->cur_col);
|
||||
|
||||
rx->indent=QueueVectU8New(doc->cur_entry->y);
|
||||
|
@ -386,11 +386,11 @@ I64 EdFindReplace(CDoc *doc)
|
||||
I64 cmd,i,j,plen,rlen,dlen,res=-1,sf_flags;
|
||||
U8 *src,*dst,*dst2;
|
||||
CDocEntry *doc_ce,*doc_e,*doc_marker=NULL;
|
||||
if (doc->find_replace->pmt)
|
||||
if (doc->find_replace->prompt)
|
||||
cmd=RSAC_REPLACE;
|
||||
else
|
||||
cmd=RSAC_ALL;
|
||||
if (!doc->find_replace->pmt || DocForm(doc->find_replace)) {
|
||||
if (!doc->find_replace->prompt || DocForm(doc->find_replace)) {
|
||||
res=0;
|
||||
unlock=DocLock(doc);
|
||||
if (doc->find_replace->match_case || doc->find_replace->local_var)
|
||||
@ -560,7 +560,7 @@ Bool sel=TRUE,Bool match_case=TRUE,Bool whole_labels=FALSE)
|
||||
doc->find_replace->scan_sel_text=sel;
|
||||
doc->find_replace->match_case=match_case;
|
||||
doc->find_replace->whole_labels=whole_labels;
|
||||
doc->find_replace->pmt=FALSE;
|
||||
doc->find_replace->prompt=FALSE;
|
||||
res=EdFindReplace(doc);
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ U8 *DocGetStr2(I64 flags=0)
|
||||
if (flags&GSF_WITH_NEW_LINE) {
|
||||
doc_e=doc->cur_entry;
|
||||
do doc_e=doc_e->last;
|
||||
while (doc_e!=doc && doc_e->type_u8!=DOCT_PMT);
|
||||
while (doc_e!=doc && doc_e->type_u8!=DOCT_PROMPT);
|
||||
doc_e=doc_e->next;
|
||||
if (res=DocScanLine(doc,doc_e,NULL,&doc_e_end)) {
|
||||
while (doc_e_end!=doc && doc_e_end->type_u8==DOCT_NEW_LINE) {
|
||||
@ -153,11 +153,11 @@ U8 *DocGetStr2(I64 flags=0)
|
||||
doc_e=doc->cur_entry;
|
||||
do doc_e=doc_e->last;
|
||||
while (doc_e!=doc && doc_e->type_u8!=DOCT_NEW_LINE &&
|
||||
doc_e->type_u8!=DOCT_PMT);
|
||||
if (doc_e!=doc && doc_e->type_u8!=DOCT_PMT) {
|
||||
doc_e->type_u8!=DOCT_PROMPT);
|
||||
if (doc_e!=doc && doc_e->type_u8!=DOCT_PROMPT) {
|
||||
do doc_e=doc_e->last;
|
||||
while (doc_e!=doc && doc_e->type_u8!=DOCT_NEW_LINE &&
|
||||
doc_e->type_u8!=DOCT_PMT);
|
||||
doc_e->type_u8!=DOCT_PROMPT);
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
res=DocScanLine(doc,doc_e,NULL);
|
||||
|
@ -52,7 +52,7 @@ U0 DocInit()
|
||||
|
||||
//Don't forget $LK,"cmp_type_flags_src_code",A="MN:cmp_type_flags_src_code"$.
|
||||
doldoc.type_flags_nontag_invis[0]=
|
||||
1<<DOCT_PMT|
|
||||
1<<DOCT_PROMPT|
|
||||
1<<DOCT_PAGE_LEN|
|
||||
1<<DOCT_LEFT_MARGIN|
|
||||
1<<DOCT_RIGHT_MARGIN|
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user