/**
* @brief memory compare
* @details [long description]
- *
+ *
* @param s1 [description]
* @param s2 [description]
* @param n [description]
*/
- typedef unsigned long size_t;
+typedef unsigned long size_t;
static int memcmp(const void *s1, const void *s2, size_t n)
{
- const char *p1 = s1;
- const char *p2 = s2;
- int res = 0;
- while (n-- && (res == 0)) {
- res = *(p1++) - *(p2++);
- }
- return res;
+ const char *p1 = s1;
+ const char *p2 = s2;
+ int res = 0;
+ while (n-- && (res == 0)) {
+ res = *(p1++) - *(p2++);
+ }
+ return res;
}
/**
* HPET defenitions
*/
+
+#define HPET_BASE_QEMU (0x00000000fed00000ULL)
+
struct address_structure
{
u8 address_space_id; // 0 - system memory, 1 - system I/O
timer->comparator_val = time;
enable_main_counter();
}
-
+
static void set_timer_one_shot(timer_regs * timer, u64 time)
{
if (time < (u64) main_counter_tick_period) {
//------------------------------------------------------
-static void irq_handler(void)
+static void irq_handler0(void)
{
printk("\nTimer 0 says hi!\n");
}
+static void irq_handler1(void)
+{
+ printk("\nTimer 1 says hi!\n");
+}
+
static void init_apic(void)
{
//unsigned long apic_freq_khz;
int_init();
- int_set_handler(APIC_TIMER_VECTOR, irq_handler);
+ int_set_handler(APIC_TIMER_VECTOR, irq_handler0);
+ int_set_handler(APIC_TIMER_VECTOR+8, irq_handler1);
//apic_freq_khz = apic_timer_init(APIC_TIMER_VECTOR);
//printk("Calibrated APIC frequency: %lu kHz\n", apic_freq_khz);
// }
//gen_reg = (gen_regs *) ( (u64) (*acpi_table)->address_st.base_address);
- gen_reg = (gen_regs *) ( (u64) 0x00000003f1ff000ULL);
-
+ gen_reg = (gen_regs *) ( (u64) HPET_BASE_QEMU);
+
printk("\nBase Address for HPET registers : %p\n", gen_reg);
+ map_range(gen_reg, PAGE_SIZE, MAP_UNCACHED);
+
u8 comparators_amount = (gen_reg->capat_id_reg & HPET_NUM_TIM_CAP_MASK) >> HPET_NUM_TIM_CAP_SHIFT;
-
main_counter_tick_period = gen_reg->clock_period;
main_counter_reg = (main_val_reg *)
{
timer[n] = (timer_regs *) curr_place;
printk("\nTimer %u on: %p, ", n, timer[n]);
- printk("Timer comparator : 0x%llx\n", timer[n]->comparator_val);
+ printk("Timer comparator : %lx\n", timer[n]->comparator_val);
}
set_legacy_mode();
set_timer_one_shot( timer[1], NANS_TO_FEMPTS(10000000000ULL) / main_counter_tick_period );
init_apic();
+ printk("Done preparation..\n");
//-------------------------------------------------------
while (!terminate) {
break;
}
}
-job_done:
+//job_done:
printk("Stopped APIC demo\n");
comm_region->cell_state = JAILHOUSE_CELL_SHUT_DOWN;