What are the basic kernel operations which require assembly?
What are the basic kernel operations which require assembly?
What are the basic kernel operations which require assembly?
I'm looking around and learning what I can about assembly. I've got the basic concepts, and will be practicing as well. But, I want to know what to keep an eye out for in terms of parts of the kernel which should be done in assembly. More specifically, amd64. Very specifically--Intel i7 740QM.
I know this is beginner, but hey, its where I'm at.
And yes, my C is fine.
Thanks!
I'm looking around and learning what I can about assembly. I've got the basic concepts, and will be practicing as well. But, I want to know what to keep an eye out for in terms of parts of the kernel which should be done in assembly. More specifically, amd64. Very specifically--Intel i7 740QM.
I know this is beginner, but hey, its where I'm at.
And yes, my C is fine.
Thanks!
Re: What are the basic kernel operations which require assem
I have the manual for the processor, but its so big I am not going through it all that fast...
Re: What are the basic kernel operations which require assem
It really depends. With an advanced bootloader you could get away with very little. But why do you even ask? It's the kind of thing you'll know when you get there, and have read the wiki & tutorials..
Re: What are the basic kernel operations which require assem
Hi,
Cheers,
Brendan
A (possibly partial) list:anadon wrote:What are the basic kernel operations which require assembly?
- CPU mode switches. Needed at least once in boot code intended for BIOS (but more likely to be much more). Possibly not needed at all when booting from UEFI.
- The task switch code in the scheduler (not the code that decides which task to switch to, but the small piece that actually does the final switch)
- Interrupt handler entry and exit (but not necessarily the interrupt handler itself)
- Kernel API entry and exit (but not necessarily the kernel API itself)
- Special purpose CPU instructions. This typically means inline assembly macros/wrappers around instructions like CLI/STI, RDSTC, RDMSR/WRMSR, CPUID, IN, OUT, FXSAVE, LGDT/LIDT, MOV to/from CRn, HLT, INVLPG, etc.
- Anything that needs to guarantee atomicity (e.g. for things like spinlocks, lock-free algorithms, etc); unless you can use something like atomic built-ins instead
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: What are the basic kernel operations which require assem
I would like to be able to code more on it--it's fun. But I can't go as fast as I want to. No hurry, but I'd like to go faster.
Re: What are the basic kernel operations which require assem
All software NEEDS assembly, or more specifically, all software NEEDS to be run as binary. if you compile some c code there are 3 steps to make an executable:
1: make the c code into assembly (all code , even java, need to go to this stage)
2: assemble, build to .o or .bin file
2: link
the last step is not needed. if you write in c you will be able to use the asm(""); keyword, now you can write in at&t syntax (or type .intel_syntax to change to intel syntax).
PS: as you know, scripting languages are not compiled at all, they are interpreted
PS: the last ps was pointless
1: make the c code into assembly (all code , even java, need to go to this stage)
2: assemble, build to .o or .bin file
2: link
the last step is not needed. if you write in c you will be able to use the asm(""); keyword, now you can write in at&t syntax (or type .intel_syntax to change to intel syntax).
PS: as you know, scripting languages are not compiled at all, they are interpreted
PS: the last ps was pointless
Re: What are the basic kernel operations which require assem
@ huh:
You're wrong. While some compilers work with an intermediate Assembly stage, this is by no means imperative. GCC, for example, works with GENERIC, GIMPLE, and RTL - no Assembly involved. If you use the "-S" option, the Assembly output is artificially generated from the intermediary binary representation.
Anyway, this was not what the OP asked about.
You're wrong. While some compilers work with an intermediate Assembly stage, this is by no means imperative. GCC, for example, works with GENERIC, GIMPLE, and RTL - no Assembly involved. If you use the "-S" option, the Assembly output is artificially generated from the intermediary binary representation.
Anyway, this was not what the OP asked about.
Every good solution is obvious once you've found it.
Re: What are the basic kernel operations which require assem
Here are some of the basic things a kernel could do:
printing functions, set the screen mode, get keyboard inupt, some sort of command line, cursor movment, mm (memory management): simple functions like cleaning registers to managing RAM.
printing functions, set the screen mode, get keyboard inupt, some sort of command line, cursor movment, mm (memory management): simple functions like cleaning registers to managing RAM.
Re: What are the basic kernel operations which require assem
Second fail at second attempt. The question was. "What are the basic kernel operations which require assembly?", and it has been answered.
Half the things you listed can be done in any system programming language.
Half the things you listed can be done in any system programming language.
Every good solution is obvious once you've found it.
Re: What are the basic kernel operations which require assem
And half of the things he listed aren't kernel operations.