| /kernel/tests/ |
| A D | uart_tests.cpp | 21 static char buf[1048]; variable 28 snprintf(buf, sizeof(buf), "Blocking Test Count %d (FIRST LINE)\n" in uart_blocking_print_test() 31 dlog_serial_write(buf, strlen(buf)); in uart_blocking_print_test() 40 snprintf(buf, sizeof(buf), "NON-Blocking Test Count %d (FIRST LINE)\n" in uart_nonblocking_print_test() 43 __kernel_serial_write(buf, strlen(buf)); in uart_nonblocking_print_test() 50 char *s = buf; in uart_print_lots_of_lines() 58 snprintf(buf, 1024, "BLOCK LINE: %d ", count); in uart_print_lots_of_lines() 60 snprintf(buf, 1024, "NON-BLOCK LINE: %d ", count); in uart_print_lots_of_lines() 65 s = buf + strlen(buf); in uart_print_lots_of_lines() 75 dlog_serial_write(buf, strlen(buf)); in uart_print_lots_of_lines() [all …]
|
| A D | cache_tests.cpp | 27 if (buf == 0) { in bench_cache() 34 printf("buf %p, size %zu\n", buf, bufsize); in bench_cache() 36 if (!buf) in bench_cache() 45 memset(buf, 0x99, bufsize); in bench_cache() 52 free(buf); in bench_cache() 58 uint8_t* buf; in cache_tests() local 63 bench_cache(2 * 1024, buf); in cache_tests() 64 bench_cache(64 * 1024, buf); in cache_tests() 65 bench_cache(256 * 1024, buf); in cache_tests() 66 bench_cache(1 * 1024 * 1024, buf); in cache_tests() [all …]
|
| A D | benchmarks.cpp | 30 if (buf == nullptr) { in bench_set_overhead() 47 free(buf); in bench_set_overhead() 52 if (buf == nullptr) { in bench_memset() 71 free(buf); in bench_memset() 97 free(buf); in bench_memset_per_page() 123 free(buf); in bench_zero_page() 139 buf[j] = 0; in bench_cset() 150 free(buf); in bench_cset() 183 free(buf); in bench_cset_wide() 197 memcpy(buf, buf + BUFSIZE / 2, BUFSIZE / 2); in bench_memcpy() [all …]
|
| A D | printf_tests.cpp | 17 char buf[100]; in test_printf() local 20 int length = vsnprintf(buf, sizeof(buf), format, args); in test_printf() 23 if (length < 0 || length >= (int)sizeof(buf)) { in test_printf() 27 if (buf[length] != '\0') { in test_printf() 32 memcmp(buf, expected, length + 1) != 0) { in test_printf() 36 buf, strlen(buf), length); in test_printf() 183 char buf[32]; in snprintf_truncation_test() local 185 memset(buf, 'x', sizeof(buf)); in snprintf_truncation_test() 188 int result = snprintf(buf, shorter_length, "%s", str); in snprintf_truncation_test() 196 EXPECT_EQ(buf[shorter_length - 1], '\0', ""); in snprintf_truncation_test() [all …]
|
| /kernel/dev/intel_rng/ |
| A D | intel-rng.cpp | 21 static ssize_t get_entropy_from_instruction(void* buf, size_t len, bool block, 23 static ssize_t get_entropy_from_rdseed(void* buf, size_t len, bool block); 24 static ssize_t get_entropy_from_rdrand(void* buf, size_t len, bool block); 37 static ssize_t get_entropy_from_cpu(void* buf, size_t len, bool block) { in get_entropy_from_cpu() argument 47 return get_entropy_from_rdseed(buf, len, block); in get_entropy_from_cpu() 49 return get_entropy_from_rdrand(buf, len, block); in get_entropy_from_cpu() 82 memcpy(static_cast<uint8_t*>(buf) + written, &val, to_copy); in get_entropy_from_instruction() 91 static ssize_t get_entropy_from_rdseed(void* buf, size_t len, bool block) { in get_entropy_from_rdseed() argument 95 static ssize_t get_entropy_from_rdrand(void* buf, size_t len, bool block) { in get_entropy_from_rdrand() argument 105 size_t hw_rng_get_entropy(void* buf, size_t len, bool block) { in hw_rng_get_entropy() argument [all …]
|
| /kernel/lib/crashlog/ |
| A D | crashlog.cpp | 20 char* buf = out; in crashlog_to_string() local 24 buf[0] = '\0'; in crashlog_to_string() 31 buf += len; in crashlog_to_string() 38 buf += len; in crashlog_to_string() 52 buf += len; in crashlog_to_string() 130 buf += len; in crashlog_to_string() 180 buf += len; in crashlog_to_string() 189 buf += len; in crashlog_to_string() 196 buf += len; in crashlog_to_string() 198 len = snprintf(buf, remain, "\n"); in crashlog_to_string() [all …]
|
| /kernel/lib/crypto/ |
| A D | global_prng.cpp | 85 uint8_t buf[PRNG::kMinEntropy] = {0}; in SeedFrom() local 97 buf, fbl::min(sizeof(buf), remaining)); in SeedFrom() 106 kGlobalPrng->AddEntropy(buf, result); in SeedFrom() 107 mandatory_memset(buf, 0, sizeof(buf)); in SeedFrom() 156 uint8_t buf[PRNG::kMinEntropy] = {0}; in EarlyBootSeed() local 157 kGlobalPrng->AddEntropy(buf, sizeof(buf)); in EarlyBootSeed()
|
| /kernel/object/ |
| A D | buffer_chain_tests.cpp | 64 auto buf = ktl::unique_ptr<char[]>(new (&ac) char[kSize]); in copy_in_copy_out() local 75 memset(buf.get(), 'A', kSize); in copy_in_copy_out() 76 ASSERT_EQ(ZX_OK, mem_out.copy_array_to_user(buf.get(), kSize), ""); in copy_in_copy_out() 89 memset(buf.get(), 'B', kSize); in copy_in_copy_out() 116 memset(buf.get(), 0, kSize); in copy_in_copy_out() 121 memset(buf.get(), 0, kSize); in copy_in_copy_out() 125 ASSERT_EQ('A', buf[index++], ""); in copy_in_copy_out() 127 EXPECT_EQ('B', buf[index++], ""); in copy_in_copy_out() 129 ASSERT_EQ('B', buf[index++], ""); in copy_in_copy_out() 131 ASSERT_EQ('B', buf[index++], ""); in copy_in_copy_out() [all …]
|
| A D | mbuf_tests.cpp | 191 memset(buf, 'A', sizeof(buf)); in datagram_read_buffer_too_small() 192 ASSERT_EQ(ZX_OK, mem_out.copy_array_to_user(buf, sizeof(buf)), ""); in datagram_read_buffer_too_small() 199 memset(buf, 'B', sizeof(buf)); in datagram_read_buffer_too_small() 200 ASSERT_EQ(ZX_OK, mem_out.copy_array_to_user(buf, sizeof(buf)), ""); in datagram_read_buffer_too_small() 208 memset(buf, 0, sizeof(buf)); in datagram_read_buffer_too_small() 209 ASSERT_EQ(ZX_OK, mem_out.copy_array_to_user(buf, sizeof(buf)), ""); in datagram_read_buffer_too_small() 212 ASSERT_EQ(ZX_OK, mem_in.copy_array_from_user(buf, sizeof(buf)), ""); in datagram_read_buffer_too_small() 219 ASSERT_EQ(ZX_OK, mem_out.copy_array_to_user(buf, sizeof(buf)), ""); in datagram_read_buffer_too_small() 223 ASSERT_EQ(ZX_OK, mem_in.copy_array_from_user(buf, sizeof(buf)), ""); in datagram_read_buffer_too_small() 246 memset(buf, i, i); in datagram_write_basic() [all …]
|
| A D | mbuf.cpp | 91 auto buf = AllocMBuf(); in WriteDatagram() local 92 if (buf == nullptr) { in WriteDatagram() 97 bufs.push_front(buf); in WriteDatagram() 101 for (auto& buf : bufs) { in WriteDatagram() local 109 buf.len_ += static_cast<uint32_t>(copy_len); in WriteDatagram() 171 MBuf* buf = new (&ac) MBuf(); in AllocMBuf() local 172 return (!ac.check()) ? nullptr : buf; in AllocMBuf() 177 void MBufChain::FreeMBuf(MBuf* buf) { in FreeMBuf() argument 178 buf->off_ = 0u; in FreeMBuf() 179 buf->len_ = 0u; in FreeMBuf() [all …]
|
| A D | message_packet_tests.cpp | 27 auto buf = ktl::unique_ptr<char[]>(new (&ac) char[kSize]); in create() local 29 memset(buf.get(), 'A', kSize); in create() 30 ASSERT_EQ(ZX_OK, mem_out.copy_array_to_user(buf.get(), kSize), ""); in create() 43 EXPECT_EQ(0, memcmp(buf.get(), result_buf.get(), kSize), ""); in create() 110 auto buf = ktl::unique_ptr<char[]>(new (&ac) char[kSize]); in create_bad_mem() local 112 memset(buf.get(), 'C', kSize); in create_bad_mem() 113 auto in = make_user_in_ptr(static_cast<const void*>(buf.get())); in create_bad_mem() 130 auto buf = ktl::unique_ptr<char[]>(new (&ac) char[kSize]); in copy_bad_mem() local 132 memset(buf.get(), 'D', kSize); in copy_bad_mem() 133 ASSERT_EQ(ZX_OK, mem_out.copy_array_to_user(buf.get(), kSize), ""); in copy_bad_mem() [all …]
|
| /kernel/lib/io/ |
| A D | console.cpp | 73 char* buf = t->linebuffer; in __kernel_stdout_write_buffered() local 77 if (unlikely(!is_kernel_address((uintptr_t)buf) || pos >= THREAD_LINEBUFFER_LENGTH)) { in __kernel_stdout_write_buffered() 85 buf[pos++] = c; in __kernel_stdout_write_buffered() 87 __kernel_stdout_write(buf, pos); in __kernel_stdout_write_buffered() 92 buf[pos++] = '\n'; in __kernel_stdout_write_buffered() 93 __kernel_stdout_write(buf, pos); in __kernel_stdout_write_buffered()
|
| /kernel/syscalls/ |
| A D | debug.cpp | 80 char buf[kMaxDebugWriteSize]; in sys_debug_write() local 81 if (ptr.copy_array_from_user(buf, len) != ZX_OK) in sys_debug_write() 87 dlog_serial_write(buf, len); in sys_debug_write() 105 char buf[kMaxDebugWriteSize + 2]; in sys_debug_send_command() local 106 if (ptr.copy_array_from_user(buf, len) != ZX_OK) in sys_debug_send_command() 109 buf[len] = '\n'; in sys_debug_send_command() 110 buf[len + 1] = 0; in sys_debug_send_command() 111 return console_run_script(buf); in sys_debug_send_command()
|
| A D | task.cpp | 85 buf[str_len] = 0; in copy_user_string() 86 *sp = fbl::StringPiece(buf); in copy_user_string() 151 char buf[ZX_MAX_NAME_LEN]; in sys_thread_create() local 154 if (name_len > sizeof(buf)) in sys_thread_create() 155 name_len = sizeof(buf); in sys_thread_create() 157 buf, sizeof(buf), &sp); in sys_thread_create() 160 LTRACEF("name %s\n", buf); in sys_thread_create() 351 char buf[ZX_MAX_NAME_LEN]; in sys_process_create() local 354 if (name_len > sizeof(buf)) in sys_process_create() 356 result = copy_user_string(_name, name_len, buf, sizeof(buf), &sp); in sys_process_create() [all …]
|
| A D | zircon.cpp | 219 char buf[DLOG_MAX_RECORD]; in sys_debuglog_write() local 220 if (ptr.reinterpret<const char>().copy_array_from_user(buf, len) != ZX_OK) in sys_debuglog_write() 223 return log->Write(options, buf, len); in sys_debuglog_write() 241 char buf[DLOG_MAX_RECORD]; in sys_debuglog_read() local 243 if ((status = log->Read(options, buf, DLOG_MAX_RECORD, &actual)) < 0) in sys_debuglog_read() 246 if (ptr.copy_array_to_user(buf, actual) != ZX_OK) in sys_debuglog_read()
|
| /kernel/lib/cbuf/ |
| A D | cbuf.cpp | 31 void cbuf_initialize_etc(cbuf_t* cbuf, size_t len, void* buf) { in cbuf_initialize_etc() argument 39 cbuf->buf = static_cast<char*>(buf); in cbuf_initialize_etc() 59 cbuf->buf[cbuf->head] = c; in cbuf_write_char() 89 *c = cbuf->buf[cbuf->tail]; in cbuf_read_char()
|
| /kernel/lib/libc/string/ |
| A D | memchr.c | 13 memchr(void const *buf, int c, size_t len) in memchr() argument 16 unsigned char const *b= buf; in memchr()
|
| /kernel/lib/libc/ |
| A D | iovec.c | 37 ssize_t iovec_to_membuf(uint8_t* buf, uint buf_len, const iovec_t* iov, uint iov_cnt, uint iov_pos)… in iovec_to_membuf() argument 40 if (!buf || !iov) { in iovec_to_membuf() 61 memcpy(buf + buf_pos, (uint8_t*)iov->iov_base + iov_pos, to_copy); in iovec_to_membuf()
|
| A D | printf.c | 88 __NO_INLINE static char *longlong_to_string(char *buf, unsigned long long n, size_t len, uint flag,… in longlong_to_string() argument 98 buf[--pos] = 0; in longlong_to_string() 106 buf[--pos] = (char)(digit + '0'); in longlong_to_string() 108 buf[--pos] = (char)(n + '0'); in longlong_to_string() 119 return &buf[pos]; in longlong_to_string() 125 __NO_INLINE static const char *longlong_to_hexstring(char *buf, unsigned long long u, size_t len, u… in longlong_to_hexstring() argument 134 buf[--pos] = 0; in longlong_to_hexstring() 140 buf[--pos] = table[digit]; in longlong_to_hexstring() 144 buf[--pos] = (flag & CAPSFLAG) ? 'X' : 'x'; in longlong_to_hexstring() 145 buf[--pos] = '0'; in longlong_to_hexstring() [all …]
|
| /kernel/lib/crypto/entropy/ |
| A D | hw_rng_collector.cpp | 31 size_t HwRngCollector::DrawEntropy(uint8_t* buf, size_t len) { in DrawEntropy() argument 40 return hw_rng_get_entropy(buf, len, /* block */ true); in DrawEntropy()
|
| A D | jitterentropy_collector.cpp | 85 size_t JitterentropyCollector::DrawEntropy(uint8_t* buf, size_t len) { in DrawEntropy() argument 93 buf[i] = static_cast<uint8_t>(jent_lfsr_var_stat(&ec_, lfsr_loops_, in DrawEntropy() 98 ssize_t err =jent_read_entropy(&ec_, reinterpret_cast<char*>(buf), in DrawEntropy()
|
| /kernel/lib/cbuf/include/lib/ |
| A D | cbuf.h | 21 char* buf; member 46 void cbuf_initialize_etc(cbuf_t* cbuf, size_t len, void* buf);
|
| /kernel/arch/x86/ |
| A D | faults.cpp | 93 uint8_t buf[256]; in exception_die() local 94 if (arch_copy_from_user(buf, (void*)frame->user_sp, sizeof(buf)) == ZX_OK) { in exception_die() 96 hexdump_ex(buf, sizeof(buf), frame->user_sp); in exception_die() 508 uint8_t buf[256]; in arch_dump_exception_context() local 509 if (arch_copy_from_user(buf, (void*)context->frame->user_sp, sizeof(buf)) == ZX_OK) { in arch_dump_exception_context() 511 hexdump_ex(buf, sizeof(buf), context->frame->user_sp); in arch_dump_exception_context()
|
| /kernel/lib/oom/ |
| A D | oom.cpp | 202 char buf[MAX_FORMAT_SIZE_LEN]; in cmd_oom() local 203 format_size_fixed(buf, sizeof(buf), oom_redline_bytes, 'M'); in cmd_oom() 204 printf(" redline: %s (%" PRIu64 " bytes)\n", buf, oom_redline_bytes); in cmd_oom()
|
| /kernel/lib/debug/ |
| A D | debug.cpp | 75 uint32_t buf[4]; in hexdump_very_ex() member 87 u.buf[i] = ((const uint32_t*)address)[i]; in hexdump_very_ex() 88 pfn("%08x ", u.buf[i]); in hexdump_very_ex()
|