1 #include <aros/debug.h>
2 #include <libraries/configvars.h>
3 #include <libraries/expansion.h>
4 #include <libraries/expansionbase.h>
5 #include <utility/tagitem.h>
6 #include <dos/filehandler.h>
8 #include <proto/exec.h>
11 * Execute the code in the boot block.
12 * This can be custom defined for your architecture.
14 * Returns 0 on success, or an error code
16 VOID_FUNC
CallBootBlockCode(APTR bootcode
, struct IOStdReq
*io
, struct ExpansionBase
*ExpansionBase
)
18 UBYTE oldflags
= ExpansionBase
->Flags
& EBF_SILENTSTART
;
22 D(bug("[Strap] Calling bootblock 0x%p!\n", bootcode
));
24 ExpansionBase
->Flags
&= ~EBF_SILENTSTART
;
26 /* Lovely. Double return values. What func. */
30 "move.l %%a6,%%sp@-\n"
33 "move.l %%sp@+,%%a6\n"
36 : "=m" (retval
), "=m" (init
)
37 : "m" (io
), "r" (SysBase
),
39 : "%d0", "%d1", "%a0", "%a1");
40 D(bug("bootblock: D0=0x%08x A0=%p\n", retval
, init
));
44 D(bug("[Strap] Boot block failed to boot.\n"));
46 ExpansionBase
->Flags
|= oldflags
;
53 /* BootPoint booting, as describe in the Amiga Devices Manual */
54 void dosboot_BootPoint(struct BootNode
*bn
)
56 struct DeviceNode
*dn
;
57 struct FileSysStartupMsg
*fssm
;
61 dn
= bn
->bn_DeviceNode
;
62 if (dn
== NULL
|| dn
->dn_Name
== BNULL
)
65 fssm
= BADDR(dn
->dn_Startup
);
69 de
= BADDR(fssm
->fssm_Environ
);
73 bootblocks
= (de
->de_TableSize
< DE_BOOTBLOCKS
) ? 0 : de
->de_BootBlocks
;
76 if (bootblocks
== 0 && bn
->bn_Node
.ln_Name
!= NULL
)
78 struct ConfigDev
*cd
= (APTR
)bn
->bn_Node
.ln_Name
;
80 if (cd
->cd_Rom
.er_DiagArea
!= NULL
)
82 struct DiagArea
*da
= cd
->cd_Rom
.er_DiagArea
;
84 if (da
->da_Config
& DAC_CONFIGTIME
)
86 /* Yes, it's actually a BootPoint node */
87 void *func
= (APTR
)(((IPTR
)da
) + da
->da_BootPoint
);
89 D(bug("dosboot_BootStrap: Calling %b BootPoint @%p\n", dn
->dn_Name
, func
));
92 * Yet another crazy Amiga calling sequence.
93 * The ConfigDev is pushed on the stack, but
94 * the BootNode is in A2. Joy.
96 * Oh, and don't forget SysBase in A6!
103 "move.l %%a1,%%sp@-\n"
107 : "d" (func
), "d" (cd
), "d" (bn
), "d" (SysBase
)
108 : "d0", "d1", "a0", "a1", "a2", "a6"