ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
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?
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.
That working indicates that DS == SS. It does not indicate that either DS or SS is correct and it doesn't indicate that you are linking correctly for the desired memory model.
Originally Posted by ntubski
you should use the flat memory model
There is not complete agreement on the terminology, but usually "flat" memory model implies the offset size is at least 32 bits. In 16 bit programming, the "flat" memory model is usually called the "tiny" memory model.
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.
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.
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.