TempleOSCDV4.12.ISO
This commit is contained in:
1 parent
93ca216483
commit
b84bbff6db
381 files changed
+18356
-18798
No files matched your search
+166
-166
@@ -1,7 +1,7 @@
|
||||
U8 *LexStmt2Bin(CCmpCtrl *cc,I64 *_type,I64 cmp_flags=0)
|
||||
{//Compile one cc stmt to bin code.
|
||||
I64 size,i,j,k,*res=INVALID_PTR;
|
||||
CCodeCtrl *tempcbh;
|
||||
CCodeCtrl *tmpcbh;
|
||||
if (_type) *_type=RT_I64;
|
||||
Btr(&cc->flags,CCf_PASS_TRACE_PRESENT);
|
||||
if (cc->aot_depth==2)
|
||||
@@ -26,8 +26,8 @@ U8 *LexStmt2Bin(CCmpCtrl *cc,I64 *_type,I64 cmp_flags=0)
|
||||
} else //TODO: too dangerous to del Misc?
|
||||
QueDel(&cc->coc.coc_head.next);
|
||||
if (cc->aot_depth==2) {
|
||||
tempcbh=COCPopNoFree(cc);
|
||||
COCAppend(cc,tempcbh);
|
||||
tmpcbh=COCPopNoFree(cc);
|
||||
COCAppend(cc,tmpcbh);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -37,8 +37,8 @@ CAOT *CmpJoin(CCmpCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=0)
|
||||
CAOTCtrl *aotc,*old_aot=cc->aotc;
|
||||
I64 i,j,l;
|
||||
U8 *buf;
|
||||
CAOTBinBlk *tempbin;
|
||||
CAOTImportExport *tempie;
|
||||
CAOTBinBlk *tmpbin;
|
||||
CAOTImportExport *tmpie;
|
||||
Bool okay=TRUE;
|
||||
CLexHashTableContext *htc=MAlloc(sizeof(CLexHashTableContext));
|
||||
CAOT *res=CAlloc(sizeof(CAOT)),*parent;
|
||||
@@ -83,10 +83,10 @@ CAOT *CmpJoin(CCmpCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=0)
|
||||
while (cc->token!=TK_EOF) {
|
||||
buf=LexStmt2Bin(cc,NULL,cmp_flags);
|
||||
if (buf!=INVALID_PTR) {
|
||||
tempie=CAlloc(sizeof(CAOTImportExport));
|
||||
tempie->type=IET_MAIN;
|
||||
tempie->ip=buf;
|
||||
QueIns(tempie,res->last_ie);
|
||||
tmpie=CAlloc(sizeof(CAOTImportExport));
|
||||
tmpie->type=IET_MAIN;
|
||||
tmpie->ip=buf;
|
||||
QueIns(tmpie,res->last_ie);
|
||||
}
|
||||
if (cmp_flags&CMPF_ASM_BLK)
|
||||
break;
|
||||
@@ -126,17 +126,17 @@ CAOT *CmpJoin(CCmpCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=0)
|
||||
res->buf=aotc->module_org;
|
||||
}
|
||||
res->aot_U8s=aotc->num_bin_U8s;
|
||||
tempbin=aotc->bin;
|
||||
tmpbin=aotc->bin;
|
||||
j=0;
|
||||
l=aotc->num_bin_U8s;
|
||||
while (tempbin) {
|
||||
while (tmpbin) {
|
||||
i=l;
|
||||
if (i>AOT_BIN_BLK_SIZE)
|
||||
i=AOT_BIN_BLK_SIZE;
|
||||
MemCpy(res->buf+j,tempbin->body,i);
|
||||
MemCpy(res->buf+j,tmpbin->body,i);
|
||||
j+=i;
|
||||
l-=i;
|
||||
tempbin=tempbin->next;
|
||||
tmpbin=tmpbin->next;
|
||||
}
|
||||
}
|
||||
LinkedLstDel(aotc->bin);
|
||||
@@ -171,20 +171,20 @@ CAOT *CmpBuf(U8 *buf,U8 *map_name=NULL,
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 CmpFixUpJITAsm(CCmpCtrl *cc,CAOT *tempaot)
|
||||
U0 CmpFixUpJITAsm(CCmpCtrl *cc,CAOT *tmpaot)
|
||||
{
|
||||
I64 i,ip2=tempaot->buf+tempaot->ip,*str=NULL;
|
||||
I64 i,ip2=tmpaot->buf+tmpaot->ip,*str=NULL;
|
||||
U8 *ptr;
|
||||
CCodeMisc *g_lb;
|
||||
CAOTAbsAddr *tempa,*tempa1;
|
||||
CAOTImportExport *tempie,*tempie1;
|
||||
CHashExport *tempex;
|
||||
CAOTAbsAddr *tmpa,*tmpa1;
|
||||
CAOTImportExport *tmpie,*tmpie1;
|
||||
CHashExport *tmpex;
|
||||
|
||||
tempa=tempaot->abss;
|
||||
while (tempa) {
|
||||
tempa1=tempa->next;
|
||||
ptr=ip2+tempa->ip;
|
||||
switch [tempa->type] {
|
||||
tmpa=tmpaot->abss;
|
||||
while (tmpa) {
|
||||
tmpa1=tmpa->next;
|
||||
ptr=ip2+tmpa->ip;
|
||||
switch [tmpa->type] {
|
||||
case AAT_ADD_U8: *ptr(U8 *) +=ip2; break;
|
||||
case AAT_SUB_U8: *ptr(U8 *) -=ip2; break;
|
||||
case AAT_ADD_U16: *ptr(U16 *)+=ip2; break;
|
||||
@@ -194,63 +194,63 @@ U0 CmpFixUpJITAsm(CCmpCtrl *cc,CAOT *tempaot)
|
||||
case AAT_ADD_U64: *ptr(I64 *)+=ip2; break;
|
||||
case AAT_SUB_U64: *ptr(I64 *)-=ip2; break;
|
||||
}
|
||||
Free(tempa);
|
||||
tempa=tempa1;
|
||||
Free(tmpa);
|
||||
tmpa=tmpa1;
|
||||
}
|
||||
tempie=tempaot->next_ie;
|
||||
while (tempie!=&tempaot->next_ie) {
|
||||
tempie1=tempie->next;
|
||||
if (tempie->str) {
|
||||
tmpie=tmpaot->next_ie;
|
||||
while (tmpie!=&tmpaot->next_ie) {
|
||||
tmpie1=tmpie->next;
|
||||
if (tmpie->str) {
|
||||
Free(str);
|
||||
str=tempie->str;
|
||||
str=tmpie->str;
|
||||
}
|
||||
switch (tempie->type) {
|
||||
switch (tmpie->type) {
|
||||
case IET_REL32_EXPORT:
|
||||
case IET_IMM32_EXPORT:
|
||||
case IET_REL64_EXPORT:
|
||||
case IET_IMM64_EXPORT:
|
||||
tempex=CAlloc(sizeof(CHashExport));
|
||||
tempex->str=str;
|
||||
tmpex=CAlloc(sizeof(CHashExport));
|
||||
tmpex->str=str;
|
||||
str=NULL;
|
||||
tempex->type=HTT_EXPORT_SYS_SYM|HTF_IMM;
|
||||
if (tempie->type==IET_IMM32_EXPORT||tempie->type==IET_IMM64_EXPORT)
|
||||
tempex->val=tempie->ip;
|
||||
tmpex->type=HTT_EXPORT_SYS_SYM|HTF_IMM;
|
||||
if (tmpie->type==IET_IMM32_EXPORT||tmpie->type==IET_IMM64_EXPORT)
|
||||
tmpex->val=tmpie->ip;
|
||||
else
|
||||
tempex->val=tempie->ip+ip2;
|
||||
tempex->src_link=tempie->src_link;
|
||||
tempie->src_link=NULL;
|
||||
HashAdd(tempex,Fs->hash_table);
|
||||
SysSymImportsResolve(tempex->str);
|
||||
tmpex->val=tmpie->ip+ip2;
|
||||
tmpex->src_link=tmpie->src_link;
|
||||
tmpie->src_link=NULL;
|
||||
HashAdd(tmpex,Fs->hash_table);
|
||||
SysSymImportsResolve(tmpex->str);
|
||||
break;
|
||||
case IET_REL_I0...IET_IMM_I64:
|
||||
if (tempie->str) {
|
||||
if (tempie->flags&IEF_GOTO_LABEL) {
|
||||
if (tmpie->str) {
|
||||
if (tmpie->flags&IEF_GOTO_LABEL) {
|
||||
if(!(g_lb=COCGoToLabelFind(cc,str)))
|
||||
"Unresolved Reference:%s\n",str;
|
||||
else {
|
||||
g_lb->use_cnt++;
|
||||
g_lb=OptLabelFwd(g_lb);
|
||||
i=g_lb->addr+tempaot->buf;
|
||||
i=g_lb->addr+tmpaot->buf;
|
||||
}
|
||||
tempex=NULL;
|
||||
tmpex=NULL;
|
||||
} else {
|
||||
if (!(tempex=HashFind(str,Fs->hash_table,
|
||||
if (!(tmpex=HashFind(str,Fs->hash_table,
|
||||
HTG_ALL-HTT_IMPORT_SYS_SYM)))
|
||||
"Unresolved Reference:%s\n",str;
|
||||
else {
|
||||
if (tempex->type & HTT_FUN)
|
||||
i=tempex(CHashFun *)->exe_addr;
|
||||
else if (tempex->type & HTT_GLBL_VAR)
|
||||
i=tempex(CHashGlblVar *)->data_addr;
|
||||
if (tmpex->type & HTT_FUN)
|
||||
i=tmpex(CHashFun *)->exe_addr;
|
||||
else if (tmpex->type & HTT_GLBL_VAR)
|
||||
i=tmpex(CHashGlblVar *)->data_addr;
|
||||
else
|
||||
i=tempex->val;
|
||||
i=tmpex->val;
|
||||
}
|
||||
g_lb=NULL;
|
||||
}
|
||||
}
|
||||
if (tempex || g_lb) {
|
||||
ptr=tempie->ip+ip2;
|
||||
switch [tempie->type] {
|
||||
if (tmpex || g_lb) {
|
||||
ptr=tmpie->ip+ip2;
|
||||
switch [tmpie->type] {
|
||||
case IET_REL_I0:
|
||||
case IET_IMM_U0:
|
||||
break;
|
||||
@@ -288,32 +288,32 @@ U0 CmpFixUpJITAsm(CCmpCtrl *cc,CAOT *tempaot)
|
||||
}
|
||||
break;
|
||||
}
|
||||
Free(tempie->src_link);
|
||||
Free(tempie);
|
||||
tempie=tempie1;
|
||||
Free(tmpie->src_link);
|
||||
Free(tmpie);
|
||||
tmpie=tmpie1;
|
||||
}
|
||||
Free(str);
|
||||
if (!cc->aot_depth && Bt(&cc->opts,OPTf_TRACE))
|
||||
Un(ip2,tempaot->aot_U8s,64);
|
||||
QueRem(tempaot);
|
||||
Free(tempaot);
|
||||
Un(ip2,tmpaot->aot_U8s,64);
|
||||
QueRem(tmpaot);
|
||||
Free(tmpaot);
|
||||
}
|
||||
|
||||
U0 CmpFixUpAOTAsm(CCmpCtrl *cc,CAOT *tempaot)
|
||||
U0 CmpFixUpAOTAsm(CCmpCtrl *cc,CAOT *tmpaot)
|
||||
{
|
||||
CAOTCtrl *aotc=cc->aotc;
|
||||
I64 i,ip2=tempaot->ip+cc->aotc->ip;
|
||||
I64 i,ip2=tmpaot->ip+cc->aotc->ip;
|
||||
U8 *ptr;
|
||||
CCodeMisc *g_lb=NULL;
|
||||
CAOTAbsAddr *tempa,*tempa1;
|
||||
CAOTImportExport *tempie,*tempie1;
|
||||
CAOTAbsAddr *tmpa,*tmpa1;
|
||||
CAOTImportExport *tmpie,*tmpie1;
|
||||
|
||||
tempa=tempaot->abss;
|
||||
while (tempa) {
|
||||
tempa1=tempa->next;
|
||||
tempa->next=aotc->abss;
|
||||
ptr=tempaot->buf+tempaot->ip+tempa->ip;
|
||||
switch [tempa->type] {
|
||||
tmpa=tmpaot->abss;
|
||||
while (tmpa) {
|
||||
tmpa1=tmpa->next;
|
||||
tmpa->next=aotc->abss;
|
||||
ptr=tmpaot->buf+tmpaot->ip+tmpa->ip;
|
||||
switch [tmpa->type] {
|
||||
case AAT_ADD_U8: *ptr(U8 *)+=ip2; break;
|
||||
case AAT_SUB_U8: *ptr(U8 *)-=ip2; break;
|
||||
case AAT_ADD_U16: *ptr(U16 *)+=ip2; break;
|
||||
@@ -323,20 +323,20 @@ U0 CmpFixUpAOTAsm(CCmpCtrl *cc,CAOT *tempaot)
|
||||
case AAT_ADD_U64: *ptr(I64 *)+=ip2; break;
|
||||
case AAT_SUB_U64: *ptr(I64 *)-=ip2; break;
|
||||
}
|
||||
aotc->abss=tempa;
|
||||
tempa->ip+=ip2;
|
||||
tempa=tempa1;
|
||||
aotc->abss=tmpa;
|
||||
tmpa->ip+=ip2;
|
||||
tmpa=tmpa1;
|
||||
}
|
||||
|
||||
tempie=tempaot->next_ie;
|
||||
while (tempie!=&tempaot->next_ie) {
|
||||
tempie1=tempie->next;
|
||||
QueRem(tempie);
|
||||
if (IET_REL_I0<=tempie->type<=IET_IMM_I64) {
|
||||
if (tempie->str) {
|
||||
if (tempie->flags&IEF_GOTO_LABEL) {
|
||||
if(!(g_lb=COCGoToLabelFind(cc,tempie->str)))
|
||||
"Unresolved Reference:%s\n",tempie->str;
|
||||
tmpie=tmpaot->next_ie;
|
||||
while (tmpie!=&tmpaot->next_ie) {
|
||||
tmpie1=tmpie->next;
|
||||
QueRem(tmpie);
|
||||
if (IET_REL_I0<=tmpie->type<=IET_IMM_I64) {
|
||||
if (tmpie->str) {
|
||||
if (tmpie->flags&IEF_GOTO_LABEL) {
|
||||
if(!(g_lb=COCGoToLabelFind(cc,tmpie->str)))
|
||||
"Unresolved Reference:%s\n",tmpie->str;
|
||||
else {
|
||||
g_lb->use_cnt++;
|
||||
g_lb=OptLabelFwd(g_lb);
|
||||
@@ -347,10 +347,10 @@ U0 CmpFixUpAOTAsm(CCmpCtrl *cc,CAOT *tempaot)
|
||||
} else
|
||||
g_lb=NULL;
|
||||
|
||||
ptr=tempaot->buf+tempaot->ip+tempie->ip;
|
||||
ptr=tmpaot->buf+tmpaot->ip+tmpie->ip;
|
||||
if (g_lb) {
|
||||
i=g_lb->addr+tempaot->buf;
|
||||
switch [tempie->type] {
|
||||
i=g_lb->addr+tmpaot->buf;
|
||||
switch [tmpie->type] {
|
||||
case IET_REL_I0:
|
||||
case IET_IMM_U0:
|
||||
break;
|
||||
@@ -385,10 +385,10 @@ U0 CmpFixUpAOTAsm(CCmpCtrl *cc,CAOT *tempaot)
|
||||
*ptr(I64 *)=i;
|
||||
break;
|
||||
}
|
||||
Free(tempie->src_link);
|
||||
Free(tempie);
|
||||
Free(tmpie->src_link);
|
||||
Free(tmpie);
|
||||
} else {
|
||||
switch (tempie->type) {
|
||||
switch (tmpie->type) {
|
||||
start:
|
||||
case IET_REL32_EXPORT:
|
||||
case IET_IMM32_EXPORT:
|
||||
@@ -406,13 +406,13 @@ U0 CmpFixUpAOTAsm(CCmpCtrl *cc,CAOT *tempaot)
|
||||
case IET_REL_I32: *ptr(U32 *)-=ip2; break;
|
||||
case IET_REL_I64: *ptr(I64 *)-=ip2; break;
|
||||
end:
|
||||
tempie->ip+=ip2;
|
||||
tmpie->ip+=ip2;
|
||||
break;
|
||||
}
|
||||
tempie->aot=NULL;
|
||||
QueIns(tempie,tempaot->parent_aot->last_ie);
|
||||
tmpie->aot=NULL;
|
||||
QueIns(tmpie,tmpaot->parent_aot->last_ie);
|
||||
}
|
||||
tempie=tempie1;
|
||||
tmpie=tmpie1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -420,115 +420,115 @@ I64 Cmp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
|
||||
{//AOT Compile HC or PRJ file a and output BIN file. Returns err_cnt.
|
||||
U8 *ptr,*fbuf=NULL,*fbuf2=NULL,*fbuf3=NULL,
|
||||
*patch_table=MAlloc(0x20000);
|
||||
CAOT *tempaot;
|
||||
CAOT *tmpaot;
|
||||
I64 i,cnt,size=0,error_cnt=0,warning_cnt=0,aot_U8s=0;
|
||||
CBinFile *bfh;
|
||||
CAOTImportExport *tempie,*tempie1;
|
||||
CAOTAbsAddr *tempa,*tempa1;
|
||||
CAOTHeapGlblRef *temphgr,*temphgr1;
|
||||
CAOTHeapGlbl *temphg,*temphg1;
|
||||
CAOTImportExport *tmpie,*tmpie1;
|
||||
CAOTAbsAddr *tmpa,*tmpa1;
|
||||
CAOTHeapGlblRef *tmphgr,*tmphgr1;
|
||||
CAOTHeapGlbl *tmphg,*tmphg1;
|
||||
|
||||
fbuf=DftExt(filename,"PRJ.Z");
|
||||
fbuf2=MStrPrint("#include \"%s\"",fbuf);
|
||||
if (map_name)
|
||||
fbuf3=DftExt(map_name,"MAP.Z");
|
||||
|
||||
if (tempaot=CmpBuf(fbuf2,fbuf3,&error_cnt,&warning_cnt,mapfile_drv_let)) {
|
||||
aot_U8s=tempaot->aot_U8s;
|
||||
if (tmpaot=CmpBuf(fbuf2,fbuf3,&error_cnt,&warning_cnt,mapfile_drv_let)) {
|
||||
aot_U8s=tmpaot->aot_U8s;
|
||||
ptr=patch_table;
|
||||
//See $LK,"Load",A="MN:Load"$()
|
||||
cnt=0;
|
||||
tempa=tempaot->abss;
|
||||
while (tempa) {
|
||||
if (!(tempa->type&IEF_IMM_NOT_REL))
|
||||
tmpa=tmpaot->abss;
|
||||
while (tmpa) {
|
||||
if (!(tmpa->type&IEF_IMM_NOT_REL))
|
||||
cnt++;
|
||||
tempa=tempa->next;
|
||||
tmpa=tmpa->next;
|
||||
}
|
||||
if (cnt) {
|
||||
*ptr++=IET_ABS_ADDR;
|
||||
*ptr(U32 *)++=cnt;
|
||||
*ptr++=0;
|
||||
tempa=tempaot->abss;
|
||||
while (tempa) {
|
||||
tempa1=tempa->next;
|
||||
if (!(tempa->type&IEF_IMM_NOT_REL))
|
||||
*ptr(U32 *)++ =tempa->ip;
|
||||
Free(tempa);
|
||||
tempa=tempa1;
|
||||
tmpa=tmpaot->abss;
|
||||
while (tmpa) {
|
||||
tmpa1=tmpa->next;
|
||||
if (!(tmpa->type&IEF_IMM_NOT_REL))
|
||||
*ptr(U32 *)++ =tmpa->ip;
|
||||
Free(tmpa);
|
||||
tmpa=tmpa1;
|
||||
}
|
||||
}
|
||||
temphg=tempaot->heap_glbls;
|
||||
while (temphg) {
|
||||
temphg1=temphg->next;
|
||||
tmphg=tmpaot->heap_glbls;
|
||||
while (tmphg) {
|
||||
tmphg1=tmphg->next;
|
||||
cnt=0;
|
||||
temphgr=temphg->references;
|
||||
while (temphgr) {
|
||||
tmphgr=tmphg->references;
|
||||
while (tmphgr) {
|
||||
cnt++;
|
||||
temphgr=temphgr->next;
|
||||
tmphgr=tmphgr->next;
|
||||
}
|
||||
if (cnt) {
|
||||
*ptr++=IET_DATA_HEAP;
|
||||
*ptr(U32 *)++=cnt;
|
||||
if (temphg->str) {
|
||||
i=StrLen(temphg->str);
|
||||
MemCpy(ptr,temphg->str,i+1);
|
||||
Free(temphg->str);
|
||||
if (tmphg->str) {
|
||||
i=StrLen(tmphg->str);
|
||||
MemCpy(ptr,tmphg->str,i+1);
|
||||
Free(tmphg->str);
|
||||
ptr+=i+1;
|
||||
} else
|
||||
*ptr++=0;
|
||||
*ptr(I64 *)++=temphg->size;
|
||||
temphgr=temphg->references;
|
||||
while (temphgr) {
|
||||
temphgr1=temphgr->next;
|
||||
*ptr(U32 *)++=temphgr->ip;
|
||||
Free(temphgr);
|
||||
temphgr=temphgr1;
|
||||
*ptr(I64 *)++=tmphg->size;
|
||||
tmphgr=tmphg->references;
|
||||
while (tmphgr) {
|
||||
tmphgr1=tmphgr->next;
|
||||
*ptr(U32 *)++=tmphgr->ip;
|
||||
Free(tmphgr);
|
||||
tmphgr=tmphgr1;
|
||||
}
|
||||
}
|
||||
Free(temphg);
|
||||
temphg=temphg1;
|
||||
Free(tmphg);
|
||||
tmphg=tmphg1;
|
||||
}
|
||||
|
||||
//Do exports first
|
||||
tempie=tempaot->next_ie;
|
||||
while (tempie!=&tempaot->next_ie) {
|
||||
tempie1=tempie->next;
|
||||
if (!tempie->type || IET_REL32_EXPORT<=tempie->type<=IET_IMM64_EXPORT) {
|
||||
QueRem(tempie);
|
||||
*ptr++=tempie->type;
|
||||
*ptr(U32 *)++=tempie->ip;
|
||||
if (tempie->str) {
|
||||
i=StrLen(tempie->str);
|
||||
MemCpy(ptr,tempie->str,i+1);
|
||||
Free(tempie->str);
|
||||
tmpie=tmpaot->next_ie;
|
||||
while (tmpie!=&tmpaot->next_ie) {
|
||||
tmpie1=tmpie->next;
|
||||
if (!tmpie->type || IET_REL32_EXPORT<=tmpie->type<=IET_IMM64_EXPORT) {
|
||||
QueRem(tmpie);
|
||||
*ptr++=tmpie->type;
|
||||
*ptr(U32 *)++=tmpie->ip;
|
||||
if (tmpie->str) {
|
||||
i=StrLen(tmpie->str);
|
||||
MemCpy(ptr,tmpie->str,i+1);
|
||||
Free(tmpie->str);
|
||||
ptr+=i+1;
|
||||
} else
|
||||
*ptr++=0;
|
||||
Free(tempie->src_link);
|
||||
Free(tempie);
|
||||
Free(tmpie->src_link);
|
||||
Free(tmpie);
|
||||
}
|
||||
tempie=tempie1;
|
||||
tmpie=tmpie1;
|
||||
}
|
||||
|
||||
//Do imports second
|
||||
tempie=tempaot->next_ie;
|
||||
while (tempie!=&tempaot->next_ie) {
|
||||
tempie1=tempie->next;
|
||||
QueRem(tempie);
|
||||
*ptr++=tempie->type;
|
||||
if (tempie->aot)
|
||||
tempie->ip+=tempie->aot->ip2;
|
||||
*ptr(U32 *)++=tempie->ip;
|
||||
if (tempie->str) {
|
||||
i=StrLen(tempie->str);
|
||||
MemCpy(ptr,tempie->str,i+1);
|
||||
Free(tempie->str);
|
||||
tmpie=tmpaot->next_ie;
|
||||
while (tmpie!=&tmpaot->next_ie) {
|
||||
tmpie1=tmpie->next;
|
||||
QueRem(tmpie);
|
||||
*ptr++=tmpie->type;
|
||||
if (tmpie->aot)
|
||||
tmpie->ip+=tmpie->aot->ip2;
|
||||
*ptr(U32 *)++=tmpie->ip;
|
||||
if (tmpie->str) {
|
||||
i=StrLen(tmpie->str);
|
||||
MemCpy(ptr,tmpie->str,i+1);
|
||||
Free(tmpie->str);
|
||||
ptr+=i+1;
|
||||
} else
|
||||
*ptr++=0;
|
||||
Free(tempie->src_link);
|
||||
Free(tempie);
|
||||
tempie=tempie1;
|
||||
Free(tmpie->src_link);
|
||||
Free(tmpie);
|
||||
tmpie=tmpie1;
|
||||
}
|
||||
|
||||
*ptr++=IET_END;
|
||||
@@ -541,11 +541,11 @@ I64 Cmp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
|
||||
#assert sizeof(CBinFile)-2<=MAX_I8
|
||||
bfh->reserved=0;
|
||||
bfh->bin_signature=BIN_SIGNATURE_VAL;
|
||||
bfh->module_org=tempaot->module_org;
|
||||
bfh->module_align_bits=tempaot->max_align_bits;
|
||||
bfh->module_org=tmpaot->module_org;
|
||||
bfh->module_align_bits=tmpaot->max_align_bits;
|
||||
bfh->patch_table_offset=sizeof(CBinFile)+aot_U8s;
|
||||
bfh->file_size=size;
|
||||
MemCpy(bfh(U8 *)+sizeof(CBinFile),tempaot->buf,aot_U8s);
|
||||
MemCpy(bfh(U8 *)+sizeof(CBinFile),tmpaot->buf,aot_U8s);
|
||||
MemCpy(bfh(U8 *)+sizeof(CBinFile)+aot_U8s,patch_table,
|
||||
size-aot_U8s-sizeof(CBinFile));
|
||||
Free(fbuf2);
|
||||
@@ -555,9 +555,9 @@ I64 Cmp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
|
||||
fbuf2=ChgExt(fbuf,"BIN.Z");
|
||||
FileWrite(fbuf2,bfh,size);
|
||||
Free(bfh);
|
||||
Free(tempaot->buf);
|
||||
QueDel(tempaot);
|
||||
Free(tempaot);
|
||||
Free(tmpaot->buf);
|
||||
QueDel(tmpaot);
|
||||
Free(tmpaot);
|
||||
}
|
||||
Free(patch_table);
|
||||
Free(fbuf);
|
||||
@@ -575,7 +575,7 @@ I64 ExePutS(U8 *buf,U8 *filename=NULL,
|
||||
Bool okay=TRUE;
|
||||
CCmpCtrl *cc;
|
||||
if (!filename)
|
||||
filename=blkdev.temp_filename;
|
||||
filename=blkdev.tmp_filename;
|
||||
cc=CmpCtrlNew(buf,ccf_flags|CCF_DONT_FREE_BUF,filename);
|
||||
if (Fs->last_cc!=&Fs->next_cc) {
|
||||
cc->opts=Fs->last_cc->opts;
|
||||
@@ -633,7 +633,7 @@ I64 ExePutS2(U8 *buf,U8 *filename=NULL,I64 ccf_flags=0)
|
||||
I64 res;
|
||||
CCmpCtrl *cc;
|
||||
if (!filename)
|
||||
filename=blkdev.temp_filename;
|
||||
filename=blkdev.tmp_filename;
|
||||
cc=CmpCtrlNew(buf,ccf_flags|CCF_DONT_FREE_BUF,filename);
|
||||
if (Fs->last_cc!=&Fs->next_cc)
|
||||
cc->opts=Fs->last_cc->opts;
|
||||
|
||||
Reference in new issue
Block a user