Skip to contentSkip to conversation

sparc64 replace tsptr with helper routine

PATCH In review Igor Kovalenko 2 participants 4 messages Jul 19, 2009 – Jul 21, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparc64 replace tsptr with helper routine

tl and tsptr of members sparc64 cpu state must be changed simultaneously to keep trap state window in sync with current trap level. Currently translation of store to tl does not change tsptr, which leads to corrupt trap state on corresponding trap level.

This patch removes tsptr from sparc64 cpu state and replaces all uses with call to helper routine.

Signed-off-by [email protected]
Signature · 2 lines
Kind regards,
Igor V. Kovalenko
#1 lore raw
Quoted 8 lines · Igor Kovalenko

tl and tsptr of members sparc64 cpu state must be changed simultaneously to keep trap state window in sync with current trap level. Currently translation of store to tl does not change tsptr, which leads to corrupt trap state on corresponding trap level.

This patch removes tsptr from sparc64 cpu state and replaces all uses with call to helper routine.

I'd rather have the stores to TL fixed instead of introducing a helper. A new function to set both TL and tsptr may help. Which stores to TL do not change tsptr?

On CPU reset, TL should be MAXTL for POR and MIN(TL+1, MAXTL) in other cases but your patch would set it to 0.

#2 lore raw
Quoted 8 lines · Blue Swirl
Quoted 6 lines · Igor Kovalenko

tl and tsptr of members sparc64 cpu state must be changed simultaneously to keep trap state window in sync with current trap level. Currently translation of store to tl does not change tsptr, which leads to corrupt trap state on corresponding trap level.

Quoted 6 lines
Quoted 2 lines

This patch removes tsptr from sparc64 cpu state and replaces all uses with call to helper routine.

I'd rather have the stores to TL fixed instead of introducing a helper. A new function to set both TL and tsptr may help. Which stores to TL do not change tsptr?

The problem is with translate.c portion about handling wrpr (it sets tl only). My idea is that even remote possibility of tsptr and tl going out of sync guarantees killing one of them. Since tl is a real register I decided to loose tsptr.

Quoted 3 lines

On CPU reset, TL should be MAXTL for POR and MIN(TL+1, MAXTL) in other cases but your patch would set it to 0.

Right but please see that original code did not done that either :)

Please see updated patch which additionally sets tl=maxtl. I decided to populate trap level, trap type and pstate with power-on reset values since other reset types are not handled yet.

Signature · 2 lines
Kind regards,
Igor V. Kovalenko
#3 lore raw
Quoted 12 lines · Igor Kovalenko
Quoted 11 lines · Blue Swirl
Quoted 8 lines · Igor Kovalenko

tl and tsptr of members sparc64 cpu state must be changed simultaneously to keep trap state window in sync with current trap level. Currently translation of store to tl does not change tsptr, which leads to corrupt trap state on corresponding trap level.

This patch removes tsptr from sparc64 cpu state and replaces all uses with call to helper routine.

Quoted 7 lines
Quoted 3 lines

I'd rather have the stores to TL fixed instead of introducing a helper. A new function to set both TL and tsptr may help. Which stores to TL do not change tsptr?

The problem is with translate.c portion about handling wrpr (it sets tl only). My idea is that even remote possibility of tsptr and tl going out of sync guarantees killing one of them. Since tl is a real register I decided to loose tsptr.

Getting rid of env->tsptr is OK, but it seems pointless to introduce a helper for such a small task. We could easily perform the get_tsptr calculation at translation time.

Quoted 8 lines
Quoted 2 lines

On CPU reset, TL should be MAXTL for POR and MIN(TL+1, MAXTL) in other cases but your patch would set it to 0.

Right but please see that original code did not done that either :)

Please see updated patch which additionally sets tl=maxtl. I decided to populate trap level, trap type and pstate with power-on reset values since other reset types are not handled yet.

Well, there is a kludge to handle the different PC for POR and others in sun4u.c. Maybe this should be moved to helper.c and handled properly with other reset type changes.