The Pedigree Project  0.1
native-protocol.cc
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #include "pedigree/native/native-protocol.h"
21 #include "pedigree/native/native-syscall.h"
22 #include "pedigree/native/nativeSyscallNumbers.h"
23 
24 int _syscall(Object *pObject, size_t nOp)
25 {
26  return -1;
27  /*
28  if(!pObject)
29  return -1;
30  uintptr_t buff; size_t buffLength;
31  pObject->serialise(&buff, buffLength);
32  if(!buff)
33  return -1;
34  syscall3(NATIVE_USERSPACE_TO_KERNEL, (uintptr_t) pObject, buffLength, nOp);
35  return 0;
36  */
37 }
38 
39 void register_object(Object *pObject)
40 {
41  long result = syscall2(
42  NATIVE_REGISTER_OBJECT, pObject->guid(),
43  reinterpret_cast<uintptr_t>(pObject));
44  if (result == 0)
45  throw result;
46 }
47 
48 void unregister_object(Object *pObject)
49 {
50  syscall1(NATIVE_UNREGISTER_OBJECT, reinterpret_cast<uintptr_t>(pObject));
51 }
52 
54 native_call(Object *pObject, uint64_t subid, void *params, size_t params_size)
55 {
56  ReturnState state;
57  syscall5(
58  NATIVE_CALL, reinterpret_cast<uintptr_t>(pObject), subid,
59  reinterpret_cast<uintptr_t>(params), params_size,
60  reinterpret_cast<uintptr_t>(&state));
61  return state;
62 }
Definition: Object.h:26
virtual uint64_t guid() const =0