gdt - swap usermode CS & SS

This commit is contained in:
RaphProductions 2025-05-16 08:48:15 +02:00
parent b2ec036055
commit ca489e986a
4 changed files with 6 additions and 7 deletions

View file

@ -10,8 +10,7 @@ void __x86_64_syscall_init() {
wrmsr(IA32_EFER, efer);
uint64_t star = 0;
star |= ((uint64_t)0x28 << 32); // kernel cs
star |= ((uint64_t)0x30
<< 48); // user cs base (SYSCALL adds 16 for CS=0x38, 24 for SS=0x40)
star |= ((uint64_t)0x30 << 48); // user cs base (SYSCALL adds 16 for CS=0x38, 24 for SS=0x40)
wrmsr(IA32_STAR, star);
wrmsr(IA32_LSTAR, (uint64_t)syscall_entry);
wrmsr(IA32_CSTAR, 0x0);