Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase memory access page alignment checking to 8KB instead of 4KB #100

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions src/cpu_defs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,15 +424,32 @@ inline u64 fsqrt64(u64 asig, s32 exp) {

#define ALIGN_PHYS(a) (phys_address & ~((u64)((a)-1)))

/* Increase memory access page alignment checking to 8KB instead of
4KB, 8KB minimum on AXP. Potentially should be dynamic in future,
resolves OpenVMS installation problems. Source:
https://www.openvmshobbyist.com/forum/viewthread.php?forum_id=161&thread_id=2801

https://github.com/gdwnldsKSC/es40/commit/dad191fb2f279164122654aba6da53acc1040d97
*/

#define DATA_PHYS(addr, flags, align) \
if ((addr) & (align)) { \
u64 a1 = (addr); \
u64 a2 = (addr) + (align); \
if ((a1 ^ a2) & ~U64(0x1fff)) /*page boundary crossed*/ \
pbc = true; \
if ((a1 ^ a2) & ~U64(0x1fff)) /* 8K page boundary crossed*/ \
{ \
state.fault_va = addr; \
state.exc_sum = ((REG_1 &0x1f) << 8); \
state.mm_stat = (I_GETOP(ins) << 4) | ((flags & ACCESS_WRITE) ? 1 : 0); \
printf("unaligned addess %d, %d -> trap! ",flags,align); \
printf("exc_sum = 0x%04" PRId64 "x, fault_va = 0x%016" PRId64 \
"x, mm_stat = 0x%03" PRId64 "x.\n",state.exc_sum, state.fault_va, \
state.mm_stat); \
GO_PAL(UNALIGN); \
return; \
} \
} \
if (virt2phys(addr, &phys_address, flags, NULL, ins)) \
return;
DATA_PHYS_NT(addr, flags) // use the define above instead of duplicating

/**
* Normal variant of read action
Expand Down
Loading