| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2010 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * be found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 | 7 |
| 8 // This module defines the interface for platform specific support | 8 // This module defines the interface for platform specific support |
| 9 // functions, such as thread creation, logging, exception catching, | 9 // functions, such as thread creation, logging, exception catching, |
| 10 // etc... This API is not expected to throw, and instead will return | 10 // etc... This API is not expected to throw, and instead will return |
| 11 // false on any function that can fail. Since this is a collection | 11 // false on any function that can fail. Since this is a collection |
| 12 // of helpers functions there is expected to be only one platform object | 12 // of helpers functions there is expected to be only one platform object |
| 13 // which can be retrieved with the static "Get" member. | 13 // which can be retrieved with the static "Get" member. |
| 14 #ifndef NATIVE_CLIENT_PORT_PLATFORM_H_ | 14 #ifndef NATIVE_CLIENT_PORT_PLATFORM_H_ |
| 15 #define NATIVE_CLIENT_PORT_PLATFORM_H_ 1 | 15 #define NATIVE_CLIENT_PORT_PLATFORM_H_ 1 |
| 16 | 16 |
| 17 #include "native_client/src/include/portability.h" | 17 #include "native_client/src/include/portability.h" |
| 18 #include "native_client/src/trusted/debug_stub/transport.h" | 18 #include "native_client/src/trusted/debug_stub/transport.h" |
| 19 | 19 |
| 20 struct NaClApp; |
| 21 |
| 20 namespace port { | 22 namespace port { |
| 21 | 23 |
| 22 class IPlatform { | 24 class IPlatform { |
| 23 public: | 25 public: |
| 24 // Request the current thread relinquish execution of msec milliseconds | 26 // Request the current thread relinquish execution of msec milliseconds |
| 25 static void Relinquish(uint32_t msec); | 27 static void Relinquish(uint32_t msec); |
| 26 | 28 |
| 27 // Called to get or set process memory. | 29 // Called to get or set process memory. |
| 28 // NOTE: These functions should change the protection of the underlying | 30 // NOTE: These functions should change the protection of the underlying |
| 29 // page if needed to provide access. It should only return false if | 31 // page if needed to provide access. It should only return false if |
| 30 // the page is not mapped into the debugged process. | 32 // the page is not mapped into the debugged process. |
| 31 static bool GetMemory(uint64_t address, uint32_t length, void *dst); | 33 static bool GetMemory(uint64_t address, uint32_t length, void *dst); |
| 32 static bool SetMemory(uint64_t address, uint32_t length, void *src); | 34 static bool SetMemory(struct NaClApp *nap, uint64_t address, uint32_t length, |
| 35 void *src); |
| 33 }; | 36 }; |
| 34 | 37 |
| 35 } // namespace port | 38 } // namespace port |
| 36 | 39 |
| 37 | 40 |
| 38 #endif // NATIVE_CLIENT_PORT_PLATFORM_H_ | 41 #endif // NATIVE_CLIENT_PORT_PLATFORM_H_ |
| 39 | 42 |
| OLD | NEW |