Problem loading kernel
Problem loading kernel
I am trying to load my kernel from my bootloader, however the int 0x13 refuses to load more than 2 sectors.
Can it only load 2 sectors at a time or something?
Can it only load 2 sectors at a time or something?
Last edited by BMW on Sun Jan 06, 2013 3:56 pm, edited 1 time in total.
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Loading sectors from disk only loading 2 sectors
Int 0x13 can read many sectors depending on a whole range of other conditions.
Learn to check error codes.
Learn to check error codes.
Re: Loading sectors from disk only loading 2 sectors
The INT 13 functions can read more than two sectors at a time, although - obviously - it is limited by the number of sectors on the track, so clearly you are doing something wrong.
Without code it is less clear what that is.
Without code it is less clear what that is.
Re: Loading sectors from disk only loading 2 sectors
I am reading 5 sectors from a hard drive (sectors 4-8).
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
- Griwes
- Member
- Posts: 374
- Joined: Sat Jul 30, 2011 10:07 am
- Libera.chat IRC: Griwes
- Location: Wrocław/Racibórz, Poland
- Contact:
Re: Loading sectors from disk only loading 2 sectors
Also, which functions of int 0x13...? What device...?iansjack wrote:Without code it is less clear what that is.
We know almost exactly nothing from your description of problem; how are we supposed to be able to help?
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
Re: Loading sectors from disk only loading 2 sectors
Sorry.Griwes wrote:Also, which functions of int 0x13...? What device...?iansjack wrote:Without code it is less clear what that is.
We know almost exactly nothing from your description of problem; how are we supposed to be able to help?
Function 0x02.
The device is a hard drive.
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Re: Loading sectors from disk only loading 2 sectors
Hmmm... there is no error.Combuster wrote:Int 0x13 can read many sectors depending on a whole range of other conditions.
Learn to check error codes.
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Loading sectors from disk only loading 2 sectors
How many more questions do we need to ask you before we are able to reproduce your problem?
Re: Loading sectors from disk only loading 2 sectors
Ok, the problem is not with the loading of the kernel, but with the executing of it.Combuster wrote:How many more questions do we need to ask you before we are able to reproduce your problem?
When you load a PE file, do you just load the whole thing then jump to the entry point? Or do you have to load different parts of it to different places?
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Re: Problem loading kernel
Do you know what the file format of a PE file is? If you did, then you'd know the answer to your question.
Re: Problem loading kernel
Ok sorry I see now. I have to use the relocation tables and move the sections to appropriate places.sortie wrote:Do you know what the file format of a PE file is? If you did, then you'd know the answer to your question.
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Re: Problem loading kernel
If I set the base address in visual studio to where I load the PE file, will this eliminate the need to change the offsets in the relocation table?
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Re: Problem loading kernel
Hi,
Cheers,
Brendan
A quick questionnaire:BMW wrote:If I set the base address in visual studio to where I load the PE file, will this eliminate the need to change the offsets in the relocation table?
- Do you need relocatable code (e.g. will the kernel be loaded at "random" virtual addresses)?
- Do you need dynamic linking (e.g. will unresolved references in the kernel be linked to something else when it's loaded)?
- Do you need a real mode stub that displays "This program requires Windows" in case someone tries to execute your kernel on MS-DOS?
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Problem loading kernel
No. No. No.
What a good idea. Thanks.
What a good idea. Thanks.
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Re: Problem loading kernel
Lol, chucked a 2.5KB PE file into objcopy, spat out a 9KB binary file 99% full of 0x00... im not putting up with that.Brendan wrote:Hi,
A quick questionnaire:BMW wrote:If I set the base address in visual studio to where I load the PE file, will this eliminate the need to change the offsets in the relocation table?If the answer to these questions are all "no", then why do you want to use PE in the first place? Just use something (e.g. objcopy) to convert the PE into a flat binary and load the flat binary into memory "as is" (without any of the PE loader hassles or file format bloat).
- Do you need relocatable code (e.g. will the kernel be loaded at "random" virtual addresses)?
- Do you need dynamic linking (e.g. will unresolved references in the kernel be linked to something else when it's loaded)?
- Do you need a real mode stub that displays "This program requires Windows" in case someone tries to execute your kernel on MS-DOS?
Cheers,
Brendan
How can I fix this?
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."