diff --git a/mem/memory.go b/mem/memory.go index ccf1f6f..eeb97c4 100644 --- a/mem/memory.go +++ b/mem/memory.go @@ -41,12 +41,12 @@ func (m *memory) AccessPage(pid string, address int) (int, bool) { displacement = m.PageSize } - for _, page := range m.pages { + for pageFrame, page := range m.pages { if page.pid == pid && page.virtualAddress == pageNumber { if m.policy.LRU { // incrementar } - realAddress := page.virtualAddress*m.PageSize + displacement + realAddress := pageFrame*m.PageSize + displacement return realAddress, true } }