Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FlightOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
Show more breadcrumbs
Armin Luntzer
FlightOS
Commits
345c7f4e
Commit
345c7f4e
authored
7 years ago
by
Armin Luntzer
Browse files
Options
Downloads
Patches
Plain Diff
add __clzsi2()
parent
d5ce2874
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
arch/sparc/kernel/ttable.S
+1
-4
1 addition, 4 deletions
arch/sparc/kernel/ttable.S
lib/Makefile
+1
-0
1 addition, 0 deletions
lib/Makefile
lib/libc_bitops.c
+66
-0
66 additions, 0 deletions
lib/libc_bitops.c
with
68 additions
and
4 deletions
arch/sparc/kernel/ttable.S
+
1
−
4
View file @
345c7f4e
...
...
@@ -149,10 +149,9 @@ fpe_trap_handler:
hw_div0_trap_handler
:
.
global
__interrupt_entry
__interrupt_entry
:
.
global
__clzsi2
__clzsi2
:
.
global
memset
memset
:
ta
1
.
global
nmi_entry
nmi_entry
:
.
global
reg_access_trap_handler
...
...
@@ -165,8 +164,6 @@ strtol:
syscall_tbl
:
.
global
syscall_trap
syscall_trap
:
.
global
tag_overflow_trap_handler
tag_overflow_trap_handler
:
.
global
.
udiv
.
udiv
:
.
global
.
umul
...
...
This diff is collapsed.
Click to expand it.
lib/Makefile
+
1
−
0
View file @
345c7f4e
...
...
@@ -9,3 +9,4 @@ lib-y += elf.o
lib-y
+=
data_proc_tracker.o
lib-y
+=
data_proc_task.o
lib-y
+=
data_proc_net.o
lib-y
+=
libc_bitops.o
This diff is collapsed.
Click to expand it.
lib/libc_bitops.c
0 → 100644
+
66
−
0
View file @
345c7f4e
// SPDX-License-Identifier: GPL-2.0
/**
* @file lib/libc_bitops.c
*
* @ingroup libc
* @defgroup functions expected by the compiler
*
* @note these can be overridden by linking architecture-specific implementation
*
* @note add as needed
*
* @see https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html
*
*/
#include
<kernel/export.h>
/**
* @brief locates the most significant bit set in a word
* @note taken from linux: include/asm-generic/bitops/fls.h
*/
static
int
fls
(
int
x
)
{
int
r
=
32
;
if
(
!
x
)
return
0
;
if
(
!
(
x
&
0xffff0000u
))
{
x
<<=
16
;
r
-=
16
;
}
if
(
!
(
x
&
0xff000000u
))
{
x
<<=
8
;
r
-=
8
;
}
if
(
!
(
x
&
0xf0000000u
))
{
x
<<=
4
;
r
-=
4
;
}
if
(
!
(
x
&
0xc0000000u
))
{
x
<<=
2
;
r
-=
2
;
}
if
(
!
(
x
&
0x80000000u
))
{
x
<<=
1
;
r
-=
1
;
}
return
r
;
}
/**
* @brief returns the number of leading 0-bits in a,
* starting at the most significant bit position.
* If a is zero, the result is undefined.
*/
int
__attribute__
((
weak
))
__clzsi2
(
unsigned
int
a
);
int
__attribute__
((
weak
))
__clzsi2
(
unsigned
int
a
)
{
return
32
-
fls
(
a
);
}
EXPORT_SYMBOL
(
__clzsi2
);
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