Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Issue 12181007: add x32 ABI support (Closed)

Created:
7 years, 10 months ago by vapier
Modified:
7 years, 8 months ago
CC:
chromium-reviews, Markus (顧孟勤)
Visibility:
Public.

Description

Add x32 ABI support The x32 ABI has 4 byte longs/pointers, so the existing x86_64 code won't work exactly as is. Many of the existing syscalls are unchanged (they still take 64bit values), and the assembly code always has to fill the 64bit registers. For the kernel stat structs, we need to mark all the fields explicitly as 64bit rather than relying on 'long' to be 8 bytes. We end up having to declare a dedicated statfs struct because it was being shared among many other 32bit arches. To make the syscall style easier, we end up gutting the existing syscall macros and replacing them with a series of expandable ones (based on the number of args). This uses an existing style as the mips code. The default code now all casts everything to uintptr_t first (which will be 32bit or 64bit based on the native size) and then casting it up to 64bits (which is required to fill a 64bit register). This works for the vast majority of syscalls as they take native sized values. However, there are a handful of syscalls that still take 64bit values. We can't cast to uintptr_t first because it'd mean we'd truncate. We also can't cast everything straight to 64bit because it'd incur a ton of compile time warnings. So for these handful of syscalls, we expand things ourselves using the new macros and take care of casting each arg exactly as needed. BUG=chromium:219015 TEST=compiled the code for x86_64 (64bit) & x86_64 (x32) & ran tests Committed: https://code.google.com/p/linux-syscall-support/source/detail?r=19

Patch Set 1 #

Total comments: 13

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Total comments: 2

Patch Set 6 : #

Total comments: 22

Patch Set 7 : #

Total comments: 2

Patch Set 8 : #

Patch Set 9 : #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+194 lines, -68 lines) Patch
M lss/linux_syscall_support.h View 1 2 3 4 5 6 7 8 12 chunks +194 lines, -68 lines 1 comment Download

Messages

Total messages: 21 (0 generated)
vapier
7 years, 10 months ago (2013-02-26 00:55:10 UTC) #1
Mark Seaborn
https://codereview.chromium.org/12181007/diff/1/lss/linux_syscall_support.h File lss/linux_syscall_support.h (right): https://codereview.chromium.org/12181007/diff/1/lss/linux_syscall_support.h#newcode1759 lss/linux_syscall_support.h:1759: #define LSS_SC_ARG(a) (sizeof(a) == 8 ? \ "SC" is ...
7 years, 9 months ago (2013-02-28 17:46:53 UTC) #2
vapier
https://codereview.chromium.org/12181007/diff/1/lss/linux_syscall_support.h File lss/linux_syscall_support.h (right): https://codereview.chromium.org/12181007/diff/1/lss/linux_syscall_support.h#newcode1759 lss/linux_syscall_support.h:1759: #define LSS_SC_ARG(a) (sizeof(a) == 8 ? \ Done. https://codereview.chromium.org/12181007/diff/1/lss/linux_syscall_support.h#newcode1761 ...
7 years, 9 months ago (2013-02-28 21:51:48 UTC) #3
Mark Seaborn
https://codereview.chromium.org/12181007/diff/1/lss/linux_syscall_support.h File lss/linux_syscall_support.h (right): https://codereview.chromium.org/12181007/diff/1/lss/linux_syscall_support.h#newcode1761 lss/linux_syscall_support.h:1761: (unsigned long long)(uintptr_t)(a)) On 2013/02/28 21:51:48, vapier wrote: > ...
7 years, 9 months ago (2013-03-01 23:15:40 UTC) #4
vapier
https://codereview.chromium.org/12181007/diff/1/lss/linux_syscall_support.h File lss/linux_syscall_support.h (right): https://codereview.chromium.org/12181007/diff/1/lss/linux_syscall_support.h#newcode1761 lss/linux_syscall_support.h:1761: (unsigned long long)(uintptr_t)(a)) sure, i didn't mean to indicate ...
7 years, 9 months ago (2013-03-01 23:21:49 UTC) #5
Mark Seaborn
https://codereview.chromium.org/12181007/diff/1/lss/linux_syscall_support.h File lss/linux_syscall_support.h (right): https://codereview.chromium.org/12181007/diff/1/lss/linux_syscall_support.h#newcode1761 lss/linux_syscall_support.h:1761: (unsigned long long)(uintptr_t)(a)) On 2013/03/01 23:21:49, vapier wrote: > ...
7 years, 9 months ago (2013-03-04 16:52:44 UTC) #6
vapier
this latest version implements your _Pragma idea. x32 is now warning free for me w/my ...
7 years, 9 months ago (2013-03-05 04:46:16 UTC) #7
Mark Seaborn
https://codereview.chromium.org/12181007/diff/12001/lss/linux_syscall_support.h File lss/linux_syscall_support.h (right): https://codereview.chromium.org/12181007/diff/12001/lss/linux_syscall_support.h#newcode1766 lss/linux_syscall_support.h:1766: _Pragma("GCC diagnostic ignored \"-Wpointer-to-int-cast\""); \ You also need to ...
7 years, 9 months ago (2013-03-05 17:05:19 UTC) #8
vapier
you're right that the flags kick on for the rest of the file (and thus ...
7 years, 9 months ago (2013-03-08 21:51:06 UTC) #9
Mark Seaborn
On 8 March 2013 13:51, <vapier@chromium.org> wrote: > the most annoying part about this is ...
7 years, 9 months ago (2013-03-09 01:13:49 UTC) #10
vapier
i believe the exceptions are: fallocate ftruncate lseek mmap posix_fadvise preadv pwritev yes, x32 doesn't ...
7 years, 9 months ago (2013-03-09 01:24:38 UTC) #11
vapier
WDYT of this version ? passes my testsuite on x86_64 in both 64bit & x32 ...
7 years, 9 months ago (2013-03-25 18:04:42 UTC) #12
Mark Seaborn
Generally good -- some suggestions below. https://codereview.chromium.org/12181007/diff/20001/lss/linux_syscall_support.h File lss/linux_syscall_support.h (left): https://codereview.chromium.org/12181007/diff/20001/lss/linux_syscall_support.h#oldcode1850 lss/linux_syscall_support.h:1850: __asm__ __volatile__("movq %5,%%r10; ...
7 years, 9 months ago (2013-03-25 19:59:05 UTC) #13
vapier
https://codereview.chromium.org/12181007/diff/20001/lss/linux_syscall_support.h File lss/linux_syscall_support.h (left): https://codereview.chromium.org/12181007/diff/20001/lss/linux_syscall_support.h#oldcode1850 lss/linux_syscall_support.h:1850: __asm__ __volatile__("movq %5,%%r10; movq %6,%%r8; movq %7,%%r9;" \ i ...
7 years, 9 months ago (2013-03-25 20:21:08 UTC) #14
Mark Seaborn
LGTM. Can you run a Chromium try job before committing as with the previous change? ...
7 years, 9 months ago (2013-03-25 23:22:01 UTC) #15
vapier
i'll try and figure out the trybots again :) https://codereview.chromium.org/12181007/diff/20001/lss/linux_syscall_support.h File lss/linux_syscall_support.h (right): https://codereview.chromium.org/12181007/diff/20001/lss/linux_syscall_support.h#newcode1828 lss/linux_syscall_support.h:1828: ...
7 years, 9 months ago (2013-03-26 04:01:11 UTC) #16
vapier
ok, this one passed CrOS/Linux trybots (didn't bother testing others) i seem to recall the ...
7 years, 9 months ago (2013-03-26 17:17:50 UTC) #17
Mark Seaborn
LGTM still On 2013/03/26 17:17:50, vapier wrote: > ok, this one passed CrOS/Linux trybots (didn't ...
7 years, 8 months ago (2013-04-01 15:46:30 UTC) #18
vapier
Committed patchset #9 manually as r19 (presubmit successful).
7 years, 8 months ago (2013-04-01 17:52:50 UTC) #19
Mark Seaborn
https://codereview.chromium.org/12181007/diff/33002/lss/linux_syscall_support.h File lss/linux_syscall_support.h (right): https://codereview.chromium.org/12181007/diff/33002/lss/linux_syscall_support.h#newcode2039 lss/linux_syscall_support.h:2039: return (void (*)())(uintptr_t)res; I noticed that this breaks the ...
7 years, 8 months ago (2013-04-02 15:47:17 UTC) #20
vapier
7 years, 8 months ago (2013-04-02 15:55:58 UTC) #21
Message was sent while issue was closed.
done: https://codereview.chromium.org/13476002

Powered by Google App Engine
This is Rietveld 408576698