Trampoline code question

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.
Post Reply
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Trampoline code question

Post by nexos »

Hello,
I was wondering what the best method to load trampoline code for SMP is. How do you embed it in a section in the executable?
Thanks,
nexos
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
User avatar
iansjack
Member
Member
Posts: 4834
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Trampoline code question

Post by iansjack »

I'm not quite sure what the problem is. You just link it in to the kernel object file in the same way as any other code.
User avatar
pvc
Member
Member
Posts: 201
Joined: Mon Jan 15, 2018 2:27 pm

Re: Trampoline code question

Post by pvc »

I do it as normal assembly subroutine, but written in position independed fashion. Then copy it somewhere below first meg, so it can be reached with startup IPI.
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: Trampoline code question

Post by nexos »

Thank you both. I was making a problem when there was no problem :D
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
8infy
Member
Member
Posts: 188
Joined: Sun Apr 05, 2020 1:01 pm

Re: Trampoline code question

Post by 8infy »

Wait so an elf32 binary can contain 16 bit code?
User avatar
pvc
Member
Member
Posts: 201
Joined: Mon Jan 15, 2018 2:27 pm

Re: Trampoline code question

Post by pvc »

8infy wrote:Wait so an elf32 binary can contain 16 bit code?
And 64 bit too. It can be a little bit problematic to link, since not every type of relocation can be applied, but it sure can be done.
Post Reply