summaryrefslogtreecommitdiff
path: root/src/vm/amd64/unixstubs.cpp
blob: 2615bdb7157ab00e782e69fa1b54460f51192d4a (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information. 
//

#include "common.h"

extern "C"
{
    void RedirectForThrowControl()
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }
    
    void ErectWriteBarrier_ASM(Object** dst, Object* ref)
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }

    void ExternalMethodFixupPatchLabel()
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }

    void ExternalMethodFixupStub()
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }
    
    void GenericPInvokeCalliHelper()
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }
    
    void NakedThrowHelper()
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }

    void PInvokeStubForHost()
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }

    void PInvokeStubForHostInner(DWORD dwStackSize, LPVOID pStackFrame, LPVOID pTarget)
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }

    void SinglecastDelegateInvokeStub()
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }
    
    void TheUMEntryPrestub()
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }

    void UMThunkStub()
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }

    void VarargPInvokeStub()
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }
    
    void STDCALL UM2MThunk_WrapperHelper(void *pThunkArgs,
                                         int argLen,
                                         void *pAddr,
                                         UMEntryThunk *pEntryThunk,
                                         Thread *pThread)
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }

    void VarargPInvokeStub_RetBuffArg()
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }

    void VirtualMethodFixupPatchLabel()
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }

    void VirtualMethodFixupStub()
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }

    DWORD getcpuid(DWORD arg, unsigned char result[16])
    {
        DWORD eax;
        __asm("  xor %%ecx, %%ecx\n" \
              "  cpuid\n" \
              "  mov %%eax, 0(%[result])\n" \
              "  mov %%ebx, 4(%[result])\n" \
              "  mov %%ecx, 8(%[result])\n" \
              "  mov %%edx, 12(%[result])\n" \
            : "=a"(eax) /*output in eax*/\ 
            : "a"(arg), [result]"r"(result) /*inputs - arg in eax, result in any register*/\
            : "eax", "rbx", "ecx", "edx" /* registers that are clobbered*/
          );
        return eax;
    }
    
    DWORD getextcpuid(DWORD arg1, DWORD arg2, unsigned char result[16])
    {
        DWORD eax;
        __asm("  cpuid\n" \
              "  mov %%eax, 0(%[result])\n" \
              "  mov %%ebx, 4(%[result])\n" \
              "  mov %%ecx, 8(%[result])\n" \
              "  mov %%edx, 12(%[result])\n" \
            : "=a"(eax) /*output in eax*/\ 
            : "c"(arg1), "a"(arg2), [result]"r"(result) /*inputs - arg1 in ecx, arg2 in eax, result in any register*/\
            : "eax", "rbx", "ecx", "edx" /* registers that are clobbered*/
          );
        return eax;
    }
    
    void STDCALL JIT_MemCpy(void *dest, const void *src, SIZE_T count)
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }

    void STDCALL JIT_MemCpy_End()
    {
    }

    void STDCALL JIT_MemSet(void *dest, int c, SIZE_T count)
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }

    void STDCALL JIT_MemSet_End()
    {
    }

    void STDCALL JIT_ProfilerEnterLeaveTailcallStub(UINT_PTR ProfilerHandle)
    {
    }

#ifdef FEATURE_PREJIT
    void StubDispatchFixupStub()
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }
#endif    

    void StubDispatchFixupPatchLabel()
    {
        PORTABILITY_ASSERT("Implement for PAL");
    }    
};