Hi,
I 'd Like to ask few questions ,
1) for programming on physical hardware the architecture may vary , but if I want a standard non changeable
architecture I can learn on virtual machines like vmware or virtualbox ..etc , now my questions where could
I get information about the architecture of that generic virtual machine like Registers and I/O map and
Equivalent Block diagram also what adds complexity is that new architectures use north bridge, south bridge
parallel processors and cores , I think books like The Intel Microprocessors (8th Edition) by Barry B. Brey
are good for knowing concepts but the block diagrams and architectures is older than today's real machines
do you have a book or material recommendations or what I will encounter as programmer on virtual machines
is included in such book
2) I'd Like to understand about the ABI and how to write Modular C-code and make libraries , I know C programming
but didn't have such experience to write code in different files compile separately and make libraries and link them
If you have any material recommendations also here or how to start understanding what is ABI and what enforces it,
it will be helpful
3) Also I have a last Question in my mind when I write a C program , functions call a function which call a function etc till
atomic function , by atomic i mean that we don't go infinity for calling functions and thos level of atomic functions can be
executed , how those functions are written , are written in assembly directly ?
4) Do you have any recommendation about material for tool chain course that willl answer question 2 and 3
I have searched the web for those questions I am confused about many times and found too many results but
confused where to start
thanks
Questions[virtual machine architecture]-[C Modular prog]
-
- Posts: 1
- Joined: Mon Apr 08, 2019 3:39 pm
-
- Member
- Posts: 71
- Joined: Fri Jun 28, 2013 1:48 am
- Contact:
Re: Questions[virtual machine architecture]-[C Modular prog]
"Architecture" usually means something like x86, ARM, SPARC, etc. Virtual Machines also have architecture. VMware and VirtualBox are just emulators of x86 architecture computers. So just pick one architecture you are most familiar with, or the architecture of your current computer (most likely x86_64).
Reinventing the Wheel, code: https://github.com/songziming/wheel
-
- Member
- Posts: 5584
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Questions[virtual machine architecture]-[C Modular prog]
Most virtual machines support the i440FX northbridge and PIIX3 southbridge, or chips in the same family (e.g. i440BX and PIIX4). There is no better place to learn about those than Intel's datasheets. You'll have to read your virtual machine's manual to see exactly which chipset it implements.AbdAllahTalaat wrote:1)
The ABI is a standard that says how to generate a binary that can be linked with other binaries to produce a working program. For example, Linux software uses the System V ABI.AbdAllahTalaat wrote:2)
I don't have any good references on writing modular code, or how to link it. Perhaps you should look for beginner C programming guides.
Functions can be written purely in C. If you're talking about things like operators, those are written in the compiler's intermediate language. The intermediate language can be translated to assembly, but most compilers will optimize it first.AbdAllahTalaat wrote:3)
I've learned a lot from reading the GCC documentation, but I wouldn't recommend starting there.AbdAllahTalaat wrote:4)
Re: Questions[virtual machine architecture]-[C Modular prog]
Hi and welcome,
About recommendations, I'd recommend to use SysV ABI and ELF, as they are Open Source and there are so many information and tutorials about them. GNU toolchain is quite common, but recently LLVM is gaining on it. For GNU, you'll have to compile your own toolchain (gcc cross-compiler and ld cross-linker at a minimum), while LLVM tool chain (Clang compiler and lld linker) is by definition a cross-compiler, so it's easier to start with. GNU toolchain has been around for decades, so it's a bit bloated but very well tested; LLVM on the other hand is well-thought and legacy-free. Despite of this, both have bugs and neither support the full C standard, only partialy.
Cheers,
bzt
All hardware are different. It is the OS' duty to hide that fact and provide a consistent interface to the user space applications. Virtual machines are different too, and you can configure them (so they are "changeable hardware" too).AbdAllahTalaat wrote:Hi,
I 'd Like to ask few questions ,
1) for programming on physical hardware the architecture may vary , but if I want a standard non changeable
architecture I can learn on virtual machines like vmware or virtualbox ..etc ,
Start at the wiki. Do you see the "Got a question? Search this first!" link in the navbar? Finding the documentation on your own is part of the fun. But the wiki has links to the specs if you feel not up to it.now my questions where could
I get information about the architecture of that generic virtual machine like Registers and I/O map and
Except for some special devices (qemu video driver, ARM semihosting, bochs E9 debug console hack etc.) there's none. I don't think there's such a book. You have to figure out which devices the emulator simulates, and write code for that. If you then boot your OS on a real hardware which happens to have the same devices, it will work on that too (hopefully).Equivalent Block diagram also what adds complexity is that new architectures use north bridge, south bridge
parallel processors and cores , I think books like The Intel Microprocessors (8th Edition) by Barry B. Brey
are good for knowing concepts but the block diagrams and architectures is older than today's real machines
do you have a book or material recommendations or what I will encounter as programmer on virtual machines
is included in such book
Again, check our wiki. There're tons on information on this topic, mostly SysV ABI related (ELF), which is good for the Open Source world (technically ELF is for everything that's not Windows). If you want to go on the PE road, MSDN is your best source of information (and I have to tell you that Microsoft documentations are sometimes incomplete, but what's in there, that's surprisingly good and detailed).2) I'd Like to understand about the ABI and how to write Modular C-code and make libraries , I know C programming
but didn't have such experience to write code in different files compile separately and make libraries and link them
If you have any material recommendations also here or how to start understanding what is ABI and what enforces it,
it will be helpful
I feel a little disturbance in the force here. First, atomic means the function is uninterruptible and exclusive, meaning only one CPU core can execute it at any given time. Functions that are not calling other funtions are called leafs. This designation has nothing to do with C or Assembly. You can write atomic functions in C (using mutexes or even inline assembly for example), and Assembly functions can call other functions. Some architecture has special C attributes which guarantees function atomiticy, while others require special assembly mnemonics for that.3) Also I have a last Question in my mind when I write a C program , functions call a function which call a function etc till
atomic function , by atomic i mean that we don't go infinity for calling functions and thos level of atomic functions can be
executed , how those functions are written , are written in assembly directly ?
Yes, start by reading the wiki.4) Do you have any recommendation about material for tool chain course that willl answer question 2 and 3
I have searched the web for those questions I am confused about many times and found too many results but
confused where to start
About recommendations, I'd recommend to use SysV ABI and ELF, as they are Open Source and there are so many information and tutorials about them. GNU toolchain is quite common, but recently LLVM is gaining on it. For GNU, you'll have to compile your own toolchain (gcc cross-compiler and ld cross-linker at a minimum), while LLVM tool chain (Clang compiler and lld linker) is by definition a cross-compiler, so it's easier to start with. GNU toolchain has been around for decades, so it's a bit bloated but very well tested; LLVM on the other hand is well-thought and legacy-free. Despite of this, both have bugs and neither support the full C standard, only partialy.
Cheers,
bzt
Re: Questions[virtual machine architecture]-[C Modular prog]
Hi,
- 1. A VM emulates existing hardware. So if you want information about the hardware it emulates, you need to find the documentation about the hardware. It should be enough for your purposes.
2. You don't need information about the ABI in order to understand how to compile multiple files into a binary.
3. I really struggle to understand your question here. It would be wise not to redefine atomicity, which is about concurrency, not about infinity.
4. IMHO, these are concepts not specific to osdev, so I advise you to learn more about C and low-level programming. You are probably confused because you have not yet mastered a lot of basic fundamental material.
My blog: http://www.rivencove.com/