blob: d6593b02a6fd70f9e67f81fa5c7f81a9c6dcfa76 [file] [log] [blame]
Kautuk Consulc86cb4a2022-12-07 17:12:35 +05301// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2022 Ventana Micro Systems Inc.
4 */
5
6#include <common.h>
7
8long smh_trap(int sysnum, void *addr)
9{
10 register int ret asm ("a0") = sysnum;
11 register void *param0 asm ("a1") = addr;
12
13 asm volatile (".align 4\n"
14 ".option push\n"
15 ".option norvc\n"
16
17 "slli zero, zero, 0x1f\n"
18 "ebreak\n"
19 "srai zero, zero, 7\n"
20 ".option pop\n"
21 : "+r" (ret) : "r" (param0) : "memory");
22
23 return ret;
24}