Flow of savevm in Android Goldfish
1. Introduction
- Android Emulator는 qemu를 사용하고 qemu의 qcow2 이미지 포멧을 활용해서
snapshot 기능을 사용할 수 있다.
- Emulator 소스의 snapshot의 flow를 살펴보자
2. snapshot은 do_savevm 함수로 구현되어 있다.
3. do_savevm을 call하는 영역?
1). console을 붙여서 명시적으로 savevm을 call
- telnet localhost 5554
- avd => snapshot => save => do_savevm call
2). savevm_on_exit 일 때
- do_savevm call
4. do_savevm call flow
- qemu_savevm_state
- register_savevm로 등록된 callback 호출
- 파라미터로 넘긴 파일에 state를 저장
- 모든 block의 bdrv_snapshot_create call
- qcow2인 경우 qcow2_snapshot_create call해서 snapshot 저장
5. android , goldfish 소스 상에서 register_savevm로 callback을 등록한 곳
- [external/qemu]# find . | grep android | xargs grep register_savevm
./telephony/android_modem.c: register_savevm( "android_modem", 0, ...
./slirp-android/slirp.c: register_savevm("slirp", 0, 1, slirp_state_save, slirp_state_load, NULL);
./android/hw-qemud.c: register_savevm( "qemud", 0, QEMUD_SAVE_VERSION,
./vl-android.c: //register_savevm("timer", 0, 2, timer_save, timer_load, &timers_state);
./vl-android.c: register_savevm_live("ram", 0, 3, ram_save_live, NULL, ram_load, NULL);
- [external/qemu]# find . | grep goldfish | xargs grep register_savevm
./hw/goldfish_events_device.c: register_savevm( "events_state", 0, ..
./hw/goldfish_interrupt.c: register_savevm( "goldfish_int", 0, GOLDFISH_INT_SAVE_VERSION,
./hw/goldfish_nand.c: register_savevm( "nand_dev", instance_id++, ..
./hw/goldfish_battery.c: register_savevm( "battery_state", 0, BATTERY_STATE_SAVE_VERSION,
./hw/goldfish_switch.c: register_savevm( "goldfish_switch", 0, ..
./hw/goldfish_tty.c: register_savevm( "goldfish_tty", instance_id++, ..
./hw/goldfish_pipe.c: register_savevm( "goldfish_pipe", 0, GOLDFISH_PIPE_SAVE_VERSION,
./hw/goldfish_fb.c: register_savevm( "goldfish_fb", 0, GOLDFISH_FB_SAVE_VERSION,
./hw/goldfish_timer.c: register_savevm( "goldfish_timer", 0, GOLDFISH_TIMER_SAVE_VERSION,
./hw/goldfish_timer.c: register_savevm( "goldfish_rtc", 0, GOLDFISH_RTC_SAVE_VERSION,
./hw/goldfish_mmc.c: register_savevm( "goldfish_mmc", 0, GOLDFISH_MMC_SAVE_VERSION,
./hw/goldfish_audio.c: register_savevm( "audio_state", 0, AUDIO_STATE_SAVE_VERSION,
[~/dev/android-jb/external/qemu]#
./telephony/android_modem.c: register_savevm( "android_modem", 0, ...
./slirp-android/slirp.c: register_savevm("slirp", 0, 1, slirp_state_save, slirp_state_load, NULL);
./android/hw-qemud.c: register_savevm( "qemud", 0, QEMUD_SAVE_VERSION,
./vl-android.c: //register_savevm("timer", 0, 2, timer_save, timer_load, &timers_state);
./vl-android.c: register_savevm_live("ram", 0, 3, ram_save_live, NULL, ram_load, NULL);
- [external/qemu]# find . | grep goldfish | xargs grep register_savevm
./hw/goldfish_events_device.c: register_savevm( "events_state", 0, ..
./hw/goldfish_interrupt.c: register_savevm( "goldfish_int", 0, GOLDFISH_INT_SAVE_VERSION,
./hw/goldfish_nand.c: register_savevm( "nand_dev", instance_id++, ..
./hw/goldfish_battery.c: register_savevm( "battery_state", 0, BATTERY_STATE_SAVE_VERSION,
./hw/goldfish_switch.c: register_savevm( "goldfish_switch", 0, ..
./hw/goldfish_tty.c: register_savevm( "goldfish_tty", instance_id++, ..
./hw/goldfish_pipe.c: register_savevm( "goldfish_pipe", 0, GOLDFISH_PIPE_SAVE_VERSION,
./hw/goldfish_fb.c: register_savevm( "goldfish_fb", 0, GOLDFISH_FB_SAVE_VERSION,
./hw/goldfish_timer.c: register_savevm( "goldfish_timer", 0, GOLDFISH_TIMER_SAVE_VERSION,
./hw/goldfish_timer.c: register_savevm( "goldfish_rtc", 0, GOLDFISH_RTC_SAVE_VERSION,
./hw/goldfish_mmc.c: register_savevm( "goldfish_mmc", 0, GOLDFISH_MMC_SAVE_VERSION,
./hw/goldfish_audio.c: register_savevm( "audio_state", 0, AUDIO_STATE_SAVE_VERSION,
[~/dev/android-jb/external/qemu]#
댓글
댓글 쓰기