buf -> 2*pagesize