Hi, The attached patch fixes some issues with console drivers, as well as access to bios disk. Greetings, Juan PREVIOUS OPERATION AND BUGS 1. File "arch/i86/drivers/char/bell.c" rings the bell on PC compatible machines. Function sound(), written mostly in assembler, programs the hardware to produce the audio output at frequency from parameter "freq". It creates a stack frame and accesses the parameter with offset 4. However, by then, the compiler already created its own stack frame and the parameter is no longer at offset 4. The previous implementation takes as "freq" the return address of the function. 2. In console output drivers, expansion of '\n' to the sequence '\r', '\n' was done at several places (i.e. the tty layer, when writing to video memory, at printk, etc.) resulting in the processing of several '\r' codes every time. 3. In file "arch/i86/drivers/char/dircon.c", some functions move the cursor on every write to video memory. It is more efficient to move the cursor only at the end of a group of writes. 4. In function "arch/i86/kernel/bios16.c", parameters to bios calls are passed in cpu registers, including the register DS. To recover the DS register after the bios call, its contents are saved in the variable "our_ds" placed in the code segment. But this is precisely the purpose of variable "stashed_ds" used in the interrupt code. NEW OPERATION 1. In bell.c, does not create another stack frame. Uses the offset for parameter "freq" as calculated by the compiler. 2. Removed the expansion of newlines except at the tty layer and the "con_charout()" function (because this last function bypasses the tty layer). Made this correction to console devices: direct-console, bios-console and sibo-console. 3. In file "arch/i86/drivers/char/dircon.c", the cursor is moved only when necessary. 4. In file "arch/i86/drivers/char/ntty.c", functions "determine_tty()" and "tty_write()" were rewritten to make them faster and smaller. 5. Variable "our_ds" was removed and "stashed_ds" used in its place. There is no need to save the contents of DS before the bios call, only to recover the kernel data segment from "stashed_ds". With this change, variable "stashed_ds" is now the only and absolutely necessary variable placed in the code segment, from the ~9 existing seven months ago. OTHER CHANGES Code size reduced by 80 bytes. The Image builded without errors. The kernel was tested with QEMU and dioscuri emulators. Also in a PPro pc booting from floppy.
Attachment:
elksM.patch
Description: Binary data