×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Linkin C and Assembly Files

Linkin C and Assembly Files

Linkin C and Assembly Files

(OP)
Writing an OS includes both C and Assembly langur\age programming. I'm not clear when to switch from asm to C. At which level or after what have been done could I switch to C programming. I would also thank you if you could suggest some optimal memory maps to follow.
Sincerely,
Ekanth

RE: Linkin C and Assembly Files

Ekaanth,
 Compiler ur C code into Binary.
U can use gcc/ld which would be a very
powerful tool to do all such work.

Ur Entry Point in the "C" code  should
know about certain things. For exp, it
might need to asssume that PM and paging
are already setup. Ur memory map during bootup
may be made available as a ".h" file. Continue
writing "C" code from there. for exp, memoruy initializn,
configuring Kernel Segments, kmem_allocations, Vm manager
etc.. In the Loader routine, do the loading of kernel ("C"
part), then initialize some basic GDT, minimal page-tables
etc.. and the make LongJump into where u have loaded
ur kernel. that would do


Do not rejoice that ur code works.
it might be a special case of an error

RE: Linkin C and Assembly Files

Hey ekaanth,
 Try doing ur kernel as an ELF image.
I m not sure how complicated loading would be then.
But When u r an ELF, u will have lot of advantages
like, u can make Page-level protection for ur code,
and RODATA (read-only data) etc.. (trapping of bugs
in kernel code can b done in early stage of life, rather
letting the bug grow..)
moreover with SymBol info, things would be more cleaner.
but u need to spend some time learning ELF.
 I haven't done ELF loading..but my colleagues have
done it..shouldnt be a problem..

Sarnath


Do not rejoice that ur code works.
it might be a special case of an error

RE: Linkin C and Assembly Files

(OP)
Sarnath,
    Its not ekaanth, its ekanth...

RE: Linkin C and Assembly Files

Ok sir!


Do not rejoice that ur code works.
it might be a special case of an error

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close