1 /*
2  * %CopyrightBegin%
3  *
4  * Copyright Ericsson AB 2001-2016. All Rights Reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * %CopyrightEnd%
19  */
20 /* hipe_bif_64.c
21  *
22  * Compiler and linker support. 64-bit specific.
23  */
24 #ifdef HAVE_CONFIG_H
25 #include "config.h"
26 #endif
27 #include "global.h"
28 #include "error.h"
29 #include "bif.h"
30 #include "big.h"	/* term_to_Sint() */
31 #include "hipe_arch.h"
32 #include "hipe_bif0.h"
33 #include "hipe_bif64.h"
34 
35 #if 0 /* unused */
36 static int term_to_Sint64(Eterm term, Sint64 *sp)
37 {
38     return term_to_Sint(term, sp);
39 }
40 
41 BIF_RETTYPE hipe_bifs_write_s64_2(BIF_ALIST_2)
42 {
43     Sint64 *address;
44     Sint64 value;
45 
46     address = term_to_address(BIF_ARG_1);
47     if (!address || !hipe_word64_address_ok(address))
48 	BIF_ERROR(BIF_P, BADARG);
49     if (!term_to_Sint64(BIF_ARG_2, &value))
50 	BIF_ERROR(BIF_P, BADARG);
51     *address = value;
52     BIF_RET(NIL);
53 }
54 #endif
55 
hipe_bifs_write_u64_2(BIF_ALIST_2)56 BIF_RETTYPE hipe_bifs_write_u64_2(BIF_ALIST_2)
57 {
58     Uint64 *address;
59     Uint64 value;
60 
61     address = term_to_address(BIF_ARG_1);
62     if (!address || !hipe_word64_address_ok(address))
63 	BIF_ERROR(BIF_P, BADARG);
64     if (!term_to_Uint(BIF_ARG_2, &value))
65 	BIF_ERROR(BIF_P, BADARG);
66     *address = value;
67     hipe_flush_icache_word(address);
68     BIF_RET(NIL);
69 }
70