Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965473AbbBCN2L (ORCPT ); Tue, 3 Feb 2015 08:28:11 -0500 Received: from primary.scalemp.com ([174.37.253.146]:58425 "EHLO primary.scalemp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754045AbbBCN2G (ORCPT ); Tue, 3 Feb 2015 08:28:06 -0500 X-Greylist: delayed 2724 seconds by postgrey-1.27 at vger.kernel.org; Tue, 03 Feb 2015 08:28:06 EST Message-ID: <54D0C234.8000203@scalemp.com> Date: Tue, 03 Feb 2015 14:42:28 +0200 From: Oren Twaig User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Alex Kuleshov CC: linux-kernel@vger.kernel.org Subject: Re: [x86_64] Question about early page tables initialization References: <87egq7dvwj.fsf@gmail.com> In-Reply-To: <87egq7dvwj.fsf@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - primary.scalemp.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - scalemp.com X-Get-Message-Sender-Via: primary.scalemp.com: authenticated_id: oren+scalemp.com/only user confirmed/virtual account not confirmed X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1327 Lines: 44 Hi, This is the corresponding C code which can help you understand: u64 *pml4 = (u64*)pgtable; u64 pdp = pgtable + 0x1000; u64 pml4_entry = pdp | PTE_P | PTE_W | PTU; // present, write, userspace = 0x7 pml4[0] = pml4_entry; The 0x1007 you see is just the calculation of the pml4_entry. Oren Twaig. On 02/03/2015 02:25 PM, Alex Kuleshov wrote: > Hello All, > > I have a question about page tables initialization in the > arch/x86/boot/compressed/head_64.S > > After we clear memory for page tables, there is code which > build PML4: > > leal pgtable + 0(%ebx), %edi > leal 0x1007(%edi), %eax > movl %eax, 0(%edi) > > Why there is offset 0x1007 instead just 0x7? 0x1007 is > 4k + 7bit (PML4E) flags as i understand correctly. But > why we skip first 4k here? > > Thank you. > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/