Code Review - Fix gcc-fuggetaboud-ecx issue V2

2 views
Skip to first unread message

Davide Libenzi

unread,
Dec 9, 2015, 11:04:15 PM12/9/15
to Akaros
Adding RSI, RDI, ECX as clobbers does not work. But marking them RW does.


https://github.com/brho/akaros/compare/master...dlibenzi:gcc_fuggetaboud_ecx_v2

The following changes since commit 2fa42319139e4cc5ca853546363f84443d0ead00:

  Rename 'reallocarray' to 'kreallocarray'. (2015-11-25 18:02:04 -0500)

are available in the git repository at:

  g...@github.com:dlibenzi/akaros gcc_fuggetaboud_ecx_v2

for you to fetch changes up to 3d4a4ec56106e29a31265eed30db6d77cf0bfc53:

  Flags RSI, RDI, ECX as RW operands so that GCC does not assume const (2015-12-09 19:55:47 -0800)

----------------------------------------------------------------
Davide Libenzi (1):
      Flags RSI, RDI, ECX as RW operands so that GCC does not assume const

 kern/arch/x86/uaccess.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kern/arch/x86/uaccess.h b/kern/arch/x86/uaccess.h
index cba0ef5..f8edaf4 100644
--- a/kern/arch/x86/uaccess.h
+++ b/kern/arch/x86/uaccess.h
@@ -101,8 +101,8 @@ struct extable_ip_fixup {
  " jmp 2b\n" \
  ".previous\n" \
  _ASM_EXTABLE(1b, 3b) \
- : "=r"(err) \
- : "D" (dst), "S" (src), "c" (count), "i" (errret), "0" (err) \
+ : "=r"(err), "+D" (dst), "+S" (src), "+c" (count) \
+ : "i" (errret), "0" (err) \
  : "memory")
 
 static inline int __put_user(void *dst, const void *src, unsigned int count)

barret rhoden

unread,
Dec 9, 2015, 11:54:03 PM12/9/15
to aka...@googlegroups.com
On 2015-12-09 at 20:04 'Davide Libenzi' via Akaros wrote:
> Adding RSI, RDI, ECX as clobbers does not work. But marking them RW
> does.

yep! that's what i was aiming for. =) will try it out tomorrow.

barret

Davide Libenzi

unread,
Dec 9, 2015, 11:59:59 PM12/9/15
to aka...@googlegroups.com
I tested that in your branch. Works.
Also looked at generated code, which now has proper reload.
> --
> You received this message because you are subscribed to the Google Groups "Akaros" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to akaros+un...@googlegroups.com.
> To post to this group, send email to aka...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Davide Libenzi

unread,
Dec 10, 2015, 8:35:50 AM12/10/15
to Akaros
I added a CLD in there as well. For zero cycles, it's a good peace of mind.

Barret Rhoden

unread,
Dec 10, 2015, 10:37:22 AM12/10/15
to aka...@googlegroups.com
On 2015-12-10 at 05:35 "'Davide Libenzi' via Akaros"
<aka...@googlegroups.com> wrote:
> I added a CLD in there as well. For zero cycles, it's a good peace of
> mind.

it shouldn't be necessary, since we CLD on our entry points. but i'll
take the peace of mind. =)

Barret Rhoden

unread,
Dec 10, 2015, 10:40:06 AM12/10/15
to aka...@googlegroups.com
Thanks,

Merged to master at 495a723da7db..3f805ed22943 (from, to]

You can see the entire diff with 'git diff' or at
https://github.com/brho/akaros/compare/495a723da7db...3f805ed22943


On 2015-12-09 at 20:04 "'Davide Libenzi' via Akaros"
Reply all
Reply to author
Forward
0 new messages