mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-08 20:56:13 +00:00
fix coding style for windows build patch (#350)
This commit is contained in:
parent
874cc951c6
commit
1266ebb222
|
@ -52,7 +52,9 @@ typedef struct {
|
||||||
#define os_printf printf
|
#define os_printf printf
|
||||||
#define os_vprintf vprintf
|
#define os_vprintf vprintf
|
||||||
|
|
||||||
static inline size_t getpagesize() {
|
static inline size_t
|
||||||
|
getpagesize()
|
||||||
|
{
|
||||||
SYSTEM_INFO S;
|
SYSTEM_INFO S;
|
||||||
GetNativeSystemInfo(&S);
|
GetNativeSystemInfo(&S);
|
||||||
return S.dwPageSize;
|
return S.dwPageSize;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "platform_api_vmcore.h"
|
#include "platform_api_vmcore.h"
|
||||||
|
|
||||||
void * os_mmap(void *hint, size_t size, int prot, int flags)
|
void * os_mmap(void *hint, size_t size, int prot, int flags)
|
||||||
{
|
{
|
||||||
DWORD AllocType = MEM_RESERVE | MEM_COMMIT;
|
DWORD AllocType = MEM_RESERVE | MEM_COMMIT;
|
||||||
|
@ -40,8 +41,8 @@ os_munmap(void *addr, size_t size)
|
||||||
{
|
{
|
||||||
size_t page_size = getpagesize();
|
size_t page_size = getpagesize();
|
||||||
size_t request_size = (size + page_size - 1) & ~(page_size - 1);
|
size_t request_size = (size + page_size - 1) & ~(page_size - 1);
|
||||||
if (addr) {
|
|
||||||
|
|
||||||
|
if (addr) {
|
||||||
if (VirtualFree(addr, 0, MEM_RELEASE) == 0) {
|
if (VirtualFree(addr, 0, MEM_RELEASE) == 0) {
|
||||||
if (VirtualFree(addr, size, MEM_DECOMMIT) == 0) {
|
if (VirtualFree(addr, size, MEM_DECOMMIT) == 0) {
|
||||||
os_printf("os_munmap error addr:%p, size:0x%lx, errno:%d\n",
|
os_printf("os_munmap error addr:%p, size:0x%lx, errno:%d\n",
|
||||||
|
@ -56,6 +57,7 @@ os_mprotect(void *addr, size_t size, int prot)
|
||||||
{
|
{
|
||||||
DWORD AllocType = MEM_RESERVE | MEM_COMMIT;
|
DWORD AllocType = MEM_RESERVE | MEM_COMMIT;
|
||||||
DWORD flProtect = PAGE_NOACCESS;
|
DWORD flProtect = PAGE_NOACCESS;
|
||||||
|
|
||||||
if (!addr)
|
if (!addr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -76,4 +78,5 @@ os_mprotect(void *addr, size_t size, int prot)
|
||||||
void
|
void
|
||||||
os_dcache_flush(void)
|
os_dcache_flush(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,9 +97,10 @@ int os_cond_wait(korp_cond *cond, korp_mutex *mutex)
|
||||||
|
|
||||||
int gettimeofday(struct timeval * tp, struct timezone * tzp)
|
int gettimeofday(struct timeval * tp, struct timezone * tzp)
|
||||||
{
|
{
|
||||||
// Note: some broken versions only have 8 trailing zero's, the correct epoch has 9 trailing zero's
|
/* Note: some broken versions only have 8 trailing zero's,
|
||||||
// This magic number is the number of 100 nanosecond intervals since January 1, 1601 (UTC)
|
the correct epoch has 9 trailing zero's
|
||||||
// until 00:00:00 January 1, 1970
|
This magic number is the number of 100 nanosecond intervals
|
||||||
|
since January 1, 1601 (UTC) until 00:00:00 January 1, 1970 */
|
||||||
static const uint64_t EPOCH = ((uint64_t) 116444736000000000ULL);
|
static const uint64_t EPOCH = ((uint64_t) 116444736000000000ULL);
|
||||||
|
|
||||||
SYSTEMTIME system_time;
|
SYSTEMTIME system_time;
|
||||||
|
@ -113,6 +114,7 @@ int gettimeofday(struct timeval * tp, struct timezone * tzp)
|
||||||
|
|
||||||
tp->tv_sec = (long)((time - EPOCH) / 10000000L);
|
tp->tv_sec = (long)((time - EPOCH) / 10000000L);
|
||||||
tp->tv_usec = (long)(system_time.wMilliseconds * 1000);
|
tp->tv_usec = (long)(system_time.wMilliseconds * 1000);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user