tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / rom / exec / sumkickdata.c
blobff804ba2ee459f67419ebfcd1a69f2e2eb672da0
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Build checksum for Kickstart.
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include "exec_intern.h"
11 #include <proto/exec.h>
13 /*****************************************************************************
15 NAME */
17 AROS_LH0(ULONG, SumKickData,
19 /* SYNOPSIS */
20 /* void */
22 /* LOCATION */
23 struct ExecBase *, SysBase, 102, Exec)
25 /* FUNCTION
27 INPUTS
29 RESULT
31 NOTES
33 EXAMPLE
35 BUGS
37 SEE ALSO
39 INTERNALS
41 *****************************************************************************/
43 AROS_LIBFUNC_INIT
45 ULONG chksum = 0;
46 BOOL isdata = FALSE;
48 D(bug("[SumKickData] KickTagPtr 0x%p KickMemPtr 0x%p\n", SysBase->KickTagPtr, SysBase->KickMemPtr));
50 if (SysBase->KickTagPtr)
52 IPTR *list = SysBase->KickTagPtr;
54 while(*list)
56 chksum += (ULONG)*list;
57 D(bug("KickTag: %p: %08x\n", list, *list));
60 * on amiga, if bit 31 is set then this points to another list of
61 * modules rather than pointing to a single module. bit 31 is
62 * inconvenient on architectures where code may be loaded above
63 * 2GB. on these platforms we assume aligned pointers and use bit
64 * 0 instead
66 if (*list & RESLIST_NEXT)
68 list = (IPTR *)(*list & ~RESLIST_NEXT);
69 continue;
71 list++;
72 isdata = TRUE;
76 if (SysBase->KickMemPtr)
78 struct MemList *ml = (struct MemList*)SysBase->KickMemPtr;
80 while (ml)
82 UBYTE i;
83 ULONG *p = (ULONG*)ml;
85 for (i = 0; i < sizeof(struct MemList) / sizeof(ULONG); i++)
86 chksum += p[i];
87 D(bug("MemList: %p: %08x %08x %d %08x %08x %08x%08x%08x%08x\n", ml, ml->ml_Node.ln_Succ, ml->ml_Node.ln_Pred, ml->ml_NumEntries,
88 ml->ml_ME[0].me_Un.meu_Addr, ml->ml_ME[0].me_Length,
89 p[sizeof(struct MemList) / sizeof(ULONG)],
90 p[sizeof(struct MemList) / sizeof(ULONG) + 1],
91 p[sizeof(struct MemList) / sizeof(ULONG) + 2],
92 p[sizeof(struct MemList) / sizeof(ULONG) + 3]));
93 ml = (struct MemList*)ml->ml_Node.ln_Succ;
94 isdata = TRUE;
97 if (isdata && !chksum)
98 chksum--;
99 return chksum;
101 AROS_LIBFUNC_EXIT
102 } /* SumKickData */