aboutsummaryrefslogtreecommitdiff
path: root/sys/powerpc/aim/swtch.S
Commit message (Collapse)AuthorAgeFilesLines
* MFppc64:Nathan Whitehorn2010-07-131-203/+0
| | | | | | | | | | Kernel sources for 64-bit PowerPC, along with build-system changes to keep 32-bit kernels compiling (build system changes for 64-bit kernels are coming later). Existing 32-bit PowerPC kernel configurations must be updated after this change to specify their architecture. Notes: svn path=/head/; revision=209975
* Unbreak cpu_switch(). The register allocator in my brain is clearlyNathan Whitehorn2009-10-311-4/+6
| | | | | | | | broken. Also, Altivec context switching worked before only by accident, but should work now by design. Notes: svn path=/head/; revision=198731
* Remove an unnecessary sync that crept in the last commit.Nathan Whitehorn2009-10-311-1/+0
| | | | Notes: svn path=/head/; revision=198725
* Loop on blocked threads when using ULE scheduler, removing anNathan Whitehorn2009-10-311-9/+21
| | | | | | | XXX MP comment. Notes: svn path=/head/; revision=198723
* Correct another typo. Actually save the condition register insteadNathan Whitehorn2009-10-111-1/+1
| | | | | | | of overwriting r12 by mistake. Notes: svn path=/head/; revision=197962
* Perform a dummy stwcx. when we switch contexts. The contextMarcel Moolenaar2009-04-041-0/+6
| | | | | | | | | | | | | | | | | | | | | | being switched out may hold a reservation. The stwcx. will clear the reservation. This is architecturally recommended. The scenario this addresses is as follows: 1. Thread 1 performs a lwarx and as such holds a reservation. 2. Thread 1 gets switched out (before doing the matching stwcx.) and thread 2 is switched in. 3. Thread 2 performs a stwcx. to the same reservation granule. This will succeed because the processor has the reservation even though thread 2 didn't do the lwarx. Note that on some processors the address given the stwcx. is not checked. On these processors the mere condition of having a reservation would cause the stwcx. to succeed, irrespective of whether the addresses are the same. The dummy stwcx. is especially important for those processors. Notes: svn path=/head/; revision=190704
* Add Altivec support for supported CPUs. This is derived from the FPU supportNathan Whitehorn2009-02-201-3/+19
| | | | | | | | | | | code, and also reducing the size of trapcode to fit inside a 32 byte handler slot. Reviewed by: grehan MFC after: 2 weeks Notes: svn path=/head/; revision=188860
* Set pcpup->pc_curthread and pcpup->pc_curpcb before callingMarcel Moolenaar2008-09-161-3/+3
| | | | | | | | pmap_activate. While pmap_activate doesn't need either, we do need a valid curthread if we enable KTR_PMAP. Notes: svn path=/head/; revision=183088
* MFp4: SMP supportMarcel Moolenaar2008-04-271-2/+12
| | | | Notes: svn path=/head/; revision=178628
* Unify and generalize PowerPC headers, adjust AIM code accordingly.Rafal Jaworowski2008-03-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Rework of this area is a pre-requirement for importing e500 support (and other PowerPC core variations in the future). Mainly the following headers are refactored so that we can cover for low-level differences between various machines within PowerPC architecture: <machine/pcpu.h> <machine/pcb.h> <machine/kdb.h> <machine/hid.h> <machine/frame.h> Areas which use the above are adjusted and cleaned up. Credits for this rework go to marcel@ Approved by: cognet (mentor) MFp4: e500 Notes: svn path=/head/; revision=176742
* Cut over to ULE on PowerPCPeter Grehan2007-10-231-2/+6
| | | | | | | | | | | | | | | | | | | | kern/sched_ule.c - Add __powerpc__ to the list of supported architectures powerpc/conf/GENERIC - Swap SCHED_4BSD with SCHED_ULE powerpc/powerpc/genassym.c - Export TD_LOCK field of thread struct powerpc/powerpc/swtch.S - Handle new 3rd parameter to cpu_switch() by updating the old thread's lock. Note: uniprocessor-only, will require modification for MP support. powerpc/powerpc/vm_machdep.c - Set 3rd param of cpu_switch to mutex of old thread's lock, making the call a no-op. Reviewed by: marcel, jeffr (slightly older version) Notes: svn path=/head/; revision=172887
* /* -> /*- for license, minor formatting changesWarner Losh2005-01-071-2/+2
| | | | Notes: svn path=/head/; revision=139825
* Update the callframe structure to leave space for the frame pointerPeter Grehan2004-07-221-1/+4
| | | | | | | | | | | | and saved link register as per the ABI call sequence. Update code that uses this (fork_trampoline etc) to use the correct genassym'd offsets. This fixes the 'invalid LR' message when backtracing kernel threads in DDB. Notes: svn path=/head/; revision=132520
* Update powerpc to use the (old thread,new thread) calling conventionPeter Grehan2003-08-141-34/+27
| | | | | | | for cpu_throw() and cpu_switch(). Notes: svn path=/head/; revision=118893
* Enable the FPU on first use per-thread and save state across contextPeter Grehan2003-03-201-11/+8
| | | | | | | | | | | | | | switches. Not as lazy as it could be. Changing FPU state with sigcontext still TODO. fpu.c - convert some asm to inline C, and macroize fpu loads/stores swtch.S - call out to save/restore fpu routines trap.c - always call enable_fpu, since this shouldn't be called once the FPU has been enabled for a thread genassym.c - define for pcb fpu flag Notes: svn path=/head/; revision=112429
* Add the USER_SR segment register to pcb state. Initialize correctly,Peter Grehan2002-10-211-0/+6
| | | | | | | | | | | | and save/restore during a context switch. The USER_SR could be overwritten when the current thread was switched out with a faulting copyin/copyout. Approved by: Benno Notes: svn path=/head/; revision=105611
* Set the thread state of the newly chosen to run thread to TDS_RUNNING inJohn Baldwin2002-07-121-2/+0
| | | | | | | | | | | choosethread() in MI C code instead of doing it in in assembly in all the various cpu_switch() functions. This fixes problems on ia64 and sparc64. Reviewed by: julian, peter, benno Tested on: i386, alpha, sparc64 Notes: svn path=/head/; revision=99887
* Changes for KSE3.Benno Rice2002-07-091-0/+2
| | | | | | | Submitted by: Peter Grehan <peterg@ptree32.com.au> Notes: svn path=/head/; revision=99659
* To quote Peter:Benno Rice2002-06-291-10/+15
| | | | | | | | | | | | | | | | | | | The case in cpu_switch() where there isn't a higher priority thread (choosethread() == curthread) uses r4 as the PCB context pointer. However, the use of r4 after the label L2 is incorrect, since it was probably trashed by the call to choosethread, and in any case was set up to curthread at the start of the routine. This condition will occur when an interrupt thread schedules a netisr, which is a lower priority thread. Another (probably unnecessary) difference is that I was paranoid about register trashing, so I decided to save r2 and r13 as well. Submitted by: Peter Grehan <peterg@ptree32.com.au> Notes: svn path=/head/; revision=99036
* The per-cpu curpmap is now set by pmap_activate. We don't need to do it hereBenno Rice2002-05-091-12/+2
| | | | | | | anymore. Notes: svn path=/head/; revision=96252
* Commit of stuff that's been sitting in my tree for a while.Benno Rice2002-04-291-7/+20
| | | | | | | | | | | | | | Highlights include: - New low-level trap code from NetBSD. The high level code still needs a lot of work. - Fixes for some pmap handling in thread switching. - The kernel will now get to attempting to jump into init in user mode. There are some pmap/trap issues which prevent it from actually getting there though. Obtained from: NetBSD (parts) Notes: svn path=/head/; revision=95719
* cpu_switch now works, for kthreads at least.Benno Rice2002-02-281-13/+26
| | | | Notes: svn path=/head/; revision=91486
* Make fork work, at least for kthreads. Switching still has some issues.Benno Rice2002-02-281-0/+11
| | | | Notes: svn path=/head/; revision=91467
* Complete rework of the PowerPC pmap and a number of other bits in the earlyBenno Rice2002-02-141-1/+1
| | | | | | | | | | | | | | | | | boot sequence. The new pmap.c is based on NetBSD's newer pmap.c (for the mpc6xx processors) which is 70% faster than the older code that the original pmap.c was based on. It has also been based on the framework established by jake's initial sparc64 pmap.c. There is no change to how far the kernel gets (it makes it to the mountroot prompt in psim) but the new pmap code is a lot cleaner. Obtained from: NetBSD (pmap code) Notes: svn path=/head/; revision=90643
* Overhaul the per-CPU support a bit:John Baldwin2001-12-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - The MI portions of struct globaldata have been consolidated into a MI struct pcpu. The MD per-CPU data are specified via a macro defined in machine/pcpu.h. A macro was chosen over a struct mdpcpu so that the interface would be cleaner (PCPU_GET(my_md_field) vs. PCPU_GET(md.md_my_md_field)). - All references to globaldata are changed to pcpu instead. In a UP kernel, this data was stored as global variables which is where the original name came from. In an SMP world this data is per-CPU and ideally private to each CPU outside of the context of debuggers. This also included combining machine/globaldata.h and machine/globals.h into machine/pcpu.h. - The pointer to the thread using the FPU on i386 was renamed from npxthread to fpcurthread to be identical with other architectures. - Make the show pcpu ddb command MI with a MD callout to display MD fields. - The globaldata_register() function was renamed to pcpu_init() and now init's MI fields of a struct pcpu in addition to registering it with the internal array and list. - A pcpu_destroy() function was added to remove a struct pcpu from the internal array and list. Tested on: alpha, i386 Reviewed by: peter, jake Notes: svn path=/head/; revision=87702
* Add enable_fpu/save_fpu for handling the floating point registers in the PCB.Mark Peek2001-11-051-0/+16
| | | | | | | Obtained from: NetBSD Notes: svn path=/head/; revision=86066
* Fix typo.Mark Peek2001-10-151-1/+1
| | | | Notes: svn path=/head/; revision=84946
* Save WIP. Partial rewrite of cpu_switch() and savectx(). This makes it closerMark Peek2001-10-151-161/+24
| | | | | | | | | to working but still needs some work to properly switch the full context (such as saving the fpu registers, switch stacks, etc.). Also, remove some dead code that was mixed in. Notes: svn path=/head/; revision=84945
* Update PowerPC MD code to compile and do initial bootstrap based onMark Peek2001-09-201-3/+3
| | | | | | | | | recent changes (KSE and VM requiring physmem to be setup). Reviewed by: benno, jhb, julian Notes: svn path=/head/; revision=83682
* KSE Milestone 2Julian Elischer2001-09-121-5/+5
| | | | | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha Notes: svn path=/head/; revision=83366
* FreeBSD doesn't use a want_resched variable. Instead, the PS_NEEDRESCHEDJohn Baldwin2001-08-151-5/+0
| | | | | | | p_sflag is managed in a MI fashion. Notes: svn path=/head/; revision=81724
* Bring in NetBSD code used in the PowerPC port.Benno Rice2001-06-101-0/+249
Reviewed by: obrien, dfr Obtained from: NetBSD Notes: svn path=/head/; revision=77957