Hello,

I have a questions regarding executing privileged instructions in gem5. I 
tested the following program on the AtomicSimple and O3 CPU type (arch x86) 
inside gem5 (version 20.0.0.2) running a full system Linux with kernel version 
5.4.55:

static inline void invlpg(unsigned long addr) {
    asm volatile("invlpg (%0)" ::"r" (addr) : "memory");
}

int main() {
    int mem;
    invlpg((unsigned long) &mem);   
}

The program was executed without an error. I would have expected, that some 
kind of error occurs, because invlpg is a privileged instruction, so I should 
not be able to execute it in user mode. To verify that this behaviour is indeed 
special to gem5 and not related to my kernel, disk image or program, I booted 
the same Linux system with the same kernel and disk image in qemu and executed 
the same binary. Executing the program in qemu resulted in a general protection 
fault.
Is gem5 missing some kind of check which prevents executing privileged 
instruction in user mode, or is this somehow expected behaviour and I missed 
something ?  
_______________________________________________
gem5-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to