72
73 #else /* !lint */
74
75 #ifdef _ASM /* The remainder of this file is only for assembly files */
76
77 #if defined(__amd64)
78
79 /*
80 * syscall handler for 32-bit user processes:
81 * See "64-BIT INTERPOSITION STACK" in brand_asm.h.
82 * To 'return' to our user-space handler, we just need to place its address
83 * into %rcx. The original return address is passed back in SYSCALL_REG.
84 */
85 ENTRY(XXX_brand_syscall32_callback)
86 CALLBACK_PROLOGUE(XXX_emulation_table, SPD_HANDLER, SYSCALL_REG,
87 SCR_REG, SCR_REGB);
88 CALC_TABLE_ADDR(SCR_REG, SPD_HANDLER);
89 mov %rcx, SYSCALL_REG; /* save orig return addr in syscall_reg */
90 mov SCR_REG, %rcx; /* place new return addr in %rcx */
91 mov %gs:CPU_RTMP_R15, SCR_REG; /* restore scratch register */
92 call *x86_md_clear /* Flush micro-arch state */
93 mov V_SSP(SP_REG), SP_REG /* restore user stack pointer */
94 jmp nopop_sys_syscall32_swapgs_sysretl
95 9:
96 retq
97 SET_SIZE(XXX_brand_syscall32_callback)
98
99 /*
100 * syscall handler for 64-bit user processes:
101 * See "64-BIT INTERPOSITION STACK" in brand_asm.h.
102 * To 'return' to our user-space handler, we just need to place its address
103 * into %rcx. The original return address is passed back in SYSCALL_REG.
104 */
105 ENTRY(XXX_brand_syscall_callback)
106 CALLBACK_PROLOGUE(XXX_emulation_table, SPD_HANDLER, SYSCALL_REG,
107 SCR_REG, SCR_REGB);
108 CALC_TABLE_ADDR(SCR_REG, SPD_HANDLER);
109 mov %rcx, SYSCALL_REG; /* save orig return addr in syscall_reg */
110 mov SCR_REG, %rcx; /* place new return addr in %rcx */
111 mov %gs:CPU_RTMP_R15, SCR_REG; /* restore scratch register */
112 call *x86_md_clear /* Flush micro-arch state */
113 mov V_SSP(SP_REG), SP_REG /* restore user stack pointer */
114 jmp nopop_sys_syscall_swapgs_sysretq
115 9:
116 retq
117 SET_SIZE(XXX_brand_syscall_callback)
118
119 /*
120 * See "64-BIT INTERPOSITION STACK" in brand_asm.h.
121 * To 'return' to our user-space handler, we just need to place its address
122 * into %rdx. The original return address is passed back in SYSCALL_REG.
123 */
124 ENTRY(XXX_brand_sysenter_callback)
125 CALLBACK_PROLOGUE(XXX_emulation_table, SPD_HANDLER, SYSCALL_REG,
126 SCR_REG, SCR_REGB);
127 CALC_TABLE_ADDR(SCR_REG, SPD_HANDLER);
128 mov %rdx, SYSCALL_REG; /* save orig return addr in syscall_reg */
129 mov SCR_REG, %rdx; /* place new return addr in %rdx */
130 mov %gs:CPU_RTMP_R15, SCR_REG; /* restore scratch register */
131 mov V_SSP(SP_REG), SP_REG /* restore user stack pointer */
132 jmp sys_sysenter_swapgs_sysexit
|
72
73 #else /* !lint */
74
75 #ifdef _ASM /* The remainder of this file is only for assembly files */
76
77 #if defined(__amd64)
78
79 /*
80 * syscall handler for 32-bit user processes:
81 * See "64-BIT INTERPOSITION STACK" in brand_asm.h.
82 * To 'return' to our user-space handler, we just need to place its address
83 * into %rcx. The original return address is passed back in SYSCALL_REG.
84 */
85 ENTRY(XXX_brand_syscall32_callback)
86 CALLBACK_PROLOGUE(XXX_emulation_table, SPD_HANDLER, SYSCALL_REG,
87 SCR_REG, SCR_REGB);
88 CALC_TABLE_ADDR(SCR_REG, SPD_HANDLER);
89 mov %rcx, SYSCALL_REG; /* save orig return addr in syscall_reg */
90 mov SCR_REG, %rcx; /* place new return addr in %rcx */
91 mov %gs:CPU_RTMP_R15, SCR_REG; /* restore scratch register */
92 call x86_md_clear /* Flush micro-arch state */
93 mov V_SSP(SP_REG), SP_REG /* restore user stack pointer */
94 jmp nopop_sys_syscall32_swapgs_sysretl
95 9:
96 retq
97 SET_SIZE(XXX_brand_syscall32_callback)
98
99 /*
100 * syscall handler for 64-bit user processes:
101 * See "64-BIT INTERPOSITION STACK" in brand_asm.h.
102 * To 'return' to our user-space handler, we just need to place its address
103 * into %rcx. The original return address is passed back in SYSCALL_REG.
104 */
105 ENTRY(XXX_brand_syscall_callback)
106 CALLBACK_PROLOGUE(XXX_emulation_table, SPD_HANDLER, SYSCALL_REG,
107 SCR_REG, SCR_REGB);
108 CALC_TABLE_ADDR(SCR_REG, SPD_HANDLER);
109 mov %rcx, SYSCALL_REG; /* save orig return addr in syscall_reg */
110 mov SCR_REG, %rcx; /* place new return addr in %rcx */
111 mov %gs:CPU_RTMP_R15, SCR_REG; /* restore scratch register */
112 call x86_md_clear /* Flush micro-arch state */
113 mov V_SSP(SP_REG), SP_REG /* restore user stack pointer */
114 jmp nopop_sys_syscall_swapgs_sysretq
115 9:
116 retq
117 SET_SIZE(XXX_brand_syscall_callback)
118
119 /*
120 * See "64-BIT INTERPOSITION STACK" in brand_asm.h.
121 * To 'return' to our user-space handler, we just need to place its address
122 * into %rdx. The original return address is passed back in SYSCALL_REG.
123 */
124 ENTRY(XXX_brand_sysenter_callback)
125 CALLBACK_PROLOGUE(XXX_emulation_table, SPD_HANDLER, SYSCALL_REG,
126 SCR_REG, SCR_REGB);
127 CALC_TABLE_ADDR(SCR_REG, SPD_HANDLER);
128 mov %rdx, SYSCALL_REG; /* save orig return addr in syscall_reg */
129 mov SCR_REG, %rdx; /* place new return addr in %rdx */
130 mov %gs:CPU_RTMP_R15, SCR_REG; /* restore scratch register */
131 mov V_SSP(SP_REG), SP_REG /* restore user stack pointer */
132 jmp sys_sysenter_swapgs_sysexit
|