Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Bug confirmed (Users)

posted by Japheth Homepage, Germany (South), 03.01.2021, 11:16

I again played a bit with FD fdisk. Here's again the 2 overlapping partitions:


  type          start sec  size            abs. sectors   
> FAT32,LBA     390703104  16777216   8192 390703104-407480319
> FAT32,LBA     407472660  16787925   8197 407472660-424260584


Now, one missing information is the geometry returned by Int 0x13, ah=0x48:

Cyl/Head/Sec=121601/255/63

This gives a good hint where the problem is:

1. Multiplying "heads" and "sectors": 255x63=16065
2. Dividing the 2. start sector thru this value: 407472660/16065=25364

The division has no remainder. And so I conclude: FD fdisk tries to align the partition's start sector (and size) to a "cylinder" boundary, either rounding or skipping remainders. This indeed works - as long as FD fdisk handles the MBR exclusively. Linux fdisk, however, doesn't seem to care about cylinder boundaries, at least not if the partition type is FAT32-LBA.

Another - minor - problem with FD fdisk's approach is that the cyl/head/sec geometry returned by Int 0x13, ah=0x48 may be invalid. There's a flag returned, indicating whether the information is valid, but FD fdisk ignores it

Here's the relevant fdisk source, file PDISKIO.C:


    asm {
      mov ah,0x48
      mov dl,BYTE PTR physical_drive
      mov ds,result_buffer_segment
      mov si,result_buffer_offset
      int 0x13

      mov BYTE PTR error_code,ah
      }

//    if(error_code>0) return(error_code);
    if(error_code > 0) Error_Handler(error_code);

    /* Compute the total number of logical cylinders based upon the number */
    /* of physical sectors returned from service 0x48.                     */

    number_of_physical_sectors = *(_u32*)(result_buffer+16);

    total_cylinders=((number_of_physical_sectors/total_sectors)/(total_heads+1));

---
MS-DOS forever!

 

Complete thread:

Back to the forum
Board view  Mix view
22751 Postings in 2119 Threads, 402 registered users (1 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum