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
4af3f2e5
Commit
4af3f2e5
authored
5 years ago
by
Federico
Browse files
Options
Downloads
Patches
Plain Diff
Miosix support for libatomic
parent
f9cab5f1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+9
-2
9 additions, 2 deletions
Makefile
miosix/stdlib_integration/libstdcpp_integration.cpp
+30
-0
30 additions, 0 deletions
miosix/stdlib_integration/libstdcpp_integration.cpp
with
39 additions
and
2 deletions
Makefile
+
9
−
2
View file @
4af3f2e5
...
...
@@ -56,8 +56,15 @@ AFLAGS := $(AFLAGS_BASE)
LFLAGS
:=
$(
LFLAGS_BASE
)
DFLAGS
:=
-MMD
-MP
LINK_LIBS
:=
$(
LIBS
)
-L
$(
KPATH
)
-Wl
,--start-group
-lmiosix
-lstdc
++
-lc
\
-lm
-lgcc
-Wl
,--end-group
## libmiosix.a is among stdlibs because needs to be within start/end group
STDLIBS
:=
-lmiosix
-lstdc
++
-lc
-lm
-lgcc
GCCMAJOR
:=
$(
shell
$(
CC
)
--version
| perl
-e
'$$_=<>;/\(GCC\) (\d+
)
/;print "$$1"'
)
ifneq
($(GCCMAJOR),4)
STDLIBS
+=
-latomic
endif
LINK_LIBS
:=
$(
LIBS
)
-L
$(
KPATH
)
-Wl
,--start-group
$(
STDLIBS
)
-Wl
,--end-group
all
:
all-recursive main
...
...
This diff is collapsed.
Click to expand it.
miosix/stdlib_integration/libstdcpp_integration.cpp
+
30
−
0
View file @
4af3f2e5
...
...
@@ -303,3 +303,33 @@ extern "C" void __cxa_guard_abort(__guard *g) noexcept
}
}
//namespace __cxxabiv1
//
// libatomic support, to provide thread safe atomic operation fallbacks
// ====================================================================
// Not using the fast version, as these may be used before the kernel is started
extern
"C"
unsigned
int
libat_quick_lock_n
(
void
*
ptr
)
{
miosix
::
disableInterrupts
();
return
0
;
}
extern
"C"
void
libat_quick_unlock_n
(
void
*
ptr
,
unsigned
int
token
)
{
miosix
::
enableInterrupts
();
}
// These are to implement "heavy" atomic operations, which are not used in
// libstdc++. For now let's keep them disbaled.
// extern "C" void libat_lock_n(void *ptr, size_t n)
// {
// miosix::pauseKernel();
// }
//
// extern "C" void libat_unlock_n(void *ptr, size_t n)
// {
// miosix::restartKernel();
// }
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