Re: Windowing Systems by Example: 3 - I Like to Move It
Posted: Thu Sep 01, 2016 1:40 pm
For your sbrk, without any context to go on, I couldn't rightly say.
Just tried upping to 1920x1080 myself and everything still works a treat (though it does start to emphasize how sluggish redrawing everything is, which is nice), so it looks like that's still probably somewhere on your end.
You're going to have to do some debugging, here. Did you copy the sources directly from the git repo and include them or did you write them out manually from the tutorial? Either way, I would start by throwing some debug printing via the serial port in there to see if you can't figure out at what point in the code your width and height are getting modified on a in-drag mousemove event. Though you should check both there and also in your rect drawing code, because it's possible that things are getting screwy during drawing and it's not actually the window props getting mangled.
One random guess as to why you might be getting a blue screen and nothing else: More memory allocation issues. I don't know how your memory protection is set up, but it's entirely possible that with the bigger buffer the addresses you're trying to write to at the tail end of the desktop rect you're beginning to infringe on protected memory and causing a page or protection fault. Also possible that, if you're not making sure that your memory allocator is aware of the memory hole claimed by the framebuffer, you've got os critical data malloc'd near the end of the framebuffer memory region and it's getting overwritten when you draw to that area of the FB. As well, if not that then it could similarly be that your OS code is loaded and running from the memory area that the framebuffer occupies and you're not checking for that before setting up the framebuffer.
You have to be *very* careful about keeping track of memory in your OS. It's one of the most critical things it does and if it goes haywire it can screw up a LOT, and in very confusing ways.
Ultimately: Debug everything, especially your malloc code, even if that just means shoving some debug prints in. Because you really can't know for sure if things are getting allocated right unless you actually take a look at it.
Just tried upping to 1920x1080 myself and everything still works a treat (though it does start to emphasize how sluggish redrawing everything is, which is nice), so it looks like that's still probably somewhere on your end.
You're going to have to do some debugging, here. Did you copy the sources directly from the git repo and include them or did you write them out manually from the tutorial? Either way, I would start by throwing some debug printing via the serial port in there to see if you can't figure out at what point in the code your width and height are getting modified on a in-drag mousemove event. Though you should check both there and also in your rect drawing code, because it's possible that things are getting screwy during drawing and it's not actually the window props getting mangled.
One random guess as to why you might be getting a blue screen and nothing else: More memory allocation issues. I don't know how your memory protection is set up, but it's entirely possible that with the bigger buffer the addresses you're trying to write to at the tail end of the desktop rect you're beginning to infringe on protected memory and causing a page or protection fault. Also possible that, if you're not making sure that your memory allocator is aware of the memory hole claimed by the framebuffer, you've got os critical data malloc'd near the end of the framebuffer memory region and it's getting overwritten when you draw to that area of the FB. As well, if not that then it could similarly be that your OS code is loaded and running from the memory area that the framebuffer occupies and you're not checking for that before setting up the framebuffer.
You have to be *very* careful about keeping track of memory in your OS. It's one of the most critical things it does and if it goes haywire it can screw up a LOT, and in very confusing ways.
Ultimately: Debug everything, especially your malloc code, even if that just means shoving some debug prints in. Because you really can't know for sure if things are getting allocated right unless you actually take a look at it.