File: misalign.c

package info (click to toggle)
biew 5.2.0-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,808 kB
  • ctags: 5,528
  • sloc: ansic: 38,763; makefile: 389; pascal: 245
file content (18 lines) | stat: -rw-r--r-- 352 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
void disable_misalign( void )
{
/* Disable misaligned memory access */
  asm("pushfl\n"
      "	popl	%%eax\n"
      "	orl	$0x40000, %%eax\n"
      "	pushl	%%eax\n"
      "	popfl"::);
/* THIS CODE MUST PRODUCED AN EXCEPTION */
 {
   long dlv[2],dlvr;
   char *eptr;
   eptr = dlv;
   eptr++;
   dlvr = 0;
   *((long *)eptr) = dlvr;
 }
}