Separate initialization of kernel from starting a program

This commit is contained in:
deadwood 2024-03-23 20:03:55 +01:00
parent db89fa1762
commit fa9b5875f8
1 changed files with 12 additions and 7 deletions

View File

@ -73,13 +73,7 @@ void init_exec();
LONG_FUNC run_emulation()
{
BPTR seg = LoadSeg32("SYS:Calculator", DOSBase);
// BPTR seg = LoadSeg32("SYS:helloabi", DOSBase);
APTR (*start)() = (APTR)((IPTR)BADDR(seg) + sizeof(BPTR));
/* Set start at first instruction (skip Seg header) */
start = (APTR)((IPTR)start + 13);
/* Init ROM */
init_exec();
APTR tmp = AllocMem(1024, MEMF_31BIT | MEMF_CLEAR);
@ -105,6 +99,17 @@ LONG_FUNC run_emulation()
for (int i = 1; i <= 45; i++) __AROS_SETVECADDRV0(abiv0LayersBase, i, 0);
__AROS_SETVECADDRV0(abiv0LayersBase, 1, (APTR32)(IPTR)proxy_Layers_OpenLib);
/* Start Program */
BPTR seg = LoadSeg32("SYS:Calculator", DOSBase);
// BPTR seg = LoadSeg32("SYS:helloabi", DOSBase);
APTR (*start)() = (APTR)((IPTR)BADDR(seg) + sizeof(BPTR));
/* Set start at first instruction (skip Seg header) */
start = (APTR)((IPTR)start + 13);
/* Switch to CS = 0x23 during FAR call. This switches 32-bit emulation mode.
Next, load 0x2B to DS (needed under 32-bit) and NEAR jump to 32-bit code */
__asm__ volatile(