小弟今天刚开始看redboot启动代码,发现一个问题请各位大侠指教?就是这条语句UNMAPPED_PTR(reset_vector)的目的何在?为啥不可以写成PTR(reset_vector)呢? 先谢过各位!!!!! #ifndef UNMAPPED #ifdef CYGHWR_HAL_ARM_HAS_MMU # ifndef CYGHWR_HAL_ROM_VADDR # define CYGHWR_HAL_ROM_VADDR __exception_handlers # endif # define UNMAPPED(x) ((x)-CYGHWR_HAL_ROM_VADDR) #else # define UNMAPPED(x) (x) #endif #endif #define UNMAPPED_PTR(name) .##name: .word UNMAPPED(name) #define PTR(name) .##name: .word name
.global __exception_handlers __exception_handlers: #ifdef CYGSEM_HAL_ROM_RESET_USES_JUMP // Assumption: ROM code has these vectors at the hardware reset address. // A simple jump removes any address-space dependencies [i.e. safer] b reset_vector // 0x00 #else ldr pc,.reset_vector // 0x00 #endif ldr pc,.undefined_instruction // 0x04 ldr pc,.software_interrupt // 0x08 start && software int ldr pc,.abort_prefetch // 0x0C ldr pc,.abort_data // 0x10 .word 0 // unused ldr pc,.IRQ // 0x18 ldr pc,.FIQ // 0x1C
// The layout of these pointers should match the vector table above since // they are copied in pairs. .global vectors vectors: UNMAPPED_PTR(reset_vector) // 0x20 PTR(undefined_instruction) // 0x24 PTR(software_interrupt) // 0x28 PTR(abort_prefetch) // 0x2C PTR(abort_data) // 0x30 .word 0 // 0x34 PTR(IRQ) // 0x38 PTR(FIQ) // 0x3c #ifdef CYGSEM_HAL_ARM_PID_ANGEL_BOOT PTR(start) // This is copied to 0x28 for bootup // 0x40 #endif
|