Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Miosix Kernel
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
Miosix Kernel
Commits
7159999e
Commit
7159999e
authored
4 months ago
by
Federico
Browse files
Options
Downloads
Patches
Plain Diff
Fix regression in MemoryProfiling::getCurrentFreeStack() caused by previous patch
parent
9b03c558
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
miosix/libsyscalls/memoryprofiling.cpp
+9
-1
9 additions, 1 deletion
miosix/libsyscalls/memoryprofiling.cpp
miosix/util/util.cpp
+9
-1
9 additions, 1 deletion
miosix/util/util.cpp
with
18 additions
and
2 deletions
miosix/libsyscalls/memoryprofiling.cpp
+
9
−
1
View file @
7159999e
...
@@ -107,7 +107,15 @@ unsigned int MemoryProfiling::getAbsoluteFreeStack()
...
@@ -107,7 +107,15 @@ unsigned int MemoryProfiling::getAbsoluteFreeStack()
unsigned
int
MemoryProfiling
::
getCurrentFreeStack
()
unsigned
int
MemoryProfiling
::
getCurrentFreeStack
()
{
{
unsigned
int
stackOccupiedByCtxsave
=
sysconf
(
ctxsaveOnStack
);
unsigned
int
stackOccupiedByCtxsave
=
sysconf
(
ctxsaveOnStack
);
int
*
stack_ptr
asm
(
"sp"
);
#ifdef __ARM_EABI__
void
*
stack_ptr
;
asm
volatile
(
"mov %0, sp"
:
"=r"
(
stack_ptr
));
#else //__ARM_EABI__
//NOTE: __builtin_frame_address doesn't add the size of the current function
//frame, likely __builtin_stack_address would be better but GCC 9.2.0 does
//not have it
void
*
stack_ptr
=
__builtin_frame_address
(
0
);
#endif //__ARM_EABI__
const
unsigned
int
*
walk
=
getStackBottom
();
const
unsigned
int
*
walk
=
getStackBottom
();
unsigned
int
freeStack
=
(
reinterpret_cast
<
unsigned
int
>
(
stack_ptr
)
unsigned
int
freeStack
=
(
reinterpret_cast
<
unsigned
int
>
(
stack_ptr
)
-
reinterpret_cast
<
unsigned
int
>
(
walk
));
-
reinterpret_cast
<
unsigned
int
>
(
walk
));
...
...
This diff is collapsed.
Click to expand it.
miosix/util/util.cpp
+
9
−
1
View file @
7159999e
...
@@ -94,7 +94,15 @@ unsigned int MemoryProfiling::getAbsoluteFreeStack()
...
@@ -94,7 +94,15 @@ unsigned int MemoryProfiling::getAbsoluteFreeStack()
unsigned
int
MemoryProfiling
::
getCurrentFreeStack
()
unsigned
int
MemoryProfiling
::
getCurrentFreeStack
()
{
{
int
*
stack_ptr
;
#ifdef __ARM_EABI__
void
*
stack_ptr
;
asm
volatile
(
"mov %0, sp"
:
"=r"
(
stack_ptr
));
#else //__ARM_EABI__
//NOTE: __builtin_frame_address doesn't add the size of the current function
//frame, likely __builtin_stack_address would be better but GCC 9.2.0 does
//not have it
void
*
stack_ptr
=
__builtin_frame_address
(
0
);
#endif //__ARM_EABI__
const
unsigned
int
*
walk
=
Thread
::
getStackBottom
();
const
unsigned
int
*
walk
=
Thread
::
getStackBottom
();
unsigned
int
freeStack
=
(
reinterpret_cast
<
unsigned
int
>
(
stack_ptr
)
unsigned
int
freeStack
=
(
reinterpret_cast
<
unsigned
int
>
(
stack_ptr
)
-
reinterpret_cast
<
unsigned
int
>
(
walk
));
-
reinterpret_cast
<
unsigned
int
>
(
walk
));
...
...
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