728x90
memory alias가 헷갈려서 한번 테스트해봤다
일단 normal world에서 QSIZE 레지스터에 0x1235460이라고 적고 secure partition에서 secure alias의 QSIZE를 출력해보았다
static void alias_test(psa_msg_t*msg){
void* s_alias=ETHOS_U55_APB_BASE_S;
//uint32_t test_ns=(((volatile struct NPU_REG*)ns_alias)->ID.word);
uint32_t test_s=(((volatile struct NPU_REG*)s_alias)->QSIZE.word);
//psa_write(msg->handle,0,&test_ns,msg->out_size[0]);//log
psa_write(msg->handle,0,&test_s,msg->out_size[0]);//log
}
normal world 코드는 이랬음
dev->reg->QSIZE.word=0x1234560;
..secure partition call..
printf("dev->reg address:0x%08lx, dev->reg->QSIZE.word:0x%08lx, secure world QSIZE:0x%08lx\n",(uint32_t)dev->reg, dev->reg->QSIZE.word,log);
결과는
dev->reg address:0x48102000, dev->reg->QSIZE.word:0x01234560, secure world QSIZE:0x01234560
이렇게 나왔다 (맨처음꺼는 normal world에서의 dev->reg가 normal alias이라는 걸 확인차 출력함)
왼쪽거는 normal world에서 출력한 거임!
즉 secure alias와 non-secure alias가 같은 곳을 가리킨다는 것을 알 수 있었따~
이 그림도 참고하면 좋을 듯
참고자료
Documentation – Arm Developer
developer.arm.com