xref: /haiku/src/system/kernel/arch/sparc/arch_asm.S (revision 5c1e072463878d1d30d9ecb9842e6d461132306e)
1/*
2 * Copyright 2019, Adrien Destugues, pulkomandy@pulkomandy.tk
3 * Distributed under the terms of the MIT License.
4 */
5
6
7#include <asm_defs.h>
8
9
10.text
11
12
13/* void arch_int_enable_interrupts(void) */
14FUNCTION(arch_int_enable_interrupts):
15	rdpr %pstate, %o0
16	or   %o0, 2, %o0
17	wrpr %o0, 0, %pstate
18	ret
19FUNCTION_END(arch_int_enable_interrupts)
20
21
22/* int arch_int_disable_interrupts(void)
23 */
24FUNCTION(arch_int_disable_interrupts):
25	rdpr %pstate, %o1
26	// Set output register to previous state
27	and %o1, 2, %o0
28	// Clear interrupt bit
29	andn %o1, 2, %o1
30
31	wrpr %o1, 0, %pstate
32	ret
33FUNCTION_END(arch_int_disable_interrupts)
34
35
36/* void arch_int_restore_interrupts(int oldState)
37 */
38FUNCTION(arch_int_restore_interrupts):
39	rdpr %pstate, %o1
40	// Clear interrupt bit
41	andn %o1, 2, %o1
42	// Restore previous interript bit state
43	or %o1, %o0, %o1
44	wrpr %o1, 0, %pstate
45	ret
46FUNCTION_END(arch_int_restore_interrupts)
47
48
49/* bool arch_int_are_interrupts_enabled(void) */
50FUNCTION(arch_int_are_interrupts_enabled):
51	rdpr %pstate, %o0
52	andn %o0, 2, %o0
53	ret
54FUNCTION_END(arch_int_are_interrupts_enabled)
55
56
57/* status_t arch_cpu_user_memcpy(void *to, const void *from, size_t size, addr_t *faultHandler) */
58FUNCTION(_arch_cpu_user_memcpy):
59	// TODO
60	ret
61FUNCTION_END(_arch_cpu_user_memcpy)
62
63
64/* status_t arch_cpu_user_memset(void *to, char c, size_t count, addr_t *faultHandler) */
65FUNCTION(_arch_cpu_user_memset):
66	// TODO
67	ret
68FUNCTION_END(_arch_cpu_user_memset)
69
70
71/* ssize_t arch_cpu_user_strlcpy(void *to, const void *from, size_t size, addr_t *faultHandler) */
72FUNCTION(_arch_cpu_user_strlcpy):
73	// TODO
74	ret
75FUNCTION_END(_arch_cpu_user_strlcpy)
76