1/*
2 * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6
7#pragma once
8
9#include <config.h>
10#include <arch/kernel/vspace.h>
11
12/*
13 * In AARCH64, hardware and virtual asids are the same and are written
14 * when updating the translation table base register.
15 */
16static inline void armv_contextSwitch(vspace_root_t *vspace, asid_t asid)
17{
18#ifdef CONFIG_ARM_HYPERVISOR_SUPPORT
19    asid = getHWASID(asid);
20#endif
21    setCurrentUserVSpaceRoot(ttbr_new(asid, pptr_to_paddr(vspace)));
22}
23
24