From: tixy@linaro.org (Jon Medhurst (Tixy))
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm: kprobes: Align stack to 8-bytes in test code
Date: Fri, 17 Mar 2017 17:50:49 +0000 [thread overview]
Message-ID: <1489773049.3063.13.camel@linaro.org> (raw)
In-Reply-To: <20170317150557.GI21222@n2100.armlinux.org.uk>
On Fri, 2017-03-17 at 15:05 +0000, Russell King - ARM Linux wrote
[...]
> I suspect we're into compiler behavioural differences, which can't be
> relied upon, so I guess we do need to do something in
> __kprobes_test_case_start() to work around it.
>
> I'd do:
>
> mov ip, sp
> tst sp, #4
> subeq sp, sp, #4 @ need to mis-align as we don't save
> stmfd sp!, {r4 - r11, ip} @ an even number of registers to end
> sub sp, sp, #size @ up with an aligned stack here
>
> and when restoring:
>
> add ip, sp, #size
> ldmfd ip, {r4 - r11, sp}
> bx r0
Thumb doesn't allow a lot of operations with SP (like that 'tst sp, #4'
or having SP in the reg list for LDM) which is why I ended up producing
slightly convoluted code. Some of these are deprecated for ARM too,
which means they might not be supported on newer architecture versions,
oh joy.
--
Tixy
prev parent reply other threads:[~2017-03-17 17:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-16 13:53 [PATCH] arm: kprobes: Align stack to 8-bytes in test code Jon Medhurst
2017-03-17 12:10 ` Russell King - ARM Linux
2017-03-17 12:59 ` Jon Medhurst (Tixy)
2017-03-17 14:06 ` Russell King - ARM Linux
2017-03-17 14:42 ` Jon Medhurst (Tixy)
2017-03-17 15:05 ` Russell King - ARM Linux
2017-03-17 17:50 ` Jon Medhurst (Tixy) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1489773049.3063.13.camel@linaro.org \
--to=tixy@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).