Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
14f791ac
A
anbox
项目概览
openeuler
/
anbox
通知
24
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
anbox
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
14f791ac
编写于
8月 04, 2017
作者:
S
Simon Fels
提交者:
GitHub
8月 04, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #397 from morphis/f/update-binder-to-latest
binder: update to latest version and fix build on older kernels
上级
7036fc07
c77ca2a2
变更
4
展开全部
显示空白变更内容
内联
并排
Showing
4 changed file
with
943 addition
and
240 deletion
+943
-240
kernel/binder/Makefile
kernel/binder/Makefile
+1
-1
kernel/binder/binder.c
kernel/binder/binder.c
+828
-236
kernel/binder/binder.h
kernel/binder/binder.h
+101
-3
kernel/binder/deps.c
kernel/binder/deps.c
+13
-0
未找到文件。
kernel/binder/Makefile
浏览文件 @
14f791ac
ccflags-y
+=
-I
$(src)
-Wno-int-conversion
ccflags-y
+=
-I
$(src)
-Wno-int-conversion
-DCONFIG_ANDROID_BINDER_DEVICES
=
"
\"
binder
\"
"
obj-m
:=
binder_linux.o
binder_linux-y
:=
deps.o binder.o
...
...
kernel/binder/binder.c
浏览文件 @
14f791ac
此差异已折叠。
点击以展开。
kernel/binder/binder.h
浏览文件 @
14f791ac
...
...
@@ -33,6 +33,8 @@ enum {
BINDER_TYPE_HANDLE
=
B_PACK_CHARS
(
's'
,
'h'
,
'*'
,
B_TYPE_LARGE
),
BINDER_TYPE_WEAK_HANDLE
=
B_PACK_CHARS
(
'w'
,
'h'
,
'*'
,
B_TYPE_LARGE
),
BINDER_TYPE_FD
=
B_PACK_CHARS
(
'f'
,
'd'
,
'*'
,
B_TYPE_LARGE
),
BINDER_TYPE_FDA
=
B_PACK_CHARS
(
'f'
,
'd'
,
'a'
,
B_TYPE_LARGE
),
BINDER_TYPE_PTR
=
B_PACK_CHARS
(
'p'
,
't'
,
'*'
,
B_TYPE_LARGE
),
};
enum
{
...
...
@@ -48,6 +50,14 @@ typedef __u64 binder_size_t;
typedef
__u64
binder_uintptr_t
;
#endif
/**
* struct binder_object_header - header shared by all binder metadata objects.
* @type: type of the object
*/
struct
binder_object_header
{
__u32
type
;
};
/*
* This is the flattened representation of a Binder object for transfer
* between processes. The 'offsets' supplied as part of a binder transaction
...
...
@@ -56,8 +66,7 @@ typedef __u64 binder_uintptr_t;
* between processes.
*/
struct
flat_binder_object
{
/* 8 bytes for large_flat_header. */
__u32
type
;
struct
binder_object_header
hdr
;
__u32
flags
;
/* 8 bytes of data. */
...
...
@@ -70,6 +79,84 @@ struct flat_binder_object {
binder_uintptr_t
cookie
;
};
/**
* struct binder_fd_object - describes a filedescriptor to be fixed up.
* @hdr: common header structure
* @pad_flags: padding to remain compatible with old userspace code
* @pad_binder: padding to remain compatible with old userspace code
* @fd: file descriptor
* @cookie: opaque data, used by user-space
*/
struct
binder_fd_object
{
struct
binder_object_header
hdr
;
__u32
pad_flags
;
union
{
binder_uintptr_t
pad_binder
;
__u32
fd
;
};
binder_uintptr_t
cookie
;
};
/* struct binder_buffer_object - object describing a userspace buffer
* @hdr: common header structure
* @flags: one or more BINDER_BUFFER_* flags
* @buffer: address of the buffer
* @length: length of the buffer
* @parent: index in offset array pointing to parent buffer
* @parent_offset: offset in @parent pointing to this buffer
*
* A binder_buffer object represents an object that the
* binder kernel driver can copy verbatim to the target
* address space. A buffer itself may be pointed to from
* within another buffer, meaning that the pointer inside
* that other buffer needs to be fixed up as well. This
* can be done by setting the BINDER_BUFFER_FLAG_HAS_PARENT
* flag in @flags, by setting @parent buffer to the index
* in the offset array pointing to the parent binder_buffer_object,
* and by setting @parent_offset to the offset in the parent buffer
* at which the pointer to this buffer is located.
*/
struct
binder_buffer_object
{
struct
binder_object_header
hdr
;
__u32
flags
;
binder_uintptr_t
buffer
;
binder_size_t
length
;
binder_size_t
parent
;
binder_size_t
parent_offset
;
};
enum
{
BINDER_BUFFER_FLAG_HAS_PARENT
=
0x01
,
};
/* struct binder_fd_array_object - object describing an array of fds in a buffer
* @hdr: common header structure
* @num_fds: number of file descriptors in the buffer
* @parent: index in offset array to buffer holding the fd array
* @parent_offset: start offset of fd array in the buffer
*
* A binder_fd_array object represents an array of file
* descriptors embedded in a binder_buffer_object. It is
* different from a regular binder_buffer_object because it
* describes a list of file descriptors to fix up, not an opaque
* blob of memory, and hence the kernel needs to treat it differently.
*
* An example of how this would be used is with Android's
* native_handle_t object, which is a struct with a list of integers
* and a list of file descriptors. The native_handle_t struct itself
* will be represented by a struct binder_buffer_objct, whereas the
* embedded list of file descriptors is represented by a
* struct binder_fd_array_object with that binder_buffer_object as
* a parent.
*/
struct
binder_fd_array_object
{
struct
binder_object_header
hdr
;
binder_size_t
num_fds
;
binder_size_t
parent
;
binder_size_t
parent_offset
;
};
/*
* On 64-bit platforms where user code may run in 32-bits the driver must
* translate the buffer (and local binder) addresses appropriately.
...
...
@@ -162,6 +249,11 @@ struct binder_transaction_data {
}
data
;
};
struct
binder_transaction_data_sg
{
struct
binder_transaction_data
transaction_data
;
binder_size_t
buffers_size
;
};
struct
binder_ptr_cookie
{
binder_uintptr_t
ptr
;
binder_uintptr_t
cookie
;
...
...
@@ -346,6 +438,12 @@ enum binder_driver_command_protocol {
/*
* void *: cookie
*/
BC_TRANSACTION_SG
=
_IOW
(
'c'
,
17
,
struct
binder_transaction_data_sg
),
BC_REPLY_SG
=
_IOW
(
'c'
,
18
,
struct
binder_transaction_data_sg
),
/*
* binder_transaction_data_sg: the sent command.
*/
};
#endif
/* _UAPI_LINUX_BINDER_H */
...
...
kernel/binder/deps.c
浏览文件 @
14f791ac
...
...
@@ -6,9 +6,14 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/kallsyms.h>
#include <linux/version.h>
static
struct
vm_struct
*
(
*
get_vm_area_ptr
)(
unsigned
long
,
unsigned
long
)
=
NULL
;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
static
void
(
*
zap_page_range_ptr
)(
struct
vm_area_struct
*
,
unsigned
long
,
unsigned
long
)
=
NULL
;
#else
static
void
(
*
zap_page_range_ptr
)(
struct
vm_area_struct
*
,
unsigned
long
,
unsigned
long
,
struct
zap_details
*
)
=
NULL
;
#endif
static
int
(
*
map_kernel_range_noflush_ptr
)(
unsigned
long
start
,
unsigned
long
size
,
pgprot_t
prot
,
struct
page
**
pages
)
=
NULL
;
static
void
(
*
unmap_kernel_range_ptr
)(
unsigned
long
,
unsigned
long
)
=
NULL
;
static
struct
files_struct
*
(
*
get_files_struct_ptr
)(
struct
task_struct
*
)
=
NULL
;
...
...
@@ -30,11 +35,19 @@ struct vm_struct *get_vm_area(unsigned long size, unsigned long flags)
return
get_vm_area_ptr
(
size
,
flags
);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
void
zap_page_range
(
struct
vm_area_struct
*
vma
,
unsigned
long
address
,
unsigned
long
size
)
#else
void
zap_page_range
(
struct
vm_area_struct
*
vma
,
unsigned
long
address
,
unsigned
long
size
,
struct
zap_details
*
details
)
#endif
{
if
(
!
zap_page_range_ptr
)
zap_page_range_ptr
=
kallsyms_lookup_name
(
"zap_page_range"
);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
zap_page_range_ptr
(
vma
,
address
,
size
);
#else
zap_page_range_ptr
(
vma
,
address
,
size
,
details
);
#endif
}
int
map_kernel_range_noflush
(
unsigned
long
start
,
unsigned
long
size
,
pgprot_t
prot
,
struct
page
**
pages
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录