Hi, Attached is the first of a set of 5 patches to fix some bugs and do several improvements. Greetings, Juan PREVIOUS OPERATION AND BUGS 1. Command "mkfs" did not work because of a bug in function "blk_rw()" in file fs/block_dev.c. When calculating the block number from the file position (filp->f_pos), it casted the file position to 16 bits before dividing by the block size, making unreachable data beyond 64 Kbytes. 2. In function "bioshd_open()", file arch/i86/drivers/block/doshd.c, disk geometry is determined by attempting to seek certain tracks and sectors. But the implementation fails to work correctly when there is no disk. 3. In function "do_bioshd_request()", file arch/i86/drivers/block/doshd.c, variable "tmp" is defined 16 bits but might need 18 bits. Variable "this_pass" is defined 32 bits, but 16 bits suffices. NEW OPERATION 1. In function "blk_rw()" the block number is casted to 16 bits after the division by the block size. Command mkfs now works. Using a block device this way might also be done by fsck, fdisk and mtools commands. 2. Fixed problem in function "bioshd_open()", reducing at the same time the code size. 3. Redefined sizes of variables in function "do_bioshd_request()". Put explicit casts in the conversion from block addressing to CHS addressing. Simplified conversion code. 4. In file "arch/i86/drivers/block/doshd.c", function "bioshd_gethdinfo()" was rewritten to make it faster and smaller. OTHER CHANGES Code size reduced by 64 bytes. The Image builded without errors. The kernel was tested with QEMU and dioscuri emulators. Also in a PPro pc booting from floppy.
Attachment:
elksO.patch
Description: Binary data