* For portability reasons change cle_addr from pointer type.
This commit is contained in:
parent
f7908e332f
commit
ffb90bfe40
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)$Id: cle.h,v 1.2 2007/01/05 17:47:53 bg- Exp $
|
* @(#)$Id: cle.h,v 1.3 2007/04/25 15:36:53 bg- Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CLE_H
|
#ifndef CLE_H
|
||||||
|
@ -42,13 +42,13 @@ typedef u16_t cle_word;
|
||||||
typedef u16_t cle_half;
|
typedef u16_t cle_half;
|
||||||
|
|
||||||
/* Also used for address arithmetic (can't be void *). */
|
/* Also used for address arithmetic (can't be void *). */
|
||||||
typedef unsigned char *cle_addr;
|
typedef uintptr_t cle_addr;
|
||||||
/* typedef uintptr_t cle_addr; */
|
|
||||||
|
|
||||||
typedef unsigned char cle_scratch[32];
|
typedef unsigned char cle_scratch[32];
|
||||||
|
|
||||||
struct cle_info {
|
struct cle_info {
|
||||||
cle_addr text, data, bss;
|
cle_addr text;
|
||||||
|
void *data, *bss;
|
||||||
|
|
||||||
cle_off textrelaoff, datarelaoff;
|
cle_off textrelaoff, datarelaoff;
|
||||||
cle_word textrelasize, datarelasize;
|
cle_word textrelasize, datarelasize;
|
||||||
|
@ -76,7 +76,7 @@ int
|
||||||
cle_relocate(struct cle_info *info,
|
cle_relocate(struct cle_info *info,
|
||||||
int (*read)(void *, int, off_t),
|
int (*read)(void *, int, off_t),
|
||||||
off_t hdr, /* Offset to start of file. */
|
off_t hdr, /* Offset to start of file. */
|
||||||
cle_addr segmem, /* Where segment is stored in memory. */
|
void *segmem, /* Where segment is stored in memory. */
|
||||||
cle_off reloff, /* .rela.<segment> start */
|
cle_off reloff, /* .rela.<segment> start */
|
||||||
cle_word relsize); /* .rela.<segment> size */
|
cle_word relsize); /* .rela.<segment> size */
|
||||||
|
|
||||||
|
@ -93,6 +93,7 @@ cle_lookup(struct cle_info *info,
|
||||||
#define CLE_NO_TEXT 4
|
#define CLE_NO_TEXT 4
|
||||||
#define CLE_UNDEFINED 5
|
#define CLE_UNDEFINED 5
|
||||||
#define CLE_UNKNOWN_SEGMENT 6
|
#define CLE_UNKNOWN_SEGMENT 6
|
||||||
|
#define CLE_UNKNOWN_RELOC 7
|
||||||
|
|
||||||
#define CLE_MULTIPLY_DEFINED 20
|
#define CLE_MULTIPLY_DEFINED 20
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)$Id: cmod.c,v 1.1 2007/01/05 18:01:06 bg- Exp $
|
* @(#)$Id: cmod.c,v 1.2 2007/04/25 15:37:41 bg- Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -90,18 +90,18 @@ cmod_load(unsigned imod,
|
||||||
*/
|
*/
|
||||||
h.data = cmod_module[imod].ram;
|
h.data = cmod_module[imod].ram;
|
||||||
h.bss = h.data + h.datasize;
|
h.bss = h.data + h.datasize;
|
||||||
h.text = h.bss + h.bsssize;
|
h.text = (cle_addr)h.bss + h.bsssize;
|
||||||
|
|
||||||
PRINTF("cmod: copy text segment to RAM %p %p\n",
|
PRINTF("cmod: copy text segment to RAM %p %p\n",
|
||||||
h.text, h.text + h.textsize);
|
h.text, h.text + h.textsize);
|
||||||
ret = pread(h.text, h.textsize, off + h.textoff);
|
ret = pread((void *)h.text, h.textsize, off + h.textoff);
|
||||||
assert(ret > 0);
|
assert(ret > 0);
|
||||||
if(h.textrelasize > 0) {
|
if(h.textrelasize > 0) {
|
||||||
PRINTF("cmod: relocate text in RAM\n");
|
PRINTF("cmod: relocate text in RAM\n");
|
||||||
ret = cle_relocate(&h,
|
ret = cle_relocate(&h,
|
||||||
pread,
|
pread,
|
||||||
off,
|
off,
|
||||||
h.text,
|
(void *)h.text,
|
||||||
h.textrelaoff, h.textrelasize);
|
h.textrelaoff, h.textrelasize);
|
||||||
if(ret != CLE_OK) {
|
if(ret != CLE_OK) {
|
||||||
strcpy(scratch, h.name);
|
strcpy(scratch, h.name);
|
||||||
|
|
|
@ -26,14 +26,14 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)$Id: cmod.h,v 1.1 2007/01/05 18:00:55 bg- Exp $
|
* @(#)$Id: cmod.h,v 1.2 2007/04/25 15:38:00 bg- Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CMOD_H
|
#ifndef CMOD_H
|
||||||
#define CMOD_H
|
#define CMOD_H
|
||||||
|
|
||||||
struct cmod_info {
|
struct cmod_info {
|
||||||
cle_addr ram;
|
void * ram;
|
||||||
/* cle_addr rom; */
|
/* cle_addr rom; */
|
||||||
void (*fini)(void);
|
void (*fini)(void);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue