Strings don't seem to be passed correctly to functions. Yes, I have .rodata in my linker script (attached), and yes the pointer is pointing to the correct space.
This is my main body code (The binary loaded by QEMU.)
Code: Select all
void start() __attribute__((naked));
void print_char(const char c);
void print_string(const char *str);
void start() {
asm volatile("mov sp, #0x10000");
char *meow = "meow\n";
print_string(meow);
/* Crash */
asm volatile("mov r0, #0x34000000");
asm volatile("mov pc, r0");
}
void print_char(const char c) {
*((unsigned char*)0x101F1000) = c;
}
void print_string(const char *str) {
while(*str != '\n') {
print_char(*str);
str++;
}
}Code: Select all
arm-elf-gcc -c kernel.c -o kernel.o
arm-elf-ld -Tlink.ld -oformat=binary kernel.o -o kernel.bin --entry start
arm-elf-strip -I elf32-bigarm -O binary kernel.binHow can 0xa0 != 0xa0? The MMU is disabled by default, so...
Thanks again,
Alboin
