Skip to content

Commit aa3e261

Browse files
MikeWang000000heiher
authored andcommitted
HevTaskSystem: Add initial support for MSYS.
Co-developed-by: hev <[email protected]>
1 parent 81626b1 commit aa3e261

File tree

4 files changed

+35
-9
lines changed

4 files changed

+35
-9
lines changed

src/arch/x86/asm.h

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
============================================================================
33
Name : asm.h
44
Author : Heiher <[email protected]>
5-
Copyright : Copyright (c) 2018 everyone.
5+
Copyright : Copyright (c) 2018 - 2025 everyone.
66
Description :
77
============================================================================
88
*/
@@ -15,6 +15,14 @@ _##symbol:
1515

1616
# define END(symbol)
1717

18+
#elif defined(__MSYS__)
19+
20+
# define NESTED(symbol) \
21+
.globl symbol; \
22+
symbol:
23+
24+
# define END(symbol)
25+
1826
#else
1927

2028
# define NESTED(symbol) \

src/arch/x86/hev-task-execute-x86_64.s

+15-5
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,31 @@
22
============================================================================
33
Name : hev-task-execute-x86_64.s
44
Author : Heiher <[email protected]>
5-
Copyright : Copyright (c) 2017 - 2018 everyone.
5+
Copyright : Copyright (c) 2017 - 2025 everyone.
66
Description :
77
============================================================================
88
*/
99

1010
#include "asm.h"
1111

12+
#if defined(__MSYS__)
13+
#define REG_ARG0 %rcx
14+
#define REG_ARG1 %rdx
15+
#define STACK_PAD 0x28
16+
#else
17+
#define REG_ARG0 %rdi
18+
#define REG_ARG1 %rsi
19+
#define STACK_PAD 0x08
20+
#endif
21+
1222
NESTED(hev_task_execute)
1323
movq %rsp, %rax
14-
movq (%rdi), %rsp
15-
subq $0x8, %rsp
24+
movq (REG_ARG0), %rsp
1625
pushq %rax
26+
subq $STACK_PAD, %rsp
1727

18-
callq *%rsi
28+
callq *REG_ARG1
1929

20-
popq %rsp
30+
movq STACK_PAD(%rsp), %rsp
2131
retq
2232
END(hev_task_execute)

src/kern/io/hev-task-io-reactor-kqueue.h

+9-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
#include <sys/event.h>
1616
#include <sys/time.h>
1717

18+
#if defined(__MSYS__)
19+
#include <io.h>
20+
#endif
21+
22+
#ifndef get_osfhandle
23+
#define get_osfhandle
24+
#endif
25+
1826
#ifndef EVFILT_EXCEPT
1927
#define EVFILT_EXCEPT (0)
2028
#endif
@@ -83,7 +91,7 @@ hev_task_io_reactor_setup_event_set (HevTaskIOReactorSetupEvent *event, int fd,
8391
action = EV_DELETE;
8492
}
8593

86-
EV_SET (event, fd, events, action | EV_CLEAR, 0, 0, data);
94+
EV_SET (event, get_osfhandle (fd), events, action | EV_CLEAR, 0, 0, data);
8795
}
8896

8997
static inline int

src/kern/task/hev-task-stack-mmap.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
============================================================================
33
Name : hev-task-stack-mmap.c
44
Author : Heiher <[email protected]>
5-
Copyright : Copyright (c) 2021 everyone.
5+
Copyright : Copyright (c) 2021 - 2025 everyone.
66
Description :
77
============================================================================
88
*/
@@ -17,7 +17,7 @@
1717

1818
#if CONFIG_STACK_BACKEND == STACK_MMAP
1919

20-
#if defined(__APPLE__) && !defined(MAP_STACK)
20+
#ifndef MAP_STACK
2121
#define MAP_STACK (0)
2222
#endif
2323

0 commit comments

Comments
 (0)