Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
U0 LoadOneImport(U8 **_src, U8 *module_base, I64 ld_flags)
|
2020-02-15 20:01:48 +00:00
|
|
|
{
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
U8 *src = *_src, *ptr2, *st_ptr;
|
|
|
|
I64 i, etype;
|
|
|
|
CHashExport *tmpex = NULL;
|
|
|
|
CHashImport *tmpiss;
|
|
|
|
Bool first = TRUE;
|
|
|
|
|
|
|
|
while (etype = *src++)
|
|
|
|
{
|
|
|
|
i = *src(U32 *)++;
|
|
|
|
st_ptr = src;
|
|
|
|
src += StrLen(st_ptr) + 1;
|
|
|
|
if (*st_ptr)
|
|
|
|
{
|
|
|
|
if (!first)
|
|
|
|
{
|
|
|
|
*_src = st_ptr - 5;
|
2020-02-20 23:40:10 +00:00
|
|
|
return;
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
first = FALSE;
|
|
|
|
if (!(tmpex = HashFind(st_ptr, Fs->hash_table, HTG_ALL - HTT_IMPORT_SYS_SYM)))
|
|
|
|
{
|
2020-02-20 23:40:10 +00:00
|
|
|
if (!(ld_flags & LDF_SILENT))
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
"Unresolved Reference:%s\n", st_ptr;
|
|
|
|
tmpiss = CAlloc(sizeof(CHashImport));
|
|
|
|
tmpiss->str = StrNew(st_ptr);
|
|
|
|
tmpiss->type = HTT_IMPORT_SYS_SYM;
|
|
|
|
tmpiss->module_header_entry = st_ptr - 5;
|
|
|
|
tmpiss->module_base = module_base;
|
|
|
|
HashAdd(tmpiss, Fs->hash_table);
|
2020-02-20 23:40:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
if (tmpex)
|
|
|
|
{
|
|
|
|
ptr2 = module_base+i;
|
2020-02-20 23:40:10 +00:00
|
|
|
if (tmpex->type & HTT_FUN)
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
i = tmpex(CHashFun *)->exe_addr;
|
2020-03-13 03:11:04 +00:00
|
|
|
else if (tmpex->type & HTT_GLOBAL_VAR)
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
i = tmpex(CHashGlobalVar *)->data_addr;
|
2020-02-20 23:40:10 +00:00
|
|
|
else
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
i = tmpex->val;
|
|
|
|
switch (etype)
|
|
|
|
{
|
|
|
|
case IET_REL_I8: *ptr2(U8 *) = i - ptr2 - 1; break;
|
|
|
|
case IET_IMM_U8: *ptr2(U8 *) = i; break;
|
|
|
|
case IET_REL_I16: *ptr2(U16 *) = i - ptr2 - 2; break;
|
|
|
|
case IET_IMM_U16: *ptr2(U16 *) = i; break;
|
|
|
|
case IET_REL_I32: *ptr2(U32 *) = i - ptr2 - 4; break;
|
|
|
|
case IET_IMM_U32: *ptr2(U32 *) = i; break;
|
|
|
|
case IET_REL_I64: *ptr2(I64 *) = i - ptr2 - 8; break;
|
|
|
|
case IET_IMM_I64: *ptr2(I64 *) = i; break;
|
2020-02-20 23:40:10 +00:00
|
|
|
}
|
|
|
|
}
|
2020-02-15 20:01:48 +00:00
|
|
|
}
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
*_src = src - 1;
|
2020-02-15 20:01:48 +00:00
|
|
|
}
|
|
|
|
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
U0 SysSymImportsResolve(U8 *st_ptr, I64 ld_flags)
|
2020-02-15 20:01:48 +00:00
|
|
|
{
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
CHashImport *tmpiss;
|
|
|
|
U8 *ptr;
|
|
|
|
|
|
|
|
while (tmpiss = HashSingleTableFind(st_ptr, Fs->hash_table, HTT_IMPORT_SYS_SYM))
|
|
|
|
{
|
|
|
|
ptr = tmpiss->module_header_entry;
|
|
|
|
LoadOneImport(&ptr, tmpiss->module_base, ld_flags);
|
|
|
|
tmpiss->type = HTT_INVALID;
|
2020-02-20 23:40:10 +00:00
|
|
|
}
|
2020-02-15 20:01:48 +00:00
|
|
|
}
|
|
|
|
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
U0 LoadPass1(U8 *src, U8 *module_base, I64 ld_flags)
|
2020-02-15 20:01:48 +00:00
|
|
|
{
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
U8 *ptr2, *ptr3, *st_ptr;
|
|
|
|
I64 i, j, count, etype;
|
|
|
|
CHashExport *tmpex = NULL;
|
|
|
|
|
|
|
|
while (etype = *src++)
|
|
|
|
{
|
|
|
|
i = *src(U32 *)++;
|
|
|
|
st_ptr = src;
|
|
|
|
src += StrLen(st_ptr) + 1;
|
|
|
|
switch (etype)
|
|
|
|
{
|
2020-02-20 23:40:10 +00:00
|
|
|
case IET_REL32_EXPORT:
|
|
|
|
case IET_IMM32_EXPORT:
|
|
|
|
case IET_REL64_EXPORT:
|
|
|
|
case IET_IMM64_EXPORT:
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
tmpex = CAlloc(sizeof(CHashExport));
|
|
|
|
tmpex->str = StrNew(st_ptr);
|
|
|
|
tmpex->type = HTT_EXPORT_SYS_SYM | HTF_IMM;
|
|
|
|
if (etype == IET_IMM32_EXPORT || etype == IET_IMM64_EXPORT)
|
|
|
|
tmpex->val = i;
|
2020-02-20 23:40:10 +00:00
|
|
|
else
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
tmpex->val = i + module_base;
|
|
|
|
HashAdd(tmpex, Fs->hash_table);
|
|
|
|
SysSymImportsResolve(st_ptr, ld_flags);
|
2020-02-20 23:40:10 +00:00
|
|
|
break;
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
|
|
|
|
case IET_REL_I0 ... IET_IMM_I64:
|
|
|
|
src = st_ptr - 5;
|
|
|
|
LoadOneImport(&src, module_base, ld_flags);
|
2020-02-20 23:40:10 +00:00
|
|
|
break;
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
case IET_ABS_ADDR:
|
|
|
|
if (ld_flags & LDF_NO_ABSS)
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
src += i * sizeof(U32);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
count = i;
|
|
|
|
for (j = 0; j < count; j++)
|
|
|
|
{
|
|
|
|
ptr2 = module_base + *src(U32 *)++;
|
|
|
|
*ptr2(U32 *) += module_base;
|
2020-02-20 23:40:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
start:
|
|
|
|
case IET_CODE_HEAP:
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
ptr3 = MAlloc(*src(I32 *)++, Fs->code_heap);
|
2020-02-20 23:40:10 +00:00
|
|
|
break;
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
case IET_ZEROED_CODE_HEAP:
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
ptr3 = CAlloc(*src(I32 *)++, Fs->code_heap);
|
2020-02-20 23:40:10 +00:00
|
|
|
break;
|
|
|
|
end:
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
if (*st_ptr)
|
|
|
|
{
|
|
|
|
tmpex = CAlloc(sizeof(CHashExport));
|
|
|
|
tmpex->str = StrNew(st_ptr);
|
|
|
|
tmpex->type = HTT_EXPORT_SYS_SYM | HTF_IMM;
|
|
|
|
tmpex->val = ptr3;
|
|
|
|
HashAdd(tmpex, Fs->hash_table);
|
2020-02-20 23:40:10 +00:00
|
|
|
}
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
count = i;
|
|
|
|
for (j = 0; j < count; j++)
|
|
|
|
{
|
|
|
|
ptr2 = module_base + *src(U32 *)++;
|
|
|
|
*ptr2(I32 *) += ptr3;
|
2020-02-20 23:40:10 +00:00
|
|
|
}
|
|
|
|
break;
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
start:
|
|
|
|
case IET_DATA_HEAP:
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
ptr3 = MAlloc(*src(I64 *)++);
|
2020-02-20 23:40:10 +00:00
|
|
|
break;
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
case IET_ZEROED_DATA_HEAP:
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
ptr3 = CAlloc(*src(I64 *)++);
|
2020-02-20 23:40:10 +00:00
|
|
|
break;
|
|
|
|
end:
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
if (*st_ptr)
|
|
|
|
{
|
|
|
|
tmpex = CAlloc(sizeof(CHashExport));
|
|
|
|
tmpex->str = StrNew(st_ptr);
|
|
|
|
tmpex->type = HTT_EXPORT_SYS_SYM | HTF_IMM;
|
|
|
|
tmpex->val = ptr3;
|
|
|
|
HashAdd(tmpex, Fs->hash_table);
|
2020-02-20 23:40:10 +00:00
|
|
|
}
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
count = i;
|
|
|
|
for (j = 0; j < count; j++)
|
|
|
|
{
|
|
|
|
ptr2 = module_base + *src(U32 *)++;
|
|
|
|
*ptr2(I64 *) += ptr3;
|
2020-02-20 23:40:10 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2020-02-15 20:01:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
U0 LoadPass2(U8 *src, U8 *module_base, I64)
|
2020-02-15 20:01:48 +00:00
|
|
|
{
|
2020-02-20 23:40:10 +00:00
|
|
|
U8 *st_ptr;
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
I64 i, etype;
|
|
|
|
|
|
|
|
while (etype = *src++)
|
|
|
|
{
|
|
|
|
i = *src(U32 *)++;
|
|
|
|
st_ptr = src;
|
|
|
|
src += StrLen(st_ptr) + 1;
|
|
|
|
switch (etype)
|
|
|
|
{
|
2020-02-20 23:40:10 +00:00
|
|
|
case IET_MAIN:
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
Call(i + module_base);
|
2020-02-20 23:40:10 +00:00
|
|
|
break;
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
case IET_ABS_ADDR:
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
src += sizeof(U32) * i;
|
2020-02-20 23:40:10 +00:00
|
|
|
break;
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
case IET_CODE_HEAP:
|
|
|
|
case IET_ZEROED_CODE_HEAP:
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
src += 4 + sizeof(U32) * i;
|
2020-02-20 23:40:10 +00:00
|
|
|
break;
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
case IET_DATA_HEAP:
|
|
|
|
case IET_ZEROED_DATA_HEAP:
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
src += 8 + sizeof(U32) * i;
|
2020-02-20 23:40:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-02-15 20:01:48 +00:00
|
|
|
}
|
|
|
|
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
CBinFile *Load(U8 *filename, I64 ld_flags=0, CBinFile *bfh_addr=INVALID_PTR)
|
2020-02-15 20:01:48 +00:00
|
|
|
{//Load a .BIN file module into memory.
|
Rename abs_addres to abs_address.
Update documentation/comments to rename addr, fun, var, stmt, blk, desc, reg, seg, ptr, dup, clus, val, and bttn, to address, function, variable, statement, block, description, register, segment, pointer, duplicate, cluster, value, and button, respectively.
2021-10-07 02:35:32 +01:00
|
|
|
//bfh_addr==INVALID_PTR means don't care what load address.
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
U8 *fbuf, *module_base, *absname;
|
|
|
|
I64 size, module_align, misalignment;
|
|
|
|
CBinFile *bfh;
|
2020-02-15 20:01:48 +00:00
|
|
|
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
fbuf = ExtDefault(filename, "BIN");
|
|
|
|
if (!(bfh = FileRead(fbuf, &size)))
|
|
|
|
{
|
2020-02-20 23:40:10 +00:00
|
|
|
Free(fbuf);
|
|
|
|
return NULL;
|
|
|
|
}
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
//See $LK,"Patch Table Generation",A="FF:::/Compiler/CMain.CC,IET_ABS_ADDR"$
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
module_align = 1 << bfh->module_align_bits;
|
|
|
|
if (!module_align || bfh->bin_signature != BIN_SIGNATURE_VAL)
|
|
|
|
{
|
2020-02-20 23:40:10 +00:00
|
|
|
Free(bfh);
|
|
|
|
Free(fbuf);
|
|
|
|
throw('BinModul');
|
|
|
|
}
|
2020-02-15 20:01:48 +00:00
|
|
|
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
if (bfh_addr == INVALID_PTR)
|
|
|
|
{
|
|
|
|
if (bfh->org == INVALID_PTR)
|
|
|
|
{
|
|
|
|
misalignment = module_align - sizeof(CBinFile);
|
|
|
|
if (misalignment < 0)
|
|
|
|
misalignment &= module_align - 1;
|
|
|
|
if (Fs->code_heap != Fs->data_heap)
|
|
|
|
{
|
|
|
|
if (module_align < 16)
|
|
|
|
module_align = 16;
|
|
|
|
bfh_addr = MAllocAligned(size, module_align, Fs->code_heap, misalignment);
|
|
|
|
}
|
|
|
|
else if (module_align > 8)
|
2020-12-23 23:27:18 +00:00
|
|
|
bfh_addr = MAllocAligned(size, module_align,, misalignment);
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
else
|
|
|
|
{//Less than 2Gig system memory
|
|
|
|
bfh_addr = bfh;
|
2020-02-20 23:40:10 +00:00
|
|
|
goto lo_skip; //File is already in code heap area, don't copy.
|
|
|
|
}
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
bfh_addr = bfh->org;
|
2020-02-20 23:40:10 +00:00
|
|
|
}
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
MemCopy(bfh_addr, bfh, size);
|
2020-02-20 23:40:10 +00:00
|
|
|
Free(bfh);
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
lo_skip:
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
module_base = bfh_addr(U8 *) + sizeof(CBinFile);
|
2020-02-15 20:01:48 +00:00
|
|
|
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
absname = FileNameAbs(fbuf);
|
2020-02-23 07:54:39 +00:00
|
|
|
Free(fbuf);
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
fbuf = StrNew(absname);
|
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
FileExtRemove(fbuf);
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
if (fbuf[1] == ':' && StrLen(fbuf) > 2)
|
|
|
|
HashGenericAdd(fbuf + 2, HTT_MODULE | HTF_PUBLIC, bfh_addr);
|
|
|
|
|
|
|
|
LoadPass1(bfh_addr(U8 *) + bfh_addr->patch_table_offset, module_base, ld_flags);
|
|
|
|
if (!(ld_flags & LDF_JUST_LOAD))
|
|
|
|
LoadPass2(bfh_addr(U8 *) + bfh_addr->patch_table_offset, module_base, ld_flags);
|
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
Free(absname);
|
|
|
|
Free(fbuf);
|
2020-12-23 23:27:18 +00:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
return bfh_addr;
|
2020-02-15 20:01:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
U0 LoadKernel()
|
|
|
|
{
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
HashGenericAdd(KERNEL_MODULE_NAME, HTT_MODULE | HTF_PUBLIC, mem_boot_base - sizeof(CBinFile));
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
//Abs patches done here $LK,"CPatchTableAbsAddr",A="FF:::/Kernel/KStart32.CC,CPatchTableAbsAddr"$.
|
Reformatted some kernel files.
Changed DVD Resolution in DoDistro to 1024x768.
Kernel files reformatted: Display.CC, EdLite.CC, FunSeg.CC, Job.CC, KConfig.CC, KDataTypes.CC, KDate.CC, KDebug.CC, KDefine.CC, KExcept.CC, KExterns.CC, KGlobals.CC, KHashA.CC, KHashB.CC, KInterrupts.CC, KLoad.CC, KMain.CC, KStart16.CC, KStart32.CC.
2020-09-07 19:01:54 +01:00
|
|
|
LoadPass1(sys_boot_patch_table_base, mem_boot_base, LDF_NO_ABSS | LDF_SILENT);
|
2020-02-15 20:01:48 +00:00
|
|
|
|
2020-02-20 23:40:10 +00:00
|
|
|
//No main routines
|
|
|
|
// LoadPass2(sys_boot_patch_table_base,mem_boot_base,0);
|
2020-02-15 20:01:48 +00:00
|
|
|
}
|