Program State Information Registers(PSW register)

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
indra
Level 1
Level 1
5 questions asked 5 replies posted 10 sign-ins

Hi, why does the IO bit in PSW register wont change, other bits get changed why is this happening

0 Likes
1 Solution
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored

They are then two possibilties, the assembler code is wrong (please provide) or the debugger always set the IO to supervisor, maybe there that this is an option in the debugger. With Lauterbach I can't see this behavior, correct assemble instruction -> correct value in PSW.
Maybe you should let show the assembled code and make there instruction step to see that the used dataregister contains the correct value.

View solution in original post

0 Likes
9 Replies
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored

What is the state of IO bitfield before and after operation?
How you make the change of register?

0 Likes
indra
Level 1
Level 1
5 questions asked 5 replies posted 10 sign-ins

Hi @MoD 

before the io bit field value is 2. I need to change the value to 0(user mode 0) or 1(user mode 1)

This is the code I am using 

//Code 1

Ifx_CPU_PSW psw;
psw.U = __mfcr(CPU_PSW);
psw.B.IO=1;

//Code 2

__mtcr(CPU_PSW, 0X00000180u);

//Code 3

uint32 psw;
psw = __mfcr( CPU_PSW );
psw &= 0xFFFFF1FF;
__mtcr( CPU_PSW, psw );

 

0 Likes
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored

Code 1 don't change the PSW, there is missing __mtcr(CPU_PSW, psw.U);

Code 2 should set the IO bitfield of PSW to 0x0

Code 3 should set the IO bitfield of PSW to 0x0 also IS bit should be cleared

How you read the valiue from PSW, which debugger? Sure that the value is updated?

0 Likes
indra
Level 1
Level 1
5 questions asked 5 replies posted 10 sign-ins

Yes I have read the PSW value the value is 0xa80(previous 0x980) from csfr registers. I use Aurix ude as debugger

0 Likes
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored

Which code change the value from 0xA80 to 0x980?

Can you add also the assembler listing for this code? 

As debugger you use the PLS UDE with an own box, correct?

0 Likes
indra
Level 1
Level 1
5 questions asked 5 replies posted 10 sign-ins

@MoD  the 2nd code changes the value and yes I use pls ude

0 Likes
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored

They are then two possibilties, the assembler code is wrong (please provide) or the debugger always set the IO to supervisor, maybe there that this is an option in the debugger. With Lauterbach I can't see this behavior, correct assemble instruction -> correct value in PSW.
Maybe you should let show the assembled code and make there instruction step to see that the used dataregister contains the correct value.

0 Likes
indra
Level 1
Level 1
5 questions asked 5 replies posted 10 sign-ins

indra_1-1678466275391.png

@MoD  This the assembly code for code 2 d15 holds correct value

0 Likes
indra
Level 1
Level 1
5 questions asked 5 replies posted 10 sign-ins

Hi @MoD ,

The problem is with the debugger. Thank you problem solved

BR,

Indra

0 Likes