Heads up for 1.13 snapshot

Jeff Johnston jjohnstn@redhat.com
Fri Dec 17 20:36:00 GMT 2004


Thanks Chris.  Patch checked in.  I'll start putting together 13 now.

-- Jeff J.

Christian Groessler wrote:
> On Fri, 17 Dec 2004, Jeff Johnston wrote:
> 
> 
>>It would be best if you could provide the updated patch.
> 
>   
> Ok, here's a new one...
> 
> regards,
> chris
> 
> 
> 
> 2004-12-17  Christian Groessler  <chris@groessler.org>
> 
> 	* libc/machine/z8k/memcmp.S: New file.
> 	* libc/machine/z8k/memcpy.S: Ditto.
> 	* libc/machine/z8k/memmove.S: Ditto.
> 	* libc/machine/z8k/memset.S: Ditto.
> 	* libc/machine/z8k/Makefile.am: Add new files.
> 	* libc/machine/z8k/Makefile.in: Regenerated.
> 	* libc/machine/z8k/setjmp.S: Fix indirect register usage in Z8002
> 	part.  Implement Z8002 stdcall version.
> 
> 
> 
> diff -rbuN newlib-cvs-orig/src/newlib/libc/machine/z8k/Makefile.am newlib-cvs/src/newlib/libc/machine/z8k/Makefile.am
> --- newlib-cvs-orig/src/newlib/libc/machine/z8k/Makefile.am	2004-12-17 20:34:29.000000000 +0100
> +++ newlib-cvs/src/newlib/libc/machine/z8k/Makefile.am	2004-05-22 22:52:01.000000000 +0200
> @@ -6,7 +6,7 @@
>  
>  noinst_LIBRARIES = lib.a
>  
> -lib_a_SOURCES = setjmp.S
> +lib_a_SOURCES = setjmp.S memset.S memcpy.S memmove.S memcmp.S
>  
>  ACLOCAL_AMFLAGS = -I ../../..
>  CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
> diff -rbuN newlib-cvs-orig/src/newlib/libc/machine/z8k/Makefile.in newlib-cvs/src/newlib/libc/machine/z8k/Makefile.in
> --- newlib-cvs-orig/src/newlib/libc/machine/z8k/Makefile.in	2004-12-17 20:34:29.000000000 +0100
> +++ newlib-cvs/src/newlib/libc/machine/z8k/Makefile.in	2004-05-22 22:52:01.000000000 +0200
> @@ -89,7 +89,7 @@
>  
>  noinst_LIBRARIES = lib.a
>  
> -lib_a_SOURCES = setjmp.S
> +lib_a_SOURCES = setjmp.S memset.S memcpy.S memmove.S memcmp.S
>  
>  ACLOCAL_AMFLAGS = -I ../../..
>  CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
> @@ -103,7 +103,7 @@
>  CPPFLAGS = @CPPFLAGS@
>  LIBS = @LIBS@
>  lib_a_LIBADD = 
> -lib_a_OBJECTS =  setjmp.o
> +lib_a_OBJECTS =  setjmp.o memset.o memcpy.o memmove.o memcmp.o
>  CFLAGS = @CFLAGS@
>  COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
>  CCLD = $(CC)
> diff -rbuN newlib-cvs-orig/src/newlib/libc/machine/z8k/memcmp.S newlib-cvs/src/newlib/libc/machine/z8k/memcmp.S
> --- newlib-cvs-orig/src/newlib/libc/machine/z8k/memcmp.S	1970-01-01 01:00:00.000000000 +0100
> +++ newlib-cvs/src/newlib/libc/machine/z8k/memcmp.S	2004-12-17 20:47:12.000000000 +0100
> @@ -0,0 +1,185 @@
> +/*
> + * memcmp routine for Z8000
> + * Copyright (C) 2004 Christian Groessler <chris@groessler.org>
> + *
> + * Permission to use, copy, modify, and distribute this file
> + * for any purpose is hereby granted without fee, provided that
> + * the above copyright notice and this notice appears in all
> + * copies.
> + *
> + * This file is distributed WITHOUT ANY WARRANTY; without even the implied
> + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> + */
> +
> +/* int memcmp(const void *b1, const void *b2, size_t length);
> + */
> +
> +	name	"memcmp.S"
> +
> +	.text
> +	even
> +global	_memcmp
> +
> +_memcmp:
> +
> +#ifdef __Z8001__
> +	segm
> +
> +#ifdef __STD_CALL__
> +	ldl	rr6,rr14(#4)
> +	ldl	rr4,rr14(#8)
> +	ldl	rr2,rr14(#12)
> +#endif
> +
> +/* rr2  - length	(high word ignored)
> + * rr4  - b2
> + * rr6  - b1
> + */
> +
> +	clr	r1		/* initialize return value */
> +	testl	rr2
> +	jr	z,finish
> +
> +	bitb	rl7,#0		/* odd b1? */
> +	jr	nz,testb2
> +	bitb	rl5,#0		/* odd b2? */
> +	jr	nz,odd_cmp	/* b1 even, b2 odd */
> +	jr	t,even_cmp
> +
> +testb2:
> +	bitb	rl5,#0
> +	jr	z,odd_cmp	/* b2 even, b1 odd */
> +
> +	cpsib	@rr6,@rr4,r3,eq
> +	jr	z,beq		/* bytes are the same */
> +	jr	t,byte_diff
> +
> +beq:	jr	ov,finish	/* jump if r3 is zero now */
> +
> +/* compare words */
> +even_cmp:
> +	ld	r2,r3		/* remember length */
> +	srl	r3,#1
> +	jr	z,no_words
> +
> +	cpsir	@rr6,@rr4,r3,ne
> +	jr	nz,no_words
> +
> +	dec	r7,#2
> +	dec	r5,#2		/* point to different bytes */
> +	ldk	r3,#2
> +	jr	t,odd_cmp
> +
> +no_words:
> +	bitb	rl2,#0		/* odd length? */
> +	jr	z,finish
> +
> +	cpsib	@rr6,@rr4,r3,eq
> +	jr	z,finish	/* last bytes are the same */
> +	jr	t,byte_diff
> +
> +/* compare bytes */
> +odd_cmp:
> +	cpsirb	@rr6,@rr4,r3,ne
> +	jr	nz,finish
> +
> +byte_diff:
> +	dec	r7,#1
> +	dec	r5,#1		/* point to different bytes */
> +
> +	ldb	rl1,@rr6
> +	clr	r0
> +	ldb	rl0,@rr4
> +	sub	r1,r0
> +
> +finish:				/* set return value */
> +#ifdef __STD_CALL__
> +	ld	r7,r1
> +#else
> +	ld	r2,r1
> +#endif
> +
> +
> +#else		/* above Z8001, below Z8002 */
> +
> +
> +	unsegm
> +
> +#ifdef __STD_CALL__
> +	ld	r7,r15(#2)
> +	ld	r6,r15(#4)
> +	ld	r5,r15(#6)
> +#endif
> +
> +/* r5  - length
> + * r6  - b2
> + * r7  - b1
> + */
> +
> +	clr	r1		/* initialize return value */
> +	test	r5
> +	jr	z,finish
> +
> +	bitb	rl7,#0		/* odd destination address? */
> +	jr	nz,testb2
> +	bitb	rl6,#0		/* odd source address? */
> +	jr	nz,odd_cmp	/* b1 even, b2 odd */
> +	jr	t,even_cmp
> +
> +testb2:
> +	bitb	rl6,#0
> +	jr	z,odd_cmp	/* b2 even, b1 odd */
> +
> +	cpsib	@r7,@r6,r5,eq
> +	jr	z,beq		/* bytes are the same */
> +	jr	t,byte_diff
> +
> +beq:	jr	ov,finish	/* jump if r3 is zero now */
> +
> +/* compare words */
> +even_cmp:
> +	ld	r4,r5		/* remember length */
> +	srl	r5,#1
> +	jr	z,no_words
> +
> +	cpsir	@r7,@r6,r5,ne
> +	jr	nz,no_words
> +
> +	dec	r7,#2
> +	dec	r6,#2		/* point to different bytes */
> +	ldk	r5,#2
> +	jr	t,odd_cmp
> +
> +no_words:
> +	bitb	rl4,#0		/* odd length? */
> +	jr	z,finish
> +
> +	cpsib	@r7,@r6,r4,eq
> +	jr	z,finish	/* last bytes are the same */
> +	jr	t,byte_diff
> +
> +/* compare bytes */
> +odd_cmp:
> +	cpsirb	@r7,@r6,r5,ne
> +	jr	nz,finish
> +
> +byte_diff:
> +	dec	r7,#1
> +	dec	r6,#1		/* point to different bytes */
> +
> +	ldb	rl1,@r7
> +	clr	r0
> +	ldb	rl0,@r6
> +	sub	r1,r0
> +
> +finish:
> +#ifdef __STD_CALL__
> +	ld	r7,r1
> +#else
> +	ld	r2,r1
> +#endif
> +
> +#endif	/* Z8002 */
> +
> +	ret
> +	.end
> diff -rbuN newlib-cvs-orig/src/newlib/libc/machine/z8k/memcpy.S newlib-cvs/src/newlib/libc/machine/z8k/memcpy.S
> --- newlib-cvs-orig/src/newlib/libc/machine/z8k/memcpy.S	1970-01-01 01:00:00.000000000 +0100
> +++ newlib-cvs/src/newlib/libc/machine/z8k/memcpy.S	2004-12-17 20:47:08.000000000 +0100
> @@ -0,0 +1,145 @@
> +/*
> + * memcpy routine for Z8000
> + * Copyright (C) 2004 Christian Groessler <chris@groessler.org>
> + *
> + * Permission to use, copy, modify, and distribute this file
> + * for any purpose is hereby granted without fee, provided that
> + * the above copyright notice and this notice appears in all
> + * copies.
> + *
> + * This file is distributed WITHOUT ANY WARRANTY; without even the implied
> + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> + */
> +
> +/* void *memcpy(void *dest, const void *src, size_t length);
> + */
> +
> +	name	"memcpy.S"
> +
> +	.text
> +	even
> +global	_memcpy
> +global	memmove_entry
> +
> +_memcpy:
> +
> +#ifdef __Z8001__
> +	segm
> +
> +#ifdef __STD_CALL__
> +	ldl	rr6,rr14(#4)
> +	ldl	rr4,rr14(#8)
> +	ldl	rr2,rr14(#12)
> +#else
> +	pushl	@rr14,rr6
> +#endif
> +
> +/* rr2  - length	(high word ignored)
> + * rr4  - src
> + * rr6  - dest
> + */
> +
> +	testl	rr2
> +	jr	z,finish
> +
> +memmove_entry:		/* external entry point from memmove */
> +
> +	bitb	rl7,#0		/* odd destination address? */
> +	jr	nz,testsrc
> +	bitb	rl5,#0		/* odd source address? */
> +	jr	nz,odd_copy
> +	jr	t,even_copy	/* dest even, src odd */
> +
> +testsrc:
> +	bitb	rl5,#0
> +	jr	z,odd_copy	/* src even, dest odd */
> +	ldib	@rr6,@rr4,r3
> +	jr	ov,finish	/* jump if r3 is zero now */
> +
> +/* copy words */
> +even_copy:
> +	ld	r2,r3		/* remember length */
> +	srl	r3,#1
> +	jr	z,no_words
> +
> +	ldir	@rr6,@rr4,r3
> +
> +no_words:
> +	bitb	rl2,#0		/* odd length? */
> +	jr	z,finish
> +	ldib	@rr6,@rr4,r2	/* yes, copy last byte */
> +	jr	finish
> +
> +/* copy bytes */
> +odd_copy:
> +	ldirb	@rr6,@rr4,r3
> +
> +finish:
> +#ifdef __STD_CALL__
> +	ldl	rr6,rr14(#4)
> +#else
> +	popl	rr2,@rr14
> +#endif
> +
> +
> +#else		/* above Z8001, below Z8002 */
> +
> +
> +	unsegm
> +
> +#ifdef __STD_CALL__
> +	ld	r7,r15(#2)
> +	ld	r6,r15(#4)
> +	ld	r5,r15(#6)
> +#else
> +	ld	r2,r7		/* buffer pointer return value */
> +#endif
> +
> +/* r5  - length
> + * r6  - src
> + * r7  - dest
> + */
> +	test	r5
> +	jr	z,finish
> +
> +memmove_entry:		/* external entry point from memmove */
> +
> +	bitb	rl7,#0		/* odd destination address? */
> +	jr	nz,testsrc
> +	bitb	rl6,#0		/* odd source address? */
> +	jr	nz,odd_copy
> +	jr	t,even_copy	/* dest even, src odd */
> +
> +testsrc:
> +	bitb	rl6,#0
> +	jr	z,odd_copy	/* src even, dest odd */
> +	ldib	@r7,@r6,r5
> +	jr	ov,finish	/* jump if r5 is zero now */
> +
> +/* copy words */
> +even_copy:
> +	ld	r4,r5		/* remember length */
> +	srl	r5,#1
> +	jr	z,no_words
> +
> +	ldir	@r7,@r6,r5
> +
> +no_words:
> +	bitb	rl4,#0		/* odd length? */
> +	jr	z,finish
> +	ldib	@r7,@r6,r4	/* yes, copy last byte */
> +	jr	finish
> +
> +/* copy bytes */
> +odd_copy:
> +	ldirb	@r7,@r6,r5
> +
> +finish:
> +#ifdef __STD_CALL__
> +	ld	r7,r15(#2)
> +#endif
> +
> +#endif	/* Z8002 */
> +
> +	ret
> +	.end
> diff -rbuN newlib-cvs-orig/src/newlib/libc/machine/z8k/memmove.S newlib-cvs/src/newlib/libc/machine/z8k/memmove.S
> --- newlib-cvs-orig/src/newlib/libc/machine/z8k/memmove.S	1970-01-01 01:00:00.000000000 +0100
> +++ newlib-cvs/src/newlib/libc/machine/z8k/memmove.S	2004-12-17 20:47:20.000000000 +0100
> @@ -0,0 +1,180 @@
> +/*
> + * memmove routine for Z8000
> + * Copyright (C) 2004 Christian Groessler <chris@groessler.org>
> + *
> + * Permission to use, copy, modify, and distribute this file
> + * for any purpose is hereby granted without fee, provided that
> + * the above copyright notice and this notice appears in all
> + * copies.
> + *
> + * This file is distributed WITHOUT ANY WARRANTY; without even the implied
> + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> + */
> +
> +/* void *memmove(void *dest, const void *src, size_t length);
> + */
> +
> +	name	"memmove.S"
> +
> +	.text
> +	even
> +global	_memmove
> +
> +_memmove:
> +
> +#ifdef __Z8001__
> +	segm
> +
> +#ifdef __STD_CALL__
> +	ldl	rr6,rr14(#4)
> +	ldl	rr4,rr14(#8)
> +	ldl	rr2,rr14(#12)
> +#else
> +	pushl	@rr14,rr6
> +#endif
> +
> +/* rr2  - length	(high word ignored)
> + * rr4  - src
> + * rr6  - dest
> + */
> +
> +	testl	rr2
> +	jr	z,finish
> +
> +/*  check for destructive overlap (src < dest && dest < src + length) */
> +
> +	cpl	rr6,rr4
> +	jp	ule,memmove_entry	/* non-destructive, let memcpy do the work */
> +	ldl	rr0,rr2
> +	addl	rr0,rr4			/* rr0 = src + length */
> +	cpl	rr0,rr6
> +	jp	ult,memmove_entry	/* non-destructive, let memcpy do the work */
> +
> +/* set-up pointers to copy backwards, add (length - 1) */
> +	addl	rr4,rr2			/* src + length */
> +	addl	rr6,rr2			/* dest + length */
> +	subl	rr4,#1
> +	subl	rr6,#1
> +
> +/* check alignment */
> +	bitb	rl7,#0		/* odd destination address? */
> +	jr	z,testsrc
> +	bitb	rl5,#0		/* odd source address? */
> +	jr	z,odd_copy
> +	jr	even_copy
> +
> +testsrc:
> +	bitb	rl5,#0
> +	jr	nz,odd_copy	/* src even, dest odd */
> +	lddb	@rr6,@rr4,r3
> +	jr	ov,finish	/* jump if r5 is zero now */
> +
> +/* copy words */
> +even_copy:
> +	ld	r2,r3			/* remember length */
> +	srl	r3,#1
> +/*	jr	z,no_words	   it cannot be zero here */
> +
> +	dec	r5,#1
> +	dec	r7,#1
> +	lddr	@rr6,@rr4,r3
> +
> +no_words:
> +	bitb	rl2,#0		/* odd length? */
> +	jr	z,finish
> +	inc	r5,#1
> +	inc	r7,#1
> +	lddb	@rr6,@rr4,r2	/* yes, copy last byte */
> +	jr	finish
> +
> +/* copy bytes */
> +odd_copy:
> +	lddrb	@rr6,@rr4,r3
> +
> +finish:
> +#ifdef __STD_CALL__
> +	ldl	rr6,rr14(#4)
> +#else
> +	popl	rr2,@rr14
> +#endif
> +
> +
> +#else		/* above Z8001, below Z8002 */
> +
> +
> +	unsegm
> +
> +#ifdef __STD_CALL__
> +	ld	r7,r15(#2)
> +	ld	r6,r15(#4)
> +	ld	r5,r15(#6)
> +#else
> +	ld	r2,r7		/* buffer pointer return value */
> +#endif
> +
> +/* r5  - length
> + * r6  - src
> + * r7  - dest
> + */
> +	test	r5
> +	jr	z,finish
> +
> +/*  check for destructive overlap (src < dest && dest < src + length) */
> +
> +	cp	r7,r6
> +	jp	ule,memmove_entry	/* non-destructive, let memcpy do the work */
> +	ld	r0,r5
> +	add	r0,r6			/* r0 = src + length */
> +	cp	r0,r7
> +	jp	ult,memmove_entry	/* non-destructive, let memcpy do the work */
> +
> +/* set-up pointers to copy backwards, add (length - 1) */
> +	add	r6,r5			/* src + length */
> +	add	r7,r5			/* dest + length */
> +	dec	r6,#1
> +	dec	r7,#1
> +
> +/* check alignment */
> +	bitb	rl7,#0		/* odd destination address? */
> +	jr	z,testsrc
> +	bitb	rl6,#0		/* odd source address? */
> +	jr	z,odd_copy
> +	jr	even_copy
> +
> +testsrc:
> +	bitb	rl6,#0
> +	jr	nz,odd_copy	/* src even, dest odd */
> +	lddb	@r7,@r6,r5
> +	jr	ov,finish	/* jump if r5 is zero now */
> +
> +/* copy words */
> +even_copy:
> +	ld	r4,r5		/* remember length */
> +	srl	r5,#1
> +/*	jr	z,no_words	   it cannot be zero here */
> +
> +	dec	r6,#1
> +	dec	r7,#1
> +	lddr	@r7,@r6,r5
> +
> +no_words:
> +	bitb	rl4,#0		/* odd length? */
> +	jr	z,finish
> +	inc	r6,#1
> +	inc	r7,#1
> +	lddb	@r7,@r6,r4	/* yes, copy last byte */
> +	jr	finish
> +
> +/* copy bytes */
> +odd_copy:
> +	lddrb	@r7,@r6,r5
> +
> +finish:
> +#ifdef __STD_CALL__
> +	ld	r7,r15(#2)
> +#endif
> +
> +#endif	/* Z8002 */
> +
> +	ret
> +	.end
> diff -rbuN newlib-cvs-orig/src/newlib/libc/machine/z8k/memset.S newlib-cvs/src/newlib/libc/machine/z8k/memset.S
> --- newlib-cvs-orig/src/newlib/libc/machine/z8k/memset.S	1970-01-01 01:00:00.000000000 +0100
> +++ newlib-cvs/src/newlib/libc/machine/z8k/memset.S	2004-12-17 20:47:17.000000000 +0100
> @@ -0,0 +1,135 @@
> +/*
> + * memset routine for Z8000
> + * Copyright (C) 2004 Christian Groessler <chris@groessler.org>
> + *
> + * Permission to use, copy, modify, and distribute this file
> + * for any purpose is hereby granted without fee, provided that
> + * the above copyright notice and this notice appears in all
> + * copies.
> + *
> + * This file is distributed WITHOUT ANY WARRANTY; without even the implied
> + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> + */
> +
> +/* void *memset(void *buffer, int value, size_t length);
> + */
> +
> +	name	"memset.S"
> +
> +	.text
> +	even
> +global	_memset
> +
> +_memset:
> +
> +#ifdef __Z8001__
> +	segm
> +
> +#ifdef __STD_CALL__
> +	ldl	rr6,rr14(#4)
> +	ld	r5,rr14(#8)
> +	ldl	rr2,rr14(#10)
> +#else
> +	pushl	@rr14,rr6
> +#endif
> +
> +/* rr2  - length
> + * rl5  - value
> + * rr6  - buffer
> + */
> +	testl	rr2
> +	jr	z,finish
> +
> +	ldb	rh5,rl5
> +	ld	r1,r5		/* r1 contains value */
> +	bit	r7,#0
> +	jr	z,not_odd
> +
> +	ldb	@rr6,rl1
> +	inc	r7,#1
> +	subl	rr2,#1
> +	jr	z,finish
> +
> +not_odd:ld	r0,r3		/* remember length */
> +	srl	r3,#1
> +	jr	z,no_words
> +
> +	ldl	rr4,rr6
> +	ld	@rr6,r1
> +	inc	r7,#2
> +	dec	r3,#1
> +	jr	z,no_words
> +
> +	ldir	@rr6,@rr4,r3	/* fill words */
> +
> +no_words:
> +	bit	r0,#0		/* one byte remaining? */
> +	jr	z,finish
> +
> +	ldb	@rr6,rl1
> +
> +finish:
> +#ifdef __STD_CALL__
> +	ldl	rr6,rr14(#4)
> +#else
> +	popl	rr2,@rr14
> +#endif
> +
> +
> +#else		/* above Z8001, below Z8002 */
> +
> +
> +	unsegm
> +
> +#ifdef __STD_CALL__
> +	ld	r7,r15(#2)
> +	ld	r6,r15(#4)
> +	ld	r5,r15(#6)
> +#else
> +	ld	r2,r7		/* buffer pointer return value */
> +#endif
> +
> +/* r5  - length
> + * r6  - value
> + * r7  - buffer
> + */
> +	test	r5
> +	jr	z,finish
> +
> +	ldb	rh6,rl6
> +	ld	r1,r6		/* r1 contains value */
> +	bit	r7,#0
> +	jr	z,not_odd
> +
> +	ldb	@r7,rl1
> +	inc	r7,#1
> +	dec	r5,#1
> +	jr	z,finish
> +
> +not_odd:ld	r0,r5		/* remember length */
> +	srl	r5,#1
> +	jr	z,no_words
> +
> +	ld	r4,r7
> +	ld	@r7,r1
> +	inc	r7,#2
> +	dec	r5,#1
> +	jr	z,no_words
> +
> +	ldir	@r7,@r4,r5	/* fill words */
> +
> +no_words:
> +	bit	r0,#0		/* one byte remaining? */
> +	jr	z,finish
> +
> +	ldb	@r7,rl1
> +
> +finish:
> +#ifdef __STD_CALL__
> +	ld	r7,r15(#2)
> +#endif
> +
> +#endif	/* Z8002 */
> +
> +	ret
> +	.end
> diff -rbuN newlib-cvs-orig/src/newlib/libc/machine/z8k/setjmp.S newlib-cvs/src/newlib/libc/machine/z8k/setjmp.S
> --- newlib-cvs-orig/src/newlib/libc/machine/z8k/setjmp.S	2004-12-17 20:34:29.000000000 +0100
> +++ newlib-cvs/src/newlib/libc/machine/z8k/setjmp.S	2004-05-22 22:52:01.000000000 +0200
> @@ -1,10 +1,9 @@
> +	.global	_setjmp
> +	.global	_longjmp
>  
>  #ifdef __Z8001__
>  	segm
>  
> -	.global	_setjmp
> -	.globl	_longjmp
> -
>  #ifdef __STD_CALL__
>  
>  _setjmp:
> @@ -56,10 +55,31 @@
>  	unseg
>  
>  #ifdef __STD_CALL__
> -#warning Z8002 std call not implemented!
> -#endif
>  
> -	.global	_setjmp
> +_setjmp:
> +	ld	r7,r15(#2)	! get argument
> +	ld	r2,@r15		! fetch pc
> +	ld	@r7,r2		! save it
> +	ldl	r7(#14),rr8
> +	ldl	r7(#2),rr10
> +	ldl	r7(#6),rr12	! remember frame pointer
> +	ldl	r7(#10),rr14	! remember stack pointer
> +	ldk	r7,#0
> +	ret	t
> +
> +_longjmp:
> +	ld	r4,r15(#2)	! get first argument (jmp_buf)
> +	ld	r7,r15(#4)	! get return value
> +	ldl	rr8,r4(#14)
> +	ldl	rr10,r4(#2)
> +	ldl	rr12,r4(#6)	! restore old frame pointer
> +	ldl	rr14,r4(#10)	! restore old stack pointer
> +	ld	r4,@r4		! return address
> +	inc	r15,#2
> +	jp	@r4
> +
> +#else /* above __STD_CALL_, below not */
> +
>  _setjmp:
>  	ld	r2,@r15	! fetch pc
>  	ld	@r7,r2	! save it
> @@ -69,14 +89,14 @@
>  	ldk	r2,#0
>  	ret	t
>  	
> -	.globl	_longjmp
> -
>  _longjmp:
>  	ld	r2,r6		! get return value
>  	ld	r4,@r7
> -	ldl	rr10,rr7(4)
> -	ldl	rr12,rr7(8)
> -	ldl	rr14,rr7(12)
> -	jp	@rr4
> +	ldl	rr10,r7(4)
> +	ldl	rr12,r7(8)
> +	ldl	rr14,r7(12)
> +	inc	r15,#2
> +	jp	@r4
>  	
> +#endif  /* not __STD_CALL__ */
>  #endif  /* Z8002 version */
> 



More information about the Newlib mailing list