Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Unified Diff: mojo/nacl/mojo_syscall_internal.h

Issue 776643004: Update NaCl's generator to support new wait APIs. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: The Change Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/nacl/mojo_syscall_internal.h
diff --git a/mojo/nacl/mojo_syscall_internal.h b/mojo/nacl/mojo_syscall_internal.h
index f0795e63ba72c92dc7ec3629b93c3ca7c72440a0..959bdd812a52f17cb237ce1732df9da974f4b10b 100644
--- a/mojo/nacl/mojo_syscall_internal.h
+++ b/mojo/nacl/mojo_syscall_internal.h
@@ -32,6 +32,14 @@ static inline uintptr_t NaClUserToSysAddrArray(
return NaClUserToSysAddrRange(nap, uaddr, range);
}
+void memcpy_volatile_out(void volatile* dst, const void* src, size_t n) {
Mark Seaborn 2014/12/08 22:24:12 Shouldn't this be static and/or inline, since it's
Nick Bray (chromium) 2014/12/09 22:14:31 Done.
+ char volatile* c_dst = reinterpret_cast<char volatile*>(dst);
+ const char* c_src = reinterpret_cast<const char*>(src);
+ for (size_t i = 0; i < n; i++) {
+ c_dst[i] = c_src[i];
+ }
+}
+
template <typename T> bool ConvertScalarInput(
struct NaClApp* nap,
uint32_t user_ptr,
@@ -49,12 +57,16 @@ template <typename T> bool ConvertScalarInput(
template <typename T> bool ConvertScalarOutput(
struct NaClApp* nap,
uint32_t user_ptr,
+ bool optional,
T volatile** sys_ptr) {
if (user_ptr) {
uintptr_t temp = NaClUserToSysAddrRange(nap, user_ptr, sizeof(T));
if (temp != kNaClBadAddress) {
*sys_ptr = reinterpret_cast<T volatile*>(temp);
return true;
+ } else if (optional) {
+ *sys_ptr = 0;
+ return true;
}
}
*sys_ptr = 0; // Paranoia.
@@ -127,7 +139,7 @@ template <typename T> bool ConvertBytes(
// TODO(ncbray): size validation and complete copy.
// TODO(ncbray): ensure non-null / missized structs are covered by a test case.
-template <typename T> bool ConvertStruct(
+template <typename T> bool ConvertExtensibleStructInput(
struct NaClApp* nap,
uint32_t user_ptr,
bool optional,

Powered by Google App Engine
This is Rietveld 408576698