generic ELF loader

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1831 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
bellard 2006-04-23 17:12:42 +00:00
parent ce2f4b3cb9
commit 5fe141fd30
5 changed files with 439 additions and 36 deletions

29
vl.c
View file

@ -332,35 +332,6 @@ int strstart(const char *str, const char *val, const char **ptr)
return 1;
}
/* return the size or -1 if error */
int get_image_size(const char *filename)
{
int fd, size;
fd = open(filename, O_RDONLY | O_BINARY);
if (fd < 0)
return -1;
size = lseek(fd, 0, SEEK_END);
close(fd);
return size;
}
/* return the size or -1 if error */
int load_image(const char *filename, uint8_t *addr)
{
int fd, size;
fd = open(filename, O_RDONLY | O_BINARY);
if (fd < 0)
return -1;
size = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
if (read(fd, addr, size) != size) {
close(fd);
return -1;
}
close(fd);
return size;
}
void cpu_outb(CPUState *env, int addr, int val)
{
#ifdef DEBUG_IOPORT