Use Genode's memcpy in L4Linux block driver

This commit is contained in:
Stefan Kalkowski 2013-06-26 12:03:25 +02:00
parent 276dbdab60
commit cfa3d38417
4 changed files with 60 additions and 2 deletions

View File

@ -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_

View File

@ -8,6 +8,7 @@ SRC_CC += env.cc \
genode_input.cc \
genode_net.cc \
genode_terminal.cc \
genode_string.cc \
l4_io.cc \
l4_log.cc \
l4_re_c_dataspace.cc \

View File

@ -27,6 +27,7 @@
/* Genode support library includes */
#include <genode/block.h>
#include <genode/string.h>
#include <l4/log/log.h>
enum Geometry {
@ -113,7 +114,7 @@ static void genode_blk_request(struct request_queue *q)
rq_for_each_segment(bvec, req, iter) {
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;
}
}
@ -136,7 +137,7 @@ genode_end_request(void *request, short write,
rq_for_each_segment(bvec, req, iter) {
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;
}
}

View File

@ -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);
}