[parisc-linux] Back to evms-1.0.1 && unaligne access && gdb

Grant Grundler grundler@dsl2.external.hp.com
Fri, 30 Aug 2002 00:30:51 -0600


jsoe0708@tiscali.be wrote:
> Ah ok but where is located the actual problem (gcc, ld, kernel ?).

the program.

> I am not a computer science engineer and have not enough knowledge
> to understand this problem of unalign access and unalign adress.
> Can you give me some source of information explaining that stuff?

Details for parisc:
	"PA-RISC 2.0 Architecture" by Jerry Kane.
	page 5-11, "Unaligned Data Reference Trap (28)"
	page 7-84, "Load Word"

heh...doesn't define "aligned address" in the Glossary.
The same stuff is in the PA 1.1 Arch books too.

"aligned" means the address of the data falls on a boundary
that is modulo the size of the data. It's more complicated
for a "struct" but the rule applies to any field in a struct.

Examples:
	0x10 is an aligned address for an "int"
	0x12 is an aligned address for a "short" but not an "int".

Got it?

BTW, even though x86 CPUs don't trap on unaligned access,
they do take a performance hit. IIRC, it's one additional cycle.
Under linux, most (all?) RISC CPUs trap and handle the unaligned access
in the kernel trap handler. Other OS's could SIGBUS the application
to kill it.

Hmm...this is interesting:
/usr/include/linux/prctl.h:# define PR_UNALIGN_SIGBUS   2       /* generate SIGBUS on unaligned user access */

Maybe you can figure out how to set this and dig through the
core file instead of trying to set break points.

grant