Page Fault when printf using newlib in user mode
Posted: Sat Nov 15, 2025 10:55 pm
Hi. I'm trying to use a printf in newlib, with rudimentary sbrk and write syscall support in my kernel. However, before it even gets to running the syscall, a page error gets thrown at the address of
(CR2=00000034) because of what seems like a null pointer.
This doesn't seem to happen because of any code I wrote (at least from what I can glance obviously) because from what I've been able to glance people don't have errors until the syscall has finished running. If someone could help it would be great.
Kernel (not fully committed but the up-to-date working syscalls are in the src/primary/kernel/syscalls folder) https://github.com/atomtables/AstatineOS
newlib: https://github.com/atomtables/newlib_astatine
test program:
Code: Select all
/newlib/libc/stdio/puts.c:88 (discriminator 1)This doesn't seem to happen because of any code I wrote (at least from what I can glance obviously) because from what I've been able to glance people don't have errors until the syscall has finished running. If someone could help it would be great.
Kernel (not fully committed but the up-to-date working syscalls are in the src/primary/kernel/syscalls folder) https://github.com/atomtables/AstatineOS
newlib: https://github.com/atomtables/newlib_astatine
test program:
Code: Select all
#include <stdio.h>
void main() {
printf("Hello, World!\n");
while(1);
}