From: Julien Grall <julien.grall@linaro.org>
To: Thomas Leonard <talex5@gmail.com>, xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org, stefano.stabellini@eu.citrix.com,
Dave.Scott@eu.citrix.com, anil@recoil.org
Subject: Re: [PATCH ARM v6 07/14] mini-os: arm: boot code
Date: Wed, 16 Jul 2014 22:49:15 +0100 [thread overview]
Message-ID: <53C6F35B.8050500@linaro.org> (raw)
In-Reply-To: <1405508874-3921-8-git-send-email-talex5@gmail.com>
Hi Thomas,
On 16/07/14 12:07, Thomas Leonard wrote:
> +
> + @ Tell the system where our page table is located.
> + @ This is the 16 KB top-level translation table, in which
> + @ each word maps one 1MB virtual section to a physical section.
> + mcr p15, 0, r1, c2, c0, 0 @ set ttbr0 = r1
I don't see any modification of TTBCR (so the initial value is 0). I
guess you are using short-descriptor translation table format, right? If
so, I would write somewhere.
> + @ Set access permission for domains.
> + @ Domains are deprecated, but we have to configure them anyway.
> + @ We mark every page as being domain 0 and set domain 0 to "client mode"
> + @ (client mode = use access flags in page table).
> + mov r0, #1 @ 1 = client
> + mcr p15, 0, r0, c3, c0, 0 @ DACR
> +
> + @ Template (flags) for a 1 MB page-table entry.
> + @ TEX[2:0] C B = 001 1 1 (outer and inner write-back, write-allocate)
> + ldr r8, =(0x2 + /* Section entry */ \
> + 0xc + /* C B */ \
> + (3 << 10) + /* Read/write */ \
> + (1 << 12) + /* TEX */ \
> + (1 << 16) + /* Sharable */ \
> + (1<<19)) /* Non-secure */
> + @ r8 = template page table entry
> +
> + @ Add an entry for the current physical section, at the old and new
> + @ addresses. It's OK if they're the same.
> + mov r0, pc, lsr#20
> + mov r0, r0, lsl#20 @ r0 = physical address of this code's section start
> + orr r3, r0, r8 @ r3 = table entry for this section
> + ldr r4, =_start @ r4 = desired virtual address of this section
> + str r3, [r1, r4, lsr#18] @ map desired virtual section to this code
> + str r3, [r1, r0, lsr#18] @ map current section to this code too
> +
> + @ Invalidate TLB
> + mcr p15, 0, r1, c8, c7, 0 @ TLBIALL
> +
> + @ Enable MMU / SCTLR
> + @ We leave caches off for now because we're going to be changing the
> + @ TLB a lot and this avoids having to flush the caches each time.
Did you intend to mean page table rather than TLB?
[..]
> +irq_handler:
> + ldr sp, =irqstack_end
> + push {r0 - r12, r14}
> +
> + ldr r0, IRQ_handler
> + cmp r0, #0
> + .word 0x07f000f0 @ undeq - panic if no handler
Hrmmm, I didn't spot this earlier. How can this work? You
unconditionally called an undefined encoding.
[..]
> diff --git a/extras/mini-os/arch/arm/minios-arm32.lds b/extras/mini-os/arch/arm/minios-arm32.lds
> new file mode 100755
> index 0000000..21c3893
> --- /dev/null
> +++ b/extras/mini-os/arch/arm/minios-arm32.lds
> @@ -0,0 +1,79 @@
> +OUTPUT_ARCH(arm)
> +ENTRY(_start)
> +SECTIONS
> +{
> + _boot_stack = 0x400000; /* 16 KB boot stack */
> + _boot_stack_end = 0x404000;
> + _page_dir = 0x404000; /* 16 KB translation table */
It might be worse to explain that you are relying on there is a hole
before the kernel address.
Regards,
--
Julien Grall
next prev parent reply other threads:[~2014-07-16 21:49 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-16 11:07 [PATCH ARM v6 00/14] mini-os: initial ARM support Thomas Leonard
2014-07-16 11:07 ` [PATCH ARM v6 01/14] mini-os: x86_64: make thread stacks 16-byte aligned Thomas Leonard
2014-07-17 15:50 ` Ian Campbell
2014-07-17 18:15 ` Samuel Thibault
2014-07-18 10:00 ` Ian Campbell
2014-07-18 13:22 ` Samuel Thibault
2014-07-17 18:15 ` Samuel Thibault
2014-07-16 11:07 ` [PATCH ARM v6 02/14] mini-os: don't include lib.h from mm.h Thomas Leonard
2014-07-16 13:30 ` Thomas Leonard
2014-07-17 15:51 ` Ian Campbell
2014-07-17 18:17 ` Samuel Thibault
2014-07-16 11:07 ` [PATCH ARM v6 03/14] mini-os: added HYPERVISOR_xsm_op Thomas Leonard
2014-07-16 11:07 ` [PATCH ARM v6 04/14] mini-os: headers for ARM Thomas Leonard
2014-07-16 21:25 ` Julien Grall
2014-07-17 8:14 ` Thomas Leonard
2014-07-17 9:04 ` Ian Campbell
2014-07-17 11:41 ` Julien Grall
2014-07-17 15:59 ` Ian Campbell
2014-07-18 1:29 ` Chen Baozi
2014-07-18 7:58 ` Thomas Leonard
2014-07-17 18:27 ` Samuel Thibault
2014-07-18 7:54 ` Thomas Leonard
2014-07-16 11:07 ` [PATCH ARM v6 05/14] mini-os: import libfdt Thomas Leonard
2014-07-16 11:44 ` Andrew Cooper
2014-07-16 12:29 ` Ian Campbell
2014-07-16 13:02 ` Andrew Cooper
2014-07-16 13:34 ` Ian Campbell
2014-07-16 14:13 ` Anil Madhavapeddy
2014-07-16 14:35 ` Ian Campbell
2014-07-17 18:30 ` Samuel Thibault
2014-07-16 11:07 ` [PATCH ARM v6 06/14] mini-os: use generic local_irq_enable function Thomas Leonard
2014-07-17 16:00 ` Ian Campbell
2014-07-17 18:32 ` Samuel Thibault
2014-07-16 11:07 ` [PATCH ARM v6 07/14] mini-os: arm: boot code Thomas Leonard
2014-07-16 21:49 ` Julien Grall [this message]
2014-07-17 9:37 ` Thomas Leonard
2014-07-17 9:46 ` Ian Campbell
2014-07-17 9:48 ` Thomas Leonard
2014-07-17 16:28 ` Ian Campbell
2014-07-30 10:47 ` Thomas Leonard
2014-07-30 11:26 ` Ian Campbell
2014-07-30 12:20 ` Thomas Leonard
2014-07-30 12:54 ` Ian Campbell
2014-07-30 13:37 ` Thomas Leonard
2014-07-30 13:43 ` Ian Campbell
2014-07-16 11:07 ` [PATCH ARM v6 08/14] mini-os: arm: memory management Thomas Leonard
2014-07-21 17:36 ` Julien Grall
2014-08-03 10:23 ` Thomas Leonard
2014-07-16 11:07 ` [PATCH ARM v6 09/14] mini-os: arm: scheduling Thomas Leonard
2014-07-28 10:53 ` Ian Campbell
2014-07-28 11:20 ` Thomas Leonard
2014-07-28 11:26 ` Ian Campbell
2014-07-16 11:07 ` [PATCH ARM v6 10/14] mini-os: arm: events Thomas Leonard
2014-07-28 10:55 ` Ian Campbell
2014-07-16 11:07 ` [PATCH ARM v6 11/14] mini-os: arm: time Thomas Leonard
2014-07-21 17:45 ` Julien Grall
2014-07-28 10:41 ` Ian Campbell
2014-07-16 11:07 ` [PATCH ARM v6 12/14] mini-os: arm: interrupt controller Thomas Leonard
2014-07-21 17:56 ` Julien Grall
2014-07-16 11:07 ` [PATCH ARM v6 13/14] mini-os: arm: build system Thomas Leonard
2014-07-16 22:03 ` Julien Grall
2014-07-17 10:16 ` Thomas Leonard
2014-07-28 10:58 ` Ian Campbell
2014-07-16 11:07 ` [PATCH ARM v6 14/14] mini-os: arm: show registers, stack and exception vector on fault Thomas Leonard
2014-07-28 11:13 ` Ian Campbell
2014-07-28 11:49 ` Thomas Leonard
2014-07-28 12:01 ` Ian Campbell
2014-07-16 21:29 ` [PATCH ARM v6 00/14] mini-os: initial ARM support Julien Grall
2014-07-17 15:55 ` Ian Campbell
2014-07-17 16:17 ` Ian Campbell
2014-07-18 8:07 ` Thomas Leonard
2014-07-18 8:17 ` Thomas Leonard
2014-07-18 10:07 ` Ian Campbell
2014-07-18 12:45 ` Ian Campbell
2014-08-05 10:56 ` Thomas Leonard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53C6F35B.8050500@linaro.org \
--to=julien.grall@linaro.org \
--cc=Dave.Scott@eu.citrix.com \
--cc=anil@recoil.org \
--cc=samuel.thibault@ens-lyon.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=talex5@gmail.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).