From 88efdc69515ccbd3df27c92330ac667290d6fd07 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 27 May 1999 09:08:25 +0000 Subject: [PATCH] Add support for the memory on the CT2 board. Info from Thomas Goirand. --- .../atari/stand/tostools/loadbsd/loadbsd.c | 90 ++++++++++--------- .../atari/stand/tostools/loadbsd/loader.h | 5 +- 2 files changed, 53 insertions(+), 42 deletions(-) diff --git a/sys/arch/atari/stand/tostools/loadbsd/loadbsd.c b/sys/arch/atari/stand/tostools/loadbsd/loadbsd.c index 2edd8485d3f7..097d52d807b6 100644 --- a/sys/arch/atari/stand/tostools/loadbsd/loadbsd.c +++ b/sys/arch/atari/stand/tostools/loadbsd/loadbsd.c @@ -1,4 +1,4 @@ -/* $NetBSD: loadbsd.c,v 1.13 1997/11/01 06:49:22 lukem Exp $ */ +/* $NetBSD: loadbsd.c,v 1.14 1999/05/27 09:08:25 leo Exp $ */ /* * Copyright (c) 1995 L. Weppelman @@ -52,7 +52,7 @@ int s_flag = 0; /* St-ram only */ int t_flag = 0; /* Just test, do not execute */ int v_flag = 0; /* show version */ -const char version[] = "$Revision: 1.13 $"; +const char version[] = "$Revision: 1.14 $"; /* * Default name of kernel to boot, large enough to patch @@ -151,6 +151,7 @@ char **argv; fatal(-1, "Cannot open kernel '%s'", kname); if (read(fd, (char *)&ehdr, sizeof(ehdr)) != sizeof(ehdr)) fatal(-1, "Cannot read exec-header of '%s'", kname); + if (N_MAGIC(ehdr) != NMAGIC) fatal(-1, "Not an NMAGIC file '%s'", kname); @@ -187,17 +188,18 @@ char **argv; * Read symbol and string table */ if (ehdr.a_syms) { - long *p; + long *p; - p = (long *)(kparam.kp + textsz + ehdr.a_data + ehdr.a_bss); - *p++ = ehdr.a_syms; - if (read(fd, (char *)p, ehdr.a_syms) != ehdr.a_syms) - fatal(-1, "Cannot read symbol table\n"); - p = (long *)((char *)p + ehdr.a_syms); - if (read(fd, (char *)p, stringsz) != stringsz) - fatal(-1, "Cannot read string table\n"); - kparam.esym_loc = (long)((char *)p-(char *)kparam.kp +stringsz); + p = (long *)(kparam.kp + textsz + ehdr.a_data + ehdr.a_bss); + *p++ = ehdr.a_syms; + if (read(fd, (char *)p, ehdr.a_syms) != ehdr.a_syms) + fatal(-1, "Cannot read symbol table\n"); + p = (long *)((char *)p + ehdr.a_syms); + if (read(fd, (char *)p, stringsz) != stringsz) + fatal(-1, "Cannot read string table\n"); + kparam.esym_loc = (long)((char *)p-(char *)kparam.kp +stringsz); } + close(fd); if (d_flag) { eprintf("\r\nKernel info:\r\n"); @@ -259,39 +261,45 @@ get_sys_info() jar = *ADDR_P_COOKIE; if (jar != NULL) { do { - if (jar[0] == 0x5f435055) { /* _CPU */ - switch (jar[1]) { - case 0: - kparam.bootflags |= ATARI_68000; - break; - case 10: - kparam.bootflags |= ATARI_68010; - break; - case 20: - kparam.bootflags |= ATARI_68020; - break; - case 30: - kparam.bootflags |= ATARI_68030; - break; - case 40: - kparam.bootflags |= ATARI_68040; - break; - case 60: - kparam.bootflags |= ATARI_68060; - break; - default: - fatal(-1, "Unknown CPU-type"); - } + if (jar[0] == 0x5f435055) { /* _CPU */ + switch (jar[1]) { + case 0: + kparam.bootflags |= ATARI_68000; + break; + case 10: + kparam.bootflags |= ATARI_68010; + break; + case 20: + kparam.bootflags |= ATARI_68020; + break; + case 30: + kparam.bootflags |= ATARI_68030; + break; + case 40: + kparam.bootflags |= ATARI_68040; + break; + case 60: + kparam.bootflags |= ATARI_68060; + break; + default: + fatal(-1, "Unknown CPU-type"); } - if (jar[0] == 0x42504658) { /* BPFX */ - unsigned long *p; + } + if (jar[0] == 0x42504658) { /* BPFX */ + unsigned long *p; - p = (unsigned long*)jar[1]; + p = (unsigned long*)jar[1]; - kparam.ttmem_start = p[1]; - kparam.ttmem_size = p[2]; - } - jar = &jar[2]; + kparam.ttmem_start = p[1]; + kparam.ttmem_size = p[2]; + } + if (jar[0] == 0x5f435432) { /* _CT2 */ + /* + * The CT2 board has a different physical base address! + */ + kparam.ttmem_start = CTRAM_BASE; + } + jar = &jar[2]; } while (jar[-2]); } if (!(kparam.bootflags & ATARI_ANYCPU)) diff --git a/sys/arch/atari/stand/tostools/loadbsd/loader.h b/sys/arch/atari/stand/tostools/loadbsd/loader.h index d649e0a2a55c..cfe9ed32f973 100644 --- a/sys/arch/atari/stand/tostools/loadbsd/loader.h +++ b/sys/arch/atari/stand/tostools/loadbsd/loader.h @@ -1,4 +1,4 @@ -/* $NetBSD: loader.h,v 1.6 1996/01/07 22:06:18 leo Exp $ */ +/* $NetBSD: loader.h,v 1.7 1999/05/27 09:08:25 leo Exp $ */ /* * Copyright (c) 1995 L. Weppelman @@ -47,6 +47,9 @@ #endif #define TTRAM_BASE 0x1000000 /* Fastram always starts here */ +#define CTRAM_BASE 0x4000000 /* ... except on CT2 boards: */ + /* Logical : TTRAM_BASE */ + /* Physical: CTRAM_BASE */ /* * System var's used in low-memory