Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcvs2svn <>2012-10-20 19:31:51 +0400
committercvs2svn <>2012-10-20 19:31:51 +0400
commit899ce99cebcb67deca7f9b2a4f1e750a2263881e (patch)
tree49ee41a55b15ab82f82305e4849859c4a2d1cc54 /newlib/libc/machine/rl78/setjmp.S
parentc0956742a74d194b9c18c7a91aa6d6010beb4cd3 (diff)
This commit was manufactured by cvs2svn to create tag 'cygwin-cygwin-1_7_17-release
1_7_17-release'. Sprout from cygwin-64bit-branch 2012-08-10 09:37:33 UTC cvs2svn 'This commit was manufactured by cvs2svn to create branch 'cygwin-64bit-' Cherrypick from cygwin-64bit-branch 2012-10-09 12:05:52 UTC cvs2svn 'This commit was manufactured by cvs2svn to create branch 'cygwin-64bit-': newlib/libc/posix/wordexp2.h Cherrypick from master 2012-10-20 15:31:50 UTC Corinna Vinschen <corinna@vinschen.de> ' * new-features.sgml (ov-new1.7.17): Add section.': ChangeLog Makefile.def Makefile.in Makefile.tpl compile config.guess config.sub config/ChangeLog config/cloog.m4 config/isl.m4 config/mt-sde configure include/ChangeLog include/demangle.h include/dis-asm.h include/dwarf2.def include/elf/ChangeLog include/elf/aarch64.h include/elf/arm.h include/elf/common.h include/elf/tilegx.h include/mach-o/ChangeLog include/mach-o/codesign.h include/mach-o/external.h include/mach-o/loader.h include/mach-o/reloc.h include/mach-o/x86-64.h include/objalloc.h include/opcode/ChangeLog include/opcode/aarch64.h include/opcode/arm.h include/opcode/hppa.h include/opcode/ia64.h include/opcode/mips.h include/opcode/moxie.h include/opcode/s390.h include/opcode/sparc.h include/plugin-api.h libtool.m4 ltoptions.m4 ltversion.m4 lt~obsolete.m4 newlib/ChangeLog newlib/HOWTO newlib/README newlib/configure.host newlib/doc/makedoc.c newlib/libc/include/_ansi.h newlib/libc/include/assert.h newlib/libc/include/machine/_default_types.h newlib/libc/include/machine/ieeefp.h newlib/libc/include/machine/setjmp.h newlib/libc/include/machine/time.h newlib/libc/include/math.h newlib/libc/include/stdint.h newlib/libc/include/sys/config.h newlib/libc/include/sys/features.h newlib/libc/include/tgmath.h newlib/libc/machine/configure newlib/libc/machine/configure.in newlib/libc/machine/rl78/Makefile.am newlib/libc/machine/rl78/Makefile.in newlib/libc/machine/rl78/aclocal.m4 newlib/libc/machine/rl78/configure newlib/libc/machine/rl78/configure.in newlib/libc/machine/rl78/setjmp.S newlib/libc/posix/engine.c newlib/libc/posix/wordexp.c newlib/libc/posix/wordfree.c newlib/libc/search/hash_buf.c newlib/libc/stdio/fgets.c newlib/libc/stdio/flags.c newlib/libc/stdio/vfprintf.c newlib/libc/stdlib/btowc.c newlib/libc/stdlib/getopt.c newlib/libc/string/strcasestr.c newlib/libc/sys/sysnecv850/sbrk.c newlib/libc/time/strftime.c newlib/libm/machine/configure newlib/libm/machine/configure.in newlib/testsuite/newlib.stdio/stdio.exp newlib/testsuite/newlib.stdio/swprintf.c winsup/cygwin/ChangeLog winsup/cygwin/DevNotes winsup/cygwin/child_info.h winsup/cygwin/cygheap.cc winsup/cygwin/cygthread.cc winsup/cygwin/cygtls.cc winsup/cygwin/cygtls.h winsup/cygwin/cygwait.cc winsup/cygwin/cygwait.h winsup/cygwin/dll_init.cc winsup/cygwin/errno.cc winsup/cygwin/exceptions.cc winsup/cygwin/fhandler.cc winsup/cygwin/fhandler.h winsup/cygwin/fhandler_clipboard.cc winsup/cygwin/fhandler_console.cc winsup/cygwin/fhandler_floppy.cc winsup/cygwin/fhandler_process.cc winsup/cygwin/fhandler_raw.cc winsup/cygwin/fhandler_socket.cc winsup/cygwin/fhandler_tape.cc winsup/cygwin/fhandler_termios.cc winsup/cygwin/fhandler_tty.cc winsup/cygwin/flock.cc winsup/cygwin/gendef winsup/cygwin/glob.cc winsup/cygwin/globals.cc winsup/cygwin/gmon.c winsup/cygwin/hookapi.cc winsup/cygwin/include/cygwin/fs.h winsup/cygwin/include/cygwin/in.h winsup/cygwin/include/limits.h winsup/cygwin/miscfuncs.cc winsup/cygwin/mount.cc winsup/cygwin/mount.h winsup/cygwin/net.cc winsup/cygwin/path.cc winsup/cygwin/pinfo.cc winsup/cygwin/posix_ipc.cc winsup/cygwin/pseudo-reloc.cc winsup/cygwin/release/1.7.10 winsup/cygwin/release/1.7.11 winsup/cygwin/release/1.7.12 winsup/cygwin/release/1.7.13 winsup/cygwin/release/1.7.14 winsup/cygwin/release/1.7.15 winsup/cygwin/release/1.7.16 winsup/cygwin/release/1.7.17 winsup/cygwin/sec_helper.cc winsup/cygwin/signal.cc winsup/cygwin/sigproc.h winsup/cygwin/smallprint.cc winsup/cygwin/spawn.cc winsup/cygwin/syscalls.cc winsup/cygwin/thread.cc winsup/cygwin/thread.h winsup/cygwin/tty.h winsup/cygwin/wait.cc winsup/doc/ChangeLog winsup/doc/faq-what.xml winsup/doc/new-features.sgml winsup/utils/ChangeLog winsup/utils/Makefile.in winsup/utils/cygcheck.cc winsup/w32api/ChangeLog winsup/w32api/include/winbase.h winsup/w32api/lib/kernel32.def
Diffstat (limited to 'newlib/libc/machine/rl78/setjmp.S')
-rw-r--r--newlib/libc/machine/rl78/setjmp.S165
1 files changed, 165 insertions, 0 deletions
diff --git a/newlib/libc/machine/rl78/setjmp.S b/newlib/libc/machine/rl78/setjmp.S
new file mode 100644
index 000000000..ddc60218d
--- /dev/null
+++ b/newlib/libc/machine/rl78/setjmp.S
@@ -0,0 +1,165 @@
+/*
+
+Copyright (c) 2011 Red Hat Incorporated.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ The name of Red Hat Incorporated may not be used to endorse
+ or promote products derived from this software without specific
+ prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+; clobberable
+r8 = 0xffef0
+r9 = 0xffef1
+r10 = 0xffef2
+r11 = 0xffef3
+r12 = 0xffef4
+r13 = 0xffef5
+r14 = 0xffef6
+r15 = 0xffef7
+; preserved
+r16 = 0xffee8
+r17 = 0xffee9
+r18 = 0xffeea
+r19 = 0xffeeb
+r20 = 0xffeec
+r21 = 0xffeed
+r22 = 0xffeee
+r23 = 0xffeef
+
+/* The jump buffer has the following structure:
+ R0 .. R23 3*8 bytes
+ SP 2 bytes
+ ES 1 byte
+ CS 1 byte
+ PC 4 bytes
+*/
+
+ .macro _saveb ofs,reg
+ mov a,\reg
+ mov [hl+\ofs],a
+ .endm
+ .macro _save ofs,reg
+ movw ax,\reg
+ movw [hl+\ofs],ax
+ .endm
+
+ .global _setjmp
+ .type _setjmp, @function
+_setjmp:
+ ;; R8 = setjmp (jmp_buf *[sp+4].w)
+ ;; must return zero !!
+ push ax
+ push hl
+ push ax
+ movw ax, [sp+10]
+ movw hl, ax
+ pop ax
+ movw [hl], ax
+ _save 2, bc
+ _save 4, de
+ pop ax
+ movw [hl+6], ax
+ _save 8, r8
+ _save 10, r10
+ _save 12, r12
+ _save 14, r14
+ _save 16, r16
+ _save 18, r18
+ _save 20, r20
+ _save 22, r22
+
+ ;; The sp we have now includes one more pushed reg, plus $PC
+ movw ax, sp
+ addw ax, #6
+ movw [hl+24], ax
+
+ _saveb 26, es
+ _saveb 27, cs
+ _save 28, [sp+2]
+ _save 30, [sp+4]
+
+ clrw ax
+ movw r8, ax
+ pop ax
+ ret
+
+ .size _setjmp, . - _setjmp
+
+ .macro _loadb ofs,reg
+ mov a,[hl+\ofs]
+ mov \reg,a
+ .endm
+ .macro _load ofs,reg
+ movw ax,[hl+\ofs]
+ movw \reg,ax
+ .endm
+ .macro _push ofs
+ movw ax,[hl+\ofs]
+ push ax
+ .endm
+
+ .global _longjmp
+ .type _longjmp, @function
+_longjmp:
+ ;; noreturn longjmp (jmp_buf *[sp+4].w, int [sp+6].w)
+ movw ax, [sp+6]
+ cmpw ax,#0
+ sknz
+ onew ax
+ movw r8, ax
+
+ movw ax, [sp+4]
+ movw hl, ax
+ movw ax, [hl+24]
+ movw sp, ax ; this is the *new* stack
+
+ _push 30 ; high half of PC
+ _push 28 ; low half of PC
+ _push 6 ; HL
+ _push 0 ; AX
+
+ _load 2, bc
+ _load 4, de
+
+ _load 10, r10
+ _load 12, r12
+ _load 14, r14
+ _load 16, r16
+ _load 18, r18
+ _load 20, r20
+ _load 22, r22
+
+ _loadb 26, es
+ _loadb 27, cs
+
+ pop ax
+ pop hl
+
+
+ ret ; pops PC (4 bytes)
+
+ .size _longjmp, . - _longjmp
+