Hello -
I'm at the part of building my own OS where I need to port Newlib. On the Porting Newlib page, it says I have to support a set of 17 system calls. Where/How exactly do I do this? The basic kernel from the C++ tutorial doesn't handle interupts.
Thanks
Porting Newlib/Handling System Calls
-
- Posts: 7
- Joined: Wed Jan 09, 2013 2:16 am
Porting Newlib/Handling System Calls
Last edited by twixthehero on Thu Feb 21, 2013 6:36 pm, edited 1 time in total.
- Griwes
- Member
- Posts: 374
- Joined: Sat Jul 30, 2011 10:07 am
- Libera.chat IRC: Griwes
- Location: Wrocław/Racibórz, Poland
- Contact:
Re: Porting Newlib/Handling System Calls
There are few nonsensical things in your post.
And the best for the end. Look at these two quotes:
You have very huge misconception of how things work in this field.
You don't *need*, you are just encouraged to do so.I need to make a cross compiler
Whoa, that was quick jump from one topic to another...On the Porting Newlib page
Wrong hobby, if you have to ask this question this way...Where/How exactly do I do this?
And the best for the end. Look at these two quotes:
The basic kernel from the C++ tutorial doesn't handle interupts.
and try to guess what is the most utterly stupid thing you wrote in that post.building my own OS
You have very huge misconception of how things work in this field.
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: Porting Newlib/Handling System Calls
I can understand the porting newlib question but if you don't know how to do a system call I wish you all the luck with making your "own" os
-
- Posts: 7
- Joined: Wed Jan 09, 2013 2:16 am
Re: Porting Newlib/Handling System Calls
Then why is it in 90% of the posts, people with compiling problems are told they need cross compilers. I assumed that this is the "better" option because everyone does this. I even remember reading a thread here where a poster said something like: "I remember the days when we didn't tell everyone they needed a cross compiler."You don't *need*, you are just encouraged to do so.
What is the title of the thread? "Porting Newlib/Handling System Calls"Whoa, that was quick jump from one topic to another...
Well excuse me for trying to learn how OS's work by making my own.Wrong hobby, if you have to ask this question this way...
I know it doesn't handle interrupts. I even said that in my post! The point is to learn HOW it can be done.And the best for the end. Look at these two quotes:The basic kernel from the C++ tutorial doesn't handle interupts.building my own OS
What might that be? Even posting?...and try to guess what is the most utterly stupid thing you wrote in that post.
Well then correct me! I'm here to learn, not get told off.You have very huge misconception of how things work in this field.
Maybe I should refine my original question even more to get a good answer: What exactly is an interrupt? And why (if I even do) would I need it to handle the system calls that newlib requires?
How would I know how to do a system call immediately off the bat? The tutorial doesn't. cover. it. I don't want people to write code for me, because then it's not my work, and I still wouldn't understand what they did.feare56 wrote:I can understand the porting newlib question but if you don't know how to do a system call I wish you all the luck with making your "own" os
Re: Porting Newlib/Handling System Calls
Well the tutorials think that you have a lot of knowledge in programming and the language you are using they are just there to help you get a bootable kernel that you can take and make it close to your own then later you can decide to redo it and truly make it your own.
-
- Member
- Posts: 283
- Joined: Mon Jan 03, 2011 6:58 pm
Re: Porting Newlib/Handling System Calls
I think the problem most people have with your post is the following:
1) There is a rather large link at the top of every page of this forum with the text "The OSDev.org Wiki - Got a question? Search this first!"
2) The link takes you to a wiki (the collected knowledge of many many many programmers before you)
3) Less than 1 page down is a link titled Interrupts that has a rather succinct definition of interrupts and how/why/when to use them.
- Monk
1) There is a rather large link at the top of every page of this forum with the text "The OSDev.org Wiki - Got a question? Search this first!"
2) The link takes you to a wiki (the collected knowledge of many many many programmers before you)
3) Less than 1 page down is a link titled Interrupts that has a rather succinct definition of interrupts and how/why/when to use them.
- Monk
-
- Posts: 7
- Joined: Wed Jan 09, 2013 2:16 am
Re: Porting Newlib/Handling System Calls
My apologies, but I did not think to search "Interrupts"! Derp Thank you very much!tjmonk15 wrote:I think the problem most people have with your post is the following:
1) There is a rather large link at the top of every page of this forum with the text "The OSDev.org Wiki - Got a question? Search this first!"
2) The link takes you to a wiki (the collected knowledge of many many many programmers before you)
3) Less than 1 page down is a link titled Interrupts that has a rather succinct definition of interrupts and how/why/when to use them.
- Monk
Re: Porting Newlib/Handling System Calls
Interrupts are a red herring; they are not equivalent to system calls (although one way to implement system calls is with software interrupts). All a system call is is a means for a user program to request a particular service from the Operating System kernel. For example, one of those system calls concerns opening a file. You need to write a routine to open a file and then provide a means for a program to "call" this routine. You can do this via a software interrupt, via the SYSCALL instruction, or any other means that you see fit. As far as the user program is concerned this is implemented as a function with specified parameters. (But, to be fair, you will probably need to learn about interrupts to best talk to the hardware.)
I'd have to say that if you don't understand this, and don't already have routines in your kernel to provide such operations as opening, reading, writing, and closing files, allocating blocks of memory, loading and executing programs, etc., then it is a little premature to be looking at porting a standard library. None of the standard tutorials that I am aware of go into this sort of detail, but by implementing these system calls and eventually porting the library (and then, ideally, an assembler, linker, and even C compiler) you will learn a lot. This is the difficult - and fun - part of writing your own OS (as opposed to typing in a tutorial), but don't expect to complete it in a week or two. In many senses your system calls are what defines your operating system.
I would recommend that rather than just following tutorials you read a few books on OS design and PC hardware (and, of course, read the articles on this Wiki and other online sources) so that you can produce your own design rather than just following someone else's.
I'd have to say that if you don't understand this, and don't already have routines in your kernel to provide such operations as opening, reading, writing, and closing files, allocating blocks of memory, loading and executing programs, etc., then it is a little premature to be looking at porting a standard library. None of the standard tutorials that I am aware of go into this sort of detail, but by implementing these system calls and eventually porting the library (and then, ideally, an assembler, linker, and even C compiler) you will learn a lot. This is the difficult - and fun - part of writing your own OS (as opposed to typing in a tutorial), but don't expect to complete it in a week or two. In many senses your system calls are what defines your operating system.
I would recommend that rather than just following tutorials you read a few books on OS design and PC hardware (and, of course, read the articles on this Wiki and other online sources) so that you can produce your own design rather than just following someone else's.