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>
/* CODE **********************************************************************/
.code64
PUBLIC MsgUnimplemented
MsgUnimplemented:
.asciz "WARNING: %s at %s:%d is UNIMPLEMENTED!\n"
.proc _chkstk
FUNC _chkstk
.endprolog
UNIMPLEMENTED chkstk
ret
.endp
ENDFUNC _chkstk
.proc _alloca_probe
FUNC _alloca_probe
.endprolog
UNIMPLEMENTED alloca_probe
ret
.endp
ENDFUNC _alloca_probe
END
/* EOF */

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -11,8 +11,7 @@
#include <asm.inc>
#include <ksamd64.inc>
/* FUNCTIONS ****************************************************************/
/* CODE **********************************************************************/
.code64
PUBLIC ceilf
@ -39,7 +38,7 @@ ceilf:
fstp dword ptr [rsp]
movss xmm0, [rsp]
add rsp, 16
ret

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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