a kernel i wrote myself cannot find data
for example if i put
Code:
kernel_print("Hey!"); |
What do you mean exactly? Did you compile the kernel or develop one on your own? And you must give much more info because I have no idea about what you want to know...
|
i developed it from scratch and got the bootloader from theNbomr
it bootloads and runs but string litterals cannot be read |
ok let me MAKE MY SELF CLEAR
i wrote a kernel from scratch and had a F### of a time getting it to work i finnaly got it to work but i cannot read anything in the data segment i think that DS is set wrong but i really ddo not know how to fix it so could someone with experence please help me? |
I understand now but I have no experience in this, sorry. You use assembly?
|
Unless you are doing something fancy, you should use the flat memory model, so DS should be same as the other segments. EDIT: didn't realize this is a 16-bit kernel.
Does it work if you print data from the stack? Code:
char str[] = "Hey!"; |
Quote:
Code:
char str[5]; |
If your goal is the "tiny" memory model (CS == DS == SS) then you should make sure your tool chain is linking that way and you should have your startup code copy CS to both DS and SS.
Your failure to get DS right, could represent either or both of the above are wrong. If your goal is some other memory model, make sure you understand what memory model you want and how to get the tool chain to compile/link for that memory model and how to make your startup code initialize for that memory model. Quote:
Quote:
So if you want to look up in your tool chain documentation how to get that memory model, you'll have an easier time using the common terminology. You can find that terminology documented at: http://en.wikipedia.org/wiki/C_memory_model The default memory model in 16 bit tool chains is "small". CS < DS == SS. If you want "small" memory model, you need to figure out how to make your startup code initialize DS and SS with the correct value. |
let me post the batch file i used to compile it
just a second |
Code:
tasm call.asm kernel.out is the bootable image |
Quote:
I certainly don't remember tlink command line switches for tiny memory model, nor do I remember where my copy of tlink documentation is. If you have an easy URL for tlink documentation, I might take a look and then explain the relevant switches. |
i copy and pasted this from the output of tlink
Code:
/3 │ Enables processing of 32-bit modules |
I thought you could get tlink to generate tiny memory model after tcc compiles object files for small memory model. Maybe you can by specifying /t which also makes the output a .com instead of a .exe. Or maybe I'm misremembering and you need a switch to tcc to get tiny memory model instead of small.
Do you understand which you want "tiny" or "small"? I don't recall the exetobin program. A .com is a flat binary format normally used with tiny memory model, but there is an implied extra 0x100 bytes at the beginning. Does exetobin also have an implied extra 0x100 bytes? All those details must be coordinated between your loader and startup code and the way you use the tool chain. |
yes it converts .exe to .com files
because if i tell the linker to do it i get an error (Error: Cannot generate COM file : invalid initial entry point address) |
1 Attachment(s)
I attach the a dissasmebley of most of the kernel below
i will release the full C source when i am done with it |
All times are GMT -5. The time now is 10:17 AM. |