summaryrefslogtreecommitdiffhomepage
path: root/dev/libDDK/src/ddk_kernel_call_dispatch.S
blob: 7b7a26cbe4a5914b0a8cbaf8bf83b6294e9f5454 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
 lang: asm
 compiler: gnu
 */

#define kKernelCallTrapId 51

.globl __ke_call_dispatch

.text

/* Really simple function, takes our va-list,
    and brings it to the trap handler in the Kernel. */

#if defined(__DDK_AMD64__)

  .intel_syntax noprefix

/* args rcx, rdx, r8, r9 */
__ke_call_dispatch:
    push rbp
    mov rbp, rsp

    int kKernelCallTrapId

    pop rbp

    ret

#elif defined(__DDK_POWER64__)

/* args r8, r9, r10, r11 */
__ke_call_dispatch:
    /* There is no specific interrupt request id for a system call in POWER. */
    sc
    blr

#elif defined(__DDK_ARM64__)

/* args x0, x8, x9, x10, x11 is kept to tell that this is a Kernel call */
__ke_call_dispatch:
    /* There is no specific interrupt request id for a system call in ARM64 as well. */
    mov x9, #kKernelCallTrapId
    svc #0

#endif