source: trunk/src/win32k/mmf/mmf.cpp

Last change on this file was 5259, checked in by bird, 25 years ago

Updated method.

File size: 3.0 KB
Line 
1/* $Id: mmf.cpp,v 1.2 2001-02-24 04:37:15 bird Exp $
2 *
3 * Memory Mapped Files.
4 *
5 * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
6 *
7 * Project Odin Software License can be found in LICENSE.TXT
8 *
9 */
10
11/** @design Memory Mapped Files - Ring 0
12
13Support for Memory Mapped Files (MMF) is an excellent feature missing in OS/2.
14Several Ring-3 implementations exists. Most of them have problems when calling
15OS/2 APIs. APIs like DosRead, DosWrite will at Ring-0 check if the buffer
16passed in is valid (all pages commited), and will fail if the pages aren't
17commited. And AFAIK the Ring-3 MMF implementations exploits the commit/decommit
18feature of DosSetMem.<p>
19
20So, the only way to get this right and fast is to implement it at Ring-0 level.
21This is what I (knut) aim to do some day. These are my current thoughts on
22the subject. (Oct 31 2000 5:39pm)<p>
23
24What I am think about is to create a Ring-0 class for MMF which maintains all
25of the MMF handling. There will be a Ring-3 DLL which provides APIs which
26uses IOCtls to communicate with the Ring-0 class. These APIs will be presented
27in these forms:
28<ul>
29 <li>My own "native" APIs.
30 <li>UNIX mmap, munmap, msync APIs
31 <li>Win32 styled APIs. (if needed)
32</ul><p>
33
34
35@subsection Loader Exploits (Overloads)
36
37The Ring-0 part will create pseudo MTEs for each file handle given in the
38openmapping call. These MTEs will not be linked into the mte list, but will
39be linked into a private MMF list. By doing it this way we'll be able to use
40the LDRGetPage function without overloading it. We just have to feed the
41loader with valid pagelists.<p>
42
43We'll have to do cleanups of this internal MTEs by overloading LDRFreeTask.<p>
44
45Objects are allocated by us self using ldrAllocObjects and ldrSetVMFlags will
46be overloaded to set the correct flags.
47
48
49@subsubsection LDRFreeTask
50
51Here we'll clean up all our resources associated with this process. I am not
52quite sure what this will be; flushing mappings, decreasing usage counts,
53eventually releasing objects, closing files.
54
55
56@subsubsection ldrAllocObjects
57
58Here we could attach inherited mappings. Not really needed.
59
60
61
62@subsection Interface Ring-0 to Ring-3
63
64An interface between Ring-0 and Ring-3 will have to be as simple as possible,
65and yet the Ring-0 would not trust the Ring-3 very much since someone may
66call the DosIOCtls them selves. These are the proposed interfaces:
67<ul>
68 <li>MMFCreating - Create a mapping handle.
69 <li>MMFDuplicate - Duplicates a mapping handle.
70 <li>MMFOpen - Open an existing mapping.
71 <li>MMFViewMap - Creates a view for a part of the file.
72 <li>MMFViewUnmap - Flushes and destroys a view.
73 <li>MMFViewSync - Flush a view.
74</ul>
75This will roughly be the exported "native" APIs too.
76
77@subsubsection MMFCreating
78@subsubsection MMFDuplicate
79@subsubsection MMFOpen
80@subsubsection MMFViewMap
81@subsubsection MMFViewUnmap
82@subsubsection MMFViewSync
83
84
85@subsection Innerworkings of the Ring-0 MMF class(es)
86
87To be written some other day.
88
89 */
90
91
Note: See TracBrowser for help on using the repository browser.