unsigned pt_access, unsigned pte_access,
                         int user_fault, int write_fault, int dirty,
                         int *ptwrite, int largepage, gfn_t gfn,
-                        struct page *page)
+                        struct page *page, bool speculative)
 {
        u64 spte;
        int was_rmapped = 0;
         * demand paging).
         */
        spte = PT_PRESENT_MASK | PT_DIRTY_MASK;
+       if (!speculative)
+               pte_access |= PT_ACCESSED_MASK;
        if (!dirty)
                pte_access &= ~ACC_WRITE_MASK;
        if (!(pte_access & ACC_EXEC_MASK))
 
                if (level == 1) {
                        mmu_set_spte(vcpu, &table[index], ACC_ALL, ACC_ALL,
-                                    0, write, 1, &pt_write, 0, gfn, page);
+                                    0, write, 1, &pt_write, 0, gfn, page, false);
                        return pt_write;
                }
 
                if (largepage && level == 2) {
                        mmu_set_spte(vcpu, &table[index], ACC_ALL, ACC_ALL,
-                                   0, write, 1, &pt_write, 1, gfn, page);
+                                    0, write, 1, &pt_write, 1, gfn, page, false);
                        return pt_write;
                }
 
 
        get_page(npage);
        mmu_set_spte(vcpu, spte, page->role.access, pte_access, 0, 0,
                     gpte & PT_DIRTY_MASK, NULL, largepage, gpte_to_gfn(gpte),
-                    npage);
+                    npage, true);
 }
 
 /*
        mmu_set_spte(vcpu, shadow_ent, access, walker->pte_access & access,
                     user_fault, write_fault,
                     walker->ptes[walker->level-1] & PT_DIRTY_MASK,
-                    ptwrite, largepage, walker->gfn, page);
+                    ptwrite, largepage, walker->gfn, page, false);
 
        return shadow_ent;
 }