source: trunk/hal/i386/remote.c @ 30

Last change on this file since 30 was 1, checked in by alain, 8 years ago

First import

File size: 3.3 KB
RevLine 
[1]1/*
2 * remote.c  - implementation of remote access HAL for x86 64 bits
3 *
4 * Authors : Mohammed Karaoui / Alain Greiner (2016)
5 *
6 * Copyright (c) UPMC Sorbonne Universites
7 *
8 * This file is part of ALMOS-kernel.
9 *
10 * ALMOS-kernel 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-kernel 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-kernel; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#if !defined( RUN_IN_PHYSICAL_MODE )
25#error: You must define RUN_IN_PHYSICAL_MODE in arch_config.h file
26#endif
27
28#if ( RUN_IN_PHYSICAL_MODE != yes )
29#error: RUN_IN_PHYSICAL_MODE in arch_config.h file must be no
30#endif
31
32
33
34//////////////////////////////////////
35inline void cpu_remote_sb( xptr_t  xp,
36                       char    data )
37{
38   char * ptr = (char *)xp;
39   *ptr       = data;
40}
41
42////////////////////////////////////////
43inline void cpu_remote_sw( xptr_t    xp,
44                       uint32_t  data )
45{
46   uint32_t * ptr = (uint32_t *)xp;
47   *ptr           = data;
48}
49
50/////////////////////////////////////////
51inline void cpu_remote_swd( xptr_t    xp,
52                        uint64_t  data )
53{
54   uint64_t * ptr = (uint64_t *)xp;
55   *ptr           = data;
56}
57
58//////////////////////////////////////
59inline char cpu_remote_lb( xptr_t xp )
60{
61   char * ptr = (char *)xp;
62   return *ptr;
63}
64
65//////////////////////////////////////////
66inline uint32_t cpu_remote_lw( xptr_t xp )
67{
68   uint32_t * ptr = (uint32_t *)xp;
69   return *ptr;
70}
71
72///////////////////////////////////////////
73inline uint64_t cpu_remote_lwd( xptr_t xp )
74{
75   uint64_t * ptr = (uint64_t *)xp;
76   return *ptr;
77}
78
79//////////////////////////////////////////////
80inline uint32_t cpu_remote_lw_unc( xptr_t xp )
81{
82    // TODO not implemented
83    printk("cpu_remote_lw_unc() function not implemented for x86\n");
84}
85
86/////////////////////////////////////////////////
87inline bool_t cpu_remote_atomic_cas( xptr_t   xp, 
88                                     uint32_t old,
89                                     uint32_t new )
90{
91    // TODO not implemented
92    printk("cpu_remote_atomic_cas() function not implemented for x86\n");
93}
94
95///////////////////////////////////////////////
96inline uint32_t cpu_remote_atomic_add( xptr_t   xp,
97                                       uint32_t incr )
98{       
99    // TODO not implemented
100    printk("cpu_remote_atomic_add() function not implemented for x86\n");
101}
102
103////////////////////////////////////////////////////
104inline error_t cpu_remote_atomic_try_add( xptr_t     xp,
105                                          uint32_t * old )
106{
107    // TODO not implemented
108    printk("cpu_remote_atomic_try_add() function not implemented for x86\n");
109}
110
111////////////////////////////////////////
112inline void * cpu_remote_memcpy( xptr_t   dst,
113                                 xptr_t   src,
114                                 size_t   size )
115{
116   void * dst_ptr = (void *)dst;
117   void * src_ptr = (void *)src;
118   return memcpy( dst_ptr , src_ptr , size );
119}
120
121
Note: See TracBrowser for help on using the repository browser.