struct proc test_proc_1 = { .name = "test_proc_1", .pid = 1, .hartid = 0, .state = PROC_READY, .cpu = { .pc = (u64)&test_proc_1, }}; 这段代码在链接的时候提示:
undefined reference to `memset' undefined reference to `memcpy' 让 ChatGPT 给我实现了一下,编译链接进去就好了。
#include "kstring.h" void *memset(void *s, int c, size_t n) { unsigned char *p = s; while (n--) *p++ = (unsigned char)c; return s; } void *memcpy(void *dest, const void *src, size_t n) { unsigned char *d = dest; const unsigned char *s = src; while (n--) *d++ = *s++; return dest; } 