2014-02-24 16:27:22 +01:00
|
|
|
/*
|
|
|
|
* \brief Generic page flags
|
|
|
|
* \author Stefan Kalkowski
|
|
|
|
* \date 2014-02-24
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 13:23:52 +01:00
|
|
|
* Copyright (C) 2014-2017 Genode Labs GmbH
|
2014-02-24 16:27:22 +01:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 13:23:52 +01:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2014-02-24 16:27:22 +01:00
|
|
|
*/
|
|
|
|
|
2017-02-21 13:46:59 +01:00
|
|
|
#ifndef _SRC__LIB__HW__PAGE_FLAGS_H_
|
|
|
|
#define _SRC__LIB__HW__PAGE_FLAGS_H_
|
2014-02-24 16:27:22 +01:00
|
|
|
|
2014-06-19 16:37:31 +02:00
|
|
|
#include <base/cache.h>
|
2016-11-03 14:49:23 +01:00
|
|
|
#include <base/output.h>
|
2014-06-19 16:37:31 +02:00
|
|
|
|
2017-02-21 13:46:59 +01:00
|
|
|
namespace Hw {
|
2016-11-07 18:00:24 +01:00
|
|
|
|
|
|
|
enum Writeable { RO, RW };
|
|
|
|
enum Executeable { NO_EXEC, EXEC };
|
|
|
|
enum Privileged { USER, KERN };
|
|
|
|
enum Global { NO_GLOBAL, GLOBAL };
|
|
|
|
enum Type { RAM, DEVICE };
|
|
|
|
|
|
|
|
struct Page_flags;
|
|
|
|
}
|
2016-11-03 14:49:23 +01:00
|
|
|
|
2017-02-21 13:46:59 +01:00
|
|
|
struct Hw::Page_flags
|
2014-02-24 16:27:22 +01:00
|
|
|
{
|
2017-02-21 13:46:59 +01:00
|
|
|
Writeable writeable;
|
|
|
|
Executeable executable;
|
|
|
|
Privileged privileged;
|
|
|
|
Global global;
|
|
|
|
Type type;
|
|
|
|
Genode::Cache_attribute cacheable;
|
2016-11-03 14:49:23 +01:00
|
|
|
|
2017-02-21 13:46:59 +01:00
|
|
|
void print(Genode::Output & out) const
|
2014-02-24 16:27:22 +01:00
|
|
|
{
|
2016-11-03 14:49:23 +01:00
|
|
|
using Genode::print;
|
2017-02-21 13:46:59 +01:00
|
|
|
using namespace Genode;
|
2016-11-03 14:49:23 +01:00
|
|
|
|
2016-11-07 18:00:24 +01:00
|
|
|
print(out, (writeable == RW) ? "writeable, " : "readonly, ",
|
|
|
|
(executable ==EXEC) ? "exec, " : "noexec, ");
|
|
|
|
if (privileged == KERN) print(out, "privileged, ");
|
|
|
|
if (global == GLOBAL) print(out, "global, ");
|
|
|
|
if (type == DEVICE) print(out, "iomem, ");
|
2016-11-03 14:49:23 +01:00
|
|
|
switch (cacheable) {
|
2016-11-07 18:00:24 +01:00
|
|
|
case UNCACHED: print(out, "uncached"); break;
|
|
|
|
case CACHED: print(out, "cached"); break;
|
|
|
|
case WRITE_COMBINED: print(out, "write-combined"); break;
|
2016-11-03 14:49:23 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
2014-02-24 16:27:22 +01:00
|
|
|
|
2016-11-07 18:00:24 +01:00
|
|
|
|
2017-02-21 13:46:59 +01:00
|
|
|
namespace Hw {
|
2016-11-07 18:00:24 +01:00
|
|
|
static constexpr Page_flags PAGE_FLAGS_KERN_IO
|
2017-08-30 11:59:35 +02:00
|
|
|
{ RW, NO_EXEC, KERN, GLOBAL, DEVICE, Genode::UNCACHED };
|
2016-11-07 18:00:24 +01:00
|
|
|
static constexpr Page_flags PAGE_FLAGS_KERN_DATA
|
2017-08-30 11:59:35 +02:00
|
|
|
{ RW, EXEC, KERN, GLOBAL, RAM, Genode::CACHED };
|
2016-11-07 18:00:24 +01:00
|
|
|
static constexpr Page_flags PAGE_FLAGS_KERN_TEXT
|
2017-08-30 11:59:35 +02:00
|
|
|
{ RW, EXEC, KERN, GLOBAL, RAM, Genode::CACHED };
|
2016-11-07 18:00:24 +01:00
|
|
|
static constexpr Page_flags PAGE_FLAGS_KERN_EXCEP
|
2017-08-30 11:59:35 +02:00
|
|
|
{ RW, EXEC, KERN, GLOBAL, RAM, Genode::CACHED };
|
2016-11-07 18:00:24 +01:00
|
|
|
static constexpr Page_flags PAGE_FLAGS_UTCB
|
2017-08-30 11:59:35 +02:00
|
|
|
{ RW, NO_EXEC, USER, NO_GLOBAL, RAM, Genode::CACHED };
|
2016-11-07 18:00:24 +01:00
|
|
|
}
|
|
|
|
|
2017-02-21 13:46:59 +01:00
|
|
|
#endif /* _SRC__LIB__HW__PAGE_FLAGS_H_ */
|