[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [PATCH 03/40] arm64: add the boot code



Hi Shijie,

On 09/11/17 03:08, Huang Shijie wrote:
On Wed, Nov 08, 2017 at 09:46:35AM +0000, Julien Grall wrote:
Hi Shijie,

On 08/11/17 06:17, Huang Shijie wrote:
On Tue, Nov 07, 2017 at 01:39:44PM +0000, Julien Grall wrote:
Hi Shijie,

More question about the boot code...

On 03/11/17 03:11, Huang Shijie wrote:
+ENTRY(_start)
+    /* Save the FDT pointer */
+    mov     x20, x0
+
+    /* Calculate where we are */
+    bl      _calc_offset
+
+    PRINT("- Mini-OS booting -\n")
+
+    PRINT("- Setup CPU -\n")
+    /* Setup CPU for turning on the MMU. */
+    bl      _setup_cpu
+
+    PRINT("- Setup booting pagetable -\n")
+    /* Setup the initial page table. */
+    bl      _setup_initial_pgtable
+
+    /* Setup the identity mapping */
+    bl      _setup_idmap_pgtable
+
+    /* Load TTBRx */
+    msr     ttbr1_el1, x4
+    msr     ttbr0_el1, x5

First at all, this is not entirely obvious where x4 and x5 are been set.
Proper documentation would be needed for that.
Okay, I will add more document for it.


Now, IIUC the code TTBR0_EL1 will contain the identity mappings. I was
expecting to see it removed as soon as MMU is enabled. But this does not

Why should we remove it after the MMU is enabled?

Is there any problem if we keep it?

Well, after the MMU is enabled the OS should never address the identity
mapping. If there are a programming error, that region may be accessed by
errror. So instead of getting a fault you would corrupt memory. The latter
is really hard to debug.

Okay. I will clear it to 0 in next version.

I think this would not be enough. 0 could be a valid physical address.... What you want to do is set TCR_EL1.EPD0 to 1. That will disable translations using TTBR0_EL1.

Cheers,

--
Julien Grall

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.