OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 12:45 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: ATAPI driver reads nothing
PostPosted: Tue Feb 18, 2020 8:28 am 
Offline

Joined: Thu Feb 13, 2020 1:06 am
Posts: 10
Code:
xorriso -as mkisofs -R -J \
      -b disk.img -no-emul-boot -boot-load-size 1 \
      -o mybootcd2.iso cd_img


i've changed command for creating iso so am i able to have binary size more than 2880 kbs?
also, i cant make my code working normally when i read it from iso by myself from 34 sector where my code is located at drive
it works but instead of printing string it prints some strange symbols and cant load GDT saying "fetch_raw_descriptor: GDT: index (f) 1 > limit (0)" (when i load code by int 13, ah=0x2 it works normally without any errors)

but dumps of memory where i load stage 2 absolutely identical (except of in second case i also load my stage1 (512 bytes) to memory so i simply add 0x200 to start address in memory) and i dont know what to do with that
Code:
load_disk_lba :
     push ax
     push si
     mov ah, 0x42
     mov si, lba_read_packet
     mov byte [lba_read_packet], 0x10
     mov word [lba_read_packet + 2], cx
     mov word [lba_read_packet + 4], di
     mov word [lba_read_packet + 6], ds
     mov word [lba_read_packet + 8], bx
     int 0x13
     jc disk_error
     pop si
     pop ax
     ret
disk_error :
      jmp $
align 8
lba_read_packet times 16 db 0

Code:
load_kernel :
   push ds
   pusha
   mov dl, [BOOT_DRIVE]
   xor ax, ax
   mov ds, ax
   mov es, ax
   mov di, 0x1000
   mov bl, 0x22
   mov cx, 0x3
   call load_disk_lba
   popa
   pop ds
   ret 


Top
 Profile  
 
 Post subject: Re: ATAPI driver reads nothing
PostPosted: Tue Feb 18, 2020 8:59 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5143
alicedeveloper wrote:
i've changed command for creating iso so am i able to have binary size more than 2880 kbs?

Yes, but you could have done that anyway by telling the BIOS to stop floppy disk emulation.

alicedeveloper wrote:
also, i cant make my code working normally when i read it from iso by myself from 34 sector where my code is located at drive
it works but instead of printing string it prints some strange symbols and cant load GDT saying "fetch_raw_descriptor: GDT: index (f) 1 > limit (0)" (when i load code by int 13, ah=0x2 it works normally without any errors)

but dumps of memory where i load stage 2 absolutely identical (except of in second case i also load my stage1 (512 bytes) to memory so i simply add 0x200 to start address in memory) and i dont know what to do with that

It sounds like your code needs to run at a specific address, and you're running it at an address 512 bytes higher. It could also be caused by bad assumptions about the value of segment registers (especially CS).


Top
 Profile  
 
 Post subject: Re: ATAPI driver reads nothing
PostPosted: Tue Feb 18, 2020 9:31 am 
Offline

Joined: Thu Feb 13, 2020 1:06 am
Posts: 10
Quote:
It sounds like your code needs to run at a specific address, and you're running it at an address 512 bytes higher. It could also be caused by bad assumptions about the value of segment registers (especially CS).


thank you very much ! i've changed value in linker command from 0x100000 to 0x100200 and now my stage 2 works ! also i've changed value in linker command for kernel and it works too !

now i know more possible solutions for new problems and understand why my atapi driver works different from as it was intended

thank you again !


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], SemrushBot [Bot] and 116 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group