When your OS goes crazy - Screenshots

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
Griwes
Member
Member
Posts: 374
Joined: Sat Jul 30, 2011 10:07 am
Libera.chat IRC: Griwes
Location: Wrocław/Racibórz, Poland
Contact:

Re: When your OS goes crazy - Screenshots

Post by Griwes »

I'll never use -Werror for very simple reason: templates in C++.

Example: I've templated function to convert integers to strings (one of those mentioned here on osdev.org, but a bit modified and C++ed). Now, I do simple "if (i < 0) {...}", where i is of templated type... and I get a warning: "comparison of unsigned expression < 0 is always false [-Wtype-limits]". I would have to write distinct version of that function for "unsigned" types just to keep that warning away - which doesn't make much sense. Although -Wall -Wextra is definitely a "must have" for every C/C++ project (and probably many more of them).
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
TreahBlade
Posts: 9
Joined: Wed Apr 18, 2012 9:32 pm

Re: When your OS goes crazy - Screenshots

Post by TreahBlade »

Funny thing is the warnings that were shown were NASM warnings not GCC. They are perfectly fine warnings about labels that don't have a : at the end of them so something like .loophere will produce a warning but .loophere: will not. Its a perfectly ok warning to ignore and is even encouraged to do so on the OSDEV wiki.

Also gcc is not perfect and can generate warnings that are sometimes bugs in the compiler or just code that is not 100% in spec but perfectly ok to compile. Only a few are actual bugs in gcc where it will throw a warning when its not supposed to and the others can be a problem later. Sometimes when GCC is updated its more strict on code and warnings can then become errors in later revisions and cause older code to no longer compile. This is a common problem with some older GNU code sometimes.

It is a good idea to always attempt to fix warnings but there are some that are not possible to fix and can be safely ignored. Its always a good idea to treat warnings as errors unless you are absolutely certain that the warning is something that can be safely ignored.
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Re: When your OS goes crazy - Screenshots

Post by NickJohnson »

I would agree with using -Werror -Wall -Wextra (et al.) with one exception: -Wunused-parameter. It throws a wrench in any proper attempt to use function pointers to simulate polymorphism in C.
User avatar
Kazinsal
Member
Member
Posts: 559
Joined: Wed Jul 13, 2011 7:38 pm
Libera.chat IRC: Kazinsal
Location: Vancouver
Contact:

Re: When your OS goes crazy - Screenshots

Post by Kazinsal »

TreahBlade wrote:Funny thing is the warnings that were shown were NASM warnings not GCC. They are perfectly fine warnings about labels that don't have a : at the end of them so something like .loophere will produce a warning but .loophere: will not. Its a perfectly ok warning to ignore and is even encouraged to do so on the OSDEV wiki.
"Label alone on line without colon may be in error" means "hey, you have a typo, fix it". Not, "hey, you have a typo, but that's okay, it doesn't affect anything at this particular moment of time, so ignore it completely!"

Now, if you have a label called, say "do_a20_test" and you forgot to put a colon after it, then you later create a macro called "do_a20_test", you're going to have weird results that may include NASM erroring out any you going nuts trying to figure out why.

All because you ignored a warning.
User avatar
Griwes
Member
Member
Posts: 374
Joined: Sat Jul 30, 2011 10:07 am
Libera.chat IRC: Griwes
Location: Wrocław/Racibórz, Poland
Contact:

Re: When your OS goes crazy - Screenshots

Post by Griwes »

My LFB printing code failed again, this time when I tried to fix broken 16bit text printing; well, before I started, it looked a bit better than now :lol:

Image
Last edited by Griwes on Sun Jul 29, 2012 3:51 am, edited 1 time in total.
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
TreahBlade
Posts: 9
Joined: Wed Apr 18, 2012 9:32 pm

Re: When your OS goes crazy - Screenshots

Post by TreahBlade »

Blacklight wrote:
TreahBlade wrote:Funny thing is the warnings that were shown were NASM warnings not GCC. They are perfectly fine warnings about labels that don't have a : at the end of them so something like .loophere will produce a warning but .loophere: will not. Its a perfectly ok warning to ignore and is even encouraged to do so on the OSDEV wiki.
"Label alone on line without colon may be in error" means "hey, you have a typo, fix it". Not, "hey, you have a typo, but that's okay, it doesn't affect anything at this particular moment of time, so ignore it completely!"

Now, if you have a label called, say "do_a20_test" and you forgot to put a colon after it, then you later create a macro called "do_a20_test", you're going to have weird results that may include NASM erroring out any you going nuts trying to figure out why.

All because you ignored a warning.

Indeed a very good argument for fixing them :). I actually have since fixed all my labels as that was very dirty "just get it working" code.
sounds
Member
Member
Posts: 112
Joined: Sat Feb 04, 2012 5:03 pm

Re: When your OS goes crazy - Screenshots

Post by sounds »

I just reworked the console driver. :roll:
Image
There's an off-screen buffer that gets blitted on-screen for scrolling. I think the console driver (or graphics driver) is one of the most fun areas of an OS to debug.
sounds
Member
Member
Posts: 112
Joined: Sat Feb 04, 2012 5:03 pm

Re: When your OS goes crazy - Screenshots

Post by sounds »

It's fixed now.
cxzuk
Member
Member
Posts: 164
Joined: Mon Dec 21, 2009 6:03 pm

Re: When your OS goes crazy - Screenshots

Post by cxzuk »

Griwes wrote:I'll never use -Werror for very simple reason: templates in C++.

Example: I've templated function to convert integers to strings (one of those mentioned here on osdev.org, but a bit modified and C++ed). Now, I do simple "if (i < 0) {...}", where i is of templated type... and I get a warning: "comparison of unsigned expression < 0 is always false [-Wtype-limits]". I would have to write distinct version of that function for "unsigned" types just to keep that warning away - which doesn't make much sense. Although -Wall -Wextra is definitely a "must have" for every C/C++ project (and probably many more of them).
Why template instead of Conversion Operators?
cxzuk
Member
Member
Posts: 164
Joined: Mon Dec 21, 2009 6:03 pm

Re: When your OS goes crazy - Screenshots

Post by cxzuk »

NickJohnson wrote:I would agree with using -Werror -Wall -Wextra (et al.) with one exception: -Wunused-parameter. It throws a wrench in any proper attempt to use function pointers to simulate polymorphism in C.
Do you have an example of what you mean?
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Re: When your OS goes crazy - Screenshots

Post by NickJohnson »

cxzuk wrote:
NickJohnson wrote:I would agree with using -Werror -Wall -Wextra (et al.) with one exception: -Wunused-parameter. It throws a wrench in any proper attempt to use function pointers to simulate polymorphism in C.
Do you have an example of what you mean?
Just any case in which you're registering callbacks for something, and the callback function signature has parameters that are not always used (but can't be removed because they're necessary in other cases.)
User avatar
Griwes
Member
Member
Posts: 374
Joined: Sat Jul 30, 2011 10:07 am
Libera.chat IRC: Griwes
Location: Wrocław/Racibórz, Poland
Contact:

Re: When your OS goes crazy - Screenshots

Post by Griwes »

NickJohnson wrote:
cxzuk wrote:
NickJohnson wrote:I would agree with using -Werror -Wall -Wextra (et al.) with one exception: -Wunused-parameter. It throws a wrench in any proper attempt to use function pointers to simulate polymorphism in C.
Do you have an example of what you mean?
Just any case in which you're registering callbacks for something, and the callback function signature has parameters that are not always used (but can't be removed because they're necessary in other cases.)
You do know that when you leave unused parameter unnamed, it will not produce warning, don't you?
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
iON
Posts: 20
Joined: Fri Sep 09, 2011 4:09 pm

Re: When your OS goes crazy - Screenshots

Post by iON »

AOS version build 99999 Million(ok so that's exaggerating but i did so many different things so far.)
does this mean Tait is welcome?
does this mean Tait is welcome?
I tried to fix printing 2 random characters instead of a string, but that seems to made it WAY worse.

-------
joke:
if you look closely, you can make out the word "Tait".
so bochs, got something to tell me about your favorites?
lol.
-------
User avatar
GAT
Member
Member
Posts: 75
Joined: Wed Nov 30, 2011 9:51 pm
Contact:

Re: When your OS goes crazy - Screenshots

Post by GAT »

1337.jpg
Don't know if this counts as crazy, but I'm testing out a hash function, and apparently it's to eleet to work.
d3: virtualizing kernel in progress
https://github.com/WizardOfHaas/d3/
Khronos
Posts: 23
Joined: Sat Jul 21, 2012 5:29 am

Re: When your OS goes crazy - Screenshots

Post by Khronos »

I had this error writing my Screen driver...

EDIT: Problem fixed, I forgot update the VGA base pointer :oops:

Code: Select all

void screen::kputs(const char * string)
{
	for (; *string != '\0'; string++)
	{
		if (*string == '\n')
			VGA_PTR += VGA_WIDTH - ((VGA_PTR - (WORD *)VGA_ADDRESS) % VGA_WIDTH);
		else
			*VGA_PTR++ = 0x0700 | *string;

		if (*(int*)(void*)&VGA_PTR >= VGA_MAX_ADDRESS) //Scroll!
		{
			asm(".intel_syntax noprefix");
			__asm__("push rcx\n"
					"push rax\n" //Push

					"lea rdi, [0xB8000]\n" //Line 0
					"lea rsi, [0xB80A0]\n" //Line 1
					"mov rcx, 1920\n"	//24 * 80

					"rep movsw\n" //Scroll up the 24 lines

					"lea rsi, [0xB8F00]\n" //Line 25
					"mov rcx, 79\n"
					"mov ax, 0x0720\n" //Attributes with ' '
					
					".scroll_loop:\n"
						"mov [rsi], ax\n"
						"add rsi, 2\n"
						"dec rcx\n"
						"or rcx, rcx\n"
						"jnz .scroll_loop\n"
					//Empty the line 25

					"pop rax\n" //Pop
					"pop rcx");
			asm(".att_syntax noprefix");

			VGA_PTR = (WORD*)0xB8F00; //<------------------------------
		}
	}
}
Attachments
Sin título.png
Post Reply