mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
x86-64: switch order of user code and data segments for syscall instruction
This commit is contained in:
@@ -27,7 +27,7 @@ arch_context_switch:
|
||||
add rsp,8 ; remove error code
|
||||
|
||||
; check if swapgs is needed
|
||||
cmp qword [rsp+8], 0x18
|
||||
cmp qword [rsp+8], 0x23
|
||||
jne .notneeded2
|
||||
swapgs
|
||||
.notneeded2:
|
||||
|
||||
@@ -9,8 +9,8 @@ static uint64_t template[7] = {
|
||||
0, // NULL 0x0
|
||||
0x00af9b000000ffff, // code64 0x8
|
||||
0x00af93000000ffff, // data64 0x10
|
||||
0x00affb000000ffff, // ucode64 0x18
|
||||
0x00aff3000000ffff, // udata64 0x20
|
||||
0x00aff3000000ffff, // udata64 0x18
|
||||
0x00affb000000ffff, // ucode64 0x20
|
||||
0x0020890000000000, // low ist 0x28
|
||||
0x0000000000000000 // high ist
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@ isr_%+ i:
|
||||
|
||||
; check if swapgs is needed
|
||||
|
||||
cmp qword [rsp+16], 0x18
|
||||
cmp qword [rsp+16], 0x23
|
||||
jne .notneeded1
|
||||
swapgs
|
||||
.notneeded1:
|
||||
@@ -73,7 +73,7 @@ isr_%+ i:
|
||||
add rsp,8 ; remove error code
|
||||
|
||||
; check if swapgs is needed
|
||||
cmp qword [rsp+8], 0x18
|
||||
cmp qword [rsp+8], 0x23
|
||||
jne .notneeded2
|
||||
swapgs
|
||||
.notneeded2:
|
||||
|
||||
@@ -44,8 +44,8 @@ typedef struct {
|
||||
|
||||
#define CTX_INIT(x,u) \
|
||||
if (u) { \
|
||||
(x)->cs = 0x1b; \
|
||||
(x)->ds = (x)->es = (x)->ss = 0x23; \
|
||||
(x)->cs = 0x23; \
|
||||
(x)->ds = (x)->es = (x)->ss = 0x1b; \
|
||||
} else { \
|
||||
(x)->cs = 0x8; \
|
||||
(x)->ds = (x)->es = (x)->ss = 0x10; \
|
||||
|
||||
Reference in New Issue
Block a user