> compile NEMU

221220000 张三
Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
 17:16:24 up 6 days, 12:21,  1 user,  load average: 0.81, 0.59, 0.53
This commit is contained in:
tracer-ics2023
2024-09-23 17:16:28 +08:00
committed by zzy
parent e36cb2a090
commit 40b6e01eac
2 changed files with 8 additions and 4 deletions

View File

@ -15,7 +15,11 @@ int num_to_ascii(int64_t num, int power, int size, char *buf) {
}
for (i = 1; num; i ++) {
_buf[i] = (num % power) < 10 ? ('0' + num % power) : ('a' + num % power);
if (power == 16 && i <= 2) {
_buf[1] = '0';
_buf[2] = 'x';
}
_buf[i] = (num % power) < 10 ? ('0' + num % power) : ('a' + num % power - 10);
num /= power;
}
if (i > size) {
@ -57,7 +61,7 @@ static inline int print_fmt(char **out, int n, const char** fmt, va_list (*ap))
(*out) += ret;
break;
case 'x':
ret = num_to_ascii(va_arg(*ap, int), 16, n, *out);
ret = num_to_ascii(va_arg(*ap, unsigned int), 16, n, *out);
(*out) += ret;
break;
default:
@ -85,4 +89,4 @@ int rvsnprintf(char* out, size_t n, const char* fmt, va_list ap) {
return ret;
}
#endif
#endif

View File

@ -38,7 +38,7 @@ static uintptr_t loader(PCB *pcb, const char *filename) {
void naive_uload(PCB *pcb, const char *filename) {
uintptr_t entry = loader(pcb, filename);
Log("Jump to entry = %x", entry);
Log("Jump to entry = %p", entry);
((void(*)())entry) ();
}