问题
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