From: <dan...@us...> - 2009-06-21 09:41:16
|
Revision: 1342 http://cegcc.svn.sourceforge.net/cegcc/?rev=1342&view=rev Author: dannybackx Date: 2009-06-21 09:40:21 +0000 (Sun, 21 Jun 2009) Log Message: ----------- Add new files to support setjmp and longjmp on x86, CE doesn't provide them. This stuff is copied from newlib. Modified Paths: -------------- trunk/cegcc/src/mingw/ChangeLog.mingw32ce trunk/cegcc/src/mingw/include/setjmp.h Added Paths: ----------- trunk/cegcc/src/mingw/mingwex/wince/i386/ trunk/cegcc/src/mingw/mingwex/wince/i386/i386mach.h trunk/cegcc/src/mingw/mingwex/wince/i386/setjmp.S Modified: trunk/cegcc/src/mingw/ChangeLog.mingw32ce =================================================================== --- trunk/cegcc/src/mingw/ChangeLog.mingw32ce 2009-06-17 19:30:45 UTC (rev 1341) +++ trunk/cegcc/src/mingw/ChangeLog.mingw32ce 2009-06-21 09:40:21 UTC (rev 1342) @@ -1,3 +1,10 @@ +2009-06-21 Danny Backx <dan...@us...> + + * mingwex/wince/i386/setjmp.S,i386mach.h : New files, implement setjmp + and longjmp on i386 because the CE support is absent. + * include/setjmp.h (_JBLEN) : Set the right size for jmp_buf. + * mingwex/Makefile.in : Build the new sources on i386 only. + 2009-05-20 Vincent Richomme <fo...@sm...> * Makefile.in : replace COREDLL by coredll.dll in definition of Modified: trunk/cegcc/src/mingw/include/setjmp.h =================================================================== --- trunk/cegcc/src/mingw/include/setjmp.h 2009-06-17 19:30:45 UTC (rev 1341) +++ trunk/cegcc/src/mingw/include/setjmp.h 2009-06-21 09:40:21 UTC (rev 1342) @@ -29,7 +29,13 @@ * contents could be different on an Alpha or something else. */ #if defined (__i386__) +#if defined(__MINGW32CE__) + /* Definition for the assembler setjmp/longjmp copied from newlib into mingwex */ +# define _JBLEN 20 +#else + /* Native (?) windows ce longjmp */ # define _JBLEN 16 +#endif #elif defined (__arm__) # define _JBLEN 11 #endif Added: trunk/cegcc/src/mingw/mingwex/wince/i386/i386mach.h =================================================================== --- trunk/cegcc/src/mingw/mingwex/wince/i386/i386mach.h (rev 0) +++ trunk/cegcc/src/mingw/mingwex/wince/i386/i386mach.h 2009-06-21 09:40:21 UTC (rev 1342) @@ -0,0 +1,83 @@ +/* This file was based on the modified setjmp.S performed by + * Joel Sherill (jo...@OA...) which specified the use + * of the __USER_LABEL_PREFIX__ and __REGISTER_PREFIX__ macros. + ** + ** This file is distributed WITHOUT ANY WARRANTY; without even the implied + ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* These are predefined by new versions of GNU cpp. */ + +#ifndef __USER_LABEL_PREFIX__ +#define __USER_LABEL_PREFIX__ _ +#endif + +#define __REG_PREFIX__ % + +/* ANSI concatenation macros. */ + +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a##b + +/* Use the right prefix for global labels. */ + +#define SYM(x) CONCAT1(__USER_LABEL_PREFIX__, x) + +/* Use the right prefix for registers. */ + +#define REG(x) CONCAT1(__REG_PREFIX__, x) + +#define eax REG(eax) +#define ebx REG(ebx) +#define ecx REG(ecx) +#define edx REG(edx) +#define esi REG(esi) +#define edi REG(edi) +#define ebp REG(ebp) +#define esp REG(esp) + +#define st0 REG(st) +#define st1 REG(st(1)) +#define st2 REG(st(2)) +#define st3 REG(st(3)) +#define st4 REG(st(4)) +#define st5 REG(st(5)) +#define st6 REG(st(6)) +#define st7 REG(st(7)) + +#define ax REG(ax) +#define bx REG(bx) +#define cx REG(cx) +#define dx REG(dx) + +#define ah REG(ah) +#define bh REG(bh) +#define ch REG(ch) +#define dh REG(dh) + +#define al REG(al) +#define bl REG(bl) +#define cl REG(cl) +#define dl REG(dl) + +#define mm1 REG(mm1) +#define mm2 REG(mm2) +#define mm3 REG(mm3) +#define mm4 REG(mm4) +#define mm5 REG(mm5) +#define mm6 REG(mm6) +#define mm7 REG(mm7) + +#ifdef _I386MACH_NEED_SOTYPE_FUNCTION +#define SOTYPE_FUNCTION(sym) .type SYM(sym),@function +#else +#define SOTYPE_FUNCTION(sym) +#endif + +#ifdef _I386MACH_ALLOW_HW_INTERRUPTS +#define __CLI +#define __STI +#else +#define __CLI cli +#define __STI sti +#endif Property changes on: trunk/cegcc/src/mingw/mingwex/wince/i386/i386mach.h ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/cegcc/src/mingw/mingwex/wince/i386/setjmp.S =================================================================== --- trunk/cegcc/src/mingw/mingwex/wince/i386/setjmp.S (rev 0) +++ trunk/cegcc/src/mingw/mingwex/wince/i386/setjmp.S 2009-06-21 09:40:21 UTC (rev 1342) @@ -0,0 +1,87 @@ +/* This is file is a merger of SETJMP.S and LONGJMP.S */ +/* + * This file was modified to use the __USER_LABEL_PREFIX__ and + * __REGISTER_PREFIX__ macros defined by later versions of GNU cpp by + * Joel Sherrill (jo...@OA...) + * Slight change: now includes i386mach.h for this (Werner Almesberger) + * + * Copyright (C) 1991 DJ Delorie + * All rights reserved. + * + * Redistribution and use in source and binary forms is permitted + * provided that the above copyright notice and following paragraph are + * duplicated in all such forms. + * + * This file is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + + /* + ** jmp_buf: + ** eax ebx ecx edx esi edi ebp esp eip + ** 0 4 8 12 16 20 24 28 32 + */ + + #include "i386mach.h" + + .global SYM (setjmp) + .global SYM (longjmp) + SOTYPE_FUNCTION(setjmp) + SOTYPE_FUNCTION(longjmp) + +SYM (setjmp): + + pushl ebp + movl esp,ebp + + pushl edi + movl 8 (ebp),edi + + movl eax,0 (edi) + movl ebx,4 (edi) + movl ecx,8 (edi) + movl edx,12 (edi) + movl esi,16 (edi) + + movl -4 (ebp),eax + movl eax,20 (edi) + + movl 0 (ebp),eax + movl eax,24 (edi) + + movl esp,eax + addl $12,eax + movl eax,28 (edi) + + movl 4 (ebp),eax + movl eax,32 (edi) + + popl edi + movl $0,eax + leave + ret + +SYM (longjmp): + pushl ebp + movl esp,ebp + + movl 8(ebp),edi /* get jmp_buf */ + movl 12(ebp),eax /* store retval in j->eax */ + movl eax,0(edi) + + movl 24(edi),ebp + + __CLI + movl 28(edi),esp + + pushl 32(edi) + + movl 0(edi),eax + movl 4(edi),ebx + movl 8(edi),ecx + movl 12(edi),edx + movl 16(edi),esi + movl 20(edi),edi + __STI + + ret This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |