Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
va_list-rs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
redox-os
va_list-rs
Commits
952bf100
Commit
952bf100
authored
Mar 06, 2018
by
Dan Robertson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support aarch64
Add support for Aarch64.
parent
b0e8415c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
0 deletions
+81
-0
src/impl-aarch64-elf.rs
src/impl-aarch64-elf.rs
+76
-0
src/lib.rs
src/lib.rs
+5
-0
No files found.
src/impl-aarch64-elf.rs
0 → 100644
View file @
952bf100
use
std
::{
mem
,
ptr
};
use
super
::
VaPrimitive
;
pub
struct
VaList
(
*
mut
VaListInner
);
#[repr(C)]
#[derive(Debug)]
#[doc(hidden)]
pub
struct
VaListInner
{
stack
:
*
const
(),
gr_top
:
*
const
(),
vr_top
:
*
const
(),
gr_offs
:
i32
,
vr_offs
:
i32
,
}
impl
VaList
{
fn
inner
(
&
mut
self
)
->
&
mut
VaListInner
{
// This pointer should be valid
unsafe
{
&
mut
*
self
.0
}
}
}
impl
VaListInner
{
pub
unsafe
fn
get_gr
<
T
>
(
&
mut
self
)
->
T
{
assert
!
(
!
self
.gr_top
.is_null
());
let
rv
=
ptr
::
read
((
self
.gr_top
as
usize
-
self
.gr_offs
.abs
()
as
usize
)
as
*
const
_
);
self
.gr_offs
+=
8
;
rv
}
pub
unsafe
fn
get_vr
<
T
>
(
&
mut
self
)
->
T
{
assert
!
(
!
self
.vr_top
.is_null
());
let
rv
=
ptr
::
read
((
self
.vr_top
as
usize
-
self
.vr_offs
.abs
()
as
usize
)
as
*
const
_
);
self
.vr_offs
+=
16
;
rv
}
}
impl
<
T
:
'static
>
VaPrimitive
for
*
const
T
{
unsafe
fn
get
(
list
:
&
mut
VaList
)
->
Self
{
<
usize
>
::
get
(
list
)
as
*
const
T
}
}
macro_rules!
impl_va_prim_gr
{
(
$u
:
ty
,
$s
:
ty
)
=>
{
impl
VaPrimitive
for
$u
{
unsafe
fn
get
(
list
:
&
mut
VaList
)
->
Self
{
list
.inner
()
.get_gr
()
}
}
impl
VaPrimitive
for
$s
{
unsafe
fn
get
(
list
:
&
mut
VaList
)
->
Self
{
mem
::
transmute
(
<
$u
>
::
get
(
list
))
}
}
};
}
macro_rules!
impl_va_prim_vr
{
(
$
(
$t:ty
),
+
)
=>
{
$
(
impl
VaPrimitive
for
$t
{
unsafe
fn
get
(
list
:
&
mut
VaList
)
->
Self
{
list
.inner
()
.get_vr
()
}
}
)
+
};
}
impl_va_prim_gr!
{
usize
,
isize
}
impl_va_prim_gr!
{
u64
,
i64
}
impl_va_prim_gr!
{
u32
,
i32
}
impl_va_prim_vr!
{
f64
,
f32
}
src/lib.rs
View file @
952bf100
...
...
@@ -59,6 +59,11 @@ mod imp;
#[path
=
"impl-x86-sysv.rs"
]
mod
imp
;
// aarch64
#[cfg(all(target_arch
=
"aarch64"
,
any(target_family
=
"unix"
,
target_os
=
"redox"
)))]
#[path
=
"impl-aarch64-elf.rs"
]
mod
imp
;
// arm+unix = cdecl
#[cfg(all(target_arch
=
"arm"
,
target_family
=
"unix"
))]
#[path
=
"impl-arm-sysv.rs"
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment