You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.4 KiB

/*
* jit-arch-x86.h - Architecture-specific definitions.
*
* Copyright (C) 2006 Southern Storm Software, Pty Ltd.
*
* The libjit library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 2.1 of
* the License, or (at your option) any later version.
*
* The libjit library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the libjit library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef _JIT_ARCH_X86_H
#define _JIT_ARCH_X86_H
/*
* If defined _JIT_ARCH_GET_CURRENT_FRAME() macro assigns the current frame
* pointer to the supplied argument that has to be a void pointer.
*/
#if defined(__GNUC__)
#define _JIT_ARCH_GET_CURRENT_FRAME(f) \
do { \
register void *__f asm("ebp"); \
f = __f; \
} while(0)
#elif defined(_MSC_VER) && defined(_M_IX86)
#define _JIT_ARCH_GET_CURRENT_FRAME(f) \
do { \
void *__ptr; \
__asm \
{ \
__asm mov dword ptr __ptr, ebp \
} \
(f) = __ptr; \
} while(0)
#else
#undef _JIT_ARCH_GET_CURRENT_FRAME
#endif
#endif /* _JIT_ARCH_X86_H */