Re: [PATCH v2 02/10] x86: assembly, FUNC_START for fn, DATA_START for data

Jiri Slaby
2017-03-22T12:07:02Z

[-- Attachment #1.1: Type: text/plain, Size: 2806 bytes --]

Hi,

On 03/21/2017, 03:08 PM, Pavel Machek wrote:
>> -ENTRY(saved_rbp) .quad 0
>> -ENTRY(saved_rsi) .quad 0
>> -ENTRY(saved_rdi) .quad 0
>> -ENTRY(saved_rbx) .quad 0
>> +SYM_DATA_START(saved_rbp) .quad 0
>> +SYM_DATA_START(saved_rsi) .quad 0
>> +SYM_DATA_START(saved_rdi) .quad 0
>> +SYM_DATA_START(saved_rbx) .quad 0
>
> Does it make sense to call it SYM_DATA_*START* when there's no
> corresponding end?
>
> Plus... it looks like saved_rsi (and friends) are only used inside
> wakeup_64.S. Could we just delete the "ENTRY" annotations?

So, now I have:

=== linkage.h ===

/* SYM_DATA_SIMPLE -- start+end wrapper around simple global data */
#ifndef SYM_DATA_SIMPLE
#define SYM_DATA_SIMPLE(name, data) \
SYM_DATA_START(name) ASM_NL \
data ASM_NL \
SYM_DATA_END(name)
#endif

/* SYM_DATA_SIMPLE_LOCAL -- start+end wrapper around simple local data */
#ifndef SYM_DATA_SIMPLE_LOCAL
#define SYM_DATA_SIMPLE_LOCAL(name, data) \
SYM_DATA_START_LOCAL(name) ASM_NL \
data ASM_NL \
SYM_DATA_END(name)
#endif

=== wakeup_64.S ===

SYM_DATA_SIMPLE_LOCAL(saved_rbp, .quad 0)
SYM_DATA_SIMPLE_LOCAL(saved_rsi, .quad 0)
SYM_DATA_SIMPLE_LOCAL(saved_rdi, .quad 0)
SYM_DATA_SIMPLE_LOCAL(saved_rbx, .quad 0)

SYM_DATA_SIMPLE_LOCAL(saved_rip, .quad 0)
SYM_DATA_SIMPLE_LOCAL(saved_rsp, .quad 0)

SYM_DATA_SIMPLE_LOCAL(saved_magic, .quad 0)

=== original ===

10: 0000000000000060 0 NOTYPE GLOBAL DEFAULT 3 saved_magic
11: 0000000000000050 0 NOTYPE GLOBAL DEFAULT 3 saved_rsp
12: 0000000000000030 0 NOTYPE GLOBAL DEFAULT 3 saved_rbx
13: 0000000000000020 0 NOTYPE GLOBAL DEFAULT 3 saved_rdi
14: 0000000000000010 0 NOTYPE GLOBAL DEFAULT 3 saved_rsi
15: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 3 saved_rbp
16: 0000000000000040 0 NOTYPE GLOBAL DEFAULT 3 saved_rip

=== new ===

4: 0000000000000030 8 OBJECT LOCAL DEFAULT 3 saved_magic
6: 0000000000000028 8 OBJECT LOCAL DEFAULT 3 saved_rsp
7: 0000000000000018 8 OBJECT LOCAL DEFAULT 3 saved_rbx
8: 0000000000000010 8 OBJECT LOCAL DEFAULT 3 saved_rdi
9: 0000000000000008 8 OBJECT LOCAL DEFAULT 3 saved_rsi
10: 0000000000000000 8 OBJECT LOCAL DEFAULT 3 saved_rbp
11: 0000000000000020 8 OBJECT LOCAL DEFAULT 3 saved_rip

=== EOF ===

BTW, ENTRY() aligned the data to 2^4 = 16 as we can see in the original.
But I see no point aligning data like this.

thanks,
--
js
suse labs

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 854 bytes --]