The Pedigree Project 0.1
IoBase.cc
1/*
2 * Copyright (c) 2008-2014, Pedigree Developers
3 *
4 * Please see the CONTRIB file in the root of the source tree for a full
5 * list of contributors.
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#include "pedigree/kernel/processor/IoBase.h"
21
22IoBase::IoBase() = default;
23IoBase::~IoBase() = default;
24
25uint64_t IoBase::read64LowFirst(size_t offset) {
26 uint64_t low = read32(offset);
27 uint64_t high = read32(offset + 4);
28 return low | (high << 32);
29}
30
31uint64_t IoBase::read64HighFirst(size_t offset) {
32 uint64_t high = read32(offset + 4);
33 uint64_t low = read32(offset);
34 return low | (high << 32);
35}
36
37void IoBase::write64LowFirst(uint64_t value, size_t offset) {
38 write32(value & 0xFFFFFFFF, offset);
39 write32(value >> 32, offset + 4);
40}
41
42void IoBase::write64HighFirst(uint64_t value, size_t offset) {
43 write32(value >> 32, offset + 4);
44 write32(value & 0xFFFFFFFF, offset);
45}
void write64LowFirst(uint64_t value, size_t offset=0)
Definition IoBase.cc:37
virtual ~IoBase()
virtual void write32(uint32_t value, size_t offset=0)=0
void write64HighFirst(uint64_t value, size_t offset=0)
Definition IoBase.cc:42
uint64_t read64HighFirst(size_t offset=0)
Definition IoBase.cc:31
virtual uint32_t read32(size_t offset=0)=0
uint64_t read64LowFirst(size_t offset=0)
Definition IoBase.cc:25