0
|
1 |
// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// e32\include\kernel\klib.h
|
|
15 |
// General library functions used by kernel-side code
|
|
16 |
//
|
|
17 |
// WARNING: This file contains some APIs which are internal and are subject
|
|
18 |
// to change without notice. Such APIs should therefore not be used
|
|
19 |
// outside the Kernel and Hardware Services package.
|
|
20 |
//
|
|
21 |
|
|
22 |
|
|
23 |
#ifndef __KLIB_H__
|
|
24 |
#define __KLIB_H__
|
|
25 |
#include <e32cmn.h>
|
|
26 |
#include <u32std.h>
|
|
27 |
#include <nklib.h>
|
|
28 |
#include <kernel/kbma.h>
|
|
29 |
|
|
30 |
//#ifndef __E32STD_H__
|
|
31 |
|
|
32 |
class DBase
|
|
33 |
/**
|
|
34 |
A base class for classes that are to be instantiated on the kernel heap.
|
|
35 |
|
|
36 |
The class provides kernel-side behaviour equivalent to that provided by the
|
|
37 |
user side class CBase, i.e it zero-fills memory prior to object construction,
|
|
38 |
and provides a virtual destructor. It also offers the additional ability to
|
|
39 |
trigger asynchronous deletion of the object, which is important in
|
|
40 |
time-critical code.
|
|
41 |
|
|
42 |
@see CBase
|
|
43 |
|
|
44 |
@publishedPartner
|
|
45 |
@released
|
|
46 |
*/
|
|
47 |
{
|
|
48 |
public:
|
|
49 |
inline DBase()
|
|
50 |
/**
|
|
51 |
Default constructor.
|
|
52 |
*/
|
|
53 |
{}
|
|
54 |
/**
|
|
55 |
Destructor.
|
|
56 |
|
|
57 |
Allows any derived object to be deleted through a DBase* pointer.
|
|
58 |
*/
|
|
59 |
inline virtual ~DBase()=0;
|
|
60 |
IMPORT_C static void Delete(DBase* aPtr);
|
|
61 |
IMPORT_C void AsyncDelete();
|
|
62 |
inline TAny* operator new(TUint aSize, TAny *aBase) __NO_THROW;
|
|
63 |
IMPORT_C TAny* operator new(TUint aSize) __NO_THROW;
|
|
64 |
IMPORT_C TAny* operator new(TUint aSize,TUint anExtraSize) __NO_THROW;
|
|
65 |
private:
|
|
66 |
DBase(const DBase&);
|
|
67 |
DBase& operator=(const DBase&);
|
|
68 |
public:
|
|
69 |
/**
|
|
70 |
The pointer to the next DBase object to be deleted
|
|
71 |
asynchronously. The queue of DBase objects is anchored
|
|
72 |
in K::AsyncDeleteHead.
|
|
73 |
|
|
74 |
@internalComponent
|
|
75 |
*/
|
|
76 |
DBase* iAsyncDeleteNext;
|
|
77 |
};
|
|
78 |
|
|
79 |
inline DBase::~DBase()
|
|
80 |
{}
|
|
81 |
|
|
82 |
class HBuf8 : public TBufBase8
|
|
83 |
/**
|
|
84 |
An 8-bit kernel-side heap descriptor whose data can be modified.
|
|
85 |
|
|
86 |
This is a descriptor class, which provides a fixed length buffer for
|
|
87 |
containing and accessing data, and is allocated on the kernel heap, .
|
|
88 |
|
|
89 |
The class intended for instantiation. The 8-bit data that the descriptor
|
|
90 |
represents is part of the descriptor object itself.
|
|
91 |
|
|
92 |
Heap descriptors have the important property that they can be made larger or
|
|
93 |
smaller, changing the size of the data area. This is achieved by explicitly
|
|
94 |
reallocating the descriptor. Note that reallocation is not done automatically.
|
|
95 |
|
|
96 |
@publishedPartner
|
|
97 |
@released
|
|
98 |
*/
|
|
99 |
{
|
|
100 |
public:
|
|
101 |
IMPORT_C static HBuf8* New(TInt aMaxLength);
|
|
102 |
IMPORT_C static HBuf8* New(const TDesC8& aDes);
|
|
103 |
IMPORT_C HBuf8* ReAlloc(TInt aNewMax);
|
|
104 |
private:
|
|
105 |
inline HBuf8(TInt aMaxLength)
|
|
106 |
: TBufBase8(aMaxLength) {}
|
|
107 |
};
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
/**
|
|
113 |
Build-independent heap descriptor.
|
|
114 |
|
|
115 |
@see HBuf8
|
|
116 |
|
|
117 |
@publishedPartner
|
|
118 |
@released
|
|
119 |
*/
|
|
120 |
typedef HBuf8 HBuf;
|
|
121 |
|
|
122 |
/** Kernel library static class
|
|
123 |
|
|
124 |
@internalComponent
|
|
125 |
*/
|
|
126 |
class KL
|
|
127 |
{
|
|
128 |
public:
|
|
129 |
enum TKernLibPanic
|
|
130 |
{
|
|
131 |
EInt32DivideByZero=0,
|
|
132 |
EInt64DivideByZero=1,
|
|
133 |
EPureCall=2,
|
|
134 |
EInvalidRadix=3,
|
|
135 |
EInvalidWidth=4,
|
|
136 |
ETDes16BadDescriptorType=7,
|
|
137 |
ETDes16LengthOutOfRange=8,
|
|
138 |
ETDes16IndexOutOfRange=9,
|
|
139 |
ETDes16PosOutOfRange=10,
|
|
140 |
ETDes16Overflow=11,
|
|
141 |
ETDes16BadFormatDescriptor=12,
|
|
142 |
ETDes16BadFormatParams=13,
|
|
143 |
ETDes16ReAllocTooSmall=14,
|
|
144 |
ETDes16RemoteBadDescriptorType=15,
|
|
145 |
ETDes16RemoteLengthOutOfRange=16,
|
|
146 |
ETDes16LengthNegative=17,
|
|
147 |
ETDes16MaxLengthNegative=18,
|
|
148 |
ETDes8BadDescriptorType=19,
|
|
149 |
ETDes8LengthOutOfRange=20,
|
|
150 |
ETDes8IndexOutOfRange=21,
|
|
151 |
ETDes8PosOutOfRange=22,
|
|
152 |
ETDes8Overflow=23,
|
|
153 |
ETDes8BadFormatDescriptor=24,
|
|
154 |
ETDes8BadFormatParams=25,
|
|
155 |
ETDes8ReAllocTooSmall=26,
|
|
156 |
ETDes8RemoteBadDescriptorType=27,
|
|
157 |
ETDes8RemoteLengthOutOfRange=28,
|
|
158 |
ETDes8LengthNegative=29,
|
|
159 |
ETDes8MaxLengthNegative=30,
|
|
160 |
EMemLeftNegative=88,
|
|
161 |
EMemRightNegative=89,
|
|
162 |
EMemCopyLengthNegative=90,
|
|
163 |
EWordMoveLengthNotMultipleOf4=91,
|
|
164 |
EWordMoveSourceNotAligned=92,
|
|
165 |
EWordMoveTargetNotAligned=93,
|
|
166 |
EMemFillLengthNegative=95,
|
|
167 |
EBadArrayGranularity=127,
|
|
168 |
EBadArrayKeyOffset=128,
|
|
169 |
EBadArrayEntrySize=129,
|
|
170 |
EBadArrayIndex=130,
|
|
171 |
EBadArrayPosition=131,
|
|
172 |
};
|
|
173 |
public:
|
|
174 |
static void Panic(TKernLibPanic aFault);
|
|
175 |
};
|
|
176 |
|
|
177 |
|
|
178 |
#ifdef __EPOC32__
|
|
179 |
extern "C" {
|
|
180 |
/**
|
|
181 |
@publishedPartner
|
|
182 |
@released
|
|
183 |
|
|
184 |
Reads the current thread's memory space with appropriate permissions.
|
|
185 |
|
|
186 |
Performs a memcpy(aKernAddr, aAddr, aLength). If the current thread is a
|
|
187 |
user thread (determined by spsr_svc) the reads are performed with user
|
|
188 |
permissions.
|
|
189 |
|
|
190 |
Note that source and destination areas may not overlap.
|
|
191 |
|
|
192 |
@param aKernAddr Destination address in kernel memory.
|
|
193 |
@param aAddr Source address in kernel or user memory.
|
|
194 |
@param aLength Number of bytes to copy.
|
|
195 |
|
|
196 |
@pre Call in a thread context.
|
|
197 |
@pre Kernel must be unlocked.
|
|
198 |
@pre Calling thread must not be in a critical section. If the calling thread
|
|
199 |
is in a critical section then Kern::ThreadRawRead() may be used with
|
|
200 |
the aThread parameter set to the current thread. However, when using
|
|
201 |
Kern::ThreadRawRead() memory may be accessed with more restrictive
|
|
202 |
permissions than with kumemget.
|
|
203 |
|
|
204 |
@see Kern::ThreadRawRead()
|
|
205 |
@see Kern::CurrentThread()
|
|
206 |
*/
|
|
207 |
// Note - Kernel code can call this function when in a critical section by using
|
|
208 |
// the internal XTRAP API.
|
|
209 |
IMPORT_C void kumemget(TAny* aKernAddr, const TAny* aAddr, TInt aLength);
|
|
210 |
|
|
211 |
|
|
212 |
|
|
213 |
|
|
214 |
/**
|
|
215 |
@publishedPartner
|
|
216 |
@released
|
|
217 |
|
|
218 |
Does a word-aligned read of the current thread's memory space with appropriate permissions.
|
|
219 |
|
|
220 |
Performs a memcpy(aKernAddr, aAddr, aLength). If the current thread is a
|
|
221 |
user thread (determined by spsr_svc) the reads are performed with user permissions.
|
|
222 |
Note that source and destination areas may not overlap.
|
|
223 |
|
|
224 |
@param aKernAddr Destination address in kernel memory, must be 4-byte aligned.
|
|
225 |
@param aAddr Source address in kernel or user memory, must be 4-byte aligned.
|
|
226 |
@param aLength Number of bytes to copy, must be a multiple of 4.
|
|
227 |
|
|
228 |
@pre Call in a thread context.
|
|
229 |
@pre Kernel must be unlocked.
|
|
230 |
@pre Calling thread must not be in a critical section. If the calling thread
|
|
231 |
is in a critical section then Kern::ThreadRawRead() may be used with
|
|
232 |
the aThread parameter set to the current thread. However, when using
|
|
233 |
Kern::ThreadRawRead() memory may be accessed with more restrictive
|
|
234 |
permissions than with kumemget32.
|
|
235 |
|
|
236 |
@see Kern::ThreadRawRead()
|
|
237 |
@see Kern::CurrentThread()
|
|
238 |
*/
|
|
239 |
// Note - Kernel code can call this function when in a critical section by using
|
|
240 |
// the internal XTRAP API.
|
|
241 |
IMPORT_C void kumemget32(TAny* aKernAddr, const TAny* aAddr, TInt aLength);
|
|
242 |
|
|
243 |
|
|
244 |
|
|
245 |
|
|
246 |
/**
|
|
247 |
@publishedPartner
|
|
248 |
@released
|
|
249 |
|
|
250 |
Writes to the current thread's memory space with appropriate permissions.
|
|
251 |
|
|
252 |
Performs a memcpy(aAddr, aKernAddr, aLength). If the current thread is a
|
|
253 |
user thread (determined by spsr_svc) the writes are performed with user permissions.
|
|
254 |
Note that source and destination areas may not overlap.
|
|
255 |
|
|
256 |
@param aAddr Destination address in kernel or user memory.
|
|
257 |
@param aKernAddr Source address in kernel memory.
|
|
258 |
@param aLength Number of bytes to copy.
|
|
259 |
|
|
260 |
@pre Call in a thread context.
|
|
261 |
@pre Kernel must be unlocked.
|
|
262 |
@pre Calling thread must not be in a critical section. If the calling thread
|
|
263 |
is in a critical section then Kern::ThreadRawWrite() may be used with
|
|
264 |
the aThread parameter set to the current thread. However, when using
|
|
265 |
Kern::ThreadRawWrite() memory may be accessed with more restrictive
|
|
266 |
permissions than with kumemput.
|
|
267 |
|
|
268 |
@see Kern::ThreadRawWrite()
|
|
269 |
@see Kern::CurrentThread()
|
|
270 |
*/
|
|
271 |
// Note - Kernel code can call this function when in a critical section by using
|
|
272 |
// the internal XTRAP API.
|
|
273 |
IMPORT_C void kumemput(TAny* aAddr, const TAny* aKernAddr, TInt aLength);
|
|
274 |
|
|
275 |
|
|
276 |
|
|
277 |
|
|
278 |
/**
|
|
279 |
@publishedPartner
|
|
280 |
@released
|
|
281 |
|
|
282 |
Does a word-aligned write to the current thread's memory space with appropriate permissions.
|
|
283 |
|
|
284 |
Performs a memcpy(aAddr, aKernAddr, aLength). If the current thread is a
|
|
285 |
user thread (determined by spsr_svc) the writes are performed with user permissions.
|
|
286 |
Note that source and destination areas may not overlap.
|
|
287 |
|
|
288 |
@param aAddr Destination address in kernel or user memory, must be 4-byte aligned.
|
|
289 |
@param aKernAddr Source address in kernel memory, must be 4-byte aligned.
|
|
290 |
@param aLength Number of bytes to copy, must be a multiple of 4.
|
|
291 |
|
|
292 |
@pre Call in a thread context.
|
|
293 |
@pre Kernel must be unlocked.
|
|
294 |
@pre Calling thread must not be in a critical section. If the calling thread
|
|
295 |
is in a critical section then Kern::ThreadRawWrite() may be used with
|
|
296 |
the aThread parameter set to the current thread. However, when using
|
|
297 |
Kern::ThreadRawWrite() memory may be accessed with more restrictive
|
|
298 |
permissions than with kumemput32.
|
|
299 |
|
|
300 |
@see Kern::ThreadRawWrite()
|
|
301 |
@see Kern::CurrentThread()
|
|
302 |
*/
|
|
303 |
// Note - Kernel code can call this function when in a critical section by using
|
|
304 |
// the internal XTRAP API.
|
|
305 |
IMPORT_C void kumemput32(TAny* aAddr, const TAny* aKernAddr, TInt aLength);
|
|
306 |
|
|
307 |
|
|
308 |
|
|
309 |
|
|
310 |
/**
|
|
311 |
@publishedPartner
|
|
312 |
@released
|
|
313 |
|
|
314 |
Fills the current thread's memory space with appropriate permissions.
|
|
315 |
|
|
316 |
Performs a memset(aAddr, aValue, aLength). If the current thread is a
|
|
317 |
user thread (determined by spsr_svc) the writes are performed with user permissions.
|
|
318 |
|
|
319 |
@param aAddr Destination address in kernel or user memory.
|
|
320 |
@param aValue Value to write to each byte.
|
|
321 |
@param aLength Number of bytes to fill.
|
|
322 |
|
|
323 |
@pre Call in a thread context.
|
|
324 |
@pre Kernel must be unlocked.
|
|
325 |
@pre Calling thread must not be in a critical section. If the calling thread
|
|
326 |
is in a critical section then Kern::ThreadRawWrite() may be used with
|
|
327 |
the aThread parameter set to the current thread. However, when using
|
|
328 |
Kern::ThreadRawWrite() memory may be accessed with more restrictive
|
|
329 |
permissions than with kumemset.
|
|
330 |
|
|
331 |
@see Kern::ThreadRawWrite()
|
|
332 |
@see Kern::CurrentThread()
|
|
333 |
*/
|
|
334 |
// Note - Kernel code can call this function when in a critical section by using
|
|
335 |
// the internal XTRAP API.
|
|
336 |
IMPORT_C void kumemset(TAny* aAddr, const TUint8 aValue, TInt aLength);
|
|
337 |
|
|
338 |
|
|
339 |
|
|
340 |
|
|
341 |
/**
|
|
342 |
@publishedPartner
|
|
343 |
@released
|
|
344 |
|
|
345 |
Reads the current thread's memory space with user permissions.
|
|
346 |
|
|
347 |
Performs a memcpy(aKernAddr, aUserAddr, aLength).
|
|
348 |
The reads are performed with user permissions.
|
|
349 |
Note that source and destination areas may not overlap.
|
|
350 |
|
|
351 |
@param aKernAddr Destination address in kernel memory.
|
|
352 |
@param aUserAddr Source address in user memory.
|
|
353 |
@param aLength Number of bytes to copy.
|
|
354 |
|
|
355 |
@pre Call in a thread context.
|
|
356 |
@pre Kernel must be unlocked.
|
|
357 |
@pre Calling thread must not be in a critical section. If the calling thread
|
|
358 |
is in a critical section then Kern::ThreadRawRead() may be used with
|
|
359 |
the aThread parameter set to the current thread. However, when using
|
|
360 |
Kern::ThreadRawRead() memory may be accessed with less restrictive
|
|
361 |
permissions than with umemget.
|
|
362 |
|
|
363 |
@see Kern::ThreadRawRead()
|
|
364 |
@see Kern::CurrentThread()
|
|
365 |
*/
|
|
366 |
// Note - Kernel code can call this function when in a critical section by using
|
|
367 |
// the internal XTRAP API.
|
|
368 |
IMPORT_C void umemget(TAny* aKernAddr, const TAny* aUserAddr, TInt aLength);
|
|
369 |
|
|
370 |
|
|
371 |
|
|
372 |
|
|
373 |
/**
|
|
374 |
@publishedPartner
|
|
375 |
@released
|
|
376 |
|
|
377 |
Does a word-aligned read of the current thread's memory space with user permissions.
|
|
378 |
|
|
379 |
Performs a memcpy(aKernAddr, aUserAddr, aLength).
|
|
380 |
The reads are performed with user permissions.
|
|
381 |
Note that source and destination areas may not overlap.
|
|
382 |
|
|
383 |
@param aKernAddr Destination address in kernel memory, must be 4-byte aligned.
|
|
384 |
@param aUserAddr Source address in user memory, must be 4-byte aligned.
|
|
385 |
@param aLength Number of bytes to copy, must be a multiple of 4.
|
|
386 |
|
|
387 |
@pre Call in a thread context.
|
|
388 |
@pre Kernel must be unlocked.
|
|
389 |
@pre Calling thread must not be in a critical section. If the calling thread
|
|
390 |
is in a critical section then Kern::ThreadRawRead() may be used with
|
|
391 |
the aThread parameter set to the current thread. However, when using
|
|
392 |
Kern::ThreadRawRead() memory may be accessed with less restrictive
|
|
393 |
permissions than with umemget32.
|
|
394 |
|
|
395 |
@see Kern::ThreadRawRead()
|
|
396 |
@see Kern::CurrentThread()
|
|
397 |
*/
|
|
398 |
// Note - Kernel code can call this function when in a critical section by using
|
|
399 |
// the internal XTRAP API.
|
|
400 |
IMPORT_C void umemget32(TAny* aKernAddr, const TAny* aUserAddr, TInt aLength);
|
|
401 |
|
|
402 |
|
|
403 |
|
|
404 |
|
|
405 |
/**
|
|
406 |
@publishedPartner
|
|
407 |
@released
|
|
408 |
|
|
409 |
Writes to the current thread's memory space with user permissions.
|
|
410 |
|
|
411 |
Performs a memcpy(aAddr, aKernAddr, aLength).
|
|
412 |
The writes are performed with user permissions.
|
|
413 |
Note that source and destination areas may not overlap.
|
|
414 |
|
|
415 |
@param aUserAddr Destination address in user memory.
|
|
416 |
@param aKernAddr Source address in kernel memory.
|
|
417 |
@param aLength Number of bytes to copy.
|
|
418 |
|
|
419 |
@pre Call in a thread context.
|
|
420 |
@pre Kernel must be unlocked.
|
|
421 |
@pre Calling thread must not be in a critical section. If the calling thread
|
|
422 |
is in a critical section then Kern::ThreadRawWrite() may be used with
|
|
423 |
the aThread parameter set to the current thread. However, when using
|
|
424 |
Kern::ThreadRawWrite() memory may be accessed with less restrictive
|
|
425 |
permissions than with umemput.
|
|
426 |
|
|
427 |
@see Kern::ThreadRawWrite()
|
|
428 |
@see Kern::CurrentThread()
|
|
429 |
*/
|
|
430 |
// Note - Kernel code can call this function when in a critical section by using
|
|
431 |
// the internal XTRAP API.
|
|
432 |
IMPORT_C void umemput(TAny* aUserAddr, const TAny* aKernAddr, TInt aLength);
|
|
433 |
|
|
434 |
|
|
435 |
|
|
436 |
|
|
437 |
/**
|
|
438 |
@publishedPartner
|
|
439 |
@released
|
|
440 |
|
|
441 |
Does a word-aligned write to the current thread's memory space with user permissions.
|
|
442 |
|
|
443 |
Performs a memcpy(aAddr, aKernAddr, aLength).
|
|
444 |
The writes are performed with user permissions.
|
|
445 |
Note that source and destination areas may not overlap.
|
|
446 |
|
|
447 |
@param aUserAddr Destination address in user memory, must be 4-byte aligned.
|
|
448 |
@param aKernAddr Source address in kernel memory, must be 4-byte aligned.
|
|
449 |
@param aLength Number of bytes to copy, must be a multiple of 4.
|
|
450 |
|
|
451 |
@pre Call in a thread context.
|
|
452 |
@pre Kernel must be unlocked.
|
|
453 |
@pre Calling thread must not be in a critical section. If the calling thread
|
|
454 |
is in a critical section then Kern::ThreadRawWrite() may be used with
|
|
455 |
the aThread parameter set to the current thread. However, when using
|
|
456 |
Kern::ThreadRawWrite() memory may be accessed with less restrictive
|
|
457 |
permissions than with umemput32.
|
|
458 |
|
|
459 |
@see Kern::ThreadRawWrite()
|
|
460 |
@see Kern::CurrentThread()
|
|
461 |
*/
|
|
462 |
// Note - Kernel code can call this function when in a critical section by using
|
|
463 |
// the internal XTRAP API.
|
|
464 |
IMPORT_C void umemput32(TAny* aUserAddr, const TAny* aKernAddr, TInt aLength);
|
|
465 |
|
|
466 |
|
|
467 |
|
|
468 |
|
|
469 |
/**
|
|
470 |
@publishedPartner
|
|
471 |
@released
|
|
472 |
|
|
473 |
Fills the current thread's memory space with user permissions.
|
|
474 |
|
|
475 |
Performs a memset(aUserAddr, aValue, aLength).
|
|
476 |
The writes are performed with user permissions.
|
|
477 |
|
|
478 |
@param aUserAddr Destination address in user memory.
|
|
479 |
@param aValue Value to write to each byte.
|
|
480 |
@param aLength Number of bytes to fill.
|
|
481 |
|
|
482 |
@pre Call in a thread context.
|
|
483 |
@pre Kernel must be unlocked.
|
|
484 |
@pre Calling thread must not be in a critical section. If the calling thread
|
|
485 |
is in a critical section then Kern::ThreadRawWrite() may be used with
|
|
486 |
the aThread parameter set to the current thread. However, when using
|
|
487 |
Kern::ThreadRawWrite() memory may be accessed with less restrictive
|
|
488 |
permissions than with umemset.
|
|
489 |
|
|
490 |
@see Kern::ThreadRawWrite()
|
|
491 |
@see Kern::CurrentThread()
|
|
492 |
*/
|
|
493 |
// Note - Kernel code can call this function when in a critical section by using
|
|
494 |
// the internal XTRAP API.
|
|
495 |
IMPORT_C void umemset(TAny* aUserAddr, const TUint8 aValue, TInt aLength);
|
|
496 |
|
|
497 |
/**
|
|
498 |
@internalComponent
|
|
499 |
|
|
500 |
Performs a a word aligned memcpy(aUserDst, aUserSrc, aLength).
|
|
501 |
Both reads and writes are performed with user permissions.
|
|
502 |
Note that source and destination areas may not overlap.
|
|
503 |
|
|
504 |
@param aUserDst Destination address in user memory. (Must be word aligned.)
|
|
505 |
@param aUserSrc Source address in kernel memory. (Must be word aligned.)
|
|
506 |
@param aLength Number of bytes to copy. (Must be a multiple of 4.)
|
|
507 |
|
|
508 |
@pre Call in a thread context.
|
|
509 |
@pre Kernel must be unlocked.
|
|
510 |
@pre Must be called under an XTRAP harness, or calling thread must not be
|
|
511 |
in a critical section.
|
|
512 |
*/
|
|
513 |
void uumemcpy32(TAny* aUserDst, const TAny* aUserSrc, TInt aLength);
|
|
514 |
|
|
515 |
/**
|
|
516 |
@internalComponent
|
|
517 |
|
|
518 |
Performs a memcpy(aUserDst, aUserSrc, aLength).
|
|
519 |
Both reads and writes are performed with user permissions.
|
|
520 |
Note that source and destination areas may not overlap.
|
|
521 |
|
|
522 |
@param aUserDst Destination address in user memory.
|
|
523 |
@param aUserSrc Source address in kernel memory.
|
|
524 |
@param aLength Number of bytes to copy.
|
|
525 |
|
|
526 |
@pre Call in a thread context.
|
|
527 |
@pre Kernel must be unlocked.
|
|
528 |
@pre Must be called under an XTRAP harness, or calling thread must not be
|
|
529 |
in a critical section.
|
|
530 |
*/
|
|
531 |
void uumemcpy(TAny* aUserDst, const TAny* aUserSrc, TInt aLength);
|
|
532 |
|
|
533 |
}
|
|
534 |
#else
|
|
535 |
inline void kumemget(TAny* aKernAddr, const TAny* aAddr, TInt aLength)
|
|
536 |
{memcpy(aKernAddr,aAddr,aLength);}
|
|
537 |
inline void kumemget32(TAny* aKernAddr, const TAny* aAddr, TInt aLength)
|
|
538 |
{memcpy(aKernAddr,aAddr,aLength);}
|
|
539 |
inline void kumemput(TAny* aAddr, const TAny* aKernAddr, TInt aLength)
|
|
540 |
{memcpy(aAddr,aKernAddr,aLength);}
|
|
541 |
inline void kumemput32(TAny* aAddr, const TAny* aKernAddr, TInt aLength)
|
|
542 |
{memcpy(aAddr,aKernAddr,aLength);}
|
|
543 |
inline void kumemset(TAny* aAddr, const TUint8 aValue, TInt aLength)
|
|
544 |
{memset(aAddr,aValue,aLength);}
|
|
545 |
inline void umemget(TAny* aKernAddr, const TAny* aUserAddr, TInt aLength)
|
|
546 |
{memcpy(aKernAddr,aUserAddr,aLength);}
|
|
547 |
inline void umemget32(TAny* aKernAddr, const TAny* aUserAddr, TInt aLength)
|
|
548 |
{memcpy(aKernAddr,aUserAddr,aLength);}
|
|
549 |
inline void umemput(TAny* aUserAddr, const TAny* aKernAddr, TInt aLength)
|
|
550 |
{memcpy(aUserAddr,aKernAddr,aLength);}
|
|
551 |
inline void umemput32(TAny* aUserAddr, const TAny* aKernAddr, TInt aLength)
|
|
552 |
{memcpy(aUserAddr,aKernAddr,aLength);}
|
|
553 |
inline void umemset(TAny* aUserAddr, const TUint8 aValue, TInt aLength)
|
|
554 |
{memset(aUserAddr,aValue,aLength);}
|
|
555 |
inline void uumemcpy(TAny* aUserDst, const TAny* aUserSrc, TInt aLength)
|
|
556 |
{memcpy(aUserDst,aUserSrc,aLength);}
|
|
557 |
inline void uumemcpy32(TAny* aUserDst, const TAny* aUserSrc, TInt aLength)
|
|
558 |
{memcpy(aUserDst,aUserSrc,aLength);}
|
|
559 |
#endif
|
|
560 |
|
|
561 |
/**
|
|
562 |
@internalComponent
|
|
563 |
|
|
564 |
A utility function that copies 2^n bytes of 2^n-byte aligned memory.
|
|
565 |
|
|
566 |
@param aTrg The target address (must be 2^n-aligned)
|
|
567 |
@param aSrc The source address (must be 2^n-aligned)
|
|
568 |
@param aPower Bytes to copy, as 2^n, minimum 2^6
|
|
569 |
*/
|
|
570 |
extern "C" void fastcpy(TAny* aTrg, const TAny* aSrc, TUint8 aPower);
|
|
571 |
|
|
572 |
/**
|
|
573 |
@publishedPartner
|
|
574 |
@released
|
|
575 |
|
|
576 |
A utility function that copies 4KB of 4KB-aligned memory.
|
|
577 |
|
|
578 |
@param aTrg The target address (must be 4KB-aligned)
|
|
579 |
@param aSrc The source address (must be 4KB-aligned)
|
|
580 |
*/
|
|
581 |
extern "C" IMPORT_C void pagecpy(TAny* aTrg, const TAny* aSrc);
|
|
582 |
|
|
583 |
/**
|
|
584 |
@publishedPartner
|
|
585 |
@released
|
|
586 |
*/
|
|
587 |
extern "C" IMPORT_C TInt memicmp(const TAny* aLeft, const TAny* aRight, TUint aLength);
|
|
588 |
|
|
589 |
inline TAny* DBase::operator new(TUint aSize, TAny* aBase) __NO_THROW
|
|
590 |
/**
|
|
591 |
Allocates the object from the kernel heap at a specified location, and then
|
|
592 |
initialises its contents to binary zeroes.
|
|
593 |
|
|
594 |
@param aSize The size of the derived class. This parameter is specified
|
|
595 |
implicitly by C++ in all circumstances in which a derived
|
|
596 |
class is allocated.
|
|
597 |
@param aBase Indicates a base address which is returned as the object's
|
|
598 |
address.
|
|
599 |
|
|
600 |
@return An untyped pointer to the allocated object.
|
|
601 |
@publishedPartner
|
|
602 |
@released
|
|
603 |
*/
|
|
604 |
{memclr(aBase,aSize); return aBase;}
|
|
605 |
|
|
606 |
//#endif
|
|
607 |
#endif
|