Fix IO memory access .. SB128 driver makes noises in VMWare - CMI is untested (Curren...
[AROS.git] / rom / exec / sumkickdata.c
blob4ebd69df5c41b7604dbe04b62ae1097baee35ae4
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Build checksum for Kickstart.
6 Lang: english
7 */
8 #include <aros/debug.h>
9 #include "exec_intern.h"
10 #include <proto/exec.h>
12 /*****************************************************************************
14 NAME */
16 AROS_LH0(ULONG, SumKickData,
18 /* SYNOPSIS */
19 /* void */
21 /* LOCATION */
22 struct ExecBase *, SysBase, 102, Exec)
24 /* FUNCTION
26 INPUTS
28 RESULT
30 NOTES
32 EXAMPLE
34 BUGS
36 SEE ALSO
38 INTERNALS
40 *****************************************************************************/
42 AROS_LIBFUNC_INIT
44 ULONG chksum = 0;
45 BOOL isdata = FALSE;
47 if (SysBase->KickTagPtr) {
48 IPTR *list = SysBase->KickTagPtr;
49 while(*list)
51 chksum += (ULONG)*list;
52 D(bug("KickTag: %p: %08x\n", list, *list));
54 /* on amiga, if bit 31 is set then this points to another list of
55 * modules rather than pointing to a single module. bit 31 is
56 * inconvenient on architectures where code may be loaded above
57 * 2GB. on these platforms we assume aligned pointers and use bit
58 * 0 instead */
59 #ifdef __mc68000__
60 if(*list & 0x80000000) { list = (IPTR *)(*list & 0x7fffffff); continue; }
61 #else
62 if(*list & 0x1) { list = (IPTR *)(*list & ~(IPTR)0x1); continue; }
63 #endif
64 list++;
65 isdata = TRUE;
69 if (SysBase->KickMemPtr) {
70 struct MemList *ml = (struct MemList*)SysBase->KickMemPtr;
71 while (ml) {
72 UBYTE i;
73 ULONG *p = (ULONG*)ml;
74 for (i = 0; i < sizeof(struct MemList) / sizeof(ULONG); i++)
75 chksum += p[i];
76 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,
77 ml->ml_ME[0].me_Un.meu_Addr, ml->ml_ME[0].me_Length,
78 p[sizeof(struct MemList) / sizeof(ULONG)],
79 p[sizeof(struct MemList) / sizeof(ULONG) + 1],
80 p[sizeof(struct MemList) / sizeof(ULONG) + 2],
81 p[sizeof(struct MemList) / sizeof(ULONG) + 3]));
82 ml = (struct MemList*)ml->ml_Node.ln_Succ;
83 isdata = TRUE;
86 if (isdata && !chksum)
87 chksum--;
88 return chksum;
90 AROS_LIBFUNC_EXIT
91 } /* SumKickData */