Commit graph

278 commits

Author SHA1 Message Date
Bamboo
f062dcdcf9 [STYLE_FIX] 2016-10-12 03:07:32 +00:00
Adrian Danis
6d07c44329 x64: Partial hardware breakpoint support
This only implementes debug support if using the SYSCALL kernel invocation
method, will not work yet with SYSENTER
2016-10-12 13:38:37 +11:00
Adrian Danis
6294225ca7 x86: Rename [ER]FLAGS to FLAGS
Having a different name for the FLAGS register creates an unnecessary difference
between ia32 and x86_64 code since regardless of the name/size the bits in the
register mean exactly the same thing
2016-10-12 13:38:35 +11:00
Adrian Danis
e2bf4881c8 x64: Refactor Arch_initContext
Split Arch_initContext into mode and arch portions
2016-10-12 13:38:26 +11:00
Adrian Danis
600fe2bc09 x86: Move hardware debug state
Assembly traps rely on the registers and kernel stack being at a
known offset
2016-10-12 12:22:32 +11:00
Adrian Danis
9c1d204eaf x64: Correctly invalidate PCIDs 2016-10-12 12:22:32 +11:00
Adrian Danis
4f09f9c42d x86: Refactor elf code 2016-10-12 12:22:32 +11:00
Adrian Danis
4c94f43c51 x64: Fastpath 2016-10-12 12:22:32 +11:00
Adrian Danis
067b71cad4 x64/libsel4: Add x64 libsel4 implementation 2016-10-12 12:22:32 +11:00
Adrian Danis
7f9970e5e2 x64: Add x86_64 support 2016-10-12 12:22:31 +11:00
Adrian Danis
726f5edaf5 x64: Check size of unsigned long 2016-10-12 12:06:22 +11:00
Adrian Danis
03ec049d6b x64: 64-bit elf loading 2016-10-12 12:06:22 +11:00
amrzar
3f9eb7c873 SELFOUR-632: implement cores non-architecture dependent structres 2016-10-10 16:33:48 +11:00
Kofi Doku Atuah
bebfcf6d27 SELFOUR-499: X86, ARM: Add userspace invocations for hardware debugging
This commit implements the body of SELFOUR-499. The API exposes the x86 DR0-7
and ARM coprocessor 14 features to userspace by virtualizing them as context-
switched registers in the TCB. Implemented as TCB invocations. This feature is
only built when CONFIG_HARDWARE_DEBUG_API is selected.

* Add low-level support routines for setting, unsetting, getting, enabling
  and disabling breakpoints.
* Add support for single-stepping as well.
  ^ Single-stepping is not supported on ARMv6 since the hardware
    doesn't have support.
  ^ ARM implements single-stepping as instruction breakpoints
    configured to fault on every instruction -- this is achieved through
    the "mismatch" mode, which is only supported from ARMv7 onwards.
* Also support explicit software break requests, a la "BKPT" and "INT $3".

* New invocations:
  * seL4_TCB_SetBreakpoint().
  * seL4_TCB_GetBreakpoint().
  * seL4_TCB_UnsetBreakpoint().
  * seL4_TCB_ConfigureSingleStepping().
* New constants:
  ^ Event types:
    ^ seL4_InstructionBreakpoint.
    ^ seL4_DataBreakpoint.
    ^ seL4_SoftwareBreakRequest.
  ^ Access types:
    ^ seL4_BreakOnRead.
    ^ seL4_BreakOnWrite.
    ^ seL4_BreakOnReadWrite.
  ^ Exports:
    ^ seL4_NumHWBreakpoints.
    ^ seL4_NumExclusiveBreakpoints.
    ^ seL4_NumExclusiveWatchpoints.
    ^ seL4_NumDualFunctionMonitors.
    ^ seL4_FirstBreakpoint.
    ^ seL4_FirstWatchpoint.
    ^ seL4_FirstDualFunctionMonitor.

See documentation in the seL4 API manual.
2016-10-10 13:53:21 +11:00
Bamboo
e3974daac1 [STYLE_FIX] 2016-10-06 01:10:16 +00:00
amrzar
e63be664c6 SELFOUR-631: implement CLH lock and barrier infrastructure 2016-10-06 11:50:57 +11:00
Adrian Danis
45622671de x86: Define large frame types 2016-10-06 07:39:25 +11:00
Adrian Danis
602836a21b x86: Generic setCurrentVSpaceRoot
Defines a generic setCurrentVSpaceRoot to replace setCurrentPD in
mode generic code
2016-10-06 07:39:25 +11:00
Adrian Danis
74cb86c202 x86: Support for syscall
syscall/sysret is an additional way of performing kernel entry/exits.
Whilst the instructions themselves are not supported when running
in 32-bit mode, this commit provides the config choice for them as
well as the generic support code for them.
2016-10-06 07:39:24 +11:00
Adrian Danis
d72cd75136 x86: Rename invalidateTLBentry->invalidateTLBEntry 2016-10-05 16:40:43 +11:00
Adrian Danis
43772b2dc2 x86: Rename decodeIA32PortOperation->decodeX86PortOperation 2016-10-04 11:17:35 +11:00
Adrian Danis
2320d90904 x86: Fixup IOMMU implementation
Adds a mapping type to frame caps that tracks
what kind of hierarchy the cap is mapped into;
an MMU, IOMMU and in the future an EPT structure.

Additionally the IOMMU code is updated to
have correct functionality and be verification
friendly.
2016-09-29 16:11:11 +10:00
amrzar
2cbc7123b6 SELFOUR-630:preliminary booting application processors
- update core detection code and Kconfig file
    - update kernel stack managment so that BSP does not use boot stack before IPI APs
    - move arch dependant data to a single structure
    - add cache line size to Kconfig
    - add cpu indexing and apic id mapping
    - boot APs to halting state
    - add guard for kernel stack if there is only one core
2016-09-28 16:10:25 +10:00
Adrian Danis
017cb20b78 arm: Move ACTLR functions out of pl2 headers
The ACTLR register is not a PL2 exclusive register, and is architecturally
defined to exist (although the contents of the register are implementation defined).
2016-09-27 09:34:29 +10:00
Joel Beeren
2d74ae7eb8 SELFOUR-421: Arch_createObject changed to use new user_data_device in ghostupdates for device pages 2016-09-23 14:15:09 +10:00
Adrian Danis
d507b2d39e SELFOUR-421 Introduce explicit device frames and untypeds
Kernel objects cannot be created from device untypeds, with the
exception of frames, which do not get zeroed and cannot be used
as an IPC buffer. Device untypeds additionally cannot be used
in the construction of ASID pools.

This then changes the API to the rootserver (i.e. bootinfo) to
send device untypeds instead of device frames. On ARM these
device untypeds are the same as the previously exported device
frame regions. On x86 PCI scanning is removed and all physical
memory addresses (that are not important for kernel integrity)
are released to the user.

In order to have bits in the frame and untyped caps on ARM the
number of software ASIDs had to be reduced from 2^18 to 2^17,
and the maximum untyped size reduced from 2^31 to 2^30
2016-09-23 14:15:08 +10:00
Kent McLeod
41ec5cf754 SELFOUR-537: Support for raspberry pi3 2016-09-19 15:53:53 +10:00
Adrian Danis
4491cae521 SELFOUR-556: Rationalize BITS vs INDEX_BITS
s/PGD_BITS/PGD_INDEX_BITS
Current convention is to say that X_BITS is the log base 2
size of an object, not the log base 2 number of indices
2016-08-31 09:24:47 +10:00
Adrian Danis
35c50cfdaf SELFOUR-556: Rationalize BITS vs INDEX_BITS
s/PD_BITS/PD_INDEX_BITS
Current convention is to say that X_BITS is the log base 2
size of an object, not the log base 2 number of indices
2016-08-31 09:24:47 +10:00
Adrian Danis
f251953f60 SELFOUR-556: Rationalize BITS vs INDEX_BITS
s/PT_BITS/PT_INDEX_BITS
Current convention is to say that X_BITS is the log base 2
size of an object, not the log base 2 number of indices
2016-08-31 09:24:47 +10:00
Adrian Danis
1103e5a30b SELFOUR-556: Rationalize BITS vs INDEX_BITS
s/ASID_POOL_BITS/ASID_POOL_INDEX_BITS
Current convention is to say that X_BITS is the log base 2
size of an object, not the log base 2 number of indices
2016-08-31 09:24:47 +10:00
Adrian Danis
bbc98573e7 SELFOUR-556: Rationalize BITS vs INDEX_BITS
s/VTD_PT_BITS/VTD_PT_INDEX_BITS
Current convention is to say that X_BITS is the log base 2
size of an object, not the log base 2 number of indices
2016-08-31 09:24:47 +10:00
Adrian Danis
935b055c5e SELFOUR-556: Rationalize BITS vs INDEX_BITS
s/PDT_BITS/PDPT_INDEX_BITS
Current convention is to say that X_BITS is the log base 2
size of an object, not the log base 2 number of indices
2016-08-31 09:24:47 +10:00
Bamboo
f4188c6cd3 [STYLE_FIX] 2016-08-31 08:59:24 +10:00
Amirreza Zarrabi
92c95c8f0e Merge pull request #335 in SEL4/sel4 from ~AZARRABI/sel4:halt_recur to master
* commit '57f1352ff70cb2de18768174d257d151e4fd12e8':
  SELFOUR-614: calling halt() on the hikey platform results in infinite data abort SELFOUR-408: halt does not halt
2016-08-30 22:19:00 +00:00
Thomas Sewell
702f8c6902 Fix prototyping for constant address pointers.
Previous change adf91d4be0
introduces const inconsistently for two pointers.
2016-08-29 13:58:43 +10:00
Bamboo
362e41f285 [STYLE_FIX] 2016-08-24 11:40:27 +10:00
Anna Lyons
e2bc428df4 style 2016-08-24 10:42:36 +10:00
Anna Lyons
ef00e98689 SELFOUR-615: arm entry point stubs 2016-08-24 10:42:36 +10:00
Adrian Danis
e0f8111faa move benchmark code from arch hooks 2016-08-24 10:42:36 +10:00
Adrian Danis
4c57e6e577 define arch entry hooks instead 2016-08-24 10:42:36 +10:00
Adrian Danis
a217102b4e Consolidate benchmark entry/exit
Move the benchmark pre/post ambles into the now existing entry/exit
hook functions
2016-08-24 10:42:36 +10:00
Adrian Danis
3c05b79a6e Provide generic C entry/exit hook routines
It can be deseriable to run code before/after user mode, but
not have to write it in assembly. This commit adds such stubs
that get called as the first/last C code when coming in
and out of the kernel
2016-08-24 10:42:36 +10:00
amrzar
57f1352ff7 SELFOUR-614: calling halt() on the hikey platform results in infinite data abort
SELFOUR-408: halt does not halt

Remove assembly files for halt and idle thread and add wfi in armv.
2016-08-23 14:49:30 +10:00
Anna Lyons
c0817f4979 Merge pull request #339 in SEL4/sel4 from ~ALYONS/sel4:bye-lcok to master
* commit '5bd050f42fa6957a43db4ab20735f10d11f60bcd':
  trivial: x86 remove unused lock.[c|h]
2016-08-23 03:11:52 +00:00
Anna Lyons
5bd050f42f trivial: x86 remove unused lock.[c|h] 2016-08-23 11:41:26 +10:00
Kofi Doku Atuah
d33e48540c Use UNREACHABLE() instead of while(1) 2016-08-22 09:25:02 +10:00
Kofi Doku Atuah
2576eef364 x86: POPF immediately before SYSEXIT.
* Change restore_user_context() and fastpath_restore() to call POPF
  just before SYSEXIT.
* Also change the way registers are loaded such that we don't access
  memory that is not guarded by the current position of the stack pointer.

The reason for this change is that EFLAGS.TF, the Trap Flag, only takes
effect on the instruction AFTER the instruction that sets EFLAGS.TF. The
reason Intel/AMD did it this way is to allow the kernel to enable EFLAGS.TF
for userspace, without it taking effect on kernel instructions BEFORE
the CPU actually has returned to userspace.

EFLAGS.TF enables single-stepping. So the full picture is that since we
executed other instructions between POPF and SYSRET, those instructions
were triggering single-stepping IN the kernel. To solve this, we must
put POPF immediately before SYSRET.
2016-08-22 09:25:02 +10:00
Anna Lyons
f34f354a5d SELFOUR-617: one source of memory object sizes
Adds the following constants to libsel4
and uses them in the kernel.

seL4_SectionSize (arm)
seL4_SuperSectionSize (arm)
seL4_HugePageSize (x86 - pae)
seL4_LargePageSize (arm)
seL4_DataFault
seL4_InstructionFault
2016-08-17 12:42:38 +10:00
Hesham Almatary
79291252a8 Merge pull request #304 in SEL4/sel4 from ~HALMATARY/sel4:SELFOUR-518/UserLevelLogBuffer to master
* commit '16c3481109e2024d6fd65365ea94265ead37dcca':
  SELFOUR-518: User-level log buffer
  Benchmark: share and use KS_LOG_PPTR and PPTR_TOP for x86 and ARM
2016-08-16 00:34:21 +00:00