LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 07-22-2016, 07:58 AM   #1
micflunu
Member
 
Registered: Oct 2012
Posts: 73

Rep: Reputation: Disabled
arrays of function pointers on x86 assembly


I am new to an assembely language and i was woundering as to how i could write arrays of function pointers and manuplate them in a c file, just like the way interrupt descriptors are handled.Any hint,books or links, on arrays of function pointers in an x86 assembly will dp.Thanks in advance
 
Old 07-22-2016, 11:09 AM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,445
Blog Entries: 4

Rep: Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897
May I suggest that you simply write the routine in C or C++? An optimizing compiler is going to write much better code than you would.

IMHO, assembly-language code today should be the stuff of a very occasional(!) asm{} block within a file of "C" source-code. About the only place where you see outright ".a" files in, say, the Linux source-tree /arch directory, is in the "trampoline" code. Almost everything else consists of "C" source-code which "sets up for" a particular architecture-specific assembly instruction.

Hand-crafting "ordinary" instruction sequences is frankly a waste of time, IMHO. You can write "C" code that contains no library references; that is exactly equivalent to assembly but much faster and easier to write. (The original Unix kernel was done that way, for instance.)

Last edited by sundialsvcs; 07-22-2016 at 11:11 AM.
 
Old 07-25-2016, 12:45 AM   #3
micflunu
Member
 
Registered: Oct 2012
Posts: 73

Original Poster
Rep: Reputation: Disabled
thnx for the replay but i need this for my course on operating systems.
 
Old 07-25-2016, 10:50 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,445
Blog Entries: 4

Rep: Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897
Try compiling it in C and notice what assembly-code the compiler produces.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
pointers and multidimensional arrays in C flatang Linux - Newbie 14 08-24-2015 10:53 AM
Why are arrays in C pointers? MTK358 Programming 23 03-27-2010 05:33 PM
Question about outputing arrays with pointers, then just arrays... RHLinuxGUY Programming 1 04-12-2006 05:40 AM
help with c++ code/pointers/arrays drisay Programming 1 01-28-2005 08:24 AM
help w/ pointers vs arrays PTBmilo Programming 3 04-10-2003 05:13 PM

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

All times are GMT -5. The time now is 11:18 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration