aboutsummaryrefslogtreecommitdiff
path: root/riscv/cfg.h
blob: bee505111b7384d26c2bace44d9f0543fc908775 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// See LICENSE for license details.
#ifndef _RISCV_CFG_H
#define _RISCV_CFG_H

#include "decode.h"

template <typename T>
class cfg_arg_t {
public:
  cfg_arg_t(T default_val)
    : value(default_val), was_set(false) {}

  bool overridden() const { return was_set; }

  T operator()() const { return value; }

  T operator=(const T v) {
    value = v;
    was_set = true;
    return value;
  }

private:
  T value;
  bool was_set;
};

class cfg_t
{
public:
  cfg_t(std::pair<reg_t, reg_t> default_initrd_bounds)
    : initrd_bounds(default_initrd_bounds)
  {}

  cfg_arg_t<std::pair<reg_t, reg_t>> initrd_bounds;
};

#endif