1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-08-05 08:26:28 +00:00

Switch to construct and copy.

This commit is contained in:
Thomas Harte
2025-03-29 17:27:29 -04:00
parent a7eab8df22
commit 69d4d8acb0
3 changed files with 13 additions and 9 deletions

View File

@@ -22,14 +22,9 @@ struct DescriptorTablePointer {
};
struct Descriptor {
void set_segment(const uint16_t segment) {
base_ = uint32_t(segment) << 4;
limit_ = 0xffff;
Descriptor() = default;
present_ = true;
}
void set(const uint16_t descriptor[4]) {
Descriptor(const uint16_t descriptor[4]) noexcept {
base_ = uint32_t(descriptor[1] | ((descriptor[2] & 0xff) << 16));
limit_ = descriptor[0];
@@ -54,6 +49,13 @@ struct Descriptor {
}
}
void set_segment(const uint16_t segment) {
base_ = uint32_t(segment) << 4;
limit_ = 0xffff;
present_ = true;
}
uint32_t to_linear(const uint32_t address) const {
return base_ + address;
}

View File

@@ -962,7 +962,7 @@ using namespace PCCompatible;
namespace {
#ifndef NDEBUG
static constexpr bool ForceAT = false;//true;
static constexpr bool ForceAT = true;
#else
static constexpr bool ForceAT = false;
#endif

View File

@@ -69,6 +69,8 @@ public:
memory_.template access<uint16_t, AccessType::Read>(table_address + 6, table_end)
};
const Descriptor incoming(entry);
// TODO: is this descriptor privilege within reach?
// TODO: is this an empty descriptor*? If so: exception!
// (* other than the 0 descriptor, which can be loaded to DS or ES)
@@ -80,7 +82,7 @@ public:
// CS: any sort of code
// }
descriptors[segment].set(entry);
descriptors[segment] = incoming;
// TODO: set descriptor accessed bit in memory if it's a segment.
} break;
}