Index: sys/biosfs.c =================================================================== RCS file: /mint/freemint/sys/biosfs.c,v retrieving revision 1.32 diff -u -a -r1.32 biosfs.c --- sys/biosfs.c 29 Jan 2013 09:21:32 -0000 1.32 +++ sys/biosfs.c 17 Feb 2013 21:36:20 -0000 @@ -406,7 +406,7 @@ /* SERIAL1(!) is not present on the Mega STe or Falcon, * device 8 is SCC channel A */ - if (mch != TT && b->private == 8) + if (machine != machine_tt && b->private == 8) { b->name[6] = '2'; /* "serial2" */ b->tty = &scca_tty; @@ -1289,8 +1289,8 @@ long ret = 0; int bdev = f->fc.aux; struct bios_file *b = (struct bios_file *) f->fc.index; - union { const char *b; long *l;} ptr; - + union { const char *b; long *l;} ptr; + ptr.b = buf; r = ptr.l;// (long *) buf; Index: sys/cnf.c =================================================================== RCS file: /mint/freemint/sys/cnf.c,v retrieving revision 1.33 diff -u -a -r1.33 cnf.c --- sys/cnf.c 2 Feb 2013 10:47:48 -0000 1.33 +++ sys/cnf.c 17 Feb 2013 21:36:20 -0000 @@ -622,7 +622,7 @@ kfree(buf); } -void +long parse_include(const char *path, struct parsinf *inf, struct parser_item *parser_tab) { XATTR xattr; @@ -630,7 +630,7 @@ long ret; ret = FP_ALLOC(rootproc, &fp); - if (ret) return; + if (ret) return -1; ret = do_open(&fp, path, O_RDONLY, 0, &xattr); if (!ret) @@ -647,6 +647,8 @@ parser(fp, xattr.size, &include, parser_tab); do_close(rootproc, fp); + + return 0; } else { @@ -656,10 +658,12 @@ parser_msg(inf, NULL); boot_printf(MSG_cnf_cannot_include, path); parser_msg(NULL, NULL); + + return -1; } } -void +long parse_cnf(const char *path, struct parser_item *parser_tab, void *data) { struct parsinf inf = { 0ul, NULL, 1, NULL, NULL, data }; @@ -668,13 +672,15 @@ long ret; ret = FP_ALLOC (rootproc, &fp); - if (ret) return; + if (ret) return -1; ret = do_open(&fp, inf.file = path, O_RDONLY, 0, &xattr); if (!ret) { parser(fp, xattr.size, &inf, parser_tab); do_close(rootproc, fp); + + return 0; } else { @@ -682,5 +688,7 @@ FP_FREE(fp); ALERT(MSG_cnf_cant_open, path); + + return -1; } } Index: sys/cnf.h =================================================================== RCS file: /mint/freemint/sys/cnf.h,v retrieving revision 1.9 diff -u -a -r1.9 cnf.h --- sys/cnf.h 13 Jul 2007 21:32:48 -0000 1.9 +++ sys/cnf.h 17 Feb 2013 21:36:20 -0000 @@ -1,6 +1,6 @@ /* * $Id: cnf.h,v 1.9 2007/07/13 21:32:48 ozk Exp $ - * + * * This file has been modified as part of the FreeMiNT project. See * the file Changes.MH for details and dates. */ @@ -125,8 +125,8 @@ void parser_msg(struct parsinf *, const char *msg); -void parse_include(const char *path, struct parsinf *, struct parser_item *); -void parse_cnf(const char *path, struct parser_item *, void *); +long parse_include(const char *path, struct parsinf *, struct parser_item *); +long parse_cnf(const char *path, struct parser_item *, void *); # endif Index: sys/cnf_mint.c =================================================================== RCS file: /mint/freemint/sys/cnf_mint.c,v retrieving revision 1.24 diff -u -a -r1.24 cnf_mint.c --- sys/cnf_mint.c 1 Jan 2013 20:05:34 -0000 1.24 +++ sys/cnf_mint.c 17 Feb 2013 21:36:21 -0000 @@ -275,8 +275,14 @@ strcpy(cnf_path, sysdir); strcat(cnf_path, "mint.cnf"); + if (parse_cnf(cnf_path, parser_tab, &mydata) != 0) + { + /* sysdir/mint.cnf not found, try mchdir/mint.cnf */ + strcpy(cnf_path, mchdir); + strcat(cnf_path, "mint.cnf"); - parse_cnf(cnf_path, parser_tab, &mydata); + parse_cnf(cnf_path, parser_tab, &mydata); + } } /*============================================================================*/ @@ -414,8 +420,8 @@ { char cmdline[128]; int i; - union { const char *cc; char *c;} pathptr; - + union { const char *cc; char *c;} pathptr; + pathptr.cc = path; i = strlen(line); Index: sys/global.c =================================================================== RCS file: /mint/freemint/sys/global.c,v retrieving revision 1.22 diff -u -a -r1.22 global.c --- sys/global.c 12 Jan 2013 10:04:56 -0000 1.22 +++ sys/global.c 17 Feb 2013 21:36:21 -0000 @@ -36,7 +36,7 @@ struct global global = { - 0, 0, 0, -1, 0, 0, "" + machine_unknown, 0, 0, -1, 0, 0, "", "" }; long mcpu = 0; Index: sys/global.h =================================================================== RCS file: /mint/freemint/sys/global.h,v retrieving revision 1.20 diff -u -a -r1.20 global.h --- sys/global.h 12 Jan 2013 10:04:57 -0000 1.20 +++ sys/global.h 17 Feb 2013 21:36:21 -0000 @@ -42,13 +42,14 @@ extern struct global global; -#define mch global.mch +#define machine global.machine #define fputype global.fputype #define tosvers global.tosvers #define gl_lang global.gl_lang #define gl_kbd global.gl_kbd #define sysdrv global.sysdrv #define sysdir global.sysdir +#define mchdir global.mchdir extern BASEPAGE *_base; /* pointer to kernel's basepage */ Index: sys/init.c =================================================================== RCS file: /mint/freemint/sys/init.c,v retrieving revision 1.135 diff -u -a -r1.135 init.c --- sys/init.c 7 Feb 2013 23:21:51 -0000 1.135 +++ sys/init.c 17 Feb 2013 21:36:21 -0000 @@ -408,7 +408,7 @@ */ if (has_bconmap) { - if (mch == ST || mch == STE || mch == MEGASTE) + if (machine == machine_st || machine == machine_ste || machine == machine_megaste) has_bconmap = 0; } @@ -650,6 +650,56 @@ strcpy(sysdir, temp); } + /* create mchdir */ + { + char *mch_str = NULL; + + switch (machine) + { + case machine_st: + mch_str = "st"; + break; + case machine_ste: + mch_str = "ste"; + break; + case machine_megaste: + mch_str = "megaste"; + break; + case machine_tt: + mch_str = "tt"; + break; + case machine_falcon: + mch_str = "falcon"; + break; + case machine_milan: + mch_str = "milan"; + break; + case machine_hades: + mch_str = "hades"; + break; + case machine_ct60: + mch_str = "ct60"; + break; + case machine_firebee: + mch_str = "firebee"; + break; +#ifdef ARANYM + case machine_aranym: + mch_str = "aranym"; + break; +#endif + case machine_unknown: + default: + /* nothing to do */ + break; + } + + if (mch_str != NULL) + { + ksprintf (mchdir, sizeof(mchdir), "%s%s/", sysdir, mch_str); + } + } + /* print the warning message if MP is turned off */ # ifdef WITH_MMU_SUPPORT if (no_mem_prot && mcpu > 20) Index: sys/k_sysctl.c =================================================================== RCS file: /mint/freemint/sys/k_sysctl.c,v retrieving revision 1.15 diff -u -a -r1.15 k_sysctl.c --- sys/k_sysctl.c 19 Mar 2007 20:59:51 -0000 1.15 +++ sys/k_sysctl.c 17 Feb 2013 21:36:22 -0000 @@ -241,7 +241,7 @@ switch (name[0]) { case HW_MACHINE: - return sysctl_rdstring (oldp, oldlenp, newp, machine); + return sysctl_rdstring (oldp, oldlenp, newp, machine_str ()); case HW_MACHINE_ARCH: return sysctl_rdstring (oldp, oldlenp, newp, machine_arch); Index: sys/keyboard.c =================================================================== RCS file: /mint/freemint/sys/keyboard.c,v retrieving revision 1.114 diff -u -a -r1.114 keyboard.c --- sys/keyboard.c 18 Jan 2013 16:40:47 -0000 1.114 +++ sys/keyboard.c 17 Feb 2013 21:36:23 -0000 @@ -70,7 +70,7 @@ # include "dev-mouse.h" /* mshift */ # include "dos.h" /* s_hutdown() */ # include "dossig.h" /* p_kill() */ -# include "global.h" /* tosver, mch, *sysdir */ +# include "global.h" /* tosver, machine, *sysdir */ # include "init.h" /* boot_printf() */ # include "info.h" /* messages */ # include "k_exec.h" /* sys_pexec() */ @@ -1682,7 +1682,7 @@ size += strlen((char *)tos_keytab->alt) + 1; size += strlen((char *)tos_keytab->altshift) + 1; size += strlen((char *)tos_keytab->altcaps) + 1; - if (mch == MILAN_C) + if (machine == machine_milan) size += strlen((char *)tos_keytab->altgr) + 1; else size += 2; @@ -1750,7 +1750,7 @@ quickmove(p, tos_keytab->altcaps, len); p += len; - if (mch == MILAN_C) + if (machine == machine_milan) { len = strlen((char *)tos_keytab->altgr) + 1; quickmove(p, tos_keytab->altgr, len); Index: sys/module.c =================================================================== RCS file: /mint/freemint/sys/module.c,v retrieving revision 1.49 diff -u -a -r1.49 module.c --- sys/module.c 29 Aug 2011 15:49:45 -0000 1.49 +++ sys/module.c 17 Feb 2013 21:36:24 -0000 @@ -155,7 +155,6 @@ do_close(rootproc, f); } - static long load_xfs (struct basepage *b, const char *name, short *class, short *subclass); static long load_xdd (struct basepage *b, const char *name, short *class, short *subclass); @@ -176,6 +175,22 @@ { int i; + if (strlen(mchdir) > 0) + { + for (i = 0; i < (sizeof(_types) / sizeof(*_types)); i++) + { + /* load machine depend external xdd */ + if (mask & (1L << i)) + { + DEBUG(("load_all_modules (machine): processing \"%s\"", _types [i])); + load_modules(mchdir, _types [i], _loads [i]); + DEBUG(("load_all_modules (machine): done with \"%s\"", _types [i])); + + stop_and_ask(); + } + } + } + for (i = 0; i < (sizeof(_types) / sizeof(*_types)); i++) { /* load external xdd */ @@ -342,6 +357,8 @@ l = (void *)loader; + if (strlen(mchdir) > 0) + load_modules(mchdir, ext, l); load_modules(sysdir, ext, l); } Index: sys/arch/info_mach.c =================================================================== RCS file: /mint/freemint/sys/arch/info_mach.c,v retrieving revision 1.3 diff -u -a -r1.3 info_mach.c --- sys/arch/info_mach.c 13 Jun 2001 20:21:36 -0000 1.3 +++ sys/arch/info_mach.c 17 Feb 2013 21:36:24 -0000 @@ -1,41 +1,42 @@ /* * $Id: info_mach.c,v 1.3 2001/06/13 20:21:36 fna Exp $ - * + * * This file belongs to FreeMiNT. It's not in the original MiNT 1.12 * distribution. See the file CHANGES for a detailed log of changes. - * - * + * + * * Copyright 2000, 2001 Frank Naumann * Copyright 1993, 1994, 1995, 1996 Kay Roemer * All rights reserved. - * + * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. - * + * * This file is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Author: Frank Naumann * Started: 2001-05-08 - * + * * Please send suggestions, patches or bug reports to me or * the MiNT mailing list. - * + * */ # include "info_mach.h" +# include "arch/aranym.h" +# include "global.h" +# include "mint/ktypes.h" - -char *machine = "m68k"; char *machine_arch = "m68k"; char cpu_model[64]; @@ -43,3 +44,50 @@ char *cpu_type = "m68k"; char *mmu_type = "none"; char *fpu_type = "none"; + +char *machine_str (void) +{ + static char *str = "Unknown clone"; + + switch (machine) + { + case machine_st: + str = "Atari ST"; + break; + case machine_ste: + str = "Atari STE"; + break; + case machine_megaste: + str = "Atari MegaSTE"; + break; + case machine_tt: + str = "Atari TT"; + break; + case machine_falcon: + str = "Atari Falcon"; + break; + case machine_firebee: + str = "FireBee"; + break; + case machine_milan: + str = "Milan"; + break; + case machine_hades: + str = "Hades"; + break; + case machine_ct60: + str = "Atari Falcon/CT60"; + break; +# ifdef ARANYM + case machine_aranym: + str = nf_name(); + break; +# endif + case machine_unknown: + default: + /* nothing to set */ + break; + } + + return str; +} Index: sys/arch/info_mach.h =================================================================== RCS file: /mint/freemint/sys/arch/info_mach.h,v retrieving revision 1.3 diff -u -a -r1.3 info_mach.h --- sys/arch/info_mach.h 13 Jun 2001 20:21:36 -0000 1.3 +++ sys/arch/info_mach.h 17 Feb 2013 21:36:24 -0000 @@ -1,35 +1,35 @@ /* * $Id: info_mach.h,v 1.3 2001/06/13 20:21:36 fna Exp $ - * + * * This file belongs to FreeMiNT. It's not in the original MiNT 1.12 * distribution. See the file CHANGES for a detailed log of changes. - * - * + * + * * Copyright 2000, 2001 Frank Naumann * Copyright 1993, 1994, 1995, 1996 Kay Roemer * All rights reserved. - * + * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. - * + * * This file is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * Author: Frank Naumann * Started: 2000-05-08 - * + * * Please send suggestions, patches or bug reports to me or * the MiNT mailing list. - * + * */ # ifndef _info_mach_h @@ -37,8 +37,7 @@ # include "mint/mint.h" - -extern char *machine; +extern char *machine_str (void); extern char *machine_arch; extern char cpu_model[64]; Index: sys/arch/init_mach.c =================================================================== RCS file: /mint/freemint/sys/arch/init_mach.c,v retrieving revision 1.27 diff -u -a -r1.27 init_mach.c --- sys/arch/init_mach.c 20 Jan 2013 00:50:07 -0000 1.27 +++ sys/arch/init_mach.c 17 Feb 2013 21:36:24 -0000 @@ -1,45 +1,45 @@ /* * This file belongs to FreeMiNT. It's not in the original MiNT 1.12 * distribution. See the file CHANGES for a detailed log of changes. - * - * + * + * * Copyright 2000, 2001 Frank Naumann * Copyright 1993, 1994, 1995, 1996 Kay Roemer * All rights reserved. - * + * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. - * + * * This file is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * + * + * * begin: 2001-05-08 * last change: 2001-05-08 - * + * * Author: Frank Naumann - * + * * Please send suggestions, patches or bug reports to me or * the MiNT mailing list. - * + * */ # include "init_mach.h" # include "libkern/libkern.h" -# include "arch/aranym.h" # include "arch/detect.h" # include "arch/info_mach.h" # include "arch/mprot.h" # include "arch/tosbind.h" +# include "arch/aranym.h" # include "cookie.h" # include "global.h" @@ -51,9 +51,6 @@ /* * _MCH cookie is not exact anymore * (special hades cookie, special ct60 cookie, special aranym cookie) - * - * XXX todo: we should replace the global mch variable with a more - * accurate enum */ enum special_hw { @@ -67,7 +64,7 @@ }; static long _getmch (void); -static void identify (enum special_hw); +static void identify (long mch, enum special_hw); long @@ -83,7 +80,7 @@ * This must be done in a separate routine because the machine type and CPU * type are needed when initializing the system, whereas install_cookies is * not called until everything is practically up. - * + * * In fact, getmch() should be called before *anything* else is * initialized, so that if we find a MiNT cookie already in the * jar we can bail out early and painlessly. @@ -92,6 +89,7 @@ _getmch (void) { enum special_hw add_info = none; + long mch = 0; struct cookie *jar; #ifdef WITH_MMU_SUPPORT int old_no_mem_prot = no_mem_prot; @@ -121,27 +119,27 @@ # endif break; } - + case COOKIE__VDO: { FalconVideo = (jar->value == 0x00030000L); ste_video = (jar->value == 0x00010000L); break; } - + case COOKIE_MiNT: { boot_print ("MiNT is already installed!!\r\n"); return -1; } - + case COOKIE__AKP: { gl_kbd = (short)(jar->value & 0x00ffL); gl_lang = (short)((jar->value >> 8) & 0x00ff); break; } - + #ifdef WITH_MMU_SUPPORT case COOKIE_PMMU: { @@ -153,19 +151,19 @@ break; } #endif - + case COOKIE_HADES: { add_info = hades; break; } - + case COOKIE_CT60: { add_info = ct60; break; } - + # ifdef ARANYM case COOKIE_NF: { @@ -185,19 +183,19 @@ } #endif } - + jar++; } } - + /* own CPU test */ mcpu = detect_cpu (); /* own FPU test; this must be done after the CPU detection */ fputype = detect_fpu (); - + if ((fputype >> 16) > 1) fpu = 1; - + #ifdef WITH_MMU_SUPPORT if (add_info == ct60 && !old_no_mem_prot) { @@ -228,7 +226,7 @@ return -1; } - + /* Odd Skancke: * If protect_page0 == 0, we check if we should tell the pmmu code * to set SUPER on the first descriptor by placing a value of 1 here. @@ -249,16 +247,16 @@ protect_page0 = 1; } # endif /* !M68000 */ - + /* initialize the info strings */ - identify (add_info); - + identify (mch, add_info); + DEBUG (("detecting hardware ... ")); /* at the moment only detection of ST-ESCC */ if (mcpu < 40 && detect_hardware ()) boot_print ("ST-ESCC extension detected\r\n"); DEBUG (("ok!\r\n")); - + /* * if no preference found, look at the country code to decide */ @@ -266,12 +264,12 @@ { long *sysbase; int i; - + sysbase = *((long **)(0x4f2L)); /* gets the RAM OS header */ sysbase = (long *)sysbase[2]; /* gets the ROM one */ - + i = (int) ((sysbase[7] & 0x7ffe0000L) >> 17L); - + switch (i) { case 1: /* Germany */ @@ -287,7 +285,7 @@ break; } } - + if (gl_lang < 0) gl_lang = 0; @@ -295,13 +293,11 @@ } static void -identify (enum special_hw info) +identify (long mch, enum special_hw info) { char buf[64]; char *_cpu, *_mmu, *_fpu; - - machine = "Unknown clone"; - + switch (info) { case none: @@ -309,52 +305,45 @@ switch (mch) { case ST: - machine = "Atari ST"; + machine = machine_st; break; case STE: - machine = "Atari STE"; + machine = machine_ste; break; case MEGASTE: - machine = "Atari MegaSTE"; + machine = machine_megaste; break; case TT: - machine = "Atari TT"; + machine = machine_tt; break; case FALCON: #ifdef __mcoldfire__ - machine = "FireBee"; + machine = machine_firebee; #else - machine = "Atari Falcon"; + machine = machine_falcon; #endif break; case MILAN_C: - machine = "Milan"; + machine = machine_milan; break; } break; } case hades: - { - machine = "Hades"; + machine = machine_hades; break; - } case ct60: - { - machine = "Atari Falcon/CT60"; + machine = machine_ct60; break; - } # ifdef ARANYM case aranym: - { - machine = nf_name(); + machine = machine_aranym; break; - } # endif - default:; } - + _fpu = " no "; - + #ifdef __mcoldfire__ if (!coldfire_68k_emulation) { @@ -389,7 +378,7 @@ break; } } - + #ifdef __mcoldfire__ UNUSED(buf); @@ -404,7 +393,7 @@ { _cpu = "m68k"; _mmu = ""; - + switch (mcpu) { case 0: @@ -440,7 +429,7 @@ case 60: { ulong pcr; - + __asm__ ( ".word 0x4e7a,0x0808;" @@ -449,11 +438,11 @@ : : "d0" ); - + ksprintf (buf, sizeof (buf), "68%s060 rev.%ld", pcr & 0x10000 ? "LC/EC" : "", (pcr >> 8) & 0xff); - + cpu_type = "68060"; _cpu = buf; if (pmmu) @@ -465,9 +454,9 @@ } } } - + ksprintf (cpu_model, sizeof (cpu_model), "%s (%s CPU%s%sFPU)", - machine, _cpu, _mmu, _fpu); - + machine_str(), _cpu, _mmu, _fpu); + boot_printf ("%s\r\n\r\n", cpu_model); } Index: sys/arch/mprot030.c =================================================================== RCS file: /mint/freemint/sys/arch/mprot030.c,v retrieving revision 1.23 diff -u -a -r1.23 mprot030.c --- sys/arch/mprot030.c 16 Jun 2011 09:25:06 -0000 1.23 +++ sys/arch/mprot030.c 17 Feb 2013 21:36:25 -0000 @@ -1,30 +1,30 @@ /* * $Id: mprot030.c,v 1.23 2011/06/16 09:25:06 alanh Exp $ - * + * * This file has been modified as part of the FreeMiNT project. See * the file Changes.MH for details and dates. - * - * + * + * * Copyright 1991,1992,1993,1994 Atari Corporation. * All rights reserved. - * + * * * page-table data structures * * * The root pointer points to a list of pointers to top-level pointer tables. - * + * * Each entry in a pointer table points to another pointer table or to * a page table, or is a page descriptor. - * + * * Since, initially, the logical address space is the physical address space, * we only need to worry about 26MB plus 32K for I/O space. - * + * * Since we want some pages to be supervisor-accessible, but we don't want * a whole separate table for that, we use long-format descriptors. - * + * * Initial memory map: - * + * * 0 - membot: S (supervisor only) * membot - memtop: P (protected TPA) * memtop - phystop: G (screen) @@ -36,52 +36,52 @@ * ramtop - $7FFFFFFF: G (A32/D32 VME, supervisor only, cacheable) * $80000000- $FEFFFFFF: G (A32/D32 VME, supervisor only, non cacheable) * $FFxxxxxx just like $00xxxxxx. - * + * * Here's a final choice of layouts: IS=0, PS=13 (8K), TIA=4, TIB=4, TIC=4, * TID=7. This lets us map out entire unused megabytes at level C, and gives * us an 8K page size, which is the largest the '040 can deal with. - * + * * This code implements 4+4+4+7, as follows: - * + * * tbl_a * 0 -> tbl_b0 * 1-7 -> Cacheable direct (VME) page descriptors * 8-E -> Non-cacheable direct (VME) page descriptors * F -> tbl_bf - * + * * tbl_b0 table: 16 entries (assumes only 16MB of TT RAM) * 0 -> tbl_c00 (16MB of ST RAM address space) * 1 -> tbl_c01 (16MB of TT RAM address space) * 2-F -> cacheable direct (VME) page descriptors - * + * * tbl_bF table: 16 entries (deals with $FF mapping to $00) * 0-E -> Non-cacheable direct (VME) page descriptors * F -> tbl_c00 (16MB of ST RAM address space, repeated here as $FF) - * + * * tbl_c00 table: ST RAM address space (example assuming 4MB ST RAM) * 0-3 -> RAM page tables * 4-D -> invalid * E -> direct map, cache enable (ROM) * F -> direct map, cache inhibit (I/O) - * + * * For each 16MB containing any TT RAM, there's a tbl_c. Within those, * for each MB that actually has TT RAM, there's another table, containing * 128 RAM page tables. Where there isn't RAM, there are "global" * pages, to let the hardware bus error or not as it sees fit. - * + * * One RAM page table is allocated per megabyte of real RAM; each table has * 128 entries, which is 8K per page. For a TT with 4MB ST RAM and 4MB TT RAM * that's 8K in page tables. You can cut this down by not allocating page * tables for which the entire megabyte is not accessible (i.e. it's all * private memory and it's not YOUR private memory). - * + * * You have one of these per process. When somebody loads into G or S memory * or leaves it, you have to go through the page tables of every process * updating S bits (for S) and DT (for G) bits. - * + * * The top levels are small & easy so replicating them once per process * doesn't really hurt us. - * + * */ # include "mprot.h" @@ -178,7 +178,7 @@ * constants here, but that's all. The first new_proc call will set up the * page table for the root process and switch it in; from then on, we're * always under some process' control. - * + * * The master page-mode table is initialized here, and some constants like * the size needed for future page tables. * @@ -192,13 +192,13 @@ void init_tables(void) -{ +{ if (no_mem_prot) { page_table_size = 0L; return; } - + { struct cookie *cookie; int n_megabytes; @@ -207,9 +207,9 @@ TRACE(("init_tables")); #define phys_top_tt (*(ulong *)0x5a4L) - + offset_tt_ram = 0; - + if (phys_top_tt == 0x01000000L) mint_top_tt = 0; else @@ -217,7 +217,7 @@ int ct2 = 0; mint_top_tt = phys_top_tt; cookie = *CJAR; - + if (cookie) { while (cookie->tag) @@ -227,14 +227,14 @@ cookie++; } } - - if ((mch == FALCON) && ct2) + + if ((machine == machine_falcon) && ct2) { offset_tt_ram = 0x03000000L; DEBUG (("init_tables: Falcon CT2 -> offset 0x%lx", offset_tt_ram)); } } - + #define phys_top_st (*(ulong *)0x42eL) mint_top_st = phys_top_st; @@ -574,7 +574,7 @@ /* Don't do anything if init_tables() has not yet finished */ if (global_mode_table == 0L) return; - + #if 0 /* this should not occur any more */ if (mode == PROT_NOCHANGE) { mode = global_mode_table[(start >> 13)]; @@ -784,7 +784,7 @@ offset = offset_tt_ram; else offset = 0; - + tbl_a = tptr; tptr += TBL_SIZE; tbl_b0 = tptr; @@ -850,7 +850,7 @@ /* Done with tbl_c for 0th 16MB; go on to TT RAM */ -/* +/* structure: for (i = each 16MB that has any TT RAM in it) @@ -948,7 +948,7 @@ if (!mmu_is_set_up) { DEBUG (("init_page_table: call set_mmu")); - + set_mmu(proc->ctxt[0].crp,proc->ctxt[0].tc); mmu_is_set_up = 1; } Index: sys/libkern/kernel_module.h =================================================================== RCS file: /mint/freemint/sys/libkern/kernel_module.h,v retrieving revision 1.46 diff -u -a -r1.46 kernel_module.h --- sys/libkern/kernel_module.h 29 Mar 2012 08:02:18 -0000 1.46 +++ sys/libkern/kernel_module.h 17 Feb 2013 21:36:26 -0000 @@ -792,7 +792,7 @@ * kentry_mch */ -# define mch ( KENTRY->vec_mch.global->mch) +# define machine ( KENTRY->vec_mch.global->machine) # define fputype ( KENTRY->vec_mch.global->fputype) # define tosvers ( KENTRY->vec_mch.global->tosvers) # define gl_lang ( KENTRY->vec_mch.global->gl_lang) Index: sys/mint/kentry.h =================================================================== RCS file: /mint/freemint/sys/mint/kentry.h,v retrieving revision 1.44 diff -u -a -r1.44 kentry.h --- sys/mint/kentry.h 29 Nov 2011 17:23:34 -0000 1.44 +++ sys/mint/kentry.h 17 Feb 2013 21:36:26 -0000 @@ -1,31 +1,31 @@ /* * $Id: kentry.h,v 1.44 2011/11/29 17:23:34 alanh Exp $ - * + * * This file belongs to FreeMiNT. It's not in the original MiNT 1.12 * distribution. See the file CHANGES for a detailed log of changes. - * - * + * + * * Copyright 2004 Frank Naumann * All rights reserved. - * + * * Please send suggestions, patches or bug reports to me or * the MiNT mailing list - * - * + * + * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. - * + * * This file is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * + * */ # ifndef _mint_kentry_h @@ -69,7 +69,7 @@ /* kentry - kernel entry vector * ---------------------------- - * + * * New kernel entry interface. This is a replacement for the existing * kerinfo interface for xdd and xfs modules. It's better sorted and include * much, much more useful kernel routines that are exported to the new kernel @@ -78,26 +78,26 @@ * It also have a seperate version number (major and minor version). A module * must check the major version and only if the major version match against * the major version the module was compiled the module can be loaded. - * - * + * + * * All functions should be called using the GCC calling conventions: * ----------------------------------------------------------------- - * + * * (1) parameters are passed on the stack, aligned on 16 bit boundaries * (2) registers d0-d1 and a0-a1 are scratch registers and may be modified * by the called functions * (3) if the function returns a value, it will be returned in register * d0 - * + * * data types: * ----------- * int is 16bit - * + * * short is 16bit * long is 32bit - * + * * and unsigned - * + * */ /* ATTENTION! @@ -244,28 +244,28 @@ struct proc **pret, long stack, struct create_process_opts *); - /* + /* * fork a kernel thread for process p - * + * * arguments: * ---------- * p - the process context for which the kernel thread is created; * can be NULL, in this case a kernel thread of rootproc is created * NOTE: Anything except the signal handler is shared! - * + * * func - the function where the thread starts - * + * * arg - additional argument passed to func - * + * * fmt - printf format string for the process name - * + * * ... - printf args */ long _cdecl (*kthread_create)(struct proc *p, void _cdecl (*func)(void *), void *arg, struct proc **np, const char *fmt, ...); /* * leave kernel thread previously created by kthread_create - * + * * NOTE: can only be called from INSIDE the thread */ void _cdecl (*kthread_exit)(short code); @@ -343,7 +343,7 @@ void *_cdecl (*kcore)(unsigned long size, const char *func); void *_cdecl (*kmalloc)(unsigned long size, const char *func); void _cdecl (*kfree)(void *place, const char *func); - + void *_cdecl (*dmabuf_alloc)(unsigned long size, short cmode, const char *func); void *_cdecl (*umalloc)(unsigned long size, const char *func); @@ -508,15 +508,15 @@ long _cdecl (*loader)(struct basepage *, const char *, short *, short *)); /* register VDI or AES trap handler - * + * * mode = 0 -> install * mode = 1 -> remove - * + * * flag = 0 -> AES dispatcher * flag = 1 -> VDI dispatcher - * + * * return 0 on success - * or error number for a failure + * or error number for a failure */ long _cdecl (*register_trap2)(long _cdecl (*dispatch)(void *), int mode, int flag, long extra); }; @@ -531,8 +531,8 @@ */ struct kentry_cnf { - void _cdecl (*parse_cnf)(const char *path, struct parser_item *, void *); - void _cdecl (*parse_include)(const char *path, struct parsinf *, struct parser_item *); + long _cdecl (*parse_cnf)(const char *path, struct parser_item *, void *); + long _cdecl (*parse_include)(const char *path, struct parsinf *, struct parser_item *); void _cdecl (*parser_msg)(struct parsinf *, const char *msg); }; #define DEFAULTS_kentry_cnf \ @@ -571,7 +571,7 @@ * function to install XHDI drivers */ long _cdecl (*XHNewCookie)(void *newcookie); -#endif +#endif }; #ifdef XHDI_MASS_STORAGE_SUPPORT #define DEFAULTS_kentry_misc \ @@ -619,7 +619,7 @@ * debug - error messages * alert - really serious errors * fatal - fatal errors - * force - always prints, even with debug level 0 + * force - always prints, even with debug level 0 */ int *debug_level; void _cdecl (*trace)(const char *, ...); @@ -911,11 +911,11 @@ unsigned char minor; /* FreeMiNT minor version */ unsigned char patchlevel; /* FreeMiNT patchlevel */ unsigned char beta; /* FreeMiNT beta ident */ - + unsigned char version_major; /* kentry major version */ unsigned char version_minor; /* kentry minor version */ unsigned short status; /* FreeMiNT status */ - + unsigned long dos_version; /* running GEMDOS version */ /* OS functions */ Index: sys/mint/ktypes.h =================================================================== RCS file: /mint/freemint/sys/mint/ktypes.h,v retrieving revision 1.17 diff -u -a -r1.17 ktypes.h --- sys/mint/ktypes.h 3 Jan 2013 23:26:47 -0000 1.17 +++ sys/mint/ktypes.h 17 Feb 2013 21:36:26 -0000 @@ -1,6 +1,6 @@ /* * $Id: ktypes.h,v 1.17 2013/01/03 23:26:47 hek Exp $ - * + * * This file has been modified as part of the FreeMiNT project. See * the file Changes.MH for details and dates. */ @@ -110,20 +110,40 @@ /* global data */ + +typedef enum +{ + machine_unknown, + machine_st, + machine_ste, + machine_megaste, + machine_tt, + machine_falcon, + machine_milan, + machine_hades, + machine_ct60, + machine_firebee +#ifdef ARANYM + , + machine_aranym +#endif +} machine_type; + struct global { - long mch; /* machine we are are running */ + machine_type machine; /* machine we are are running */ long fputype; /* fpu type, value for cookie jar */ short tosvers; /* the underlying TOS version */ short gl_lang; /* language preference */ - short gl_kbd; /* default keyboard layout */ + short gl_kbd; /* default keyboard layout */ /* The path to the system directory */ short sysdrv; char sysdir[32]; + char mchdir[32]; /* sysdir/, derived from machine type */ }; /* BIOS device map */