44#include " BuildVersion.h"
55#include " Common.h"
66#include " Host.h"
7- #include " Memory.h"
87#include " Elfheader.h"
98#include " SaveState.h"
109#include " PINE.h"
1110#include " VMManager.h"
11+ #include " vtlb.h"
1212#include " common/Error.h"
1313#include " common/Threading.h"
1414
@@ -538,7 +538,8 @@ PINEServer::IPCBuffer PINEServer::ParseCommand(std::span<u8> buf, std::vector<u8
538538 if (!SafetyChecks (buf_cnt, 4 , ret_cnt, 1 , buf_size)) [[unlikely]]
539539 goto error;
540540 const u32 a = FromSpan<u32 >(buf, buf_cnt);
541- const u8 res = memRead8 (a);
541+ u8 res;
542+ vtlb_ramRead<mem8_t >(a, &res);
542543 ToResultVector (ret_buffer, res, ret_cnt);
543544 ret_cnt += 1 ;
544545 buf_cnt += 4 ;
@@ -551,7 +552,8 @@ PINEServer::IPCBuffer PINEServer::ParseCommand(std::span<u8> buf, std::vector<u8
551552 if (!SafetyChecks (buf_cnt, 4 , ret_cnt, 2 , buf_size)) [[unlikely]]
552553 goto error;
553554 const u32 a = FromSpan<u32 >(buf, buf_cnt);
554- const u16 res = memRead16 (a);
555+ u16 res;
556+ vtlb_ramRead<mem16_t >(a, &res);
555557 ToResultVector (ret_buffer, res, ret_cnt);
556558 ret_cnt += 2 ;
557559 buf_cnt += 4 ;
@@ -564,7 +566,8 @@ PINEServer::IPCBuffer PINEServer::ParseCommand(std::span<u8> buf, std::vector<u8
564566 if (!SafetyChecks (buf_cnt, 4 , ret_cnt, 4 , buf_size)) [[unlikely]]
565567 goto error;
566568 const u32 a = FromSpan<u32 >(buf, buf_cnt);
567- const u32 res = memRead32 (a);
569+ u32 res;
570+ vtlb_ramRead<mem32_t >(a, &res);
568571 ToResultVector (ret_buffer, res, ret_cnt);
569572 ret_cnt += 4 ;
570573 buf_cnt += 4 ;
@@ -577,7 +580,8 @@ PINEServer::IPCBuffer PINEServer::ParseCommand(std::span<u8> buf, std::vector<u8
577580 if (!SafetyChecks (buf_cnt, 4 , ret_cnt, 8 , buf_size)) [[unlikely]]
578581 goto error;
579582 const u32 a = FromSpan<u32 >(buf, buf_cnt);
580- const u64 res = memRead64 (a);
583+ u64 res;
584+ vtlb_ramRead<mem64_t >(a, &res);
581585 ToResultVector (ret_buffer, res, ret_cnt);
582586 ret_cnt += 8 ;
583587 buf_cnt += 4 ;
@@ -590,7 +594,7 @@ PINEServer::IPCBuffer PINEServer::ParseCommand(std::span<u8> buf, std::vector<u8
590594 if (!SafetyChecks (buf_cnt, 1 + 4 , ret_cnt, 0 , buf_size)) [[unlikely]]
591595 goto error;
592596 const u32 a = FromSpan<u32 >(buf, buf_cnt);
593- memWrite8 (a, FromSpan<u8 >(buf, buf_cnt + 4 ));
597+ vtlb_ramWrite< mem8_t > (a, FromSpan<u8 >(buf, buf_cnt + 4 ));
594598 buf_cnt += 5 ;
595599 break ;
596600 }
@@ -601,7 +605,7 @@ PINEServer::IPCBuffer PINEServer::ParseCommand(std::span<u8> buf, std::vector<u8
601605 if (!SafetyChecks (buf_cnt, 2 + 4 , ret_cnt, 0 , buf_size)) [[unlikely]]
602606 goto error;
603607 const u32 a = FromSpan<u32 >(buf, buf_cnt);
604- memWrite16 (a, FromSpan<u16 >(buf, buf_cnt + 4 ));
608+ vtlb_ramWrite< mem16_t > (a, FromSpan<u16 >(buf, buf_cnt + 4 ));
605609 buf_cnt += 6 ;
606610 break ;
607611 }
@@ -612,7 +616,7 @@ PINEServer::IPCBuffer PINEServer::ParseCommand(std::span<u8> buf, std::vector<u8
612616 if (!SafetyChecks (buf_cnt, 4 + 4 , ret_cnt, 0 , buf_size)) [[unlikely]]
613617 goto error;
614618 const u32 a = FromSpan<u32 >(buf, buf_cnt);
615- memWrite32 (a, FromSpan<u32 >(buf, buf_cnt + 4 ));
619+ vtlb_ramWrite< mem32_t > (a, FromSpan<u32 >(buf, buf_cnt + 4 ));
616620 buf_cnt += 8 ;
617621 break ;
618622 }
@@ -623,7 +627,7 @@ PINEServer::IPCBuffer PINEServer::ParseCommand(std::span<u8> buf, std::vector<u8
623627 if (!SafetyChecks (buf_cnt, 8 + 4 , ret_cnt, 0 , buf_size)) [[unlikely]]
624628 goto error;
625629 const u32 a = FromSpan<u32 >(buf, buf_cnt);
626- memWrite64 (a, FromSpan<u64 >(buf, buf_cnt + 4 ));
630+ vtlb_ramWrite< mem64_t > (a, FromSpan<u64 >(buf, buf_cnt + 4 ));
627631 buf_cnt += 12 ;
628632 break ;
629633 }
0 commit comments