This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfa] Contribute newlib Support for mep-elf (MeP


Minor comments.

Please look at libc/machine/arm/Makefile.am. You are missing the additional AM_ACLOCAL_FLAGS path pointing to the top-level src directory. As well, please add a lib_a_CFLAGS statement; although you currently only have a .S file, it makes life easier for anyone who adds a C file to the directory in the future. An author, or "written by", comment in setjmp.S would be helpful since this code will fall under the default Red Hat license. The ChangeLog comment for setjmp.S's creation should specify setjmp.S (it currently does not).

Other than those minor comments, approved for check-in.

-- Jeff J.


Dave Brolley wrote:
Hi,

The attached patch adds support for the mep-elf target to newlib. I would like approval to commit these changes and new files.

Thanks,
Dave


------------------------------------------------------------------------


2007-11-05 Dave Brolley <brolley@redhat.com>

	* libc/machine/configure: Regenerated to pick up mep-elf changes.
	
	* Contribute mep-elf from Red Hat
	2006-10-27  DJ Delorie  <dj@redhat.com>

* libc/include/machine/setjmp.h: Add MeP support.

2003-04-17 DJ Delorie <dj@redhat.com>

* configure.host (mep-*-*): Support "long long" type.

2001-06-06 DJ Delorie <dj@redhat.com>

* libc/include/machine/ieeefp.h (mep): Support little endian too.

2001-05-14 DJ Delorie <dj@redhat.com>

	* configure.host: Add mep's machine_dir.
	* libc/include/setjmp.h: Add mep support.
	* libc/machine/mep: New, support mep's setjmp/longjmp.

2001-05-04 DJ Delorie <dj@redhat.com>

	* configure.host: Add mep.
	* libc/include/machine/ieeefp.h: Ditto.



------------------------------------------------------------------------

Index: configure.host
===================================================================
RCS file: /cvs/src/src/newlib/configure.host,v
retrieving revision 1.96
diff -r1.96 configure.host
192a193,195
  mep)
	machine_dir=mep
	;;
430a434,437
  mep-*-*)
	default_newlib_io_long_long="yes"
	newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
	;;
Index: libc/include/machine/ieeefp.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/machine/ieeefp.h,v
retrieving revision 1.32
diff -r1.32 ieeefp.h
312a313,320
#ifdef __mep__
#ifdef __LITTLE_ENDIAN__
#define __IEEE_LITTLE_ENDIAN
#else
#define __IEEE_BIG_ENDIAN
#endif
#endif

Index: libc/include/machine/setjmp.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/machine/setjmp.h,v
retrieving revision 1.33
diff -r1.33 setjmp.h
225a226,230
#ifdef __mep__
/* 16 GPRs, pc, hi, lo */
#define _JBLEN 19
#endif

Index: libc/machine/configure.in
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/configure.in,v
retrieving revision 1.8
diff -r1.8 configure.in
44a45
mep ) AC_CONFIG_SUBDIRS(mep) ;;

------------------------------------------------------------------------

dnl This is the newlib/libc/machine/mep configure.in file.
dnl Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)
AC_INIT([newlib],[NEWLIB_VERSION])
AC_CONFIG_SRCDIR([Makefile.am])

dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake. AC_CONFIG_AUX_DIR(../../../..)

NEWLIB_CONFIGURE(../../..)

AC_CONFIG_FILES([Makefile])
AC_OUTPUT

------------------------------------------------------------------------

## Process this file with automake to generate Makefile.in

AUTOMAKE_OPTIONS = cygnus

INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)

AM_CCASFLAGS = $(INCLUDES)

noinst_LIBRARIES = lib.a

lib_a_SOURCES = setjmp.S

ACLOCAL_AMFLAGS = -I ../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host

------------------------------------------------------------------------

#
#  Setjmp/longjmp for MeP
#
#  19 32-bit words in the jmpbuf:
#    $0
#    $1
#    ...
#    $15
#    $pc
#    $hi
#    $lo
#
#  Note that $0 is saved but not restored.  It can't be restored
#  as it's the return value of setjmp, but we save it in case
#  some application wants to see it in the jmp_buf.  Ideally,
#  we should not need to save anything that is call-clobbered,
#  but you never know what the user is going to tell gcc with -f
#  options.

	.noregerr
	.text

	.globl	setjmp
	.type	setjmp,@function

setjmp:

# $1 is the address of the buffer. We return 0 in $0.

	sw	$0, ($1)
	sw	$1, 4($1)
	sw	$2, 8($1)
	sw	$3, 12($1)
	sw	$4, 16($1)
	sw	$5, 20($1)
	sw	$6, 24($1)
	sw	$7, 28($1)
	sw	$8, 32($1)
	sw	$9, 36($1)
	sw	$10, 40($1)
	sw	$11, 44($1)
	sw	$12, 48($1)
	sw	$13, 52($1)
	sw	$14, 56($1)
	sw	$15, 60($1)

	ldc	$0, $lp
	sw	$0, 64($1)
	ldc	$0, $opt
	sra	$0, 24
	and3	$0, $0, 3
	beqz	$0, sj_skip_hilo
	ldc	$0, $hi
	sw	$0, 68($1)
	ldc	$0, $lo
	sw	$0, 72($1)
sj_skip_hilo:

	mov	$0, 0
	ret

	.globl	longjmp
	.type	longjmp,@function

longjmp:

	# $1 is the address of the buffer.  $2 is the value setjmp
	# returns.  We do not faithfully restore $0 or $lp, because
	# the act of calling setjmp clobbered those anyway.

	bnez	$2, rv_not_zero
	mov	$2, 1
rv_not_zero:

	# We restore $sp first so we can save the return value there,
	# otherwise we'd need to have another unrestored register.
	lw	$15, 60($1)
	add3	$sp, $sp, -4
	sw	$2, ($sp)

	# Now restore the general registers.
	lw	$2, 8($1)
	lw	$3, 12($1)
	lw	$4, 16($1)
	lw	$5, 20($1)
	lw	$6, 24($1)
	lw	$7, 28($1)
	lw	$8, 32($1)
	lw	$9, 36($1)
	lw	$10, 40($1)
	lw	$11, 44($1)
	lw	$12, 48($1)
	lw	$13, 52($1)
	lw	$14, 56($1)

	# We restore $pc's value to $lp so that we can just ret later.
	lw	$0, 64($1)
	stc	$0, $lp
	ldc	$0, $opt
	sra	$0, 24
	and3	$0, $0, 3
	beqz	$0, lj_skip_hilo
	lw	$0, 68($1)
	stc	$0, $hi
	lw	$0, 72($1)
	stc	$0, $lo
lj_skip_hilo:

	# Restore $1
	lw	$1, 8($1)

	# Get the return value off the stack, and restore the stack.
	lw	$0, ($sp)
	add3	$sp, $sp, 4

ret


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]