source: trunk/hal/generic/hal_user.h @ 445

Last change on this file since 445 was 445, checked in by alain, 4 years ago

Restructure the mini_libc.

File size: 3.3 KB
Line 
1/*
2 * hal_user.h - User-side, architecture specific API definition.
3 *
4 * Author      Alain Greiner (2016,2017)
5 *
6 * Copyright (c) UPMC Sorbonne Universites
7 *
8 * This file is part of ALMOS-MKH.
9 *
10 * ALMOS-MKH is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; version 2.0 of the License.
13 *
14 * ALMOS-MKH is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#ifndef _HAL_USER_H_
25#define _HAL_USER_H_
26
27#include <hal_types.h>
28
29//////////////////////////////////////////////////////////////////////////////////////////
30//     User-side, hardware dependant functions API definition.
31//
32//   Any architecture specific implementation must implement this API.
33//////////////////////////////////////////////////////////////////////////////////////////
34
35/*****************************************************************************************
36 * This function implements the ALMOS-MKH user-side syscall handler.
37 * The syscall index and the arguments values are written in the proper core registers
38 * to enter the kernel as required by the specific hardware architecture.
39 *****************************************************************************************
40 * @ service_num  : syscall index (defined in the "shared_sycalls.h" file.
41 * @ arg0         : first  syscall argument (semantice depends on syscall index).
42 * @ arg1         : second syscall argument (semantice depends on syscall index).
43 * @ arg2         : third  syscall argument (semantice depends on syscall index).
44 * @ arg3         : fourth syscall argument (semantice depends on syscall index).
45 * @ returned value semantic depends on the syscall index.
46 ****************************************************************************************/
47int hal_user_syscall( reg_t service_num,
48                      reg_t arg0,
49                      reg_t arg1,
50                      reg_t arg2,
51                      reg_t arg3 );
52
53/*****************************************************************************************
54 * This blocking function atomically adds a positive or negative value to an int
55 * shared variable, returning only when atomic add is successful.
56 * This function does not use a syscall.
57 *****************************************************************************************
58 * @ ptr     : pointer on the shared variable.
59 * @ val     : signed value to add
60 * @ return shared variable value before add.
61 ****************************************************************************************/
62int hal_user_atomic_add( int * ptr,
63                         int   val );
64
65/*****************************************************************************************
66 * This blocking function implement a memory fence.
67 * It actually flush the calling core write buffer.
68 ****************************************************************************************/
69void hal_user_fence();
70
71
72#endif   // _HAL_USER_H_
Note: See TracBrowser for help on using the repository browser.