Home | History | Annotate | Download | only in lib
      1 #pragma once
      2 /*
      3  * Copyright (C) 2018 The Android Open Source Project
      4  *
      5  * Licensed under the Apache License, Version 2.0 (the "License");
      6  * you may not use this file except in compliance with the License.
      7  * You may obtain a copy of the License at
      8  *
      9  *      http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 
     18 #include <stdint.h>
     19 
     20 #include <vector>
     21 
     22 namespace vsoc {
     23 
     24 class VSoCRegionLayout {
     25  public:
     26   virtual const char* region_name() const = 0;
     27   virtual const char* managed_by() const = 0;
     28 
     29   virtual size_t layout_size() const = 0;
     30   virtual int guest_to_host_signal_table_log_size() const = 0;
     31   virtual int host_to_guest_signal_table_log_size() const = 0;
     32  protected:
     33   VSoCRegionLayout() = default;
     34   virtual ~VSoCRegionLayout() = default;
     35 };
     36 
     37 class VSoCMemoryLayout {
     38  public:
     39   // Returns a pointer to the memory layout singleton.
     40   static VSoCMemoryLayout* Get();
     41 
     42   VSoCMemoryLayout(const VSoCMemoryLayout&) = delete;
     43   VSoCMemoryLayout(VSoCMemoryLayout&&) = delete;
     44 
     45   virtual std::vector<const VSoCRegionLayout *> GetRegions() const = 0;
     46   virtual const VSoCRegionLayout* GetRegionByName(
     47       const char* region_name) const = 0;
     48  protected:
     49   VSoCMemoryLayout() = default;
     50   virtual ~VSoCMemoryLayout() = default;
     51 };
     52 
     53 }  // namespace vsoc
     54