参照元†
割り込みベクタ、補助ルーチンの配置
----------------------------------------
(*1) vectors = CONFIG_VECTORS_BASE
(*2) kuser_sz = __kuser_helper_start 〜 __kuser_helper_end のサイズ
vectors --> +--------+
| |
| | <-- __vectors_start 〜 __vectors_end をコピー
| | br 命令や ldr pc, address などが並んでいる。
| | 1エントリの長さ = 1命令分(32bit)
vectors --> +--------+
+ 0x200 | |
| | <-- __stubs_start 〜 __stubs_end をコピー
| | ベクタのジャンプ命令でこの領域にジャンプする。
| |
vectors --> +--------+
+ stubs の | |
サイズ | |
| 空 |
| |
| |
vectors --> +--------+
+ 0x1000 | |
- kuser_sz | |
| | <-- __kuser_helper_start 〜 __kuser_helper_end をコピー
| |
vectors --> +--------+
+ 0x1000
返り値†
void __init early_trap_init(void)
{
unsigned long vectors = CONFIG_VECTORS_BASE;
extern char __stubs_start[], __stubs_end[];
extern char __vectors_start[], __vectors_end[];
extern char __kuser_helper_start[], __kuser_helper_end[];
int kuser_sz = __kuser_helper_end - __kuser_helper_start;
/*
* Copy the vectors, stubs and kuser helpers (in entry-armv.S)
* into the vector page, mapped at 0xffff0000, and ensure these
* are visible to the instruction stream.
*/
memcpy((void *)vectors, __vectors_start, __vectors_end - __vectors_start);
memcpy((void *)vectors + 0x200, __stubs_start, __stubs_end - __stubs_start);
memcpy((void *)vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz);
/*
* Copy signal return handlers into the vector page, and
* set sigreturn to be a pointer to these.
*/
memcpy((void *)KERN_SIGRETURN_CODE, sigreturn_codes,
sizeof(sigreturn_codes));
memcpy((void *)KERN_RESTART_CODE, syscall_restart_code,
sizeof(syscall_restart_code));
flush_icache_range(vectors, vectors + PAGE_SIZE);
modify_domain(DOMAIN_USER, DOMAIN_CLIENT);
}
コメント†