Instead of storing physical addresses along with page flags in the
PGD, store virtual addresses and use NULL to indicate a not present
second-level page table. A non-page-aligned page table indicates a bad
PMD.
This simplifies the TLB miss handler since it no longer has to check
the Present bit and no longer has to convert the PGD entry from
physical to virtual address. Instead, it has to check for a NULL
entry, which is slightly cheaper than either.
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Kill the special exception handler sections .tlbx.ex.text,
.tlbr.ex.text, tlbw.ex.text and .scall.text. Use .org instead to place
the handlers at the required offsets from EVBA.
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
This patch consolidate all definitions of .init.text, .init.data
and .exit.text, .exit.data section definitions in
the generic vmlinux.lds.h.
This is a preparational patch - alone it does not buy
us much good.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
The current debug trap handling code does a number of things that are
illegal according to the AVR32 Architecture manual. Most importantly,
it may try to schedule from Debug Mode, thus clearing the D bit, which
can lead to "undefined behaviour".
It seems like this works in most cases, but several people have
observed somewhat unstable behaviour when debugging programs,
including soft lockups. So there's definitely something which is not
right with the existing code.
The new code will never schedule from Debug mode, it will always exit
Debug mode with a "retd" instruction, and if something not running in
Debug mode needs to do something debug-related (like doing a single
step), it will enter debug mode through a "breakpoint" instruction.
The monitor code will then return directly to user space, bypassing
its own saved registers if necessary (since we don't actually care
about the trapped context, only the one that came before.)
This adds three instructions to the common exception handling code,
including one branch. It does not touch super-hot paths like the TLB
miss handler.
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
__init_end, which comes immediately before .text, is already page
aligned, and that should be more than enough for the .text section.
The reason why we need to align the .text section is because the
interrupt handler offset is ORed with EVBA, so we need to provide
enough alignment of EVBA that this OR operation works as an ADD.
Currently, the last interrupt handler is not nearly a full page away
from EVBA, so it won't be a problem.
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Use PAGE_SIZE, THREAD_SIZE and L1_CACHE_BYTES instead of harcoded
constants in places where that's what we really mean.
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Rename vmlinux.lds to a .S file to match other architectures.
Simplify Makefile to match the rename and deleted the unused
USE_STANDARD_AS_RULE
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>