On 9/21/23 14:11, Nikolay Borisov wrote:

+SYM_FUNC_START(asm_fred_entry_from_kvm)
+    push %rbp
+    mov %rsp, %rbp

use FRAME_BEGIN/FRAME_END macros to ommit this code if CONFIG_FRAME_POINTER is disabled.

No, the previous stack pointer is used below, so the code might as well use %rbp for that; but it must do so unconditionally.

Paolo

+
+    UNWIND_HINT_SAVE
+
+    /*
+     * Don't check the FRED stack level, the call stack leading to this
+     * helper is effectively constant and shallow (relatively speaking).
+     *
+     * Emulate the FRED-defined redzone and stack alignment.
+     */
+    sub $(FRED_CONFIG_REDZONE_AMOUNT << 6), %rsp
+    and $FRED_STACK_FRAME_RSP_MASK, %rsp
+
+    /*
+     * Start to push a FRED stack frame, which is always 64 bytes:
+     *
+     * +--------+-----------------+
+     * | Bytes  | Usage           |
+     * +--------+-----------------+
+     * | 63:56  | Reserved        |
+     * | 55:48  | Event Data      |
+     * | 47:40  | SS + Event Info |
+     * | 39:32  | RSP             |
+     * | 31:24  | RFLAGS          |
+     * | 23:16  | CS + Aux Info   |
+     * |  15:8  | RIP             |
+     * |   7:0  | Error Code      |
+     * +--------+-----------------+
+     */
+    push $0                /* Reserved, must be 0 */
+    push $0                /* Event data, 0 for IRQ/NMI */
+    push %rdi            /* fred_ss handed in by the caller */
+    push %rbp

^^ here

Paolo

+    pushf
+    mov $__KERNEL_CS, %rax
+    push %rax


Reply via email to