1 #ifndef __v3_hvm_ros_user
2 #define __v3_hvm_ros_user
5 Copyright (c) 2015 Peter Dinda
11 // note that there is ONE HRT hence no naming
12 int v3_hvm_ros_user_init();
13 int v3_hvm_ros_user_deinit();
15 // by default, debugging and other log output goes to STDERR
16 // you can change this here
17 int v3_hvm_ros_user_set_log(FILE *log);
19 // Establish function to be invoked by the VMM
20 // to signal activity (basically an interrupt handler)
21 // The handler can use the GPRs, but must save/restore
22 // any other registers it needs itself. If it goes
23 // out of its stack, it's out of luck
24 int v3_hvm_ros_register_signal(void (*handler)(uint64_t), void *stack, uint64_t stack_size);
25 int v3_hvm_ros_unregister_signal();
27 // Replace the existing HRT with a new one
28 // - this does not boot the new HRT
29 // - the intial image is the one given in the .pal config
30 int v3_hvm_ros_install_hrt_image(void *image, uint64_t size);
32 // Reset diffent components of the HVM
33 // or the entire HVM. The component immediatly reboots
34 typedef enum {RESET_HRT, RESET_ROS, RESET_BOTH} reset_type;
35 int v3_hvm_ros_reset(reset_type what);
37 // Merge address spaces between
38 // this ROS process and a compatible HRT
39 int v3_hvm_ros_merge_address_spaces();
40 int v3_hvm_ros_unmerge_address_spaces();
42 // Reflect this ROS process's GDT into a compatible
43 // HRT. This is typically necessary to run
44 // code out of the ROS address space in the HRT
45 int v3_hvm_ros_mirror_gdt(uint64_t fsbase, uint64_t cpu);
46 int v3_hvm_ros_unmiror_gdt();
48 // Asynchronosus invocation of the HRT using an
49 // opaque pointer (typically this is a pointer
50 // to a structure containing a function pointer and
51 // arguments. The parallel flag indicates that
52 // that it will be invoked simulatneously on all
54 int v3_hvm_ros_invoke_hrt_async(void *p, int parallel);
55 int v3_hvm_ros_invoke_hrt_async_nowait(void *buf, int par);
58 // synchronize with HRT via shared location
59 // allow synchronous invokcations. Note that
60 // any parallelism is done internal to the HRT.
61 // Also the synchronous invocation always waits
62 int v3_hvm_ros_synchronize();
63 int v3_hvm_ros_invoke_hrt_sync(void *p, int handle_ros_events);
64 int v3_hvm_ros_desynchronize();
66 // Handle events occuring within the HRT
67 // that need to be be handled within the ROS
69 int v3_hvm_handle_ros_event(struct v3_ros_event * event);
70 int v3_hvm_handle_ros_event_nohcall(struct v3_ros_event * event);
72 // Signal the ROS process from the ROS process
73 // These signals usually are generated by the HRT, but
74 // The ROS can also signal itself using the same mechanism
75 int v3_hvm_hrt_signal_ros(uint64_t code);