OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Mar 29, 2024 2:18 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Load program for AP
PostPosted: Tue Apr 11, 2017 3:33 am 
Offline

Joined: Tue Apr 11, 2017 3:19 am
Posts: 12
Hello!

I am trying to load in memory some test program (smth like hello world) that will be running on AP.
For this did next:
1. turn off SMP in linux kernel
2. wrote code in userspace that map address from low memory (0x8000) and trying to load there test program ( currently just one arbitrary byte, for this i am using next: https://github.com/izard/RTBench/tree/m ... tal/phymem ).

When I wrote something to 0x8000, I am getting corruption:
Code:
29879.549297]  mac_hid i2c_piix4 vboxguest parport_pc ppdev lp parport autofs4 hid_generic usbhid hid psmouse ahci libahci fjes video e1000 pata_acpi [last unloaded: resmem]
[29879.549347] CPU: 0 PID: 16682 Comm: kworker/0:1 Tainted: G           OE   4.4.0-72-generic #93-Ubuntu
[29879.549351] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[29879.549360] Workqueue: events check_corruption
[29879.549366]  0000000000000286 00000000fc8f8723 ffff880008027d20 ffffffff813f82b3
[29879.549374]  ffff880008027d68 ffffffff81caffd0 ffff880008027d58 ffffffff81081302
[29879.549381]  0000000000000000 ffff880000010000 ffffffff821031f0 0000000000000001
[29879.549389] Call Trace:
[29879.549400]  [<ffffffff813f82b3>] dump_stack+0x63/0x90
[29879.549409]  [<ffffffff81081302>] warn_slowpath_common+0x82/0xc0
[29879.549415]  [<ffffffff8108139c>] warn_slowpath_fmt+0x5c/0x80
[29879.549423]  [<ffffffff8106541f>] check_for_bios_corruption.part.1+0xaf/0x100
[29879.549430]  [<ffffffff81065488>] check_corruption+0x18/0x50
[29879.549438]  [<ffffffff8109a555>] process_one_work+0x165/0x480
[29879.549445]  [<ffffffff8109a8bb>] worker_thread+0x4b/0x4c0
[29879.549451]  [<ffffffff8109a870>] ? process_one_work+0x480/0x480
[29879.549457]  [<ffffffff8109a870>] ? process_one_work+0x480/0x480
[29879.549463]  [<ffffffff810a0be8>] kthread+0xd8/0xf0
[29879.549469]  [<ffffffff810a0b10>] ? kthread_create_on_node+0x1e0/0x1e0
[29879.549479]  [<ffffffff8183ca0f>] ret_from_fork+0x3f/0x70
[29879.549484]  [<ffffffff810a0b10>] ? kthread_create_on_node+0x1e0/0x1e0
[29879.549489] ---[ end trace fa273c1ab0b0e6b7 ]---
[85440.016782] Corrupted low memory at ffff880000008000 (8000 phys) = 00000001


Code:
test@test-VirtualBox:~/Projects/RTBench/tools/src/baremetal/phymem$ sudo ./phymem.x -p 0x8000 -l 0x1
Physical address : 0x8000
length : 0x1
adjust span size to 4K
Memory locations :

8000: 0000000000
Unmap memory..
test@test-VirtualBox:~/Projects/RTBench/tools/src/baremetal/phymem$ sudo ./phymem.x -p 0x8000 -l 0x1 -w -d 0x1
Physical address : 0x8000
length : 0x1
Memory Write operation
Data : 0x1
adjust span size to 4K
Writing 0x1 to location 0x8000

Unmap memory..
test@test-VirtualBox:~/Projects/RTBench/tools/src/baremetal/phymem$
test@test-VirtualBox:~/Projects/RTBench/tools/src/baremetal/phymem$
test@test-VirtualBox:~/Projects/RTBench/tools/src/baremetal/phymem$ sudo ./phymem.x -p 0x8000 -l 0x1
Physical address : 0x8000
length : 0x1
adjust span size to 4K
Memory locations :

8000: 0x00000001
Unmap memory..
test@test-VirtualBox:~/Projects/RTBench/tools/src/baremetal/phymem$ sudo ./phymem.x -p 0x8000 -l 0x1
Physical address : 0x8000
length : 0x1
adjust span size to 4K
Memory locations :

8000: 0000000000
Unmap memory..


Can U give me some advice?

And another one problem.
When I am trying to set memmap=0x80M$0x18000000 in Linux kernel command line than kernel does not load. Anyone get same problem?

With best,
coldfire


Top
 Profile  
 
 Post subject: Re: Load program for AP
PostPosted: Tue Apr 11, 2017 4:45 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5103
If you want to program on bare metal, why aren't you programming on bare metal? Fighting Linux for resources doesn't sound like fun to me.

The error is coming from the low memory corruption check because you're using iopl() to steal memory from the kernel. The error will go away if you use the correct memory allocation API.


Top
 Profile  
 
 Post subject: Re: Load program for AP
PostPosted: Tue Apr 11, 2017 5:26 am 
Offline

Joined: Tue Apr 11, 2017 3:19 am
Posts: 12
Octocontrabass wrote:
If you want to program on bare metal, why aren't you programming on bare metal? Fighting Linux for resources doesn't sound like fun to me.

I do not programming on bare metal because of currently want to run simultaneously 2 OS ( Linux and my some bare metal like).

Octocontrabass wrote:
The error is coming from the low memory corruption check because you're using iopl() to steal memory from the kernel. The error will go away if you use the correct memory allocation API.

Thanks for answer.
I decided just to turn off this check.

There is just one remained open question about memmap in Linux cmdline.


Top
 Profile  
 
 Post subject: Re: Load program for AP
PostPosted: Tue Apr 11, 2017 8:03 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 27, 2004 11:00 pm
Posts: 874
Location: WA
coldfire wrote:
I do not programming on bare metal because of currently want to run simultaneously 2 OS ( Linux and my some bare metal like).

you cannot do this
there is much more to an OS then just control of the CPU, 2 OSes cannot co-exist (the way you are doing it, you will just be running a linux application on a dedicated CPU -- that is not 2 OSes, that is linux and a linux application -- if what you run on the other CPU is anything other than a linux application, your computer will crash, and it might be physically damaged, and possibly start a fire)

_________________
## ---- ----- ------ Intel Manuals
OSdev wiki


Top
 Profile  
 
 Post subject: Re: Load program for AP
PostPosted: Tue Apr 11, 2017 8:20 am 
Offline
Member
Member
User avatar

Joined: Mon Jul 28, 2008 9:46 am
Posts: 325
Location: Ontario, Canada
Did someone say BareMetal? :wink:

coldfire, you may be interested in trying BareMetal OS if you want to experiment with running code on different APs. In the next version I'll be removing the SMP work queue so workloads can be assigned directly to specific APs.

-Ian

_________________
BareMetal OS - http://www.returninfinity.com/
Mono-tasking 64-bit OS for x86-64 based computers, written entirely in Assembly


Top
 Profile  
 
 Post subject: Re: Load program for AP
PostPosted: Tue Apr 11, 2017 8:34 am 
Offline

Joined: Tue Apr 11, 2017 3:19 am
Posts: 12
Thanks for answers.

I will look at ReturnInfinity/BareMetal-OS!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: DotBot [Bot], Google [Bot], Majestic-12 [Bot] and 196 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group