How can gem5 se mode execute a program with operating system dependencies?

谁都会走 提交于 2019-12-08 02:47:09

问题


Gem5 se mode is non-os mode, but i am able to execute row-hammer code on it which has commands with os dependencies.But if there is no os in se mode then how are they executed in se mode.


回答1:


Most userland allowed instructions just do the usual thing, which is to change the state of the the CPU slightly: touch registers + cache + memory.

Then when a syscall instruction is reached, the syscall is forwarded to the host which actually takes action.

However, this also requires some extra bookkeeping by the OS, which is why every single syscall must be implemented separately.

If I wanted to learn this :-) I would look at the implementation of a simple syscall like brk:

  • https://github.com/gem5/gem5/blob/5d442571eff5116551609ee7a3b63a3b9d27ff45/src/arch/x86/linux/process.cc#L223
  • https://github.com/gem5/gem5/blob/5d442571eff5116551609ee7a3b63a3b9d27ff45/src/sim/syscall_emul.cc#L212

I would also look into QEMU user mode, I think it will be a similar concept there, but with potentially more material available.

Maybe someone with a better understanding can explain further in more detail, and annotate specific parts of the code further.



来源:https://stackoverflow.com/questions/50961740/how-can-gem5-se-mode-execute-a-program-with-operating-system-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!