Page MenuHomeFreeBSD

fix libproc for big-endian systems
ClosedPublic

Authored by br on Oct 14 2016, 2:24 PM.
Tags
None
Referenced Files
F156638740: D8250.id21701.diff
Fri, May 15, 7:29 AM
F156621286: D8250.id21492.diff
Fri, May 15, 4:32 AM
F156621266: D8250.id21492.diff
Fri, May 15, 4:32 AM
F156589571: D8250.id21389.diff
Thu, May 14, 10:14 PM
F156578507: D8250.id21651.diff
Thu, May 14, 7:53 PM
F156577003: D8250.id.diff
Thu, May 14, 7:32 PM
Unknown Object (File)
Thu, May 14, 4:09 PM
Unknown Object (File)
Wed, May 13, 1:28 PM
Subscribers
None

Details

Summary

use uint32_t for instruction storage. This fixes operation on big endian 64bit MIPS

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

br retitled this revision from to fix libproc for big-endian systems.
br updated this object.
br edited the test plan for this revision. (Show Details)
br added a reviewer: rpaulo.

I don't think this is right. Not all big endian systems are LP64.

I don't think this is right. Not all big endian systems are LP64.

why? I bet it should work with any sizeof(unsigned long), e.g. 4 or 8

In D8250#172166, @br wrote:

I don't think this is right. Not all big endian systems are LP64.

why? I bet it should work with any sizeof(unsigned long), e.g. 4 or 8

What does this have to do with big endianess? You're basically moving 8 bytes forward and then 4 bytes backwards. What system is this on?

What does this have to do with big endianess? You're basically moving 8 bytes forward and then 4 bytes backwards. What system is this on?

it is MIPS64EB. Unsigned long is 8 bytes, instruction is 4 bytes, so it copies wrong data (it copies zeroes)

In D8250#172233, @br wrote:

What does this have to do with big endianess? You're basically moving 8 bytes forward and then 4 bytes backwards. What system is this on?

it is MIPS64EB. Unsigned long is 8 bytes, instruction is 4 bytes, so it copies wrong data (it copies zeroes)

Then how is it reading the original instruction correctly?

In D8250#172233, @br wrote:

What does this have to do with big endianess? You're basically moving 8 bytes forward and then 4 bytes backwards. What system is this on?

it is MIPS64EB. Unsigned long is 8 bytes, instruction is 4 bytes, so it copies wrong data (it copies zeroes)

Then how is it reading the original instruction correctly?

it reads the correct value, e.g. 0x67bdfff000000000. Casting it to uint32_t gives us 0x67bdfff0.

br edited edge metadata.

here is another one possible solution

In D8250#172346, @br wrote:
In D8250#172233, @br wrote:

What does this have to do with big endianess? You're basically moving 8 bytes forward and then 4 bytes backwards. What system is this on?

it is MIPS64EB. Unsigned long is 8 bytes, instruction is 4 bytes, so it copies wrong data (it copies zeroes)

Then how is it reading the original instruction correctly?

it reads the correct value, e.g. 0x67bdfff000000000. Casting it to uint32_t gives us 0x67bdfff0.

Well, this is odd. I wouldn't expect casting would produce such result.

In D8250#172348, @br wrote:

here is another one possible solution

I like this solution better.

br updated this object.

use instr_t for instruction storage.

rpaulo edited edge metadata.
rpaulo added inline comments.
lib/libproc/proc_bkpt.c
71 ↗(On Diff #21651)

Maybe add a comment here explaining why this works for x86.

This revision is now accepted and ready to land.Oct 24 2016, 3:05 PM
br edited edge metadata.

add comment

This revision now requires review to proceed.Oct 26 2016, 2:11 PM
This revision was automatically updated to reflect the committed changes.