VIRTUTECH CONFIDENTIAL    Previous - Up - Next

ppc

Implemented By
ppc405gp, ppc440gp, ppc440gx, ppc603e, ppc7400, ppc7447, ppc7450, ppc7457, ppc750, ppc750fx, ppc750gx, ppc970fx
Description
typedef struct {
        void (*clear_atomic_reservation_bit)(conf_object_t *cpu);
        void (*raise_machine_check_exception)(conf_object_t *cpu,
                                              ppc_mc_exc_t exc);
        void (*register_spr_user_handlers)(integer_t spr_number,
                                           ppc_spr_user_getter_func_t getter,
                                           lang_void *user_getter_data,
                                           ppc_spr_user_setter_func_t setter,
                                           lang_void *user_setter_data,
                                           int privilege_checks);
        void (*unregister_spr_user_handlers)(integer_t spr_number);
        void (*spr_set_target_value)(conf_object_t *cpu, uinteger_t value);
        void (*spr_stash_value)(conf_object_t *cpu, integer_t spr_number,
                                uinteger_t value);
        uinteger_t (*spr_fetch_value)(conf_object_t *cpu,
                                      integer_t spr_number);
        ppc_spr_ret_t (*spr_default_getter)(conf_object_t *cpu,
                                            integer_t spr_number,
                                            ppc_spr_access_type_t type);
        ppc_spr_ret_t (*spr_default_setter)(conf_object_t *cpu,
                                            integer_t spr_number,
                                            uinteger_t value,
                                            ppc_spr_access_type_t type);
        const char* (*spr_get_name)(integer_t spr_number);
        integer_t (*spr_get_number)(const char *spr_name);
} ppc_interface_t;

#define PPC_INTERFACE "ppc"

The clear_atomic_reservation_bit() function clears the reservation bit which is set by an lwarx instruction. Clearing the reservation will cause a following stwcx. instruction to fail. This function is typically used by a cache hierarchy supporting SMP.

The raise_machine_check_exception() function raises a machine check exception. The exc argument is of the following type:

typedef enum {
        Sim_PPC_Generic_MC,

        Sim_PPC_MC_TEA,
        Sim_PPC_MC_MCP,
        Sim_PPC_Bus_Address_Parity,
        Sim_PPC_Bus_Data_Parity,
        Sim_PPC_Instruction_Cache_Parity,
        Sim_PPC_Data_Cache_Parity,
        Sim_PPC_L2_Data_Parity,
        Sim_PPC_L3_Data_Parity,
        Sim_PPC_L3_Address_Parity,
        
        Sim_PPC970_Data_Cache_Parity,
        Sim_PPC970_Data_Cache_Tag_Parity,
        Sim_PPC970_D_ERAT_Parity,
        Sim_PPC970_TLB_Parity,
        Sim_PPC970_SLB_Parity,
        Sim_PPC970_L2_Load_ECC_Parity,
        Sim_PPC970_L2_Page_Table_ECC_Parity,
        Sim_PPC970_Uncacheable_Load_Parity,
        Sim_PPC970_MC_External
} ppc_mc_exc_t;

The register_spr_user_handlers function will register user implemented get and set functions that will be called every time a read or write access is made to the SPR with number spr. The getter and setter function is of the following type:

The type parameter in the get and set functions is one of the following, depending on where from the access originated:

Both the get and the set functions must return one of these enum values:

If privilege_checks is not zero, Simics will do privilege checks when a mfspr/mtspr instruction is executed. If this does not produce the desired results, you can register the SPR handlers with privilege_checks set to zero, and do you own checks in your handlers.

The functions unregister_spr_user_handlers will remove any registered user handlers for a particular SPR.

The function spr_set_target_value should be called from the get function. The value will be written to the target register for instruction accesses, and returned for attribute and int register interface accesses. If this function is not called, the target register is not changed for instruction accesses (and the mfspr thus acts as a nop).

The functions spr_stash_value and spr_fetch_value can be used to store a SPR value in the processor. This is useful if only the getter (or only the setter) has been overridden with a user handler.

Sometimes it may be desirable to let the processor take care of the access. The functions spr_default_getter and spr_default_setter exist for this purpose.

The function spr_get_name takes spr_number as parameter and returns the name of the SPR.

The function spr_get_number takes the spr_name and returns the SPR number.

VIRTUTECH CONFIDENTIAL    Previous - Up - Next