Make pointer volatile in Bare Bones?
Posted: Tue Jan 09, 2018 2:41 am
Hi all,
So recently I have been starting to develop my own kernel. I am quite new into the topic, but like it so far and I am ready to struggle. To set up my build environment, I followed the (probably) well-known Bare bones tutorial on the wiki:
http://wiki.osdev.org/Bare_bones
After some rewrite of the terminal stuff, qemu kept rebooting my kernel without notice (I guess a triple fault). This was because the variable terminal_buffer is not declared as being volatile (and was being optimized away). Isn't it best practice to do that and explicitly let your compiler know that this pointer points to a memory-mapped location? Or is it best practice to not compile with any optimization? I am interested to hear your thoughts on this.
So recently I have been starting to develop my own kernel. I am quite new into the topic, but like it so far and I am ready to struggle. To set up my build environment, I followed the (probably) well-known Bare bones tutorial on the wiki:
http://wiki.osdev.org/Bare_bones
After some rewrite of the terminal stuff, qemu kept rebooting my kernel without notice (I guess a triple fault). This was because the variable terminal_buffer is not declared as being volatile (and was being optimized away). Isn't it best practice to do that and explicitly let your compiler know that this pointer points to a memory-mapped location? Or is it best practice to not compile with any optimization? I am interested to hear your thoughts on this.