2011-10-11 0:48:10

来源:互联网 发布:北航网络远程教育 编辑:程序博客网 时间:2024/05/21 15:07
 

2011-10-11 0:48:10

    goldfish_device_init(goldfish_pic, 0xff010000, 0x7f0000, 10, 22);
   
   
    设备总线
   
    goldfish_device_bus_init(0xff001000, 1);
   
   
    static inline int get_phys_addr(CPUState *env, uint32_t address,
                                int access_type, int is_user,
                                uint32_t *phys_ptr, int *prot)
{
    /* Fast Context Switch Extension.  */
    if (address < 0x02000000)
        address += env->cp15.c13_fcse;

    if ((env->cp15.c1_sys & 1) == 0) {
        /* MMU/MPU disabled.  */
        *phys_ptr = address;
        *prot = PAGE_READ | PAGE_WRITE;
        return 0;
    } else if (arm_feature(env, ARM_FEATURE_MPU)) {
 return get_phys_addr_mpu(env, address, access_type, is_user, phys_ptr,
     prot);
    } else if (env->cp15.c1_sys & (1 << 23)) {
        return get_phys_addr_v6(env, address, access_type, is_user, phys_ptr,
                                prot);
    } else {
        return get_phys_addr_v5(env, address, access_type, is_user, phys_ptr,
                                prot);
    }
}

从虚拟地址到物理地址


static uint32_t get_level1_table_address(CPUState *env, uint32_t address)
{
    uint32_t table;

    if (address & env->cp15.c2_mask)
        table = env->cp15.c2_base1 & 0xffffc000;
    else
        table = env->cp15.c2_base0 & env->cp15.c2_base_mask;

    table |= (address >> 18) & 0x3ffc;
    return table;
}

找到1级页表

设备总线将所有设备通知给内核