Chromium Code Reviews| Index: src/trusted/service_runtime/arch/x86_32/sel_addrspace_x86_32.c |
| =================================================================== |
| --- src/trusted/service_runtime/arch/x86_32/sel_addrspace_x86_32.c (revision 6420) |
| +++ src/trusted/service_runtime/arch/x86_32/sel_addrspace_x86_32.c (working copy) |
| @@ -9,9 +9,9 @@ |
| #include "native_client/src/trusted/service_runtime/sel_memory.h" |
| #include "native_client/src/trusted/service_runtime/sel_ldr.h" |
| - |
| NaClErrorCode NaClAllocateSpace(void **mem, size_t addrsp_size) { |
| int result; |
| + const size_t kOneGb = 0x40000000; |
|
Brad Chen
2011/08/16 01:21:49
I'm used to 'b' meaning 'bit'. I'd rather see kOne
bbudge
2011/08/16 19:46:22
Done.
|
| CHECK(NULL != mem); |
| @@ -26,6 +26,16 @@ |
| *mem = (void *) NACL_TRAMPOLINE_START; |
| result = NaCl_page_alloc_at_addr(mem, addrsp_size); |
| *mem = 0; |
| +#elif NACL_WINDOWS && NACL_ARCH_CPU_32_BITS |
|
Mark Seaborn
2011/08/16 17:34:10
Can you use "NACL_BUILD_SUBARCH == 64" rather than
bbudge
2011/08/16 19:46:22
Done.
|
| + /* |
| + * On 32 bit Windows XP, a 1Gb region of address space is reserved before |
| + * starting up this process to make sure we can get a contiguous block. Look |
| + * for it now. |
| + */ |
| + if (0 == NaCl_find_sandbox_memory(mem, kOneGb)) |
|
Mark Seaborn
2011/08/16 17:34:10
Nit: I'd use curly brackets for this 'if'.
bbudge
2011/08/16 19:46:22
Done.
|
| + result = NaCl_page_alloc_at_addr(mem, addrsp_size); |
|
Brad Chen
2011/08/16 01:21:49
I don't understand how mem gets initialized in thi
bbudge
2011/08/16 17:21:02
It's obscure, but the 'mem' parameter gets filled
Brad Chen
2011/08/16 17:28:38
Nit: A brief comment before the call to NaCl_page_
bbudge
2011/08/16 19:46:22
Done. (I expanded the comment for the whole case)
|
| + else |
| + result = NaCl_page_alloc(mem, addrsp_size); |
| #else |
| result = NaCl_page_alloc(mem, addrsp_size); |
| #endif |