This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: Patch to allow MIPS users to override default memory sizing
- From: "J. Johnston" <jjohnstn at redhat dot com>
- To: Michael Meissner <meissner at redhat dot com>
- Cc: newlib at sources dot redhat dot com
- Date: Wed, 30 Jan 2002 17:51:40 -0500
- Subject: Re: Patch to allow MIPS users to override default memory sizing
- Organization: Red Hat Inc.
- References: <200201300619.g0U6Jnf12985@tiktok.cygnus.com>
Michael Meissner wrote:
>
> I was working on some MIPS programs, and discovered that the memory
> sizing doesn't work in the simulator. I added the following code to
> allow programs to override the default value (1 megabyte) in such a
> situation. Is this ok to instal?
>
> 2002-01-29 Michael Meissner <meissner@redhat.com>
>
> * mips/cma101.c (__sizemem_default): Allow user to specify the
> memory size.
> (__sizemem): Use it.
>
Yes, go ahead.
-- Jeff J.
> *** libgloss/mips/cma101.c.~1~ Mon Oct 15 17:21:11 2001
> --- libgloss/mips/cma101.c Tue Jan 29 20:06:09 2002
> ***************
> *** 1,7 ****
> /*
> * cma101.c -- lo-level support for Cogent CMA101 development board.
> *
> ! * Copyright (c) 1996, 2001 Cygnus Support
> *
> * The authors hereby grant permission to use, copy, modify, distribute,
> * and license this software and its documentation for any purpose, provided
> --- 1,7 ----
> /*
> * cma101.c -- lo-level support for Cogent CMA101 development board.
> *
> ! * Copyright (c) 1996, 2001, 2002 Cygnus Support
> *
> * The authors hereby grant permission to use, copy, modify, distribute,
> * and license this software and its documentation for any purpose, provided
> *************** extern unsigned int __buserr_count(void)
> *** 179,184 ****
> --- 179,187 ----
> extern void __default_buserr_handler(void);
> extern void __restore_buserr_handler(void);
>
> + /* Allow the user to provide his/her own defaults. */
> + unsigned int __sizemem_default;
> +
> unsigned int
> __sizemem ()
> {
> *************** __sizemem ()
> *** 189,194 ****
> --- 192,202 ----
> extern void *end;
> char *endptr = (char *)&end;
> int extra;
> +
> + /* If the linker script provided a value for the memory size (or the user
> + overrode it in a debugger), use that. */
> + if (__sizemem_default)
> + return __sizemem_default;
>
> /* If we are running in kernel segment 0 (possibly cached), try sizing memory
> in kernel segment 1 (uncached) to avoid some problems with monitors. */
>
> --
> Michael Meissner, Red Hat, Inc. (GCC group)
> PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
> Work: meissner@redhat.com phone: +1 978-486-9304
> Non-work: meissner@the-meissners.org fax: +1 978-692-4482