gem5  v22.1.0.0
shared_memory_server.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2022 Google, Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met: redistributions of source code must retain the above copyright
7  * notice, this list of conditions and the following disclaimer;
8  * redistributions in binary form must reproduce the above copyright
9  * notice, this list of conditions and the following disclaimer in the
10  * documentation and/or other materials provided with the distribution;
11  * neither the name of the copyright holders nor the names of its
12  * contributors may be used to endorse or promote products derived from
13  * this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef __MEM_SHARED_MEMORY_SERVER_HH__
29 #define __MEM_SHARED_MEMORY_SERVER_HH__
30 
31 #include <memory>
32 #include <string>
33 #include <unordered_map>
34 
35 #include "base/pollevent.hh"
36 #include "params/SharedMemoryServer.hh"
37 #include "sim/sim_object.hh"
38 #include "sim/system.hh"
39 
40 namespace gem5
41 {
42 namespace memory
43 {
44 
46 {
47  public:
48  enum class RequestType : int
49  {
50  kGetPhysRange = 0,
51  };
52 
53  explicit SharedMemoryServer(const SharedMemoryServerParams& params);
55 
56  private:
57  class BaseShmPollEvent : public PollEvent
58  {
59  public:
60  BaseShmPollEvent(int fd, SharedMemoryServer* shm_server);
61 
62  const std::string& name() const;
63 
64  protected:
65  bool tryReadAll(void* buffer, size_t size);
66 
68  std::string eventName;
69  };
70 
72  {
73  public:
75  void process(int revent) override;
76  };
77 
79  {
80  public:
82  void process(int revent) override;
83  };
84 
85  std::string unixSocketPath;
87 
88  int serverFd;
89  std::unique_ptr<ListenSocketEvent> listenSocketEvent;
90  std::unordered_map<int, std::unique_ptr<ClientSocketEvent>>
92 };
93 
94 } // namespace memory
95 } // namespace gem5
96 
97 #endif // __MEM_SHARED_MEMORY_SERVER_HH__
Abstract superclass for simulation objects.
Definition: sim_object.hh:148
BaseShmPollEvent(int fd, SharedMemoryServer *shm_server)
SharedMemoryServer(const SharedMemoryServerParams &params)
std::unique_ptr< ListenSocketEvent > listenSocketEvent
std::unordered_map< int, std::unique_ptr< ClientSocketEvent > > clientSocketEvents
const Params & params() const
Definition: sim_object.hh:176
Bitfield< 14, 12 > fd
Definition: types.hh:150
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: mem.h:38

Generated on Wed Dec 21 2022 10:22:39 for gem5 by doxygen 1.9.1