1 /*
2  *		    	Debugger Library
3  *
4  *	    Copyright (C) 2000-2008 Green Hills Software,Inc.
5  *
6  *  This program is the property of Green Hills Software, Inc,
7  *  its contents are proprietary information and no part of it
8  *  is to be disclosed to anyone except employees of Green Hills
9  *  Software, Inc., or as agreed in writing signed by the President
10  *  of Green Hills Software, Inc.
11 */
12 #ifndef _INDSECINFO_H
13 #define _INDSECINFO_H
14 
15 #include <stdint.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 typedef struct secinfo_t {
22     struct secinfo_t*   next; /* NULL for no next section */
23     const char*		name; /* nul-terminated section name */
24     void*		addr; /* Address of section in memory */
25     uint32_t		size; /* length of section (bytes) */
26     uint32_t		flags; /* flags, see below */
27     struct secinfo_t*   romcopyof; /* this section is a ROM copy of 'romcopyof' */
28 
29  /* Future fields go here */
30 
31 } *secinfo_ptr;
32 
33 #define SECINFO_TEXT     0x1  /* is executable */
34 #define SECINFO_DATA     0x2  /* is initialized data */
35 #define SECINFO_BSS      0x4  /* is zero-init data */
36 #define SECINFO_WRITABLE 0x8  /* not read-only */
37 #define SECINFO_ABSOLUTE 0x10 /* absolute, does not move under PIC/PID */
38 #define SECINFO_CHECKSUM 0x20 /* CRC word present at end of section */
39 
40 extern struct secinfo_t __secinfo;
41 
42 #ifdef __cplusplus
43 } /* extern "C" */
44 #endif
45 
46 #if 0 /* SAMPLE PROGRAM */
47 
48 #include <stdio.h>
49 int main() {
50     secinfo_ptr p;
51     int count=0;
52     for (p = &__secinfo; p != NULL; p=p->next,count++) {
53 	printf("section \"%s\"\n",p->name);
54 	printf(" address: 0x%08x\n",p->addr);
55 	printf(" length:  0x%x\n",p->size);
56 	printf(" flags:   ");
57 #define SECINFO_FLAG(F) \
58     if (p->flags&SECINFO_##F) printf("%s ",#F)
59 	SECINFO_FLAG(TEXT);
60 	SECINFO_FLAG(DATA);
61 	SECINFO_FLAG(BSS);
62 	SECINFO_FLAG(WRITABLE);
63 	SECINFO_FLAG(ABSOLUTE);
64 	SECINFO_FLAG(CHECKSUM);
65 	printf("\n");
66 	if (p->romcopyof)
67 	    printf(" ROMing:  \"%s\"\n",p->romcopyof->name);
68 	printf("\n");
69     }
70     printf("%i sections in this module\n",count);
71     return 0;
72 }
73 #endif /* SAMPLE PROGRAM */
74 
75 #endif /* _INFSECINFO_H */
76