let check_access ptable page_nb = let entry = entry_address ptable page_nb in match mode_of_int memory.(entry) with | UN -> raise (Page_fault page_nb) (* unallocated *) | _ -> ();; (* write access *) let get ptable address = let page_nb = address / page_size in check_access ptable page_nb; let offset = address mod page_size in let entry = entry_address ptable page_nb in let real_address = memory.(entry+1) * page_size + offset in memory.(real_address);; let set ptable address v = let page_nb = address / page_size in check_access ptable page_nb; let offset = address mod page_size in let entry = entry_address ptable page_nb in let real_address = memory.(entry+1) * page_size + offset in memory.(real_address) <- v;; |