blob: 9f5e452fe6c49e56cb70d9b8120e8212b75e2eb2 [file] [log] [blame]
Nico Huberf03ef4f2017-03-04 13:57:09 +01001--
2-- Copyright (C) 2017 Nico Huber <nico.h@gmx.de>
3--
4-- This program is free software; you can redistribute it and/or modify
5-- it under the terms of the GNU General Public License as published by
6-- the Free Software Foundation; either version 2 of the License, or
7-- (at your option) any later version.
8--
9-- This program is distributed in the hope that it will be useful,
10-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-- GNU General Public License for more details.
13--
14
15package HW.File is
16
17 -- Map a file's content into our address space
18 --
19 -- If `Map_Copy` is `False`, `Len` bytes from the start of the file
20 -- given by `Path` shall be mapped into the application's address
21 -- space at `Addr` using mmap(). If `Map_Copy` is `True`, anonymous
22 -- memory should be mapped instead and be filled with a copy of the
23 -- file's content using read().
24 procedure Map
25 (Path : in String;
26 Addr : in Word64;
27 Len : in Natural;
28 Readable : in Boolean := False;
29 Writable : in Boolean := False;
30 Map_Copy : in Boolean := False;
31 Success : out Boolean)
32 with
33 Pre => (Readable or Writable) and
34 (if Map_Copy then Readable and not Writable);
35
36end HW.File;