- Timestamp:
- 2025-04-13T19:33:48Z (3 months ago)
- Branches:
- master
- Children:
- f5e1692
- Parents:
- 97f6b71
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-13 18:56:51)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-13 19:33:48)
- Location:
- kernel/generic
- Files:
-
- 2 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/meson.build
r97f6b71 r163e34c 40 40 'common/adt/list.c', 41 41 'common/adt/odict.c', 42 'common/gsort.c', 42 43 'common/printf/printf_core.c', 43 44 'common/stdc/calloc.c', 44 45 'common/stdc/ctype.c', 45 46 'common/stdc/mem.c', 46 'common/gsort.c', 47 'common/stdc/snprintf.c', 48 'common/stdc/vsnprintf.c', 47 49 'common/str.c', 48 50 'common/str_error.c', … … 96 98 'src/mm/reserve.c', 97 99 'src/printf/printf.c', 98 'src/printf/snprintf.c',99 100 'src/printf/vprintf.c', 100 'src/printf/vsnprintf.c',101 101 'src/proc/program.c', 102 102 'src/proc/scheduler.c', -
kernel/generic/src/log/log.c
r97f6b71 r163e34c 33 33 */ 34 34 35 #include <sysinfo/sysinfo.h> 36 #include <synch/spinlock.h> 37 #include <typedefs.h> 35 #include <abi/log.h> 36 #include <arch.h> 37 #include <atomic.h> 38 #include <console/console.h> 39 #include <ddi/ddi.h> 38 40 #include <ddi/irq.h> 39 #include < ddi/ddi.h>41 #include <errno.h> 40 42 #include <ipc/event.h> 41 43 #include <ipc/irq.h> 42 #include < arch.h>44 #include <log.h> 43 45 #include <panic.h> 46 #include <print.h> 47 #include <printf_core.h> 44 48 #include <putchar.h> 45 #include <atomic.h> 49 #include <stdarg.h> 50 #include <stdlib.h> 51 #include <str.h> 52 #include <synch/spinlock.h> 46 53 #include <syscall/copy.h> 47 #include <errno.h> 48 #include <str.h> 49 #include <print.h> 50 #include <printf/printf_core.h> 51 #include <stdarg.h> 52 #include <log.h> 53 #include <console/console.h> 54 #include <abi/log.h> 55 #include <stdlib.h> 54 #include <sysinfo/sysinfo.h> 55 #include <typedefs.h> 56 56 57 57 #define LOG_PAGES 8 … … 204 204 { 205 205 size_t offset = 0; 206 size_t chars = 0; 207 208 while (offset < size) { 206 207 while (offset < size) 209 208 kio_push_char(str_decode(str, &offset, size)); 210 chars++;211 }212 209 213 210 log_append((const uint8_t *)str, size); 214 211 215 return chars; 216 } 217 218 static int log_printf_wstr_write(const char32_t *wstr, size_t size, void *data) 219 { 220 char buffer[16]; 221 size_t offset = 0; 222 size_t chars = 0; 223 224 for (offset = 0; offset < size; offset += sizeof(char32_t), chars++) { 225 kio_push_char(wstr[chars]); 226 227 size_t buffer_offset = 0; 228 errno_t rc = chr_encode(wstr[chars], buffer, &buffer_offset, 16); 229 if (rc != EOK) { 230 return EOF; 231 } 232 233 log_append((const uint8_t *)buffer, buffer_offset); 234 } 235 236 return chars; 212 return EOK; 237 213 } 238 214 … … 243 219 int log_vprintf(const char *fmt, va_list args) 244 220 { 245 int ret;246 247 221 printf_spec_t ps = { 248 222 log_printf_str_write, 249 log_printf_wstr_write,250 223 NULL 251 224 }; 252 225 253 ret = printf_core(fmt, &ps, args); 254 255 return ret; 226 return printf_core(fmt, &ps, args); 256 227 } 257 228 -
kernel/generic/src/printf/vprintf.c
r97f6b71 r163e34c 36 36 #include <console/console.h> 37 37 #include <print.h> 38 #include <printf /printf_core.h>38 #include <printf_core.h> 39 39 #include <putchar.h> 40 40 #include <str.h> … … 42 42 #include <typedefs.h> 43 43 44 static int vprintf_str_write(const char *str, size_t size, void *data)44 static errno_t vprintf_str_write(const char *str, size_t size, void *data) 45 45 { 46 46 size_t offset = 0; 47 size_t chars = 0;48 47 49 while (offset < size) {48 while (offset < size) 50 49 putuchar(str_decode(str, &offset, size)); 51 chars++;52 }53 50 54 return chars; 55 } 56 57 static int vprintf_wstr_write(const char32_t *str, size_t size, void *data) 58 { 59 size_t offset = 0; 60 size_t chars = 0; 61 62 while (offset < size) { 63 putuchar(str[chars]); 64 chars++; 65 offset += sizeof(char32_t); 66 } 67 68 return chars; 51 return EOK; 69 52 } 70 53 … … 92 75 printf_spec_t ps = { 93 76 vprintf_str_write, 94 vprintf_wstr_write,95 77 NULL 96 78 };
Note:
See TracChangeset
for help on using the changeset viewer.