mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 15:08:21 +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
|
add rsp,8 ; remove error code
|
||||||
|
|
||||||
; check if swapgs is needed
|
; check if swapgs is needed
|
||||||
cmp qword [rsp+8], 0x18
|
cmp qword [rsp+8], 0x23
|
||||||
jne .notneeded2
|
jne .notneeded2
|
||||||
swapgs
|
swapgs
|
||||||
.notneeded2:
|
.notneeded2:
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ static uint64_t template[7] = {
|
|||||||
0, // NULL 0x0
|
0, // NULL 0x0
|
||||||
0x00af9b000000ffff, // code64 0x8
|
0x00af9b000000ffff, // code64 0x8
|
||||||
0x00af93000000ffff, // data64 0x10
|
0x00af93000000ffff, // data64 0x10
|
||||||
0x00affb000000ffff, // ucode64 0x18
|
0x00aff3000000ffff, // udata64 0x18
|
||||||
0x00aff3000000ffff, // udata64 0x20
|
0x00affb000000ffff, // ucode64 0x20
|
||||||
0x0020890000000000, // low ist 0x28
|
0x0020890000000000, // low ist 0x28
|
||||||
0x0000000000000000 // high ist
|
0x0000000000000000 // high ist
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ isr_%+ i:
|
|||||||
|
|
||||||
; check if swapgs is needed
|
; check if swapgs is needed
|
||||||
|
|
||||||
cmp qword [rsp+16], 0x18
|
cmp qword [rsp+16], 0x23
|
||||||
jne .notneeded1
|
jne .notneeded1
|
||||||
swapgs
|
swapgs
|
||||||
.notneeded1:
|
.notneeded1:
|
||||||
@@ -73,7 +73,7 @@ isr_%+ i:
|
|||||||
add rsp,8 ; remove error code
|
add rsp,8 ; remove error code
|
||||||
|
|
||||||
; check if swapgs is needed
|
; check if swapgs is needed
|
||||||
cmp qword [rsp+8], 0x18
|
cmp qword [rsp+8], 0x23
|
||||||
jne .notneeded2
|
jne .notneeded2
|
||||||
swapgs
|
swapgs
|
||||||
.notneeded2:
|
.notneeded2:
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ typedef struct {
|
|||||||
|
|
||||||
#define CTX_INIT(x,u) \
|
#define CTX_INIT(x,u) \
|
||||||
if (u) { \
|
if (u) { \
|
||||||
(x)->cs = 0x1b; \
|
(x)->cs = 0x23; \
|
||||||
(x)->ds = (x)->es = (x)->ss = 0x23; \
|
(x)->ds = (x)->es = (x)->ss = 0x1b; \
|
||||||
} else { \
|
} else { \
|
||||||
(x)->cs = 0x8; \
|
(x)->cs = 0x8; \
|
||||||
(x)->ds = (x)->es = (x)->ss = 0x10; \
|
(x)->ds = (x)->es = (x)->ss = 0x10; \
|
||||||
|
|||||||
Reference in New Issue
Block a user