Refactor FourCC magic uses

- Use new fourcc_t type
- Improves compiler compatibility by removing multi chars
This commit is contained in:
Joel Linn
2021-05-06 18:46:43 +02:00
committed by Rick Gibbed
parent 4daa3f5a52
commit a86d7173e1
25 changed files with 65 additions and 42 deletions

View File

@@ -432,12 +432,12 @@ void Processor::LowerIrql(Irql old_value) {
}
bool Processor::Save(ByteStream* stream) {
stream->Write('PROC');
stream->Write(kProcessorSaveSignature);
return true;
}
bool Processor::Restore(ByteStream* stream) {
if (stream->Read<uint32_t>() != 'PROC') {
if (stream->Read<uint32_t>() != kProcessorSaveSignature) {
XELOGE("Processor::Restore - Invalid magic value!");
return false;
}

View File

@@ -34,6 +34,8 @@ DECLARE_bool(debug);
namespace xe {
namespace cpu {
constexpr fourcc_t kProcessorSaveSignature = make_fourcc("PROC");
class Breakpoint;
class StackWalker;
class XexModule;

View File

@@ -899,9 +899,9 @@ bool XexModule::Load(const std::string_view name, const std::string_view path,
const void* xex_addr, size_t xex_length) {
auto src_header = reinterpret_cast<const xex2_header*>(xex_addr);
if (src_header->magic == 'XEX1') {
if (src_header->magic == kXEX1Signature) {
xex_format_ = kFormatXex1;
} else if (src_header->magic == 'XEX2') {
} else if (src_header->magic == kXEX2Signature) {
xex_format_ = kFormatXex2;
} else {
return false;

View File

@@ -25,6 +25,10 @@ class KernelState;
namespace xe {
namespace cpu {
constexpr fourcc_t kXEX1Signature = make_fourcc("XEX1");
constexpr fourcc_t kXEX2Signature = make_fourcc("XEX2");
constexpr fourcc_t kElfSignature = make_fourcc(0x7F, 'E', 'L', 'F');
class Runtime;
class XexModule : public xe::cpu::Module {