Commit 358aa57b authored by Ian Seyler's avatar Ian Seyler

smptest C version

parent fb99f053
......@@ -43,13 +43,13 @@ unsigned long b_disk_write(void *mem, unsigned long start, unsigned long num, un
}
unsigned long b_system_config(unsigned long function, unsigned long var) {
unsigned long b_config(unsigned long function, unsigned long var) {
unsigned long tlong;
asm volatile ("call *0x00100040" : "=a"(tlong) : "c"(function), "a"(var));
return tlong;
}
void b_system_misc(unsigned long function, void* var1, void* var2) {
void b_system(unsigned long function, void* var1, void* var2) {
asm volatile ("call *0x00100048" : : "c"(function), "a"(var1), "d"(var2));
}
......
......@@ -22,8 +22,8 @@ unsigned long b_disk_read(void *mem, unsigned long start, unsigned long num, uns
unsigned long b_disk_write(void *mem, unsigned long start, unsigned long num, unsigned long disknum);
// Misc
unsigned long b_system_config(unsigned long function, unsigned long var);
void b_system_misc(unsigned long function, void *var1, void *var2);
unsigned long b_config(unsigned long function, unsigned long var);
void b_system(unsigned long function, void *var1, void *var2);
// Index for b_system_config calls
#define TIMECOUNTER 0
......
......@@ -19,7 +19,7 @@ int main(void)
{
b_output("EthTest: S to send a packet, Q to quit.\nReceived packets will display automatically.", 84);
// Configure the network callback
b_system_config(NETWORKCALLBACK_SET, (unsigned long int)ethtool_receive);
b_config(NETWORKCALLBACK_SET, (unsigned long int)ethtool_receive);
while (running == 1)
{
......@@ -36,7 +36,7 @@ int main(void)
}
// Clear the network callback
b_system_config(NETWORKCALLBACK_SET, 0);
b_config(NETWORKCALLBACK_SET, 0);
return 0;
}
......
// smptest.c -- Output a test message from every available CPU
// gcc -c -m64 -nostdlib -nostartfiles -nodefaultlibs -falign-functions=16 -o smptest.o smptest.c
// gcc -c -m64 -nostdlib -nostartfiles -nodefaultlibs -o libBareMetal.o api/libBareMetal.c
// ld -T c.ld -o smptest.bin smptest.o libBareMetal.o
#include "api/libBareMetal.h"
void smp_task();
char *message = "Hello from core 0x";
char *newline = "\n";
unsigned long i = 0;
unsigned long outputlock = 0;
int main(void)
{
for (i=0; i<256; i++)
b_system(10, (void *)&smp_task, (void *)i);
smp_task();
return 0;
}
// This code will be executed on every available CPU in the system
// The mutex is used so only one CPU can output its message at a time
void smp_task()
{
b_output(message, 18);
b_output(newline, 1);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment