Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
athornton committed Apr 28, 2024
1 parent b74f1ad commit 663391f
Showing 1 changed file with 21 additions and 4 deletions.
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

0 comments on commit 663391f

Please sign in to comment.