LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 02-01-2018, 01:19 AM   #1
zlin
LQ Newbie
 
Registered: Feb 2018
Posts: 1

Rep: Reputation: Disabled
kernel learning


I want to know the role assemble language has played in learning linux kernel?
 
Old 02-01-2018, 03:07 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,929

Rep: Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320
Hi and welcome to LQ.
Without knowing your level of knowledge about it it will be really hard (to answer).
But basically you do not need start with assembler to learn kernel.
 
Old 02-01-2018, 02:29 PM   #3
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
You need to know assembly only if you enter in the low level architecture code (like boot, memory management unit) or do very high performance optimizations using specific instructions. If you're doing typical kernel development in the core code or drivers, you do not need to learn assembly.
 
Old 02-06-2018, 07:49 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,671
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
You will find some assembly-level code in the /arch subtree.

Some of the code is pure-assembler, such as the so-called "trampoline" which hands control from the boot-loader to the kernel. Much of it takes the form of functions with asm {...} blocks which are used when specific machine instructions must be issued on a particular architecture.

Since Linux runs on well over twenty different architectures – "from mainframes to microwave ovens" – the use of assembly code is confined to these areas. Also notice how it is used to implement functions which are called by non-assembly code, and how the actual use of assembly code is minimized. (Because "compilers write better code than we do.")

The source-code sometimes uses macros, which are implemented on some architectures and no-ops on others.

Unlike "user-land" source code, the kernel code does not use any sort of "runtime library." (There is no glibc.)

Today's microprocessors aren't engineered to be programmed "by hand." They're engineered to accept object-code that has been produced by a compiler. Chip designers work closely with compiler designers, and also produce their own compilers. Assembly is now used only where there is no other alternative – where you are obliged to specify exactly what the CPU is to do. At all other times, "the compiler will produce better object-code than you would."

Last edited by sundialsvcs; 02-07-2018 at 12:12 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Learning about kernel? turboscrew Linux - Newbie 1 03-19-2016 08:18 AM
Books on Learning Linux Kernel yogesh605 Linux - Newbie 4 12-30-2011 09:32 PM
Learning to configure the kernel 2.6.x Punkie Linux - Newbie 6 05-18-2004 07:16 PM
Learning to configure the kernel 2.6.x Punkie Linux From Scratch 1 05-02-2004 08:43 AM
Compiling/Learning the kernel drewski Linux - General 3 05-13-2003 04:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration