Index: /trunk/src/VBox/Runtime/string/memcpy.asm
===================================================================
--- /trunk/src/VBox/Runtime/string/memcpy.asm	(revision 3)
+++ /trunk/src/VBox/Runtime/string/memcpy.asm	(revision 3)
@@ -0,0 +1,86 @@
+; $Id$
+;; @file
+; InnoTek Portable Runtime - No-CRT memcpy - AMD64 & X86.
+;
+
+;
+; Copyright (C) 2006 InnoTek Systemberatung GmbH
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License as published by the Free Software Foundation,
+; in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+; distribution. VirtualBox OSE is distributed in the hope that it will
+; be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; If you received this file as part of a commercial VirtualBox
+; distribution, then only the terms of your commercial VirtualBox
+; license agreement apply instead of the previous paragraph.
+;
+
+%include "iprt/asmdefs.mac"
+
+;;
+; @param    pvDst   gcc: rdi  msc: rcx  x86:[esp+4]
+; @param    pvSrc   gcc: rsi  msc: rdx  x86:[esp+8]
+; @param    cb      gcc: rdx  msc: r8   x86:[esp+0ch]
+BEGINPROC RT_NOCRT(memcpy)
+        cld
+
+        ; Do the bulk of the work.
+%ifdef __AMD64__
+ %ifdef ASM_CALL64_MSC
+        mov     r10, rdi                ; save
+        mov     r11, rsi                ; save
+        mov     rdi, rcx
+        mov     rsi, rdx
+        mov     rcx, r8
+        mov     rdx, r8
+ %else
+        mov     rcx, rdx
+ %endif
+        mov     rax, rdi                ; save the return value
+        shr     rcx, 3
+        rep movsq
+%else
+        push    edi
+        push    esi
+
+        mov     ecx, [esp + 0ch + 8]
+        mov     edi, [esp + 04h + 8]
+        mov     esi, [esp + 08h + 8]
+        mov     edx, ecx
+        mov     eax, edi                ; save the return value
+        shl     ecx, 2
+        rep movsd
+%endif
+
+        ; The remaining bytes.
+%ifdef __AMD64__
+        test    dl, 4
+        jz      .dont_move_dword
+        movsd
+%endif
+.dont_move_dword:
+        test    dl, 2
+        jz      .dont_move_word
+        movsw
+.dont_move_word:
+        test    dl, 1
+        jz      .dont_move_byte
+        movsb
+.dont_move_byte:
+
+%ifdef __AMD64__
+ %ifdef ASM_CALL64_MSC
+        mov     rdi, r10
+        mov     rsi, r11
+ %endif
+%else
+        pop     esi
+        pop     edi
+%endif
+        ret
+ENDPROC RT_NOCRT(memcpy)
+
Index: /trunk/src/VBox/Runtime/string/memcpy_alias.c
===================================================================
--- /trunk/src/VBox/Runtime/string/memcpy_alias.c	(revision 3)
+++ /trunk/src/VBox/Runtime/string/memcpy_alias.c	(revision 3)
@@ -0,0 +1,48 @@
+/* $Id: memcpy.cpp 17216 2007-01-10 16:40:30Z bird $ */
+/** @file
+ * InnoTek Portable Runtime - No-CRT memcpy() alias for gcc.
+ */
+
+/*
+ * Copyright (C) 2006 InnoTek Systemberatung GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ * distribution. VirtualBox OSE is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * If you received this file as part of a commercial VirtualBox
+ * distribution, then only the terms of your commercial VirtualBox
+ * license agreement apply instead of the previous paragraph.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/nocrt/string.h>
+#undef memcpy
+
+#if defined(__DARWIN__) || defined(__WIN__)
+# ifndef __MINGW32__
+#  pragma weak memcpy
+# endif
+
+/* No alias support here (yet in the ming case). */
+extern void *(memcpy)(void *pvDst, const void *pvSrc, size_t cb)
+{
+    return RT_NOCRT(memcpy)(pvDst, pvSrc, cb);
+}
+
+#elif __GNUC__ >= 4
+/* create a weak alias. */
+__asm__(".weak memcpy\t\n"
+        " .set memcpy," RT_NOCRT_STR(memcpy) "\t\n");
+#else
+/* create a weak alias. */
+extern __typeof(RT_NOCRT(memcpy)) memcpy __attribute__((weak, alias(RT_NOCRT_STR(memcpy))));
+#endif
+
Index: /trunk/src/VBox/Runtime/string/mempcpy.asm
===================================================================
--- /trunk/src/VBox/Runtime/string/mempcpy.asm	(revision 3)
+++ /trunk/src/VBox/Runtime/string/mempcpy.asm	(revision 3)
@@ -0,0 +1,86 @@
+; $Id$
+;; @file
+; InnoTek Portable Runtime - No-CRT mempcpy - AMD64 & X86.
+;
+
+;
+; Copyright (C) 2006 InnoTek Systemberatung GmbH
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License as published by the Free Software Foundation,
+; in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+; distribution. VirtualBox OSE is distributed in the hope that it will
+; be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; If you received this file as part of a commercial VirtualBox
+; distribution, then only the terms of your commercial VirtualBox
+; license agreement apply instead of the previous paragraph.
+;
+
+%include "iprt/asmdefs.mac"
+
+;;
+; @param    pvDst   gcc: rdi  msc: rcx  x86:[esp+4]
+; @param    pvSrc   gcc: rsi  msc: rdx  x86:[esp+8]
+; @param    cb      gcc: rdx  msc: r8   x86:[esp+0ch]
+BEGINPROC RT_NOCRT(mempcpy)
+        cld                             ; paranoia
+
+        ; Do the bulk of the work.
+%ifdef __AMD64__
+ %ifdef ASM_CALL64_MSC
+        mov     r10, rdi                ; save
+        mov     r11, rsi                ; save
+        mov     rdi, rcx
+        mov     rsi, rdx
+        mov     rcx, r8
+        mov     rdx, r8
+ %else
+        mov     rcx, rdx
+ %endif
+        shr     rcx, 3
+        rep movsq
+%else
+        mov     eax, edi                ; saving edi in eax
+        push    esi
+
+        mov     ecx, [esp + 0ch + 4]
+        mov     edi, [esp + 04h + 4]
+        mov     esi, [esp + 08h + 4]
+        mov     edx, ecx
+        shl     ecx, 2
+        rep movsd
+%endif
+
+        ; The remaining bytes.
+%ifdef __AMD64__
+        test    dl, 4
+        jz      .dont_move_dword
+        movsd
+%endif
+.dont_move_dword:
+        test    dl, 2
+        jz      .dont_move_word
+        movsw
+.dont_move_word:
+        test    dl, 1
+        jz      .dont_move_byte
+        movsb
+.dont_move_byte:
+
+        ; restore & return
+%ifdef __AMD64__
+        mov     rax, rdi
+ %ifdef ASM_CALL64_MSC
+        mov     rsi, r11
+        mov     rdi, r10
+ %endif
+%else
+        pop     esi
+        xchg    eax, edi
+%endif
+        ret
+ENDPROC RT_NOCRT(mempcpy)
+
Index: /trunk/src/VBox/Runtime/string/memset.asm
===================================================================
--- /trunk/src/VBox/Runtime/string/memset.asm	(revision 3)
+++ /trunk/src/VBox/Runtime/string/memset.asm	(revision 3)
@@ -0,0 +1,85 @@
+; $Id$
+;; @file
+; InnoTek Portable Runtime - No-CRT memset - AMD64 & X86.
+;
+
+;
+; Copyright (C) 2006 InnoTek Systemberatung GmbH
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License as published by the Free Software Foundation,
+; in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+; distribution. VirtualBox OSE is distributed in the hope that it will
+; be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; If you received this file as part of a commercial VirtualBox
+; distribution, then only the terms of your commercial VirtualBox
+; license agreement apply instead of the previous paragraph.
+;
+
+%include "iprt/asmdefs.mac"
+
+;;
+; @param    pvDst   gcc: rdi  msc: ecx  x86:[esp+4]
+; @param    ch      gcc: esi  msc: edx  x86:[esp+8]
+; @param    cb      gcc: rdx  msc: r8   x86:[esp+0ch]
+BEGINPROC RT_NOCRT(memset)
+        cld
+%ifdef __AMD64__
+ %ifdef ASM_CALL64_MSC
+        int3
+  %error "Port me"
+ %else
+        movzx   eax, sil
+        cmp     rdx, 32
+        jb      .dobytes
+
+        ; eax = (al << 24) | (al << 16) | (al << 8) | al;
+        ; rdx = (eax << 32) | eax
+        movzx   esi, sil
+        mov     rax, qword 0101010101010101h
+        imul    rax, rsi
+
+        ; todo: alignment.
+
+        mov     rcx, rdx
+        shr     rcx, 3
+        rep stosq
+
+        and     rdx, 7
+.dobytes:
+        mov     rcx, rdx
+        rep stosb
+ %endif
+
+%else
+        push    edi
+
+        mov     ecx, [esp + 0ch + 4]
+        movzx   eax, byte [esp + 08h + 4]
+        mov     edi, [esp + 04h + 4]
+        cmp     ecx, 12
+        jb      .dobytes
+
+        ; eax = (al << 24) | (al << 16) | (al << 8) | al;
+        mov     ah, al
+        mov     edx, eax
+        shr     edx, 16
+        or      eax, edx
+
+        mov     edx, ecx
+        shr     ecx, 2
+        rep stosd
+
+        and     edx, 3
+        mov     ecx, edx
+.dobytes:
+        rep stosb
+
+        pop     edi
+%endif
+        ret
+ENDPROC RT_NOCRT(memset)
+
Index: /trunk/src/VBox/Runtime/string/memset_alias.c
===================================================================
--- /trunk/src/VBox/Runtime/string/memset_alias.c	(revision 3)
+++ /trunk/src/VBox/Runtime/string/memset_alias.c	(revision 3)
@@ -0,0 +1,48 @@
+/* $Id: $ */
+/** @file
+ * InnoTek Portable Runtime - No-CRT memset() alias for gcc.
+ */
+
+/*
+ * Copyright (C) 2006 InnoTek Systemberatung GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ * distribution. VirtualBox OSE is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * If you received this file as part of a commercial VirtualBox
+ * distribution, then only the terms of your commercial VirtualBox
+ * license agreement apply instead of the previous paragraph.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/nocrt/string.h>
+#undef memset
+
+#if defined(__DARWIN__) || defined(__WIN__)
+# ifndef __MINGW32__
+#  pragma weak memset
+# endif
+
+/* No alias support here (yet in the ming case). */
+extern void *(memset)(void *pvDst, int ch, size_t cb)
+{
+    return RT_NOCRT(memset)(pvDst, ch, cb);
+}
+
+#elif __GNUC__ >= 4
+/* create a weak alias. */
+__asm__(".weak memset\t\n"
+        " .set memset," RT_NOCRT_STR(memset) "\t\n");
+#else
+/* create a weak alias. */
+extern __typeof(RT_NOCRT(memset)) memset __attribute__((weak, alias(RT_NOCRT_STR(memset))));
+#endif
+
