3 * Ovlymgr.c -- Runtime Overlay Manager for the GDB testsuite.
8 /* Local functions and data: */
10 extern unsigned long _ovly_table
[][4];
11 extern unsigned long _novlys
__attribute__ ((section (".data")));
12 enum ovly_index
{ VMA
, SIZE
, LMA
, MAPPED
};
14 static void ovly_copy (unsigned long dst
, unsigned long src
, long size
);
16 /* Flush the data and instruction caches at address START for SIZE bytes.
17 Support for each new port must be added here. */
18 /* FIXME: Might be better to have a standard libgloss function that
19 ports provide that we can then use. Use libgloss instead of newlib
20 since libgloss is the one intended to handle low level system issues.
21 I would suggest something like _flush_cache to avoid the user's namespace
22 but not be completely obscure as other things may need this facility. */
28 volatile char *mspr
= (char *) 0xfffffff7;
34 * Debuggers may set a breakpoint here, to be notified
35 * when the overlay table has been modified.
38 _ovly_debug_event (void)
43 * Copy the overlay into its runtime region,
44 * and mark the overlay as "mapped".
48 OverlayLoad (unsigned long ovlyno
)
52 if (ovlyno
< 0 || ovlyno
>= _novlys
)
53 exit (-1); /* fail, bad ovly number */
55 if (_ovly_table
[ovlyno
][MAPPED
])
56 return TRUE
; /* this overlay already mapped -- nothing to do! */
58 for (i
= 0; i
< _novlys
; i
++)
60 _ovly_table
[i
][MAPPED
] = 1; /* this one now mapped */
61 else if (_ovly_table
[i
][VMA
] == _ovly_table
[ovlyno
][VMA
])
62 _ovly_table
[i
][MAPPED
] = 0; /* this one now un-mapped */
64 ovly_copy (_ovly_table
[ovlyno
][VMA
],
65 _ovly_table
[ovlyno
][LMA
],
66 _ovly_table
[ovlyno
][SIZE
]);
74 * Copy the overlay back into its "load" region.
75 * Does NOT mark overlay as "unmapped", therefore may be called
76 * more than once for the same mapped overlay.
80 OverlayUnload (unsigned long ovlyno
)
82 if (ovlyno
< 0 || ovlyno
>= _novlys
)
83 exit (-1); /* fail, bad ovly number */
85 if (!_ovly_table
[ovlyno
][MAPPED
])
86 exit (-1); /* error, can't copy out a segment that's not "in" */
88 ovly_copy (_ovly_table
[ovlyno
][LMA
],
89 _ovly_table
[ovlyno
][VMA
],
90 _ovly_table
[ovlyno
][SIZE
]);
97 ovly_copy (unsigned long dst
, unsigned long src
, long size
)
99 memcpy ((void *) dst
, (void *) src
, size
);
This page took 0.030293 seconds and 4 git commands to generate.