Use Genode's memcpy in L4Linux block driver
This commit is contained in:
parent
276dbdab60
commit
cfa3d38417
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* \brief Genode C API string related functions
|
||||||
|
* \author Stefan Kalkowski
|
||||||
|
* \date 2013-06-26
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2013 Genode Labs GmbH
|
||||||
|
*
|
||||||
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
|
* under the terms of the GNU General Public License version 2.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _INCLUDE__GENODE__STRING_H_
|
||||||
|
#define _INCLUDE__GENODE__STRING_H_
|
||||||
|
|
||||||
|
#include <l4/sys/compiler.h>
|
||||||
|
|
||||||
|
#include <genode/linkage.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
L4_CV void genode_memcpy(void* dst, void *src, unsigned long size);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif //_INCLUDE__GENODE__STRING_H_
|
|
@ -8,6 +8,7 @@ SRC_CC += env.cc \
|
||||||
genode_input.cc \
|
genode_input.cc \
|
||||||
genode_net.cc \
|
genode_net.cc \
|
||||||
genode_terminal.cc \
|
genode_terminal.cc \
|
||||||
|
genode_string.cc \
|
||||||
l4_io.cc \
|
l4_io.cc \
|
||||||
l4_log.cc \
|
l4_log.cc \
|
||||||
l4_re_c_dataspace.cc \
|
l4_re_c_dataspace.cc \
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
/* Genode support library includes */
|
/* Genode support library includes */
|
||||||
#include <genode/block.h>
|
#include <genode/block.h>
|
||||||
|
#include <genode/string.h>
|
||||||
#include <l4/log/log.h>
|
#include <l4/log/log.h>
|
||||||
|
|
||||||
enum Geometry {
|
enum Geometry {
|
||||||
|
@ -113,7 +114,7 @@ static void genode_blk_request(struct request_queue *q)
|
||||||
|
|
||||||
rq_for_each_segment(bvec, req, iter) {
|
rq_for_each_segment(bvec, req, iter) {
|
||||||
void *buffer = page_address(bvec->bv_page) + bvec->bv_offset;
|
void *buffer = page_address(bvec->bv_page) + bvec->bv_offset;
|
||||||
memcpy((void*)ptr, buffer, bvec->bv_len);
|
genode_memcpy((void*)ptr, buffer, bvec->bv_len);
|
||||||
ptr += bvec->bv_len;
|
ptr += bvec->bv_len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,7 +137,7 @@ genode_end_request(void *request, short write,
|
||||||
|
|
||||||
rq_for_each_segment(bvec, req, iter) {
|
rq_for_each_segment(bvec, req, iter) {
|
||||||
void *buffer = page_address(bvec->bv_page) + bvec->bv_offset;
|
void *buffer = page_address(bvec->bv_page) + bvec->bv_offset;
|
||||||
memcpy(buffer, (void*)ptr, bvec->bv_len);
|
genode_memcpy(buffer, (void*)ptr, bvec->bv_len);
|
||||||
ptr += bvec->bv_len;
|
ptr += bvec->bv_len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* \brief Genode C API string API
|
||||||
|
* \author Stefan Kalkowski
|
||||||
|
* \date 2013-06-26
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2013 Genode Labs GmbH
|
||||||
|
*
|
||||||
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
|
* under the terms of the GNU General Public License version 2.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <util/string.h>
|
||||||
|
|
||||||
|
namespace Fiasco {
|
||||||
|
#include <genode/string.h>
|
||||||
|
}
|
||||||
|
using namespace Fiasco;
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void genode_memcpy(void *dst, void *src, unsigned long size)
|
||||||
|
{
|
||||||
|
Genode::memcpy(dst, src, size);
|
||||||
|
}
|
Loading…
Reference in New Issue