Commit Graph

685 Commits

Author SHA1 Message Date
skrll
e57b205ea8 Remove unnecssary brackets. Same binary before and after. 2021-05-03 19:33:09 +00:00
skrll
b915c72fc6 Make the ddb for pmap / pte information pmap agnostic 2021-04-30 20:07:22 +00:00
skrll
1208aa4def Remove some unnecessary tlb invalidate in pmap_growkernel and ASAN shadow
map. Ensure the shadow map mappings are visible to the TLB walkers.
2021-04-29 09:27:29 +00:00
ryo
ea089466ac added more attributes of PTE displayed by "ddb>machine pte" 2021-04-21 09:52:20 +00:00
mrg
f405a45af6 remove KERNHIST_INIT_STATIC(). it stradles the line between usable
early in boot and broken early in boot by requiring a partly static
structure with another structure that must be present by the time
any uses are performed.  theoretically platform code could allocate
a chunk while seting up memory and assign it here, giving a dynamic
sizing for the entry list, but the reality is that all users have
a statically allocated entry list as well.

the existing KERNHIST_LINK_STATIC() is used in conjunction with
KERNHIST_INITIALIZER() instead.

this stops a NULL pointer deref when the _LOG() macro is called
before the storage is linked in, which happens with GCC 10 on OCTEON
with UVMHIST enabled, crashing in very early kernel init.
2021-04-17 01:53:58 +00:00
ryo
fdfe41cfc9 Fix the problem "pcictl pci0 list" causes "panic: trap_el1h_error" on rockpro64.
The panic occures in bus_space_barrier() in rk3399_pcie.c:rkpcie_conf_read().
We expected bus_space_peek_4() to trap and recover in the path
trap_el1h_sync() -> data_abort_handler(), but In fact, the read is delayed
until bus_space_barrier(), and we get an SError interrupt (trap_el1h_error)
instead of a Synchronous Exception (trap_el1h_sync).

To catch this correctly, An implicit barrier in bus_space_peek have been added,
and trap the SError interrupt to recover from.
2021-04-14 05:43:09 +00:00
skrll
32889a98fd fix a comment that has been c&p'ed around and not updated 2021-03-28 10:29:05 +00:00
jmcneill
1aeb00284a Revert recent pic optimizations until I have more time to work on this. 2021-03-27 12:15:08 +00:00
skrll
dba938b5f2 More debug 2021-03-25 07:31:56 +00:00
skrll
44cdaeaf20 Update a comment to reflect reality 2021-03-25 07:30:16 +00:00
simonb
5f885a01cf s/depreciated/deprecated/g 2021-03-24 05:00:24 +00:00
skrll
56c0734421 Fix a comment 2021-03-21 09:08:40 +00:00
skrll
01099b443f Adjust the kernel virtual address space so that KASAN will map the kernel
seperately from managed kernel virtual memory and not map the unused space
between the two.
2021-03-21 07:32:44 +00:00
skrll
ea4fbb3f9f Tweak a comment 2021-03-21 07:17:12 +00:00
skrll
cbef7ae258 Remove the unnecessary invalidation code in arm_efirt_md_map_range.
pmapboot_enter will panic if any overlapping mappings existed before and
a full TLB invalidate was done as part of turning the MMU on in locore.
2021-03-21 07:09:54 +00:00
skrll
fe42ab4b72 Make pmapboot_enter panic if anything goes wrong and any mappings overlap
rather than only doing it in locore.S
2021-03-20 14:30:50 +00:00
skrll
d312f2c65b Don't mark EFI runtime pages LX_BLKPAG_OS_READ | LX_BLKPAG_OS_WRITE as
these bits are only used by the current pmap fault code and these are
wired pages which will never fault.
2021-03-20 06:48:23 +00:00
ryo
a41b701065 Numeric modifiers conflict with the syntax interpretation of ddb, so use 'b', 'w', 'l', 'q' instead.
Also, change load/store('l','s') to 'r','w' like the other arch.

 >db{0}> machine watch/1 hostname
 >Bad modifier

 >db{0}> machine watch/s1 hostname
 >add watchpoint 0 as ffffc00001087848
2021-03-11 10:34:34 +00:00
ryo
060a3f1bf4 - fixed a problem where hardware {break,watch}points other than #0 could not be cleared
- hardware {break,watch}point addresses are now strictly checked
2021-03-11 09:48:40 +00:00
ryo
bc288328f6 Add support hardware breakpoint and watchpoint again.
Limited support for hardware watchpoint has been available for some time, but it
has not been working properly. In addition, it stopped working at the time of
the PTRACE support commit on 2018-12-13. This has been fixed to work correctly,
and also fixed to be practical by sharing hardware watchpoints and breakpoints
between CPUs on MULTIPROCESSOR.

Also fixed a bug that causes a malfunction when switching CPUs with
"machine cpu N" when entering ddb mode from other than cpu_Debugger().

I have confirmed that the CPU can be switched by "machine cpu N" and return from
ddb properly in each case where ddb is called triggered by ddb break/watchpoint,
hardware break/watchpoint, and cpu_Debugger().
2021-03-09 16:44:27 +00:00
ryo
d206f2c033 "machine cpu" command shows pc of trapframe and the symbol 2021-03-09 16:43:13 +00:00
ryo
7eef28f19b match the macro name to the order of the arguments. NFC. 2021-03-09 16:42:36 +00:00
ryo
52f8f20d27 fixed mask width of DBGWVR_MASK, and added definition of DBGBVR_MASK 2021-03-09 16:41:43 +00:00
ryo
41d796ff07 fix build error without options DDB.
kvtopte() is referenced from arm/acpi/acpi_machdep.c
2021-03-09 16:40:59 +00:00
jmcneill
06591db8ba cpu_lwp_fork: KASSERT -> KASSERTMSG to print the actual value of DAIF if
it is not 0 in cpu_lwp_fork
2021-03-01 11:37:31 +00:00
jmcneill
9feefd4bbc Add DISABLE_INTERRUPT_SAVE(), like DISABLE_INTERRUPT() but also returns
the previous state.

Use DISABLE_INTERRUPT_SAVE()/ENABLE_INTERRUPT() in pic_splfuncs instead
of cpsid()/cpsie(). The difference here is the caller no longer specifies
which bits to disable and enable; on arm32 we continue to use I32_bit and
on aarch64 we now consistently toggle both IRQ and FIQ state.
2021-03-01 11:29:14 +00:00
ryo
8cb72274d8 adjust tab. NFC 2021-02-23 20:34:54 +00:00
ryo
3c44d80bfc fix wrong target register size of "ldrsh"
"ldrsh Xt, [Xn, Xm]" was being output as "ldrsh Wt, [Xn, Xm]"
2021-02-23 20:26:50 +00:00
ryo
9dd3dbfda8 make more system registers are disassemblable 2021-02-23 20:15:04 +00:00
ryo
ff5de225ee The immediate offset of "ldtrb", "ldtrh", "sttrb", and "sttrh" was always output as unsigned.
Correctly, it is 9bit signed.
2021-02-23 17:48:46 +00:00
ryo
8b8517166c The register operand size for "smnegl" and "smsubl' was wrong.
not "smsubl Xd, Xn, Xm, Xa", but "smsubl Xd, Wn, Wm, Xa".
2021-02-23 17:30:56 +00:00
ryo
bbb2f83e35 Just a few optimizations.
- in cpu_idle(), ci_intr_depth is always 0, so there is no need to fetch for increment or conditional branch.
- curcpu() is immutable in idle lwp, there is no need to consider KPREEMPT. Therefore, get curcpu() first and keep using it.
- add more comment.
2021-02-23 14:50:33 +00:00
mrg
110ac605f8 introduce DDB_END_CMD and replace more than 20 copies of the same
list of NULLs and 0.  idea from rillig@.

all touched ports built, several booted.
2021-02-23 07:13:51 +00:00
ryo
e6178ccf0e PR/56002: aarch64 has a true 64bit CPU cycle counter, we will use it.
This fix solves PR/56002 on aarch64, but this problems can occur on
all other architectures where cpu_counter() is 32bit.
2021-02-22 09:29:38 +00:00
jmcneill
276aa796cb KNF 2021-02-22 02:18:33 +00:00
jmcneill
d7832b60a2 When waking from cpu_idle(), only call dosoftints if ci_intr_depth == 0 2021-02-21 23:37:09 +00:00
jmcneill
388a3964cd Add cpu_dosoftints_ci(). Like cpu_dosoftints(), but takes a cpu_info ptr
so we can avoid the extra tpidr_el1 access if cpu_info is already known.
2021-02-21 17:07:06 +00:00
jmcneill
5ea515b272 Keep current hardware priority value in struct cpu_info and use it instead
of reading icc_pmr_el1 in gicv3_set_priority.
2021-02-21 15:00:04 +00:00
jmcneill
a52d1e775b daif_disable: since we read bits before setting them, if the current state
matches the desired state we can skip the daif write
2021-02-20 19:27:35 +00:00
jmcneill
7987f42723 Move 'struct pic_pending' from percpu to struct cpu_info. Saves a few
instructions in splx.
2021-02-20 14:51:06 +00:00
jmcneill
f6fa9ebf5a revert previous; user reports of panics under load 2021-02-18 11:23:15 +00:00
jmcneill
fb90b35074 interrupt: enable interrupts before running soft intr handlers. To avoid
stack usage going out of control, only do this at ci_intr_depth==0.
2021-02-15 17:46:36 +00:00
ryo
27267eb2dc No assignment is needed here.
the loop in pmap_page_remove() always removes the first pv,
and since the list is managed by _pmap_remove_pv(), pp->pp_pv.pv_next always points to the first.
2021-02-13 18:13:53 +00:00
ryo
d9af110bc0 include "opt_gprof.h" so that _PROF_PROLOGUE works properly in ENTRY() macro in *.S files 2021-02-11 08:35:11 +00:00
ryo
1b3a3b1b74 Oh...the name of the mcount call was different between gcc and llvm.
gcc calls it as "_mconut", llvm calls as "__mcount".

Change the main name of mcount to "mcount()", and created "_mcount" and "__mcount" entries
to work regardless of which compiler the object was created with.
2021-02-10 12:31:34 +00:00
ryo
05347759f0 add support kernel profiling on aarch64
- add MCOUNT_ENTER, MCOUNT_EXIT macro
- __mcount() function should be aligned
- add "-fno-optimize-sibling-calls" option when PROF. for accurate profiling, it is better to suppress the tail call.
2021-02-10 08:25:01 +00:00
jmcneill
e410421efc Use reg_daif{set,clr}_write directly instead of daif_{en,dis}able for
ENABLE_INTERRUPT() and DISABLE_INTERRUPT() macros, to avoid an unnecessary
reg_daif_read().
2021-02-07 21:15:09 +00:00
joerg
86e238e257 Avoid duplicate definition of ddb_regs in crash(8). 2021-02-05 21:44:34 +00:00
ryo
b0dafcdff6 It is enough to make a page accessible instead of writable.
same fix as r1.76
2021-02-01 18:12:11 +00:00
skrll
77dbdee4b2 Improve a comment 2021-01-31 08:14:58 +00:00