ML64 compatibility fixes for amd64 assembly

svn path=/branches/cmake-bringup/; revision=50512
This commit is contained in:
Timo Kreuzer 2011-01-27 13:37:21 +00:00
parent 4814cb8ca6
commit 676e232576
21 changed files with 136 additions and 108 deletions

View file

@ -10,21 +10,25 @@
#include <asm.inc> #include <asm.inc>
/* CODE **********************************************************************/
.code64
PUBLIC MsgUnimplemented PUBLIC MsgUnimplemented
MsgUnimplemented: MsgUnimplemented:
.asciz "WARNING: %s at %s:%d is UNIMPLEMENTED!\n" .asciz "WARNING: %s at %s:%d is UNIMPLEMENTED!\n"
.proc _chkstk FUNC _chkstk
.endprolog
UNIMPLEMENTED chkstk UNIMPLEMENTED chkstk
ret ret
.endp ENDFUNC _chkstk
.proc _alloca_probe FUNC _alloca_probe
.endprolog
UNIMPLEMENTED alloca_probe UNIMPLEMENTED alloca_probe
ret ret
.endp ENDFUNC _alloca_probe
END END
/* EOF */ /* EOF */

View file

@ -17,42 +17,43 @@
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
.globl _global_unwind2 PUBLIC _global_unwind2
.globl _local_unwind2 PUBLIC _local_unwind2
.globl _abnormal_termination PUBLIC _abnormal_termination
.globl _except_handler2 PUBLIC _except_handler2
.globl _except_handler3 PUBLIC _except_handler3
/* FUNCTIONS *****************************************************************/ /* CODE **********************************************************************/
.code64
.func _unwind_handler FUNC _unwind_handler
_unwind_handler: .endprolog
ret ret
.endfunc ENDFUNC _unwind_handler
.func _global_unwind2 FUNC _global_unwind2
_global_unwind2: .endprolog
ret ret
.endfunc ENDFUNC _global_unwind2
.func _abnormal_termination FUNC _abnormal_termination
_abnormal_termination: .endprolog
ret ret
.endfunc ENDFUNC _abnormal_termination
.func _local_unwind2 FUNC _local_unwind2
_local_unwind2: .endprolog
ret ret
.endfunc ENDFUNC _local_unwind2
.func _except_handler2 FUNC _except_handler2
_except_handler2: .endprolog
ret ret
.endfunc ENDFUNC _except_handler2
.func _except_handler3 FUNC _except_handler3
_except_handler3: .endprolog
ret ret
.endfunc ENDFUNC _except_handler3
END END

View file

@ -10,18 +10,21 @@
#include <asm.inc> #include <asm.inc>
/* DATA *********************************************************************/ /* DATA **********************************************************************/
.code64
PUBLIC _fltused PUBLIC _fltused
_fltused: _fltused:
.long 0x9875 .long HEX(9875)
/* FUNCTIONS ****************************************************************/
/* CODE **********************************************************************/
.code64 .code64
.proc alldiv FUNC alldiv
.endprolog
UNIMPLEMENTED alldiv UNIMPLEMENTED alldiv
ret ret
.endp alldiv ENDFUNC alldiv
END

View file

@ -11,11 +11,12 @@
#include <asm.inc> #include <asm.inc>
#include <ksamd64.inc> #include <ksamd64.inc>
/* FUNCTIONS ****************************************************************/ /* CODE **********************************************************************/
.code64 .code64
PUBLIC atan PUBLIC atan
atan: atan:
UNIMPLEMENTED atan UNIMPLEMENTED atan
ret ret
END

View file

@ -11,11 +11,12 @@
#include <asm.inc> #include <asm.inc>
#include <ksamd64.inc> #include <ksamd64.inc>
/* FUNCTIONS ****************************************************************/ /* CODE **********************************************************************/
.code64 .code64
PUBLIC atan2 PUBLIC atan2
atan2: atan2:
UNIMPLEMENTED atan2 UNIMPLEMENTED atan2
ret ret
END

View file

@ -11,8 +11,7 @@
#include <asm.inc> #include <asm.inc>
#include <ksamd64.inc> #include <ksamd64.inc>
/* FUNCTIONS ****************************************************************/ /* CODE **********************************************************************/
.code64 .code64
PUBLIC ceil PUBLIC ceil
@ -20,3 +19,4 @@ ceil:
UNIMPLEMENTED ceil UNIMPLEMENTED ceil
ret ret
END

View file

@ -11,8 +11,7 @@
#include <asm.inc> #include <asm.inc>
#include <ksamd64.inc> #include <ksamd64.inc>
/* FUNCTIONS ****************************************************************/ /* CODE **********************************************************************/
.code64 .code64
PUBLIC ceilf PUBLIC ceilf

View file

@ -11,8 +11,7 @@
#include <asm.inc> #include <asm.inc>
#include <ksamd64.inc> #include <ksamd64.inc>
/* FUNCTIONS ****************************************************************/ /* CODE **********************************************************************/
.code64 .code64
PUBLIC exp PUBLIC exp

View file

@ -10,12 +10,12 @@
#include <asm.inc> #include <asm.inc>
/* FUNCTIONS ****************************************************************/ /* CODE **********************************************************************/
.code64 .code64
PUBLIC fabs PUBLIC _fabs
fabs: _fabs:
UNIMPLEMENTED fabs UNIMPLEMENTED fabs
ret ret
END

View file

@ -11,8 +11,7 @@
#include <asm.inc> #include <asm.inc>
#include <ksamd64.inc> #include <ksamd64.inc>
/* FUNCTIONS ****************************************************************/ /* CODE **********************************************************************/
.code64 .code64
PUBLIC floor PUBLIC floor

View file

@ -11,8 +11,7 @@
#include <asm.inc> #include <asm.inc>
#include <ksamd64.inc> #include <ksamd64.inc>
/* FUNCTIONS ****************************************************************/ /* CODE **********************************************************************/
.code64 .code64
PUBLIC floorf PUBLIC floorf

View file

@ -10,10 +10,11 @@
#include <asm.inc> #include <asm.inc>
/* DATA *********************************************************************/ /* CODE **********************************************************************/
.code64
PUBLIC fmod PUBLIC _fmod
fmod: _fmod:
UNIMPLEMENTED fmod UNIMPLEMENTED fmod
ret ret

View file

@ -10,7 +10,8 @@
#include <asm.inc> #include <asm.inc>
/* DATA *********************************************************************/ /* CODE **********************************************************************/
.code64
PUBLIC fmodf PUBLIC fmodf
fmodf: fmodf:

View file

@ -10,7 +10,8 @@
#include <asm.inc> #include <asm.inc>
/* DATA *********************************************************************/ /* CODE **********************************************************************/
.code64
PUBLIC ldexp PUBLIC ldexp
ldexp: ldexp:

View file

@ -10,9 +10,12 @@
#include <asm.inc> #include <asm.inc>
/* DATA *********************************************************************/ /* CODE **********************************************************************/
.code64
PUBLIC log PUBLIC log
log: log:
UNIMPLEMENTED log UNIMPLEMENTED log
ret ret
END

View file

@ -10,10 +10,12 @@
#include <asm.inc> #include <asm.inc>
/* DATA *********************************************************************/ /* CODE **********************************************************************/
.code64
PUBLIC log10 PUBLIC log10
log10: log10:
UNIMPLEMENTED log10 UNIMPLEMENTED log10
ret ret
END

View file

@ -11,10 +11,12 @@
#include <asm.inc> #include <asm.inc>
#include <ksamd64.inc> #include <ksamd64.inc>
/* DATA *********************************************************************/ /* CODE **********************************************************************/
.code64
PUBLIC pow PUBLIC pow
pow: pow:
UNIMPLEMENTED pow UNIMPLEMENTED pow
ret ret
END

View file

@ -11,7 +11,8 @@
#include <asm.inc> #include <asm.inc>
#include <ksamd64.inc> #include <ksamd64.inc>
/* DATA *********************************************************************/ /* CODE **********************************************************************/
.code64
PUBLIC sqrt PUBLIC sqrt
sqrt: sqrt:

View file

@ -11,7 +11,8 @@
#include <asm.inc> #include <asm.inc>
#include <ksamd64.inc> #include <ksamd64.inc>
/* DATA *********************************************************************/ /* CODE **********************************************************************/
.code64
PUBLIC sqrtf PUBLIC sqrtf
sqrtf: sqrtf:

View file

@ -11,7 +11,8 @@
#include <asm.inc> #include <asm.inc>
#include <ksamd64.inc> #include <ksamd64.inc>
/* DATA *********************************************************************/ /* CODE **********************************************************************/
.code64
PUBLIC tan PUBLIC tan
tan: tan:

View file

@ -11,41 +11,45 @@
#include <asm.inc> #include <asm.inc>
#include <ksamd64.inc> #include <ksamd64.inc>
#define JUMP_BUFFER_Frame 0x00 #define JUMP_BUFFER_Frame 0 /* 0x00 */
#define JUMP_BUFFER_Rbx 0x08 #define JUMP_BUFFER_Rbx 8 /* 0x08 */
#define JUMP_BUFFER_Rsp 0x10 #define JUMP_BUFFER_Rsp 16 /* 0x10 */
#define JUMP_BUFFER_Rbp 0x18 #define JUMP_BUFFER_Rbp 24 /* 0x18 */
#define JUMP_BUFFER_Rsi 0x20 #define JUMP_BUFFER_Rsi 32 /* 0x20 */
#define JUMP_BUFFER_Rdi 0x28 #define JUMP_BUFFER_Rdi 40 /* 0x28 */
#define JUMP_BUFFER_R12 0x30 #define JUMP_BUFFER_R12 48 /* 0x30 */
#define JUMP_BUFFER_R13 0x38 #define JUMP_BUFFER_R13 56 /* 0x38 */
#define JUMP_BUFFER_R14 0x40 #define JUMP_BUFFER_R14 64 /* 0x40 */
#define JUMP_BUFFER_R15 0x48 #define JUMP_BUFFER_R15 72 /* 0x48 */
#define JUMP_BUFFER_Rip 0x50 #define JUMP_BUFFER_Rip 80 /* 0x50 */
#define JUMP_BUFFER_Spare 0x58 #define JUMP_BUFFER_Spare 88 /* 0x58 */
#define JUMP_BUFFER_Xmm6 0x60 #define JUMP_BUFFER_Xmm6 96 /* 0x60 */
#define JUMP_BUFFER_Xmm7 0x70 #define JUMP_BUFFER_Xmm7 112 /* 0x70 */
#define JUMP_BUFFER_Xmm8 0x80 #define JUMP_BUFFER_Xmm8 128 /* 0x80 */
#define JUMP_BUFFER_Xmm9 0x90 #define JUMP_BUFFER_Xmm9 144 /* 0x90 */
#define JUMP_BUFFER_Xmm10 0xa0 #define JUMP_BUFFER_Xmm10 160 /* 0xa0 */
#define JUMP_BUFFER_Xmm11 0xb0 #define JUMP_BUFFER_Xmm11 176 /* 0xb0 */
#define JUMP_BUFFER_Xmm12 0xc0 #define JUMP_BUFFER_Xmm12 192 /* 0xc0 */
#define JUMP_BUFFER_Xmm13 0xd0 #define JUMP_BUFFER_Xmm13 208 /* 0xd0 */
#define JUMP_BUFFER_Xmm14 0xe0 #define JUMP_BUFFER_Xmm14 224 /* 0xe0 */
#define JUMP_BUFFER_Xmm15 0xf0 #define JUMP_BUFFER_Xmm15 240 /* 0xf0 */
/* FUNCTIONS ******************************************************************/ /* FUNCTIONS ******************************************************************/
.code64
/* /*!
* int _setjmp(jmp_buf env); * int _setjmp(jmp_buf env);
* *
* Parameters: <rcx> - jmp_buf env * \param <rcx> - jmp_buf env
* Returns: 0 * \return 0
* Notes: Sets up the jmp_buf * \note Sets up the jmp_buf
*/ */
PUBLIC _setjmp PUBLIC _setjmp
.proc _setjmp FUNC _setjmp
.endprolog
/* Load rsp as it was before the call into rax */ /* Load rsp as it was before the call into rax */
lea rax, [rsp + 8] lea rax, [rsp + 8]
/* Load return address into r8 */ /* Load return address into r8 */
@ -73,18 +77,21 @@ PUBLIC _setjmp
movdqa [rcx + JUMP_BUFFER_Xmm15], xmm15 movdqa [rcx + JUMP_BUFFER_Xmm15], xmm15
xor rax, rax xor rax, rax
ret ret
.endp setjmp ENDFUNC _setjmp
/* /*!
* int _setjmpex(jmp_buf _Buf,void *_Ctx); * int _setjmpex(jmp_buf _Buf,void *_Ctx);
* *
* Parameters: <rcx> - jmp_buf env * \param <rcx> - jmp_buf env
* <rdx> - frame * \param <rdx> - frame
* Returns: 0 * \return 0
* Notes: Sets up the jmp_buf * \note Sets up the jmp_buf
*/ */
PUBLIC _setjmpex PUBLIC _setjmpex
.proc _setjmpex FUNC _setjmpex
.endprolog
/* Load rsp as it was before the call into rax */ /* Load rsp as it was before the call into rax */
lea rax, [rsp + 8] lea rax, [rsp + 8]
/* Load return address into r8 */ /* Load return address into r8 */
@ -112,19 +119,21 @@ PUBLIC _setjmpex
movdqa [rcx + JUMP_BUFFER_Xmm15], xmm15 movdqa [rcx + JUMP_BUFFER_Xmm15], xmm15
xor rax, rax xor rax, rax
ret ret
.endp setjmpex ENDFUNC _setjmpex
/* /*!
* void longjmp(jmp_buf env, int value); * void longjmp(jmp_buf env, int value);
* *
* Parameters: <rcx> - jmp_buf setup by _setjmp * \param <rcx> - jmp_buf setup by _setjmp
* <rdx> - int value to return * \param <rdx> - int value to return
* Returns: Doesn't return * \return Doesn't return
* Notes: Non-local goto * \note Non-local goto
*/ */
PUBLIC longjmp PUBLIC longjmp
.proc longjmp FUNC longjmp
.endprolog
// FIXME: handle frame // FIXME: handle frame
@ -152,9 +161,9 @@ PUBLIC longjmp
/* return param2 or 1 if it was 0 */ /* return param2 or 1 if it was 0 */
mov rax, rdx mov rax, rdx
test rax, rax test rax, rax
jnz 2f jnz l2
inc rax inc rax
2: jmp r8 l2: jmp r8
.endp longjmp ENDFUNC longjmp
END END