1 |
706 |
jeremybenn |
------------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- GNAT RUN-TIME COMPONENTS --
|
4 |
|
|
-- --
|
5 |
|
|
-- S Y S T E M . M E M O R Y _ C O P Y --
|
6 |
|
|
-- --
|
7 |
|
|
-- S p e c --
|
8 |
|
|
-- --
|
9 |
|
|
-- Copyright (C) 2001-2009 Free Software Foundation, Inc. --
|
10 |
|
|
-- --
|
11 |
|
|
-- This specification is derived from the Ada Reference Manual for use with --
|
12 |
|
|
-- GNAT. The copyright notice above, and the license provisions that follow --
|
13 |
|
|
-- apply solely to the contents of the part following the private keyword. --
|
14 |
|
|
-- --
|
15 |
|
|
-- GNAT is free software; you can redistribute it and/or modify it under --
|
16 |
|
|
-- terms of the GNU General Public License as published by the Free Soft- --
|
17 |
|
|
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
18 |
|
|
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
19 |
|
|
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
20 |
|
|
-- or FITNESS FOR A PARTICULAR PURPOSE. --
|
21 |
|
|
-- --
|
22 |
|
|
-- As a special exception under Section 7 of GPL version 3, you are granted --
|
23 |
|
|
-- additional permissions described in the GCC Runtime Library Exception, --
|
24 |
|
|
-- version 3.1, as published by the Free Software Foundation. --
|
25 |
|
|
-- --
|
26 |
|
|
-- You should have received a copy of the GNU General Public License and --
|
27 |
|
|
-- a copy of the GCC Runtime Library Exception along with this program; --
|
28 |
|
|
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
|
29 |
|
|
-- <http://www.gnu.org/licenses/>. --
|
30 |
|
|
-- --
|
31 |
|
|
-- GNAT was originally developed by the GNAT team at New York University. --
|
32 |
|
|
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
33 |
|
|
-- --
|
34 |
|
|
------------------------------------------------------------------------------
|
35 |
|
|
|
36 |
|
|
-- This package provides general block copy mechanisms analogous to those
|
37 |
|
|
-- provided by the C routines memcpy and memmove allowing for copies with
|
38 |
|
|
-- and without possible overlap of the operands.
|
39 |
|
|
|
40 |
|
|
-- The idea is to allow a configurable run-time to provide this capability
|
41 |
|
|
-- for use by the compiler without dragging in C-run time routines.
|
42 |
|
|
|
43 |
|
|
with System.CRTL;
|
44 |
|
|
-- The above with is contrary to the intent ???
|
45 |
|
|
|
46 |
|
|
package System.Memory_Copy is
|
47 |
|
|
pragma Preelaborate;
|
48 |
|
|
|
49 |
|
|
procedure memcpy (S1 : Address; S2 : Address; N : System.CRTL.size_t)
|
50 |
|
|
renames System.CRTL.memcpy;
|
51 |
|
|
-- Copies N storage units from area starting at S2 to area starting
|
52 |
|
|
-- at S1 without any check for buffer overflow. The memory areas
|
53 |
|
|
-- must not overlap, or the result of this call is undefined.
|
54 |
|
|
|
55 |
|
|
procedure memmove (S1 : Address; S2 : Address; N : System.CRTL.size_t)
|
56 |
|
|
renames System.CRTL.memmove;
|
57 |
|
|
-- Copies N storage units from area starting at S2 to area starting
|
58 |
|
|
-- at S1 without any check for buffer overflow. The difference between
|
59 |
|
|
-- this memmove and memcpy is that with memmove, the storage areas may
|
60 |
|
|
-- overlap (forwards or backwards) and the result is correct (i.e. it
|
61 |
|
|
-- is as if S2 is first moved to a temporary area, and then this area
|
62 |
|
|
-- is copied to S1 in a separate step).
|
63 |
|
|
|
64 |
|
|
-- In the standard library, these are just interfaced to the C routines.
|
65 |
|
|
-- But in the HI-E (high integrity version) they may be reprogrammed to
|
66 |
|
|
-- meet certification requirements (and marked High_Integrity).
|
67 |
|
|
|
68 |
|
|
-- Note that in high integrity mode these routines are by default not
|
69 |
|
|
-- available, and the HI-E compiler will as a result generate implicit
|
70 |
|
|
-- loops (which will violate the restriction No_Implicit_Loops).
|
71 |
|
|
|
72 |
|
|
end System.Memory_Copy;
|