Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
ffb04a58
Commit
ffb04a58
authored
9 years ago
by
Jan Pochyla
Committed by
Paul Sokolovsky
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
unix: fix symbol references for x86 Mac
parent
a6c9060d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
py/nlrx86.S
+26
-8
26 additions, 8 deletions
py/nlrx86.S
unix/Makefile
+5
-1
5 additions, 1 deletion
unix/Makefile
unix/gccollect.c
+12
-0
12 additions, 0 deletions
unix/gccollect.c
with
43 additions
and
9 deletions
py/nlrx86.S
+
26
−
8
View file @
ffb04a58
...
@@ -37,9 +37,18 @@
...
@@ -37,9 +37,18 @@
#if defined(_WIN32) || defined(__CYGWIN__)
#if defined(_WIN32) || defined(__CYGWIN__)
#define NLR_OS_WINDOWS
#define NLR_OS_WINDOWS
#endif
#if defined(__APPLE__) && defined(__MACH__)
#define NLR_OS_MAC
#endif
#if defined(NLR_OS_WINDOWS) || defined(NLR_OS_MAC)
#define NLR_TOP (_mp_state_ctx + NLR_TOP_OFFSET)
#define NLR_TOP (_mp_state_ctx + NLR_TOP_OFFSET)
#define MP_THREAD_GET_STATE _mp_thread_get_state
#else
#else
#define NLR_TOP (mp_state_ctx + NLR_TOP_OFFSET)
#define NLR_TOP (mp_state_ctx + NLR_TOP_OFFSET)
#define MP_THREAD_GET_STATE mp_thread_get_state
#endif
#endif
//
offset
of
nlr_top
within
mp_state_thread_t
structure
//
offset
of
nlr_top
within
mp_state_thread_t
structure
...
@@ -55,6 +64,9 @@
...
@@ -55,6 +64,9 @@
.
globl
_nlr_push
.
globl
_nlr_push
.
def
_nlr_push
; .scl 2; .type 32; .endef
.
def
_nlr_push
; .scl 2; .type 32; .endef
_nlr_push
:
_nlr_push
:
#elif defined(NLR_OS_MAC)
.
globl
_nlr_push
_nlr_push
:
#else
#else
.
globl
nlr_push
.
globl
nlr_push
.
type
nlr_push
,
@
function
.
type
nlr_push
,
@
function
...
@@ -75,7 +87,7 @@ nlr_push:
...
@@ -75,7 +87,7 @@ nlr_push:
mov
%
edx
,
NLR_TOP
#
stor
new
nlr_buf
(
to
make
linked
list
)
mov
%
edx
,
NLR_TOP
#
stor
new
nlr_buf
(
to
make
linked
list
)
#else
#else
//
to
check
:
stack
is
aligned
to
16
-
byte
boundary
before
this
call
//
to
check
:
stack
is
aligned
to
16
-
byte
boundary
before
this
call
call
mp_thread_get_state
#
get
mp_state_thread
ptr
into
eax
call
MP_THREAD_GET_STATE
#
get
mp_state_thread
ptr
into
eax
mov
4
(%
esp
),
%
edx
#
load
nlr_buf
argument
into
edx
(
edx
clobbered
by
call
)
mov
4
(%
esp
),
%
edx
#
load
nlr_buf
argument
into
edx
(
edx
clobbered
by
call
)
mov
NLR_TOP_TH_OFF
(%
eax
),
%
ecx
#
get
thread
.
nlr_top
(
last
nlr_buf
)
mov
NLR_TOP_TH_OFF
(%
eax
),
%
ecx
#
get
thread
.
nlr_top
(
last
nlr_buf
)
mov
%
ecx
,
(%
edx
)
#
store
it
mov
%
ecx
,
(%
edx
)
#
store
it
...
@@ -84,7 +96,7 @@ nlr_push:
...
@@ -84,7 +96,7 @@ nlr_push:
xor
%
eax
,
%
eax
#
return
0
,
normal
return
xor
%
eax
,
%
eax
#
return
0
,
normal
return
ret
#
return
ret
#
return
#if !defined(NLR_OS_WINDOWS)
#if !defined(NLR_OS_WINDOWS)
&& !defined(NLR_OS_MAC)
.
size
nlr_push
,
.
-
nlr_push
.
size
nlr_push
,
.
-
nlr_push
#endif
#endif
...
@@ -95,6 +107,9 @@ nlr_push:
...
@@ -95,6 +107,9 @@ nlr_push:
.
globl
_nlr_pop
.
globl
_nlr_pop
.
def
_nlr_pop
; .scl 2; .type 32; .endef
.
def
_nlr_pop
; .scl 2; .type 32; .endef
_nlr_pop
:
_nlr_pop
:
#elif defined(NLR_OS_MAC)
.
globl
_nlr_pop
_nlr_pop
:
#else
#else
.
globl
nlr_pop
.
globl
nlr_pop
.
type
nlr_pop
,
@
function
.
type
nlr_pop
,
@
function
...
@@ -106,14 +121,14 @@ nlr_pop:
...
@@ -106,14 +121,14 @@ nlr_pop:
mov
(%
eax
),
%
eax
#
load
prev
nlr_buf
mov
(%
eax
),
%
eax
#
load
prev
nlr_buf
mov
%
eax
,
NLR_TOP
#
store
nlr_top
(
to
unlink
list
)
mov
%
eax
,
NLR_TOP
#
store
nlr_top
(
to
unlink
list
)
#else
#else
call
mp_thread_get_state
#
get
mp_state_thread
ptr
into
eax
call
MP_THREAD_GET_STATE
#
get
mp_state_thread
ptr
into
eax
mov
NLR_TOP_TH_OFF
(%
eax
),
%
ecx
#
get
thread
.
nlr_top
(
last
nlr_buf
)
mov
NLR_TOP_TH_OFF
(%
eax
),
%
ecx
#
get
thread
.
nlr_top
(
last
nlr_buf
)
mov
(%
ecx
),
%
ecx
#
load
prev
nlr_buf
mov
(%
ecx
),
%
ecx
#
load
prev
nlr_buf
mov
%
ecx
,
NLR_TOP_TH_OFF
(%
eax
)
#
store
prev
nlr_buf
(
to
unlink
list
)
mov
%
ecx
,
NLR_TOP_TH_OFF
(%
eax
)
#
store
prev
nlr_buf
(
to
unlink
list
)
#endif
#endif
ret
#
return
ret
#
return
#if !defined(NLR_OS_WINDOWS)
#if !defined(NLR_OS_WINDOWS)
&& !defined(NLR_OS_MAC)
.
size
nlr_pop
,
.
-
nlr_pop
.
size
nlr_pop
,
.
-
nlr_pop
#endif
#endif
...
@@ -124,6 +139,9 @@ nlr_pop:
...
@@ -124,6 +139,9 @@ nlr_pop:
.
globl
_nlr_jump
.
globl
_nlr_jump
.
def
_nlr_jump
; .scl 2; .type 32; .endef
.
def
_nlr_jump
; .scl 2; .type 32; .endef
_nlr_jump
:
_nlr_jump
:
#elif defined(NLR_OS_MAC)
.
globl
_nlr_jump
_nlr_jump
:
#else
#else
.
globl
nlr_jump
.
globl
nlr_jump
.
type
nlr_jump
,
@
function
.
type
nlr_jump
,
@
function
...
@@ -133,7 +151,7 @@ nlr_jump:
...
@@ -133,7 +151,7 @@ nlr_jump:
#if !MICROPY_PY_THREAD
#if !MICROPY_PY_THREAD
mov
NLR_TOP
,
%
edx
#
load
nlr_top
mov
NLR_TOP
,
%
edx
#
load
nlr_top
test
%
edx
,
%
edx
#
check
for
nlr_top
being
NULL
test
%
edx
,
%
edx
#
check
for
nlr_top
being
NULL
#if defined(NLR_OS_WINDOWS)
#if defined(NLR_OS_WINDOWS)
|| defined(NLR_OS_MAC)
je
_nlr_jump_fail
#
fail
if
nlr_top
is
NULL
je
_nlr_jump_fail
#
fail
if
nlr_top
is
NULL
#else
#else
je
nlr_jump_fail
#
fail
if
nlr_top
is
NULL
je
nlr_jump_fail
#
fail
if
nlr_top
is
NULL
...
@@ -143,10 +161,10 @@ nlr_jump:
...
@@ -143,10 +161,10 @@ nlr_jump:
mov
(%
edx
),
%
eax
#
load
prev
nlr_top
mov
(%
edx
),
%
eax
#
load
prev
nlr_top
mov
%
eax
,
NLR_TOP
#
store
nlr_top
(
to
unlink
list
)
mov
%
eax
,
NLR_TOP
#
store
nlr_top
(
to
unlink
list
)
#else
#else
call
mp_thread_get_state
#
get
mp_state_thread
ptr
into
eax
call
MP_THREAD_GET_STATE
#
get
mp_state_thread
ptr
into
eax
mov
NLR_TOP_TH_OFF
(%
eax
),
%
edx
#
get
thread
.
nlr_top
(
last
nlr_buf
)
mov
NLR_TOP_TH_OFF
(%
eax
),
%
edx
#
get
thread
.
nlr_top
(
last
nlr_buf
)
test
%
edx
,
%
edx
#
check
for
nlr_top
being
NULL
test
%
edx
,
%
edx
#
check
for
nlr_top
being
NULL
#if defined(NLR_OS_WINDOWS)
#if defined(NLR_OS_WINDOWS)
|| defined(NLR_OS_MAC)
je
_nlr_jump_fail
#
fail
if
nlr_top
is
NULL
je
_nlr_jump_fail
#
fail
if
nlr_top
is
NULL
#else
#else
je
nlr_jump_fail
#
fail
if
nlr_top
is
NULL
je
nlr_jump_fail
#
fail
if
nlr_top
is
NULL
...
@@ -167,7 +185,7 @@ nlr_jump:
...
@@ -167,7 +185,7 @@ nlr_jump:
xor
%
eax
,
%
eax
#
clear
return
register
xor
%
eax
,
%
eax
#
clear
return
register
inc
%
al
#
increase
to
make
1
,
non
-
local
return
inc
%
al
#
increase
to
make
1
,
non
-
local
return
ret
#
return
ret
#
return
#if !defined(NLR_OS_WINDOWS)
#if !defined(NLR_OS_WINDOWS)
&& !defined(NLR_OS_MAC)
.
size
nlr_jump
,
.
-
nlr_jump
.
size
nlr_jump
,
.
-
nlr_jump
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
unix/Makefile
+
5
−
1
View file @
ffb04a58
...
@@ -61,7 +61,11 @@ endif
...
@@ -61,7 +61,11 @@ endif
# while cross-compile ports require gcc, so we test here for OSX and
# while cross-compile ports require gcc, so we test here for OSX and
# if necessary override the value of 'CC' set in py/mkenv.mk
# if necessary override the value of 'CC' set in py/mkenv.mk
ifeq
($(UNAME_S),Darwin)
ifeq
($(UNAME_S),Darwin)
ifeq
($(MICROPY_FORCE_32BIT),1)
CC
=
clang
-m32
else
CC
=
clang
CC
=
clang
endif
# Use clang syntax for map file
# Use clang syntax for map file
LDFLAGS_ARCH
=
-Wl
,-map,
$@
.map
-Wl
,-dead_strip
LDFLAGS_ARCH
=
-Wl
,-map,
$@
.map
-Wl
,-dead_strip
else
else
...
...
This diff is collapsed.
Click to expand it.
unix/gccollect.c
+
12
−
0
View file @
ffb04a58
...
@@ -80,6 +80,18 @@ STATIC void gc_helper_get_regs(regs_t arr) {
...
@@ -80,6 +80,18 @@ STATIC void gc_helper_get_regs(regs_t arr) {
register
long
esi
asm
(
"esi"
);
register
long
esi
asm
(
"esi"
);
register
long
edi
asm
(
"edi"
);
register
long
edi
asm
(
"edi"
);
register
long
ebp
asm
(
"ebp"
);
register
long
ebp
asm
(
"ebp"
);
#ifdef __clang__
// TODO:
// This is dirty workaround for Clang. It tries to get around
// uncompliant (wrt to GCC) behavior of handling register variables.
// Application of this patch here is random, and done only to unbreak
// MacOS build. Better, cross-arch ways to deal with Clang issues should
// be found.
asm
(
""
:
"=r"
(
ebx
));
asm
(
""
:
"=r"
(
esi
));
asm
(
""
:
"=r"
(
edi
));
asm
(
""
:
"=r"
(
ebp
));
#endif
arr
[
0
]
=
ebx
;
arr
[
0
]
=
ebx
;
arr
[
1
]
=
esi
;
arr
[
1
]
=
esi
;
arr
[
2
]
=
edi
;
arr
[
2
]
=
edi
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment