1 /*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "ecmascript/platform/os.h"
17
18 #include <malloc.h>
19 #include <sysinfoapi.h>
20 #include <timezoneapi.h>
21
22 #include "ecmascript/log_wrapper.h"
23
24 namespace panda::ecmascript {
MallocUsableSize(void * ptr)25 size_t MallocUsableSize(void *ptr)
26 {
27 return _msize(ptr);
28 }
29
PrctlSetVMA(const void * ptr,const size_t size,const char * tag)30 int PrctlSetVMA([[maybe_unused]] const void *ptr, [[maybe_unused]] const size_t size, [[maybe_unused]] const char *tag)
31 {
32 return -1;
33 }
34
PtracePeektext(int pid,uintptr_t addr)35 long PtracePeektext([[maybe_unused]] int pid, [[maybe_unused]] uintptr_t addr)
36 {
37 return static_cast<long>(-1);
38 }
39
BindSmallCpuCore()40 void BindSmallCpuCore()
41 {
42 LOG_ECMA(INFO) << "Bind Small Core in windows not support";
43 }
44
BindMidCpuCore()45 void BindMidCpuCore()
46 {
47 LOG_ECMA(INFO) << "Bind Mid Core in windows not support";
48 }
49
BindAllCpuCore()50 void BindAllCpuCore()
51 {
52 LOG_ECMA(INFO) << "Bind All Core in windows not support";
53 }
54
PageMapExecFortSpace(void * addr,size_t size,int prot)55 void *PageMapExecFortSpace(void *addr, [[maybe_unused]] size_t size, [[maybe_unused]] int prot)
56 {
57 // basically no op
58 return addr;
59 }
60
SetSecurityLabel(const std::string & path)61 void SetSecurityLabel([[maybe_unused]] const std::string& path)
62 {
63 LOG_ECMA(INFO) << "Set Security Label in windows not support";
64 }
65
HasJitFortACL()66 bool HasJitFortACL()
67 {
68 LOG_ECMA(INFO) << "Get Jit Fort ACL in windows not support";
69 return false;
70 }
71
InitializeMallocConfig()72 void InitializeMallocConfig()
73 {
74 LOG_ECMA(INFO) << "Initialize Malloc Config in windows not support";
75 }
76
CheckDiskSpace(const std::string & path,size_t requiredBytes)77 bool CheckDiskSpace([[maybe_unused]] const std::string& path, [[maybe_unused]] size_t requiredBytes)
78 {
79 LOG_ECMA(INFO) << "Check Disk Space not support in Windows";
80 return true;
81 }
82
GetDeviceValidSize(const std::string & path)83 uint64_t GetDeviceValidSize(const std::string &path)
84 {
85 return 0;
86 }
87 } // namespace panda::ecmascript
88