Why does my subroutine crash when called from an ISR?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
Nutterts
Member
Member
Posts: 159
Joined: Wed Aug 05, 2015 5:33 pm
Libera.chat IRC: Nutterts
Location: Drenthe, Netherlands

Re: Why does my subroutine crash when called from an ISR?

Post by Nutterts »

onlyonemac wrote:
iansjack wrote:I'd respectfully suggest that you need to use a different package system. (Yeah - I know - no-one's going to tell you what package system to use).
Actually I use apt with my Ubuntu system.

Code: Select all

sudo apt-get update && sudo apt-get install nasm
Replace nasm for yasm if you prefer that assemblers. (You also might want to take a look at fasm. But it's not in the repositories)

Guessing you did a apt-cache search or something like that? Don't expect the descriptions to tell you everything. Only use it to find the exact package name you want or other packages that are related to it. On debian based systems google (or duckduckgo) is still your best friend.
"Always code as if the guy who ends up maintaining it will be a violent psychopath who knows where you live." - John F. Woods

Failed project: GoOS - https://github.com/nutterts/GoOS
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: Why does my subroutine crash when called from an ISR?

Post by onlyonemac »

nutterts wrote:Guessing you did a apt-cache search or something like that? Don't expect the descriptions to tell you everything. Only use it to find the exact package name you want or other packages that are related to it. On debian based systems google (or duckduckgo) is still your best friend.
I searched using the Synaptic package manager which was my preferred tool at the time, before I had learnt to use the apt command-line utilities. Synaptic's search tool is rather poor...

Anyway I might take a look at another of those assemblers when I have the time to translate all my assembler directives and some of the code etc. The other thing, by the way, which I liked about as86 is that it can produce raw binaries which is what I need due to my lack of knowledge of how to use a linker. Again, I might try using a linker some time but for now I can do what I need to do.
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Octocontrabass
Member
Member
Posts: 5588
Joined: Mon Mar 25, 2013 7:01 pm

Re: Why does my subroutine crash when called from an ISR?

Post by Octocontrabass »

onlyonemac wrote:Anyway I might take a look at another of those assemblers when I have the time to translate all my assembler directives and some of the code etc.
Every line of code you write for as86 is another line of code you will need to translate. It's better to switch assemblers now, instead of writing hundreds of lines of code for an obsolete assembler.
onlyonemac wrote:The other thing, by the way, which I liked about as86 is that it can produce raw binaries which is what I need due to my lack of knowledge of how to use a linker.
Both yasm and nasm can do this. (You need a linker or objdump to produce raw binaries with gas.)
Nable
Member
Member
Posts: 453
Joined: Tue Nov 08, 2011 11:35 am

Re: Why does my subroutine crash when called from an ISR?

Post by Nable »

nutterts wrote:You also might want to take a look at fasm. But it's not in the repositories.
Debian Testing has FASM in its repo:

Code: Select all

$ apt-cache show fasm
Package: fasm
Version: 1.71.39-1
Installed-Size: 286
Maintainer: Tomasz Buchert <[email protected]>
Architecture: amd64
Depends: libc6-i386 (>= 2.1)
Description-en: fast assembler for the x86 and x86-64 architectures
 Flat assembler is a fast, self-compilable assembly language compiler for the
 x86 and x86-64 architecture processors, which does multiple passes to optimize
 the size of generated machine code.
Description-md5: bc56833ca51013cf84753cdfae7d97a4
Homepage: http://flatassembler.net/
Section: devel
Priority: optional
Filename: pool/main/f/fasm/fasm_1.71.39-1_amd64.deb
Size: 142978
MD5sum: fcddd2f4d9be3795d0a9babb4aa0f994
SHA1: 38fe913775838c20ac388605fb11c45ad441262d
SHA256: 815c9b810a4d51e8e3dae171ef4399079cb111a06245cb452dab477af7ef0dba
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Why does my subroutine crash when called from an ISR?

Post by iansjack »

Anyway I might take a look at another of those assemblers when I have the time to translate all my assembler directives and some of the code etc.
If you have made a mistake (and, without wishing to tell you which assembler you should use, I believe you have) it is easier to correct it sooner rather than later.
The other thing, by the way, which I liked about as86 is that it can produce raw binaries which is what I need due to my lack of knowledge of how to use a linker. Again, I might try using a linker some time but for now I can do what I need to do.
As has been pointed out, all assemblers can produce raw binaries; but it's not normally a good choice as it leads to the sort of problems you have encountered. It really is a good idea to learn how to use the tools before getting too deeply into coding as it will save you a lot of work undoing what you have done and it will protect you from the even worse situation of sticking with bad design choices and habits because you can't be bothered to undo them.

The more you get right to start with the easier life is in the long run.
Post Reply