haiku/headers/private/kernel/arch/riscv64/arch_traps.h
X512 8ca0f03d0c riscv64/smp: Implement multi-processor support
* Working under qemu smp 1,2+
* Working on SiFive Unmatched
* x86_64 efi not broken by smp_boot_other_cpus change

Change-Id: I32ebc17913e46ed082be9ade8f56448bbf12f16e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4705
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-12-12 15:35:24 +00:00

89 lines
2.2 KiB
C

/*
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _ARCH_TRAPS_H_
#define _ARCH_TRAPS_H_
# NOTE: this macro don't save SP, it should be saved manually
.macro PushTrapFrame extSize
addi sp, sp, -(\extSize + 256)
sd ra, \extSize + 0*8(sp)
sd t6, \extSize + 1*8(sp)
# sd sp, \extSize + 2*8(sp) # sp
sd gp, \extSize + 3*8(sp)
sd tp, \extSize + 4*8(sp)
sd t0, \extSize + 5*8(sp)
sd t1, \extSize + 6*8(sp)
sd t2, \extSize + 7*8(sp)
sd t5, \extSize + 8*8(sp)
sd s1, \extSize + 9*8(sp)
sd a0, \extSize + 10*8(sp)
sd a1, \extSize + 11*8(sp)
sd a2, \extSize + 12*8(sp)
sd a3, \extSize + 13*8(sp)
sd a4, \extSize + 14*8(sp)
sd a5, \extSize + 15*8(sp)
sd a6, \extSize + 16*8(sp)
sd a7, \extSize + 17*8(sp)
sd s2, \extSize + 18*8(sp)
sd s3, \extSize + 19*8(sp)
sd s4, \extSize + 20*8(sp)
sd s5, \extSize + 21*8(sp)
sd s6, \extSize + 22*8(sp)
sd s7, \extSize + 23*8(sp)
sd s8, \extSize + 24*8(sp)
sd s9, \extSize + 25*8(sp)
sd s10, \extSize + 26*8(sp)
sd s11, \extSize + 27*8(sp)
sd t3, \extSize + 28*8(sp)
sd t4, \extSize + 29*8(sp)
sd fp, \extSize + 30*8(sp)
addi fp, sp, \extSize + 256
.endm
.macro PopTrapFrame extSize
ld ra, \extSize + 0*8(sp)
ld t6, \extSize + 1*8(sp)
# ld sp, \extSize + 2*8(sp) restore later
ld gp, \extSize + 3*8(sp)
# ld tp, \extSize + 4*8(sp)
ld t0, \extSize + 5*8(sp)
ld t1, \extSize + 6*8(sp)
ld t2, \extSize + 7*8(sp)
ld t5, \extSize + 8*8(sp)
ld s1, \extSize + 9*8(sp)
ld a0, \extSize + 10*8(sp)
ld a1, \extSize + 11*8(sp)
ld a2, \extSize + 12*8(sp)
ld a3, \extSize + 13*8(sp)
ld a4, \extSize + 14*8(sp)
ld a5, \extSize + 15*8(sp)
ld a6, \extSize + 16*8(sp)
ld a7, \extSize + 17*8(sp)
ld s2, \extSize + 18*8(sp)
ld s3, \extSize + 19*8(sp)
ld s4, \extSize + 20*8(sp)
ld s5, \extSize + 21*8(sp)
ld s6, \extSize + 22*8(sp)
ld s7, \extSize + 23*8(sp)
ld s8, \extSize + 24*8(sp)
ld s9, \extSize + 25*8(sp)
ld s10, \extSize + 26*8(sp)
ld s11, \extSize + 27*8(sp)
ld t3, \extSize + 28*8(sp)
ld t4, \extSize + 29*8(sp)
ld fp, \extSize + 30*8(sp)
ld sp, \extSize + 2*8(sp)
.endm
#endif // _ARCH_TRAPS_H_