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
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
6e6c01b9
Commit
6e6c01b9
authored
8 years ago
by
Pavol Rusnak
Committed by
Damien George
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
unix: Convert mp_uint_t to size_t in alloc.c.
parent
2460888c
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
unix/alloc.c
+3
-3
3 additions, 3 deletions
unix/alloc.c
unix/mpconfigport.h
+5
-3
5 additions, 3 deletions
unix/mpconfigport.h
with
8 additions
and
6 deletions
unix/alloc.c
+
3
−
3
View file @
6e6c01b9
...
...
@@ -49,7 +49,7 @@ typedef struct _mmap_region_t {
struct
_mmap_region_t
*
next
;
}
mmap_region_t
;
void
mp_unix_alloc_exec
(
mp_uint
_t
min_size
,
void
**
ptr
,
mp_uint
_t
*
size
)
{
void
mp_unix_alloc_exec
(
size
_t
min_size
,
void
**
ptr
,
size
_t
*
size
)
{
// size needs to be a multiple of the page size
*
size
=
(
min_size
+
0xfff
)
&
(
~
0xfff
);
*
ptr
=
mmap
(
NULL
,
*
size
,
PROT_READ
|
PROT_WRITE
|
PROT_EXEC
,
MAP_PRIVATE
|
MAP_ANONYMOUS
,
-
1
,
0
);
...
...
@@ -65,7 +65,7 @@ void mp_unix_alloc_exec(mp_uint_t min_size, void **ptr, mp_uint_t *size) {
MP_STATE_VM
(
mmap_region_head
)
=
rg
;
}
void
mp_unix_free_exec
(
void
*
ptr
,
mp_uint
_t
size
)
{
void
mp_unix_free_exec
(
void
*
ptr
,
size
_t
size
)
{
munmap
(
ptr
,
size
);
// unlink the mmap'd region from the list
...
...
@@ -93,7 +93,7 @@ void *ffi_closure_alloc(size_t size, void **code);
void
ffi_closure_free
(
void
*
ptr
);
void
*
ffi_closure_alloc
(
size_t
size
,
void
**
code
)
{
mp_uint
_t
dummy
;
size
_t
dummy
;
mp_unix_alloc_exec
(
size
,
code
,
&
dummy
);
return
*
code
;
}
...
...
This diff is collapsed.
Click to expand it.
unix/mpconfigport.h
+
5
−
3
View file @
6e6c01b9
...
...
@@ -217,6 +217,9 @@ extern const struct _mp_obj_module_t mp_module_jni;
// type definitions for the specific machine
// For size_t and ssize_t
#include
<unistd.h>
// assume that if we already defined the obj repr then we also defined types
#ifndef MICROPY_OBJ_REPR
#ifdef __LP64__
...
...
@@ -239,8 +242,8 @@ typedef long long mp_off_t;
typedef
long
mp_off_t
;
#endif
void
mp_unix_alloc_exec
(
mp_uint
_t
min_size
,
void
**
ptr
,
mp_uint
_t
*
size
);
void
mp_unix_free_exec
(
void
*
ptr
,
mp_uint
_t
size
);
void
mp_unix_alloc_exec
(
size
_t
min_size
,
void
**
ptr
,
size
_t
*
size
);
void
mp_unix_free_exec
(
void
*
ptr
,
size
_t
size
);
void
mp_unix_mark_exec
(
void
);
#define MP_PLAT_ALLOC_EXEC(min_size, ptr, size) mp_unix_alloc_exec(min_size, ptr, size)
#define MP_PLAT_FREE_EXEC(ptr, size) mp_unix_free_exec(ptr, size)
...
...
@@ -253,7 +256,6 @@ void mp_unix_mark_exec(void);
#if MICROPY_PY_OS_DUPTERM
#define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
#else
#include
<unistd.h>
#define MP_PLAT_PRINT_STRN(str, len) do { ssize_t ret = write(1, str, len); (void)ret; } while (0)
#endif
...
...
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