forked from phipse/pok
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix the imcomplete hypercall and now the example/testHypercall can ru…
…n and get timetick
- Loading branch information
Showing
10 changed files
with
195 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
BUILD = --models=model.aadl --no-run | ||
TESTS = compile-x86 | ||
|
||
include $(POK_PATH)/misc/mk/examples.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* POK header | ||
* | ||
* The following file is a part of the POK project. Any modification should | ||
* made according to the POK licence. You CANNOT use this file or a part of | ||
* this file is this part of a file for your own project | ||
* | ||
* For more information on the POK licence, please see our LICENCE FILE | ||
* | ||
* Please follow the coding guidelines described in doc/CODING_GUIDELINES | ||
* | ||
* Copyright (c) 2007-2013 POK team | ||
* | ||
* Created by phipse on Wed May 15 13:12:32 2013 | ||
*/ | ||
|
||
#include <libc/stdio.h> | ||
#include <core/time.h> | ||
#include <core/thread.h> | ||
#include <core/hypercall.h> | ||
static unsigned counter = 0; | ||
|
||
void time_handler( unsigned vector, void* frame ) | ||
{ | ||
(void) frame; | ||
(void)vector; | ||
counter++; | ||
} | ||
|
||
|
||
void register_handler() | ||
{ | ||
pok_ret_t ret = pok_hypercall2( POK_HYPERCALL_IRQ_REGISTER_HANDLER, 0, (uint32_t)&time_handler ); | ||
if( ret != POK_ERRNO_OK ) | ||
printf( "Couldn't register handler\n"); | ||
} | ||
|
||
|
||
/* this shows, that the handler registration doesn't work propperly. | ||
* If we don't try to register the handler, the program executes propperly. | ||
*/ | ||
|
||
static int flag = 0; | ||
int user_hello( void ) | ||
{ | ||
printf( "Hello POK world!\n"); | ||
// if (flag < 1) | ||
// { | ||
// register_handler(); | ||
// flag++; | ||
// } | ||
pok_time_t tmp = 0; | ||
uint8_t _level = 0; | ||
|
||
printf( "Forever spin\n"); | ||
for( ;; ) | ||
{ | ||
pok_hypercall2(POK_HYPERCALL_GETTICK, (uint32_t)(&tmp),0); | ||
if( tmp >= 2000 && tmp <= 3000 ) | ||
{ | ||
pok_hypercall1( POK_HYPERCALL_IRQ_PARTITION_DISABLE, _level ); | ||
printf( "Counter: %u\n", counter ); | ||
} | ||
if( tmp >= 6000 && tmp <= 8000 ) | ||
{ | ||
pok_hypercall1( POK_HYPERCALL_IRQ_PARTITION_ENABLE, _level ); | ||
printf( "Counter: %u\n", counter ); | ||
} | ||
|
||
printf( "Clock gettick: %u \n", tmp ); | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
-- | ||
-- POK header | ||
-- | ||
-- The following file is a part of the POK project. Any modification should | ||
-- be made according to the POK licence. You CANNOT use this file or a part | ||
-- of a file for your own project. | ||
-- | ||
-- For more information on the POK licence, please see our LICENCE FILE | ||
-- | ||
-- Please follow the coding guidelines described in doc/CODING_GUIDELINES | ||
-- | ||
-- Copyright (c) 2007-2013 POK team | ||
-- | ||
-- Created by phipse on Wed May 15 13:12:32 2013 | ||
-- | ||
|
||
|
||
|
||
package myHello | ||
|
||
public | ||
|
||
|
||
with Data_Model; | ||
with POK; | ||
|
||
virtual processor partition | ||
properties | ||
POK::Scheduler => RR; | ||
POK::Additional_Features => (x86_vmm, libc_stdio, console); | ||
end partition; | ||
|
||
|
||
virtual processor implementation partition.impl | ||
end partition.impl; | ||
|
||
|
||
processor x86 | ||
end x86; | ||
|
||
processor implementation x86.impl | ||
subcomponents | ||
part1 : virtual processor partition.impl; | ||
properties | ||
POK::Architecture => x86; | ||
POK::BSP => x86_qemu_vmm; | ||
POK::Major_Frame => 1000ms; | ||
POK::Scheduler => static; | ||
POK::Slots => (500ms); | ||
POK::Slots_Allocation => ( reference (part1)); | ||
end x86.impl; | ||
|
||
|
||
process myProcess | ||
end myProcess; | ||
|
||
process implementation myProcess.impl | ||
subcomponents | ||
thr1 : thread mythread.impl; | ||
properties | ||
POK::Needed_Memory_Size => 120Kbyte; | ||
end myProcess.impl; | ||
|
||
|
||
thread mythread | ||
properties | ||
Source_Stack_Size => 30Kbyte; | ||
end mythread; | ||
|
||
thread implementation mythread.impl | ||
calls | ||
call1 : { pspg : subprogram user_hello; }; | ||
properties | ||
dispatch_protocol => periodic; | ||
period => 1000ms; | ||
deadline => 1000ms; | ||
compute_execution_time => 1ms .. 2ms; | ||
end mythread.impl; | ||
|
||
|
||
|
||
subprogram user_hello | ||
properties | ||
source_name => "user_hello"; | ||
source_language => C; | ||
POK::Source_Location => "../../../hello.o"; | ||
end user_hello; | ||
|
||
|
||
system node | ||
end node; | ||
|
||
system implementation node.impl | ||
subcomponents | ||
cpu : processor x86.impl; | ||
part1 : process myProcess.impl; | ||
properties | ||
Actual_Processor_Binding => (reference (cpu.part1)) applies to part1; | ||
end node.impl; | ||
end myHello; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters