How to enter into supervisor mode and user mode in MPC5675K MCU?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to enter into supervisor mode and user mode in MPC5675K MCU?

ソリューションへジャンプ
2,862件の閲覧回数
mohammedshibin
Contributor I

Hi,

 

How to enter into supervisor mode and user mode in MPC5675K and how to access CPU special function registers such as MSR(Machine State Register)?

 

Regards,

Mohammed Shibin

ラベル(1)
0 件の賞賛
返信
1 解決策
1,901件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

Screenshot_2.png

Access to MSR and SPR register must be done indirectly with using of mtmsr/mfmsr and mtmsr/mfmsr. Sometimes I am using macros below where ‘address’ points to variable where data are being written from/are read to. Or you can use pure assembler code.

/************** macro for MSR WRITE **************/

// param 'address' is a variable name (thus its address)

#define WRITE_TO_MSR(address)            \

asm (lis r30, (address)@h);              \

asm (ori r30, r30, (address)@l);         \

asm (lwz r31, 0x0(r30));                 \

asm (mtmsr r31);

/************** macro for MSR READ **************/

// param 'address' is a variable name (thus its address)

#define READ_FROM_MSR(address)           \

asm (lis r30, (address)@h);              \

asm (ori r30, r30, (address)@l);         \

asm (mfmsr r31);                         \

asm (stw r31, 0(r30));

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
1,902件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

Screenshot_2.png

Access to MSR and SPR register must be done indirectly with using of mtmsr/mfmsr and mtmsr/mfmsr. Sometimes I am using macros below where ‘address’ points to variable where data are being written from/are read to. Or you can use pure assembler code.

/************** macro for MSR WRITE **************/

// param 'address' is a variable name (thus its address)

#define WRITE_TO_MSR(address)            \

asm (lis r30, (address)@h);              \

asm (ori r30, r30, (address)@l);         \

asm (lwz r31, 0x0(r30));                 \

asm (mtmsr r31);

/************** macro for MSR READ **************/

// param 'address' is a variable name (thus its address)

#define READ_FROM_MSR(address)           \

asm (lis r30, (address)@h);              \

asm (ori r30, r30, (address)@l);         \

asm (mfmsr r31);                         \

asm (stw r31, 0(r30));

0 件の賞賛
返信
An error has occurred when reading existing sub-variable "Language_PG_Configuration"; see cause exception! The type of the containing value was: extended_hash+string (lithium.coreapi.webui.template.models.NamedValueByNameTemplateModel wrapped into f.e.b.StringModel) ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign redirect_lingo_page_url = web... [in template "language_macro_header.ftl" at line 173, column 1] - Reached through: #include "language_macro_header.ftl" [in template "Language_translator_Dashboard" at line 3, column 1] ----