Page MenuHomeFreeBSD

[PowerPC] Fix offset calculations in bridge mode
ClosedPublic

Authored by bdragon on Jan 6 2020, 8:03 PM.

Details

Summary

In rS354701, I replaced text relocations with offsets from &generictrap.

Unfortunately, the magic variable I was using doesn't actually mean the address of &generictrap, in bridge mode it actually means &generictrap64.

So, for bridge mode to work, it is necessary to differentiate between "where do we need to branch to to handle a trap" and "where is &generictrap for purposes of doing relative math".

Introduce a new TRAP_ENTRY and use it instead of TRAP_GENTRAP for doing actual calls to the generic trap handler.

Unfortunately, bridge mode is still broken even with this change due to the memory corruption problem.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

bdragon created this revision.Jan 6 2020, 8:03 PM
jhibbits added inline comments.Jan 6 2020, 9:23 PM
sys/powerpc/include/trap.h
150 ↗(On Diff #66420)

Is 0x1e8 taken?

bdragon added inline comments.Jan 18 2020, 12:54 AM
sys/powerpc/include/trap.h
150 ↗(On Diff #66420)

Nope, I just apparently can't count backwards in hex.

bdragon updated this revision to Diff 66946.Jan 18 2020, 1:14 AM

Use different address. I meant to have them next to each other but I jumped from f to d.

bdragon marked an inline comment as done.Jan 18 2020, 1:15 AM
bdragon updated this revision to Diff 66952.Jan 18 2020, 1:34 AM

I *meant* to alphabetize this in the first place.
This puts TRAP_GENTRAP back at its original address, too.

jhibbits accepted this revision.Jan 18 2020, 2:13 AM
This revision is now accepted and ready to land.Jan 18 2020, 2:13 AM
This revision was automatically updated to reflect the committed changes.