summaryrefslogtreecommitdiff
path: root/src/vm/arm/crthelpers.S
blob: b561f2790c801dc27b534a1eb35d007e3f121f87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

// ==++==
//

//
// ==--==
// ***********************************************************************
// File: crthelpers.S
//
// ***********************************************************************

#include "unixasmmacros.inc"
#include "asmconstants.h"

.syntax unified
.thumb

// JIT_MemSet/JIT_MemCpy
//
// It is IMPORANT that the exception handling code is able to find these guys
// on the stack, but to keep them from being tailcalled by VC++ we need to turn
// off optimization and it ends up being a wasteful implementation.
//
// Hence these assembly helpers.
// 
//EXTERN_C void __stdcall JIT_MemSet(void* _dest, int c, size_t count)
LEAF_ENTRY JIT_MemSet, _TEXT

        cmp r2, #0
        it eq
        bxeq lr
        
        ldr r3, [r0]
        
        b C_PLTFUNC(memset)

LEAF_END_MARKED JIT_MemSet, _TEXT


//EXTERN_C void __stdcall JIT_MemCpy(void* _dest, const void *_src, size_t count)
LEAF_ENTRY JIT_MemCpy, _TEXT
//
// It only requires 4 byte alignment
// and doesn't return a value

        cmp r2, #0
        it eq
        bxeq lr
        
        ldr r3, [r0]
        ldr r3, [r1]
        
        b C_PLTFUNC(memcpy)

LEAF_END_MARKED JIT_MemCpy, _TEXT