OSDev.org
https://forum.osdev.org/

Fiwix 0.9.0
https://forum.osdev.org/viewtopic.php?f=2&t=32278
Page 2 of 3

Author:  Mikaku [ Tue Aug 08, 2017 3:21 pm ]
Post subject:  Re: Fiwix 0.9.0

Octocontrabass wrote:
It doesn't hang anymore, but it still does something that makes the keyboard completely unresponsive until the BIOS resets it. Since the keyboard is unresponsive, I can't do anything after the OS boots. The same keyboard on the other 386 has no issues.


Good to know that it no longer hangs on boot, but still worried that the keyboard gets unresponsive after a complete boot. I've never experienced that problem in all PCs where I tested Fiwix. Perhaps this is just an incompatible feature in that specific PC.

Octocontrabass wrote:
On both machines, I see floppy disk seek errors near the end of boot. This doesn't happen in Bochs, so it might just be a problem with the disk I'm using.


Yeah, that looks like a problem in the diskette.

Author:  Mikaku [ Tue Aug 08, 2017 3:30 pm ]
Post subject:  Re: Fiwix 0.9.0

zaval wrote:
i think it's just a taste and personal preference. if it was driven by the logic, the first ultimate FS to choose for this kind of stuff, would be ... the FAT family of course! it's interoperable AF, it's simple, it's fast, it's easy to implement. For every intelligent being in the whole Universe. not only for the weird "unix" world. :mrgreen:


Well ... you know, the FAT filesystem was not a choice, it is not suitable for UNIX-like operating systems. Looks like a toy. :wink:

Author:  zaval [ Tue Aug 08, 2017 5:15 pm ]
Post subject:  Re: Fiwix 0.9.0

Mikaku wrote:
Well ... you know, the FAT filesystem was not a choice, it is not suitable for UNIX-like operating systems. Looks like a toy. :wink:

ah. so you have chosen a "suitable" FS with "maximum size of each filesystem is 64MB". doesn't look like a toy. this must be that famous "unix philosophy".

Author:  Mikaku [ Wed Aug 09, 2017 12:15 am ]
Post subject:  Re: Fiwix 0.9.0

zaval wrote:
ah. so you have chosen a "suitable" FS with "maximum size of each filesystem is 64MB". doesn't look like a toy. this must be that famous "unix philosophy".


No, as I said, the decision was to have a simple and UNIX-like filesystem. This is a double requirement. FAT is only simple, not UNIX-like. And also, the Minix FS is just temporary, this permits me to advance the kernel quickly. Then, as I also said, the EXT2 FS will be probably implemented to have more space in the FS.

Author:  Octocontrabass [ Wed Aug 09, 2017 4:40 am ]
Post subject:  Re: Fiwix 0.9.0

Mikaku wrote:
Good to know that it no longer hangs on boot, but still worried that the keyboard gets unresponsive after a complete boot. I've never experienced that problem in all PCs where I tested Fiwix. Perhaps this is just an incompatible feature in that specific PC.

I was able to make the original kernel work by patching your keyboard_wait() function, so I don't think it's a problem with the hardware. From what I saw when I was creating that patch, your code to communicate with the keyboard has some issues. For example, you try to send and receive a lot of data through the keyboard controller without making sure it's ready. (Only your IRQ handler can do that, since the IRQ indicates that the keyboard controller is ready for you to read some data.)

Author:  zaval [ Wed Aug 09, 2017 12:35 pm ]
Post subject:  Re: Fiwix 0.9.0

Mikaku wrote:
No, as I said, the decision was to have a simple and UNIX-like filesystem. This is a double requirement. FAT is only simple, not UNIX-like. And also, the Minix FS is just temporary, this permits me to advance the kernel quickly. Then, as I also said, the EXT2 FS will be probably implemented to have more space in the FS.

okay. the only question, just of curiosity, don't you think that a FS should not give a sh!t what your OS is "like"? I mean isn't it stupid to confer an entity with attributes which aren't (shouldn't) even closely be relevant to it? what's a "unix-like" FS? Or whatever-like FS? Is this a design which is impossible to reproduce on a non-whatever-like system? Is it where the design and implemenation are twisted into incomprehensible spagetti, where non-FS concepts are unnecessarily pulled into a FS? If so, then it's a garbage-like design. imho.

Author:  Mikaku [ Fri Aug 11, 2017 8:36 am ]
Post subject:  Re: Fiwix 0.9.0

Octocontrabass wrote:
I was able to make the original kernel work by patching your keyboard_wait() function, so I don't think it's a problem with the hardware. From what I saw when I was creating that patch, your code to communicate with the keyboard has some issues. For example, you try to send and receive a lot of data through the keyboard controller without making sure it's ready. (Only your IRQ handler can do that, since the IRQ indicates that the keyboard controller is ready for you to read some data.)


I've been working on a complete rewrite of the keyboard reset routine, I've based it on this PDF document: http://caspar.hazymoon.jp/OpenBSD/annex/docs/8042-KBC.pdf, but it doesn't work neither. It hangs in the most real hardware I have around here. Then, I've included some ideas from Linux and it worked better, but still hangs sometimes.

Do you know of a document with a functional example of a keyboard reset?

Author:  Mikaku [ Fri Aug 11, 2017 4:39 pm ]
Post subject:  Re: Fiwix 0.9.0

zaval wrote:
okay. the only question, just of curiosity, don't you think that a FS should not give a sh!t what your OS is "like"? I mean isn't it stupid to confer an entity with attributes which aren't (shouldn't) even closely be relevant to it? what's a "unix-like" FS? Or whatever-like FS? Is this a design which is impossible to reproduce on a non-whatever-like system? Is it where the design and implemenation are twisted into incomprehensible spagetti, where non-FS concepts are unnecessarily pulled into a FS? If so, then it's a garbage-like design. imho.


At user-level you're right, the FS should be transparent enough that the user is not able to distinguish what kind of system is working behind that FS. But the FS is intrinsically bound (at low level) to the kernel, and so it must cooperate in a way that both worlds must understand each other.

Author:  zaval [ Fri Aug 11, 2017 6:47 pm ]
Post subject:  Re: Fiwix 0.9.0

Mikaku wrote:
zaval wrote:
okay. the only question, just of curiosity, don't you think that a FS should not give a sh!t what your OS is "like"? I mean isn't it stupid to confer an entity with attributes which aren't (shouldn't) even closely be relevant to it? what's a "unix-like" FS? Or whatever-like FS? Is this a design which is impossible to reproduce on a non-whatever-like system? Is it where the design and implemenation are twisted into incomprehensible spagetti, where non-FS concepts are unnecessarily pulled into a FS? If so, then it's a garbage-like design. imho.


At user-level you're right, the FS should be transparent enough that the user is not able to distinguish what kind of system is working behind that FS. But the FS is intrinsically bound (at low level) to the kernel, and so it must cooperate in a way that both worlds must understand each other.

see, what you described, in no way implies any esoteric "likeness" of a FS to the OS of the FS implemenation residence. its implementation needs to integrate good with the kernel it belongs to, but not the FS design things. because the only outcome of such a wrong approach is that noone else wants that FS. ;) trust me, the world we live in, is not unix-like.)

Author:  Octocontrabass [ Sat Aug 12, 2017 2:15 pm ]
Post subject:  Re: Fiwix 0.9.0

Mikaku wrote:
Do you know of a document with a functional example of a keyboard reset?

I don't think there's anything wrong with the reset commands you're sending to the keyboard. The problem is how you're using the keyboard controller to send those commands and receive the responses. Before every read from or write to port 0x60, you must read port 0x64 to see if the keyboard controller is ready. Bit 0 is set when you can read from port 0x60. Bit 1 is clear when you can write to port 0x60.

For example, sending a byte to the keyboard should look something like this:
Code:
bool send_to_keyboard( uint8_t byte_to_keyboard )
{
    while( /* timeout */ )
    {
        if( !(inport_b( 0x64 ) & 0x02) )
        {
            outport_b( 0x60, byte_to_keyboard );
            return true;
        }
    }
    return false;
}

And receiving:
Code:
bool receive_from_keyboard( uint8_t * byte_from_keyboard )
{
    while( /* timeout */ )
    {
        if( inport_b( 0x64 ) & 0x01 )
        {
            byte_from_keyboard = inport_b( 0x60 );
            return true;
        }
    }
    return false;
}

Note that the timeout should be based on actual time, not a number of loop repetitions.

Your IRQ handler doesn't have this limitation: the IRQ itself is how the keyboard controller indicates that you may read one byte from port 0x60. I would enable IRQs before trying to reset the keyboard so the IRQ handler could deal with receiving all the responses from the keyboard, but you don't have to do it like that.

Author:  stevewoods1986 [ Mon Aug 14, 2017 2:42 pm ]
Post subject:  Re: Fiwix 0.9.0

Great OS. I will test if you want. It's great to have another Linux around.
You need to port a few GNU packages like Binutils, GCC and Nano. If you add NASM as well, I might be using your OS for my OS :)

Mikaku wrote:
I just sent a RESET command (0xFF) and then there was an infinite 'while()' waiting for the byte 0xAA (RESET OK).


Always good to do PS/2 keyboard tests. 0xFF to 0x60. Is your code open source? I would love to contribute.

Author:  Mikaku [ Mon Aug 14, 2017 2:58 pm ]
Post subject:  Re: Fiwix 0.9.0

Octocontrabass wrote:
I don't think there's anything wrong with the reset commands you're sending to the keyboard. The problem is how you're using the keyboard controller to send those commands and receive the responses. Before every read from or write to port 0x60, you must read port 0x64 to see if the keyboard controller is ready. Bit 0 is set when you can read from port 0x60. Bit 1 is clear when you can write to port 0x60.


Well, after some days working on the keyboard driver I think that now is doing a stable initialization, at least here with all my old hardware. Bochs, Qemu and VMware Player are always more friendly. :wink:

Thanks for the URLs you gave in your last post. These with that one http://www.flingos.co.uk/docs/reference/PS2-Keyboards/ helped me a lot to improve that driver. Now the kernel even shows a line indicating the keyboard type and the number of PS/2 devices (and supported).

Test the latest patch I uploaded in the Fiwix web site http://www.fiwix.org/fiwix-0.9.0p3.img.gz, and let me know if you still have problems with that old 386 you have there.

Regards.

Author:  Mikaku [ Tue Aug 15, 2017 8:32 am ]
Post subject:  Re: Fiwix 0.9.0

stevewoods1986 wrote:
You need to port a few GNU packages like Binutils, GCC and Nano. If you add NASM as well, I might be using your OS for my OS :)


Yeah, I started porting newlib and I have ported some tools but I realized that it's really hard to compile GNU tools with that library. It's a pity because it was easy to port newlib and I enjoyed a lot doing it, but it lacks a lot of functions. So, now I'm considering a different C library, and musl is a good candidate. :)

stevewoods1986 wrote:
Is your code open source? I would love to contribute.


Not right now, but it will be as soon as it reaches 1.0 version (self-hosting).

Thanks for your interest.
Regards.

Author:  Octocontrabass [ Sat Aug 19, 2017 10:36 am ]
Post subject:  Re: Fiwix 0.9.0

Mikaku wrote:
Test the latest patch I uploaded in the Fiwix web site http://www.fiwix.org/fiwix-0.9.0p3.img.gz, and let me know if you still have problems with that old 386 you have there.

It works!

It seems like sometimes one of the shift keys gets stuck, and num lock affects keys that it shouldn't, but the keyboard is usable now.

Author:  Mikaku [ Sat Aug 19, 2017 2:17 pm ]
Post subject:  Re: Fiwix 0.9.0

Octocontrabass wrote:
It works!

It seems like sometimes one of the shift keys gets stuck, and num lock affects keys that it shouldn't, but the keyboard is usable now.


Great!, that's good news! :)

Yeah, keyboard driver is far from perfect, but if it's usable enough I prefer focusing on other things.
Thanks a lot for your valuable testing and feedback.
Regards!

Page 2 of 3 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/