HomeFreeBSD

PPC64: fix TOC behavior on process initialization

Description

PPC64: fix TOC behavior on process initialization

Set stack pointer to correct value after thread's stack pointer restore

Restoring new thread's stack pointer caused stack corruption because
restored stack pointer didn't point to callee (cpu_switch) stack frame but
caller stack frame.

As a result we had mysterious errors in caller function (sched_switch).

Solution: simply set stack pointer to correct value

Also, initialize TOC to a valid pointer once the thread is being
created.

Created by: Patryk Duda <pdk@semihalf.com>
Submitted by: Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Reviewed by: nwhitehorn
Differential revision: https://reviews.freebsd.org/D13947
Sponsored by: QCM Technologies

Details

Provenance
wmaAuthored on
Reviewer
nwhitehorn
Differential Revision
D13947: PPC64: fix TOC behavior on process initialization
Parents
rS328111: PPC: machdep, zero BSS always but BookE
Branches
Unknown
Tags
Unknown