Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/atari/stand/tostools/libtos Arrange include files s...
details: https://anonhg.NetBSD.org/src/rev/dde9d048cfc0
branches: trunk
changeset: 516020:dde9d048cfc0
user: leo <leo%NetBSD.org@localhost>
date: Sat Oct 13 19:50:36 2001 +0000
description:
Arrange include files section in such a way that we can use this code in
the MiNT and NetBSD/libsa environment.
diffstat:
sys/arch/atari/stand/tostools/libtos/aout.c | 31 +++++++++++++++++--------
sys/arch/atari/stand/tostools/libtos/elf.c | 23 +++++++++++++-----
sys/arch/atari/stand/tostools/libtos/sysinfo.c | 12 +++++++++-
3 files changed, 48 insertions(+), 18 deletions(-)
diffs (171 lines):
diff -r c3f2db8b6132 -r dde9d048cfc0 sys/arch/atari/stand/tostools/libtos/aout.c
--- a/sys/arch/atari/stand/tostools/libtos/aout.c Sat Oct 13 18:28:10 2001 +0000
+++ b/sys/arch/atari/stand/tostools/libtos/aout.c Sat Oct 13 19:50:36 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: aout.c,v 1.2 2001/10/11 07:07:42 leo Exp $ */
+/* $NetBSD: aout.c,v 1.3 2001/10/13 19:50:36 leo Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -36,16 +36,27 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+
+#ifdef TOSTOOLS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
+#include <a_out.h>
-#ifdef TOSTOOLS
-#include <a_out.h>
+#define MALLOC(x) malloc(x)
+
#else
+
+#include <stand.h>
+#include <atari_stand.h>
+#include <string.h>
+#include <libkern.h>
#include <sys/exec_aout.h>
+
+#define MALLOC(x) alloc(x)
#endif
+
#include "tosdefs.h"
#include "kparamb.h"
#include "libtos.h"
@@ -63,13 +74,8 @@
#define __LDPGSZ (8*1024) /* Page size for NetBSD */
-#ifndef N_MAGIC
-#define N_MAGIC(hdr) (hdr.a_magic & 0xffff)
-#endif
-
#endif /* TOSTOOLS */
-
/*
* Load an a.out image.
* Exit codes:
@@ -94,8 +100,13 @@
if (read(fd, (char *)&ehdr, sizeof(ehdr)) != sizeof(ehdr))
return -1;
- if (N_MAGIC(ehdr) != NMAGIC)
+#ifdef TOSTOOLS
+ if ((ehdr.a_magic & 0xffff) != NMAGIC)
return -1;
+#else
+ if ((N_GETMAGIC(ehdr) != NMAGIC) && (N_GETMAGIC(ehdr) != OMAGIC))
+ return -1;
+#endif
/*
* Extract various sizes from the kernel executable
@@ -120,7 +131,7 @@
}
err = 4;
- if ((od->kstart = (u_char *)malloc(od->ksize)) == NULL)
+ if ((od->kstart = (u_char *)MALLOC(od->ksize)) == NULL)
goto error;
/*
diff -r c3f2db8b6132 -r dde9d048cfc0 sys/arch/atari/stand/tostools/libtos/elf.c
--- a/sys/arch/atari/stand/tostools/libtos/elf.c Sat Oct 13 18:28:10 2001 +0000
+++ b/sys/arch/atari/stand/tostools/libtos/elf.c Sat Oct 13 19:50:36 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: elf.c,v 1.2 2001/10/11 07:07:42 leo Exp $ */
+/* $NetBSD: elf.c,v 1.3 2001/10/13 19:50:36 leo Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -36,17 +36,26 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#ifdef TOSTOOLS
#include <stdio.h>
-#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
+#include "exec_elf.h"
-#ifdef TOSTOOLS
-#include "exec_elf.h"
+#define MALLOC(x) malloc(x)
+
#else
+
+#include <stand.h>
+#include <atari_stand.h>
+#include <string.h>
+#include <libkern.h>
#include <sys/exec_elf.h>
+
+#define MALLOC(x) alloc(x)
#endif
+
#include "tosdefs.h"
#include "kparamb.h"
#include "libtos.h"
@@ -89,7 +98,7 @@
*/
i = ehdr.e_phnum * sizeof(Elf32_Phdr);
err = 1;
- if ((phdrs = (Elf32_Phdr *)malloc(i)) == NULL)
+ if ((phdrs = (Elf32_Phdr *)MALLOC(i)) == NULL)
goto error;
err = 2;
if (read(fd, phdrs, i) != i)
@@ -140,7 +149,7 @@
od->kentry = ehdr.e_entry;
err = 5;
- if ((od->kstart = (u_char *)malloc(od->ksize)) == NULL)
+ if ((od->kstart = (u_char *)MALLOC(od->ksize)) == NULL)
goto error;
/*
@@ -159,7 +168,7 @@
if (read(fd, p, php->p_filesz) != php->p_filesz)
goto error;
if (php->p_memsz > php->p_filesz)
- memset(p + php->p_filesz, 0, php->p_memsz - php->p_filesz);
+ bzero(p + php->p_filesz, php->p_memsz - php->p_filesz);
}
}
diff -r c3f2db8b6132 -r dde9d048cfc0 sys/arch/atari/stand/tostools/libtos/sysinfo.c
--- a/sys/arch/atari/stand/tostools/libtos/sysinfo.c Sat Oct 13 18:28:10 2001 +0000
+++ b/sys/arch/atari/stand/tostools/libtos/sysinfo.c Sat Oct 13 19:50:36 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysinfo.c,v 1.1 2001/10/10 14:19:53 leo Exp $ */
+/* $NetBSD: sysinfo.c,v 1.2 2001/10/13 19:50:36 leo Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -36,8 +36,18 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#ifdef TOSTOOLS
#include <stdio.h>
#include <sys/types.h>
+#else
+
+#include <stand.h>
+#include <atari_stand.h>
+#include <string.h>
+#include <libkern.h>
+#include <machine/cpu.h>
+#endif /* TOSTOOLS */
+
#include "tosdefs.h"
#include "kparamb.h"
#include "libtos.h"
Home |
Main Index |
Thread Index |
Old Index