1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-20 10:17:05 +00:00

Correct LEAVE authorisation.

Failures: 1,207.
This commit is contained in:
Thomas Harte
2025-08-07 15:16:12 -04:00
parent 900195efac
commit 0882d2b7ce
3 changed files with 11 additions and 6 deletions
+4 -2
View File
@@ -224,11 +224,13 @@ void leave(
) {
// TODO: should use StackAddressSize to determine assignment of bp to sp.
if constexpr (std::is_same_v<IntT, uint32_t>) {
context.memory.preauthorise_read(Source::SS, context.registers.ebp(), sizeof(uint32_t));
context.registers.esp() = context.registers.ebp();
context.registers.ebp() = pop<uint32_t, false>(context);
context.registers.ebp() = pop<uint32_t, true>(context);
} else {
context.memory.preauthorise_read(Source::SS, context.registers.bp(), sizeof(uint16_t));
context.registers.sp() = context.registers.bp();
context.registers.bp() = pop<uint16_t, false>(context);
context.registers.bp() = pop<uint16_t, true>(context);
}
}
+6 -2
View File
@@ -152,8 +152,12 @@ public:
);
}
void preauthorise_read(InstructionSet::x86::Source, uint16_t, uint32_t) {}
void preauthorise_write(InstructionSet::x86::Source, uint16_t, uint32_t) {}
void preauthorise_read(const InstructionSet::x86::Source descriptor, const uint16_t offset, const uint32_t size) {
segments_.descriptors[descriptor].template authorise<InstructionSet::x86::AccessType::Read, uint16_t>(offset, offset + size);
}
void preauthorise_write(const InstructionSet::x86::Source descriptor, const uint16_t offset, const uint32_t size) {
segments_.descriptors[descriptor].template authorise<InstructionSet::x86::AccessType::Write, uint16_t>(offset, offset + size);
}
// TODO: perform authorisation checks.
@@ -56,7 +56,6 @@ NSSet *const allowList = [NSSet setWithArray:@[
// @"C6.json.gz",
// @"C7.json.gz",
// @"C8.json.gz", // ENTER
// @"C9.json.gz", // LEAVE
// @"CD.json.gz",
// @"CE.json.gz", // INTO
// @"D8.json.gz", // Various floating point
@@ -390,7 +389,7 @@ void apply_execution_test(
NSDictionary *metadata
) {
// NSLog(@"%@", test[@"hash"]);
if([test[@"hash"] isEqualToString:@"09bc7d2c7275af399dfbb532779b72e36920dc1f"]) {
if([test[@"hash"] isEqualToString:@"b16007339dbc7a5035f513f4d9ed56c3659ae040"]) {
printf("");
}