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
6eae8616
Commit
6eae8616
authored
10 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py: Put define of x86 argument registers in asmx86.h.
parent
7ff996c2
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
py/asmx86.c
+3
-3
3 additions, 3 deletions
py/asmx86.c
py/asmx86.h
+8
-0
8 additions, 0 deletions
py/asmx86.h
py/emitnative.c
+3
-3
3 additions, 3 deletions
py/emitnative.c
with
14 additions
and
6 deletions
py/asmx86.c
+
3
−
3
View file @
6eae8616
...
@@ -496,13 +496,13 @@ void asm_x86_call_ind(asm_x86_t *as, void *ptr, mp_uint_t n_args, int temp_r32)
...
@@ -496,13 +496,13 @@ void asm_x86_call_ind(asm_x86_t *as, void *ptr, mp_uint_t n_args, int temp_r32)
// TODO align stack on 16-byte boundary before the call
// TODO align stack on 16-byte boundary before the call
assert
(
n_args
<=
3
);
assert
(
n_args
<=
3
);
if
(
n_args
>
2
)
{
if
(
n_args
>
2
)
{
asm_x86_push_r32
(
as
,
REG_ARG_3
);
asm_x86_push_r32
(
as
,
ASM_X86_
REG_ARG_3
);
}
}
if
(
n_args
>
1
)
{
if
(
n_args
>
1
)
{
asm_x86_push_r32
(
as
,
REG_ARG_2
);
asm_x86_push_r32
(
as
,
ASM_X86_
REG_ARG_2
);
}
}
if
(
n_args
>
0
)
{
if
(
n_args
>
0
)
{
asm_x86_push_r32
(
as
,
REG_ARG_1
);
asm_x86_push_r32
(
as
,
ASM_X86_
REG_ARG_1
);
}
}
#ifdef __LP64__
#ifdef __LP64__
// We wouldn't run x86 code on an x64 machine. This is here to enable
// We wouldn't run x86 code on an x64 machine. This is here to enable
...
...
This diff is collapsed.
Click to expand it.
py/asmx86.h
+
8
−
0
View file @
6eae8616
...
@@ -44,6 +44,14 @@
...
@@ -44,6 +44,14 @@
#define REG_ESI (6)
#define REG_ESI (6)
#define REG_EDI (7)
#define REG_EDI (7)
// x86 passes values on the stack, but the emitter is register based, so we need
// to define registers that can temporarily hold the function arguments. They
// need to be defined here so that asm_x86_call_ind can push them onto the stack
// before the call.
#define ASM_X86_REG_ARG_1 REG_EAX
#define ASM_X86_REG_ARG_2 REG_ECX
#define ASM_X86_REG_ARG_3 REG_EDX
// condition codes, used for jcc and setcc (despite their j-name!)
// condition codes, used for jcc and setcc (despite their j-name!)
#define ASM_X86_CC_JB (0x2) // below, unsigned
#define ASM_X86_CC_JB (0x2) // below, unsigned
#define ASM_X86_CC_JZ (0x4)
#define ASM_X86_CC_JZ (0x4)
...
...
This diff is collapsed.
Click to expand it.
py/emitnative.c
+
3
−
3
View file @
6eae8616
...
@@ -200,9 +200,9 @@ STATIC byte mp_f_n_args[MP_F_NUMBER_OF] = {
...
@@ -200,9 +200,9 @@ STATIC byte mp_f_n_args[MP_F_NUMBER_OF] = {
#define EXPORT_FUN(name) emit_native_x86_##name
#define EXPORT_FUN(name) emit_native_x86_##name
#define REG_RET REG_EAX
#define REG_RET REG_EAX
#define REG_ARG_1
REG_EAX
#define REG_ARG_1
ASM_X86_REG_ARG_1
#define REG_ARG_2
REG_ECX
#define REG_ARG_2
ASM_X86_REG_ARG_2
#define REG_ARG_3
REG_EDX
#define REG_ARG_3
ASM_X86_REG_ARG_3
// caller-save, so can be used as temporaries
// caller-save, so can be used as temporaries
#define REG_TEMP0 REG_EAX
#define REG_TEMP0 REG_EAX
...
...
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