UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor andrew57jm
Visitor
6,985 Views
Registered: ‎06-14-2012

Microblaze Unaligned Data Exception

Hi,

I'm developing a project with SDK 14.3 and lwIP140 that contains a simple embedded webserver. Early on in the game I realized that a lot of the webserver functions involved dereferencing pointers in potentially unaligned byte streams. So I enabled the unaligned data exception on the microblaze, enabled exceptions in the BSP and for a while all was well.

 

Just recently, while testing with an obsolete version of IE, we noticed that connecting to our webserver caused the microblaze to hang dead.It's stuck at  the ex_handler_unhandled label in hw_exception_handler.S. What's happening is that it's getting an unaligned data exception from register 17, and the table entry for register 17 doesn't fix the  unaligned data acess but just instead just traps it and that's what hangs the microblaze.

 

sw_r14: SWREG_TO_R3 (14);
sw_r15: SWREG_TO_R3 (15);
sw_r16: SWREG_TO_R3 (16);
sw_r17: SWREG_NOP;                      // this is where the code gets sent to the unhandled exception trap
sw_r18: SWREG_TO_R3 (18);
sw_r19: SWREG_TO_R3 (19);
sw_r20: SWREG_TO_R3 (20);

 

The problem is that I have no idea what to do about this. I don't control the register allocation by the compiler so I don't even know where to start. But it's unacceptable to have the processor hang when the webserver gets accessed by a certain web browser, even obsolete IE.

Any ideas?

 

0 Kudos
3 Replies
Xilinx Employee
Xilinx Employee
6,966 Views
Registered: ‎08-06-2007

Re: Microblaze Unaligned Data Exception

Hi,

 

There is something weird going around here since the compiler should never allocate R17 since it is used as the exception return address.

 

Do you have any code that uses R17?

 

Göran

 

0 Kudos
Visitor andrew57jm
Visitor
6,957 Views
Registered: ‎06-14-2012

Re: Microblaze Unaligned Data Exception

Nope, we don't do anything in assembly. 

0 Kudos
Xilinx Employee
Xilinx Employee
6,943 Views
Registered: ‎08-06-2007

Re: Microblaze Unaligned Data Exception

Hi,

 

Then the only other reason behind this is that MicroBlaze is execute something that isn't instruction code.

Stack or data corruption can lead to MicroBlaze executing random code and this code could use R17 and thus you experience this issue.

 

Göran

0 Kudos