2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
7 #include <libraries/configvars.h>
8 #include <libraries/expansion.h>
9 #include <libraries/expansionbase.h>
10 #include <utility/tagitem.h>
11 #include <dos/filehandler.h>
13 #include <proto/exec.h>
16 * Execute the code in the boot block.
17 * This can be custom defined for your architecture.
19 * Returns 0 on success, or an error code
21 VOID_FUNC
CallBootBlockCode(APTR bootcode
, struct IOStdReq
*io
, struct ExpansionBase
*ExpansionBase
)
23 UBYTE oldflags
= ExpansionBase
->Flags
& EBF_SILENTSTART
;
27 D(bug("[Strap] Calling bootblock 0x%p!\n", bootcode
));
29 ExpansionBase
->Flags
&= ~EBF_SILENTSTART
;
31 /* Lovely. Double return values. What func. */
35 "move.l %%a6,%%sp@-\n"
38 "move.l %%sp@+,%%a6\n"
41 : "=m" (retval
), "=m" (init
)
42 : "m" (io
), "r" (SysBase
),
44 : "%d0", "%d1", "%a0", "%a1");
45 D(bug("bootblock: D0=0x%08x A0=%p\n", retval
, init
));
49 D(bug("[Strap] Boot block failed to boot.\n"));
51 ExpansionBase
->Flags
|= oldflags
;
58 /* BootPoint booting, as describe in the Amiga Devices Manual */
59 void dosboot_BootPoint(struct BootNode
*bn
)
61 struct DeviceNode
*dn
;
62 struct FileSysStartupMsg
*fssm
;
66 dn
= bn
->bn_DeviceNode
;
67 if (dn
== NULL
|| dn
->dn_Name
== BNULL
)
70 fssm
= BADDR(dn
->dn_Startup
);
74 de
= BADDR(fssm
->fssm_Environ
);
78 bootblocks
= (de
->de_TableSize
< DE_BOOTBLOCKS
) ? 0 : de
->de_BootBlocks
;
81 if (bootblocks
== 0 && bn
->bn_Node
.ln_Name
!= NULL
)
83 struct ConfigDev
*cd
= (APTR
)bn
->bn_Node
.ln_Name
;
85 if (cd
->cd_Rom
.er_DiagArea
!= NULL
)
87 struct DiagArea
*da
= cd
->cd_Rom
.er_DiagArea
;
89 if (da
->da_Config
& DAC_CONFIGTIME
)
91 /* Yes, it's actually a BootPoint node */
92 void *func
= (APTR
)(((IPTR
)da
) + da
->da_BootPoint
);
94 D(bug("dosboot_BootStrap: Calling %b BootPoint @%p\n", dn
->dn_Name
, func
));
97 * Yet another crazy Amiga calling sequence.
98 * The ConfigDev is pushed on the stack, but
99 * the BootNode is in A2. Joy.
101 * Oh, and don't forget SysBase in A6!
108 "move.l %%a1,%%sp@-\n"
112 : "d" (func
), "d" (cd
), "d" (bn
), "d" (SysBase
)
113 : "d0", "d1", "a0", "a1", "a2", "a6"