Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Thorsten Kranzkowski <th@Marvin.DL8BCU.ampr.org>
To: Richard Henderson <rth@cygnus.com>
Cc: linux-alpha mailing list <linux-alpha@vger.rutgers.edu>,
	axp-list mailing list <axp-list@redhat.com>
Subject: unaligned access sin sys_swapon()
Date: Sat, 15 Apr 2000 01:11:36 +0000	[thread overview]
Message-ID: <20000415011135.A980@Marvin.DL8BCU.ampr.org> (raw)


Hello!
This is an Alpha AXPpxi33, ev4
gcc 2.96 (egcs-20000410)
kernel 2.3.99-pre5

I get an unaligned access in sys_swapon():

[from /proc/cpuinfo]:
kernel unaligned acc    : 10 (pc=fffffc0000346384,va=fffffc0007c8fff6)

[from System.map]:
fffffc0000345bc0 T get_swaparea_info
fffffc0000345e10 T is_swap_partition
fffffc0000345e80 T sys_swapon
fffffc00003468c0 T si_swapinfo
fffffc00003469d0 T swap_duplicate

[gcc invocation]:
gcc -D__KERNEL__ -I/usr/src/linux-2.3.99-pre5-work/include -Wall 
-Wstrict-prototypes -O2 -fomit-frame-pointer  -fno-strict-aliasing 
-pipe -mno-fp-regs -ffixed-8 -mcpu=ev4 -Wa,-mev6   
-c -o swapfile.o swapfile.c

[disassembled from swapfile.o]:

    16e8:       1f 04 ff 47     nop
    16ec:       00 00 e0 2f     unop
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:700
    16f0:       fa 1f ef b3     stl     zero,8186(fp)
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:704
    16f4:       01 00 ff 24     ldah    t6,1(zero)
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:700
    16f8:       fc 1f 2f a0     ldl     t0,8188(fp)
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:701
    16fc:       11 04 ff 47     clr     a1
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:704
    1700:       01 00 bf 20     lda     t4,1(zero)
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:700
    1704:       f6 1f ef b3     stl     zero,8182(fp)	<-------- this is the
							     unaligned access
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:704
    1708:       ff ff e7 20     lda     t6,-1(t6)
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:700
    170c:       21 76 3e 48     zapnot  t0,0xf3,t0
    1710:       fc 1f 2f b0     stl     t0,8188(fp)
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:702
    1714:       20 00 e9 b3     stl     zero,32(s0)
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:703
    1718:       24 00 e9 b3     stl     zero,36(s0)
    171c:       00 00 e0 2f     unop

[from swapfile.c]:
698:	switch (swap_header_version) {
699:	case 1:
700:		memset(((char *) swap_header)+PAGE_SIZE-10,0,10);
701:		j = 0;
702:		p->lowest_bit = 0;
703:		p->highest_bit = 0;
704:		for (i = 1 ; i < 8*PAGE_SIZE ; i++) {
705:			if (test_bit(i,(char *) swap_header)) {


So memset tries to fill the last 10 bytes of a page with '0'. But 2 of the
3 stl insns use an unaligned address!

				      ...this page... | ...next page...
[0]	[1] 	....	[8176]	[8180]	[8184]	[8188]|	[8192]
0123	4567 	....	0123	4567	89ab	cdef  |	0123
						      |
16f0::					  WW	WW 	unaligned write
16f8::				  		RRRR	aligned read
1704::				  WW	WW		unaligned write
1710::						..WW	aligned write


From asm-alpha/string.h it appears thet memset is in fact __builtin_memset 
in this case. Is this a gcc problem or did I miss something?


Bye,
Thorsten

-- 
| Thorsten Kranzkowski        Internet: dl8bcu@gmx.net                        |
| Mobile: ++49 170 1876134       Snail: Niemannsweg 30, 49201 Dissen, Germany |
| Ampr: dl8bcu@db0lj.#rpl.deu.eu, dl8bcu@marvin.dl8bcu.ampr.org [44.130.8.19] |


             reply	other threads:[~2000-04-15  1:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-15  1:11 Thorsten Kranzkowski [this message]
2000-04-16 20:11 ` unaligned access sin sys_swapon() Richard Henderson
2000-04-18 10:20   ` Ivan Kokshaysky
2000-04-18 20:47     ` Thorsten Kranzkowski
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox