Home | History | Annotate | Download | only in arm32
History log of /src/sys/arch/arm/include/arm32/frame.h
RevisionDateAuthorComments
 1.48  14-Aug-2020  skrll Mirror the changes to aarch64 and

- Switch to TPIDRPRW_IS_CURLWP, because curlwp is accessed much more often
by MI code. It also makes curlwp preemption safe,

- Make ASTs operate per-LWP rather than per-CPU, otherwise sometimes LWPs
can see spurious ASTs (which doesn't cause a problem, it just means some
time may be wasted).

- Make sure ASTs are always set on the same CPU as the target LWP, and
delivered via IPI if posted from a remote CPU so that they are resolved
quickly.

- Add some cache line padding to struct cpu_info.

- Add a memory barrier in a couple of places where ci_curlwp is set. This
is needed whenever an LWP that is resuming on the CPU could hold an
adaptive mutex. The barrier needs to drain the CPU's store buffer, so
that the update to ci_curlwp becomes globally visible before the LWP can
resume and call mutex_exit().
 1.47  28-Oct-2018  skrll Consistency - NFC
 1.46  28-Oct-2018  skrll Remove magic number
 1.45  07-Jul-2017  skrll branches: 1.45.4; 1.45.6;
Fixup the non-KDTRACE_HOOKS case of PUSHDTRACEGAP - we need to copy the
stack pointer to r2.
 1.44  07-Jul-2017  chs split PUSHFRAMEINSVC into two pieces so that we can insert some additional
instructions in the middle in undefinedinstruction_bounce, namely to add
some additional space on the stack before the trapframe for undefineds from
SVC mode. this extra space allows dtrace to emulate a "push" instruction.
the initial version was from me and some improvements were from nick.
 1.43  22-Jun-2017  skrll Trailing whitespace
 1.42  17-Apr-2015  matt Put the clearing of ci_astpending back in frame.h while interrupts are
disabled.
 1.41  08-Apr-2015  matt Don't clear CI_ASTPENDING in exception return, do it in ast() instead.
Add basic support for __HAVE_PREEMPTION.
Use atomic ops for ci_astpending if __HAVE_PREEMPTION is defined.
Use kpreempt_disable/kpreempt_enable
 1.40  08-Apr-2015  matt CI_ASTPENDING is now a bitfield and low bit is for user ASTs.
 1.39  26-Feb-2014  matt branches: 1.39.6;
Remove KERNEL_LOCK/KERNEL_UNLOCK
 1.38  20-Dec-2013  matt When restoring SPRSR, use spsr_fsxc not spsr_all so bits[23-8] are restored.
This should fix use of simd instructions that rely on the GE bits.
 1.37  02-Dec-2013  joerg Don't use cpsr_all/spsr_all with mrs, it doesn't take a mask.
 1.36  18-Aug-2013  matt Use blx ip if _ARM_ARCH_5
prepare to get of switchframe
 1.35  21-Oct-2012  matt branches: 1.35.2;
Change to use symbolic constants from assym.h and fix a typo in a comment.
 1.34  21-Oct-2012  matt Implement a "fast" path for IRQ handling out of the idle loop. Since we
are in SVC32 already we only need to save a few registers. Processing is
also simplified since we know we can't return to user-mode.
 1.33  29-Aug-2012  matt branches: 1.33.2;
Use ARMV6+ cpsi{d,f} instructions whenever possible. Use r7 to hold previous
mode and avoid recomputing it. Add support for obtaining kernel_lock on
exception entry and exit.
 1.32  25-Aug-2012  matt Fix typo.
 1.31  16-Aug-2012  matt small rototill.
pcb_flags is dead. PCB_NOALIGNFLT is now in stored l_md.md_flags as
MDLWP_NOALIGNFLT. This avoids a few loads of the PCB in exception handling.
pcb_tf has been moved to l_md.md_tf. Again this avoids a lot of pcb
references just to access or set this. It also means that pcb doesn't
need to accessed by MI code.
Move pcb_onfault to after the pcb union.
Add pcb_sp macro to make code prettier.
Add lwp_settrapframe(l, tf) to set the l_md.md_tf field.
Use lwp_trapframe to access it (was process_frame but that name was changed
in a previous commit).
Kill off curpcb in acorn26.
Kill the checks for curlwp being NULL.
Move TRAP_USERMODE from arm32/fault.c to frame.h and a __PROG26 version.
Replace tests for usermode with that macro.
 1.30  02-Aug-2012  skrll Remove irqframe and replace with identical trapframe.
 1.29  01-Aug-2012  matt Move fill to between spsr and r0 so that the registers will be dword aligned.
Adjust PUSH/PULL macros accordingly.
 1.28  01-Aug-2012  matt Shrink PUSHFRAMEINSVC by 4 more instructions.
 1.27  31-Jul-2012  matt Add code to make sure the trapframe is aligned to a doubleword boundary.
 1.26  31-Jul-2012  matt Only do the SA110 user register save workaround on kernel using SA110s.
 1.25  31-Jul-2012  matt Make trapframe/irqframe an even number of words (make adjustments for
the filler word).
Improve the comments in PUSH/PULL macros.
Use the armv6+ CPS instruction if we can.
 1.24  31-Jul-2012  matt whitespace cleanup
 1.23  18-Jan-2009  bjh21 branches: 1.23.14; 1.23.22;
Now that GET_CURPCB and GET_CURCPU are generally available, use them
unconditionally rather than rolling our own (often badly) all over the
place.
 1.22  17-Jan-2009  bjh21 Clear out the vestigial support for the Simtec Hydra board. Now that we're
getting support for proper SMP ARMs, keeping non-functional support for
a seriously crippled not-really-SMP system is likely to cause more problems
than it's worth, even if it was fun for a while.
 1.21  19-Nov-2008  matt Fix __HAVE_FAST_SOFTINTS (boolean dyslexia strikes again).
Add some KASSERTS to make sure assumptions are valid.
 1.20  26-Oct-2008  matt branches: 1.20.2; 1.20.8;
Fix DO_PENDING_SOFTINTS (remove pasto, remove a branch, use movs)
pasto spotted by mjf
 1.19  07-Aug-2008  matt Only call dosoftints() is ci_intr_depth == 0
 1.18  07-Aug-2008  matt Do fast softint processing in DO_AST_AND_RESTORE_ALIGNMENT_FAULTS.
Redo the softint mask so ci_softints >> ci_cpl != 0 becomes an easy
test for work to be done.
 1.17  27-Apr-2008  matt branches: 1.17.2; 1.17.6;
Merge kernel changes in matt-armv6 to HEAD.
 1.16  12-Jan-2008  skrll branches: 1.16.6; 1.16.8; 1.16.10;
Push a switchframe in dumpsys and cpu_switchto, but as dumpsys calls
other funcs a switchframe needs to be a multiple of 8 bytes. Stash sp as
well in the switchframe to bump it to 24bytes.

Setup the switchframe appropriately in cpu_lwp_fork.

Remove savectx - nothing uses it.

All of this make gdb's life much easier when dealing with crash dumps and
live kernels.

Reviewd by chris.
 1.15  09-Mar-2007  thorpej branches: 1.15.8; 1.15.16; 1.15.20; 1.15.22; 1.15.28; 1.15.34;
Rewrite the ARM mutex implementation to be of the simple-mutex variety.
Because pre-v6 ARM lacks support for an atomic compare-and-swap, we
implement _lock_cas() as a restartable atomic squence that is checked
in the IRQ handler right before AST processing. (This is safe because,
for all practical purposes, there are no SMP pre-v6 ARM systems.)

This can serve as a model for other non-MP platforms that lack the
necessary atomic operations for mutexes (SuperH, for example).

Upshots of this change:
- kmutex_t is now down to 8 bytes on ARM; about as good as we can get.
- ARM2 systems don't have to trap and emulate SWP or SWPB for mutexes.

The acorn26 port is not updated by this commit to do the LOCK_CAS_CHECK.
That is left as an exercise for the port maintainer.

Reviewed and tested by Matt Thomas.
 1.14  27-Sep-2006  manu branches: 1.14.4;
- Document COMPAT_15 as doing nothing
- Add COMPAT_15 to all the kernel that had COMPAT_14, for the sake of coherency
- Remove the only occurences of #ifdef COMPAT_15 in the tree: for the ARM
ports, COMPAT_15 was always used in conjunction with EXEC_AOUT. Only EXEC_AOUT
matters here.

This address kern/18407
 1.13  11-Dec-2005  christos branches: 1.13.20; 1.13.22;
merge ktrace-lwp.
 1.12  11-Aug-2005  cube Change all archs that did:

#define clockframe somethingelse

to:

struct clockframe {
struct somethingelse cf_se;
};

and change access macros accordingly.

That means that, at least for that very issue, things will not go
ka-boomy if you don't have the actual definition of struct clockframe
before including systm.h.
 1.11  27-Apr-2004  scw branches: 1.11.12;
Always disable interrupts at the start of DO_AST_AND_RESTORE_ALIGNMENT_FAULTS.
This addresses #2 of port-arm/23581 by Richard Earnshaw.

Many thanks to Richard for spotting the cause of this problem.
 1.10  15-Dec-2003  scw branches: 1.10.2;
The last cpsr_all change was misguided. Just use cpsr_c wherever possible.
 1.9  01-Dec-2003  scw - For consistency, use cpsr_all instead of cpsr.
- Make sure IRQs are enabled before handling ASTs.
 1.8  14-Nov-2003  scw Slight re-org of the alignment/ast exit macro to better mimic the
original behaviour WRT cpsr/I32_bit handling.
 1.7  30-Oct-2003  scw Move the alignment fault enable/disable code into macroes to avoid
needless duplication.

Additionally, merge AST handling into the same code.

exception.S and the generic irq_dispatch.S routines have been updated
to use the macroes.

XXX: I have patches for the non-generic IRQ dispatch routines, but they
need testing by someone with hardware.
 1.6  23-Oct-2003  scw Don't drop to spl0 in cpu_switch/cpu_switchto. Do it in the idle loop
instead.

With this change, we no longer need to save the current interrupt level
in the switchframe. This is no great loss since both cpu_switch and
cpu_switchto are always called at splsched, so the process' spl is
effectively saved somewhere in the callstack.

This fixes an evbarm problem reported by Allen Briggs:

lwp gets into sa_switch -> mi_switch with newl != NULL
when it's the last element on the runqueue, so it
hits the second bit of:
if (newl == NULL) {
retval = cpu_switch(l, NULL);
} else {
remrunqueue(newl);
cpu_switchto(l, newl);
retval = 0;
}

mi_switch calls remrunqueue() and cpu_switchto()

cpu_switchto unlocks the sched lock
cpu_switchto drops CPU priority
softclock is received
schedcpu is called from softclock
schedcpu hits the first if () {} block here:
if (l->l_priority >= PUSER) {
if (l->l_stat == LSRUN &&
(l->l_flag & L_INMEM) &&
(l->l_priority / PPQ) != (l->l_usrpri / PPQ)) {
remrunqueue(l);
l->l_priority = l->l_usrpri;
setrunqueue(l);
} else
l->l_priority = l->l_usrpri;
}

Since mi_switch has already run remrunqueue, the LWP has been
removed, but it's not been put back on any queue, so the
remrunqueue panics.
 1.5  19-Oct-2002  bjh21 branches: 1.5.2; 1.5.8;
Undo recent cpu_switch register usage changes in order to decrease nathanw_sa
merge pain.
 1.4  18-Oct-2002  bjh21 In cpu_switch(), stack more registers at the start of the function,
and hence save fewer into the PCB. This should give me enough free
registers in cpu_switch to tidy things up and support MULTIPROCESSOR
properly. While we're here, make the stacked registers into an
APCS stack frame, so that DDB backtraces through cpu_switch() will
work.

This also affects cpu_fork(), which has to fabricate a switchframe and
PCB for the new process.
 1.3  14-Aug-2002  thorpej Use cpsr_c rather then cpsr_all where appropriate.
 1.2  31-Aug-2001  simonb branches: 1.2.6; 1.2.14;
Use comments around the token after a #endif.
 1.1  23-Feb-2001  reinoud branches: 1.1.4; 1.1.6;
Big patch for merging common include files of the new hpcarm tree and the old arm32
tree into the new arm substree. All moved files are relinked with a stub that included
the file from the new location; this might be done better later.
 1.1.6.2  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1  13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.1.4.2  12-Mar-2001  bouyer Sync with HEAD.
 1.1.4.1  23-Feb-2001  bouyer file frame.h was added on branch thorpej_scsipi on 2001-03-12 13:27:24 +0000
 1.2.14.1  30-Aug-2002  gehenna catch up with -current.
 1.2.6.2  19-Aug-2002  thorpej Partial (ARM only) sync with trunk -- significant performance improvements
for XScale-based systems.
 1.2.6.1  31-Aug-2001  thorpej file frame.h was added on branch nathanw_sa on 2002-08-19 21:39:17 +0000
 1.5.8.4  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.8.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.8.2  18-Sep-2004  skrll Sync with HEAD.
 1.5.8.1  03-Aug-2004  skrll Sync with HEAD
 1.5.2.2  19-Oct-2002  bjh21 Re-do the following revisions, this time on a branch where they won't
interfere with the nathanw_sa merge:

syssrc/sys/arch/arm/arm32/cpuswitch.S 1.26
syssrc/sys/arch/arm/arm32/genassym.cf 1.18
syssrc/sys/arch/arm/arm32/vm_machdep.c 1.21
syssrc/sys/arch/arm/include/pcb.h 1.5

Original commit message:

In cpu_switch(), stack more registers at the start of the function,
and hence save fewer into the PCB. This should give me enough free
registers in cpu_switch to tidy things up and support MULTIPROCESSOR
properly. While we're here, make the stacked registers into an
APCS stack frame, so that DDB backtraces through cpu_switch() will
work.

This also affects cpu_fork(), which has to fabricate a switchframe and
PCB for the new process.
 1.5.2.1  19-Oct-2002  bjh21 file frame.h was added on branch bjh21-hydra on 2002-10-19 11:59:37 +0000
 1.10.2.1  29-Apr-2004  jmc Pullup rev 1.11 (requested by scw in ticket #209)

Always disable interrupts at the start of
DO_AST_AND_RESTORE_ALIGNMENT_FAULTS. PR#23581
 1.11.12.4  21-Jan-2008  yamt sync with head
 1.11.12.3  03-Sep-2007  yamt sync with head.
 1.11.12.2  30-Dec-2006  yamt sync with head.
 1.11.12.1  21-Jun-2006  yamt sync with head.
 1.13.22.1  22-Oct-2006  yamt sync with head
 1.13.20.1  18-Nov-2006  ad Sync with head.
 1.14.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.15.34.1  19-Jan-2008  bouyer Sync with HEAD
 1.15.28.1  18-Feb-2008  mjf Sync with HEAD.
 1.15.22.3  23-Mar-2008  matt sync with HEAD
 1.15.22.2  30-Aug-2007  matt Move GET_CURCPU before the branch in ENABLE_ALIGNMENT_FAULTS.
 1.15.22.1  28-Aug-2007  matt Rototill to deal with curpcb/astpending/etc moves to cpu_info.
Make ENABLE_ALIGNMENTS_FAULT leave cpu_info in r4.
DO_AST_AND_RESTORE_ALIGNMENT_FAULTS takes advantage of r4 being cpu_info.
 1.15.20.1  20-Jan-2008  chris Sync to HEAD.
 1.15.16.1  28-Feb-2008  rjs Sync with HEAD.
 1.15.8.1  18-Apr-2007  thorpej Remove _lock_cas() in favor of atomic_cas_32().
 1.16.10.2  04-May-2009  yamt sync with head.
 1.16.10.1  16-May-2008  yamt sync with head.
 1.16.8.1  18-May-2008  yamt sync with head.
 1.16.6.3  17-Jan-2009  mjf Sync with HEAD.
 1.16.6.2  28-Sep-2008  mjf Sync with HEAD.
 1.16.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.17.6.2  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.17.6.1  19-Oct-2008  haad Sync with HEAD.
 1.17.2.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.20.8.1  15-Feb-2014  matt Merge armv7 support from HEAD, specifically support for the BCM5301X
and BCM56340 evbarm kernels.
 1.20.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.23.22.1  28-Nov-2012  matt Merge improved arm support (especially Cortex) from HEAD
including OMAP and BCM53xx support.
 1.23.14.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.23.14.1  30-Oct-2012  yamt sync with head
 1.33.2.3  03-Dec-2017  jdolecek update from HEAD
 1.33.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.33.2.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.35.2.2  18-May-2014  rmind sync with head
 1.35.2.1  28-Aug-2013  rmind sync with head
 1.39.6.2  28-Aug-2017  skrll Sync with HEAD
 1.39.6.1  06-Jun-2015  skrll Sync with HEAD
 1.45.6.1  10-Jun-2019  christos Sync with HEAD
 1.45.4.1  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts

RSS XML Feed