FreeNOS
ProcessShares.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Niek Linnenbank
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 3 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 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __KERNEL_PROCESSSHARES_H
19#define __KERNEL_PROCESSSHARES_H
20
21#include <Types.h>
22#include <Macros.h>
23#include <List.h>
24#include <MemoryMap.h>
25#include <Index.h>
26
27class MemoryChannel;
28class MemoryContext;
29class Process;
30
40{
41 private:
42
44 static const Size MaximumMemoryShares = 32u;
45
46 public:
47
65
76
81
85 virtual ~ProcessShares();
86
90 const ProcessID getProcessID() const;
91
98
107
112 MemoryShare *share);
113
126 Size coreId,
127 Size tagId,
128 Address virt,
129 Size size);
130
138 Result readShare(MemoryShare *share);
139
148
149 private:
150
159 Result releaseShare(MemoryShare *share, Size idx);
160
170 MemoryShare * findShare(const ProcessID pid,
171 const Size coreId,
172 const Size tagId);
173
174 private:
175
178
181
184};
185
190#endif /* __KERNEL_PROCESSSHARES_H */
u8 coreId
Definition IntelACPI.h:1
Index is a N-sized array of pointers to items of type T.
Definition Index.h:37
Unidirectional point-to-point channel using shared memory.
Virtual memory abstract interface.
Manages memory shares for a Process.
const ProcessID getProcessID() const
Get process.
Result readShare(MemoryShare *share)
Read memory share by Process, Core and Tag IDs.
Result setMemoryContext(MemoryContext *context)
Set MemoryContext.
static const Size MaximumMemoryShares
Maximum number of memory shares that a single process can have.
Result createShare(ProcessShares &instance, MemoryShare *share)
ProcessID m_pid
ProcessID associated to these shares.
MemoryShare * findShare(const ProcessID pid, const Size coreId, const Size tagId)
Retrieve MemoryShare object.
MemoryContext * m_memory
MemoryContext instance.
Result releaseShare(MemoryShare *share, Size idx)
Release one memory share.
virtual ~ProcessShares()
Destructor function.
Result removeShares(ProcessID pid)
Remove all shares for the given ProcessID.
MemoryContext * getMemoryContext()
Get MemoryContext object.
Index< MemoryShare, MaximumMemoryShares > m_shares
Contains all memory shares.
Represents a process which may run on the host.
Definition Process.h:45
u32 ProcessID
Process Identification Number.
Definition Types.h:140
unsigned long Address
A memory address.
Definition Types.h:131
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128
Memory range.
Definition Memory.h:56
bool attached
True if the share is attached (used by both processes)
ProcessID pid
Remote process id for this share.
Size tagId
Share tag id is defined by the application.
Memory::Range range
Physical memory address range.
Size coreId
CoreId for the other process.