mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 08:06:32 +00:00
bugfix: exec执行的文件不存在时,自动退出进程。
This commit is contained in:
@ -178,26 +178,6 @@ void apic_init_ap_core_local_apic()
|
||||
: "a"(0x10000), "d"(0x00)
|
||||
: "memory");
|
||||
|
||||
/*
|
||||
io_mfence();
|
||||
*(uint *)(APIC_LOCAL_APIC_VIRT_BASE_ADDR + LOCAL_APIC_OFFSET_Local_APIC_LVT_CMCI) = 0x1000000;
|
||||
io_mfence();
|
||||
kdebug("cmci = %#018lx", *(uint *)(APIC_LOCAL_APIC_VIRT_BASE_ADDR + LOCAL_APIC_OFFSET_Local_APIC_LVT_CMCI));
|
||||
*/
|
||||
//*(uint *)(APIC_LOCAL_APIC_VIRT_BASE_ADDR + LOCAL_APIC_OFFSET_Local_APIC_LVT_TIMER) = 0x10000;
|
||||
// io_mfence();
|
||||
/*
|
||||
*(uint *)(APIC_LOCAL_APIC_VIRT_BASE_ADDR + LOCAL_APIC_OFFSET_Local_APIC_LVT_THERMAL) = 0x1000000;
|
||||
io_mfence();
|
||||
*(uint *)(APIC_LOCAL_APIC_VIRT_BASE_ADDR + LOCAL_APIC_OFFSET_Local_APIC_LVT_PERFORMANCE_MONITOR) = 0x1000000;
|
||||
io_mfence();
|
||||
*(uint *)(APIC_LOCAL_APIC_VIRT_BASE_ADDR + LOCAL_APIC_OFFSET_Local_APIC_LVT_LINT0) = 0x1000000;
|
||||
io_mfence();
|
||||
*(uint *)(APIC_LOCAL_APIC_VIRT_BASE_ADDR + LOCAL_APIC_OFFSET_Local_APIC_LVT_LINT1) = 0x1000000;
|
||||
io_mfence();
|
||||
*(uint *)(APIC_LOCAL_APIC_VIRT_BASE_ADDR + LOCAL_APIC_OFFSET_Local_APIC_LVT_ERROR) = 0x1000000;
|
||||
io_mfence();
|
||||
*/
|
||||
kdebug("All LVT Masked");
|
||||
}
|
||||
/**
|
||||
|
@ -201,7 +201,6 @@ void ps2_keyboard_init()
|
||||
kb_buf_ptr = (struct ps2_keyboard_input_buffer *)kmalloc(sizeof(struct ps2_keyboard_input_buffer), 0);
|
||||
|
||||
ps2_keyboard_reset_buffer(kb_buf_ptr);
|
||||
|
||||
|
||||
// ======== 初始化中断RTE entry ==========
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <process/process.h>
|
||||
#include <sched/sched.h>
|
||||
#include <smp/ipi.h>
|
||||
#include <driver/video/video.h>
|
||||
|
||||
static struct acpi_HPET_description_table_t *hpet_table;
|
||||
static uint64_t HPET_REG_BASE = 0;
|
||||
@ -65,7 +66,7 @@ void HPET_handler(uint64_t number, uint64_t param, struct pt_regs *regs)
|
||||
|
||||
// 若当前时间比定时任务的时间间隔大,则进入中断下半部
|
||||
if (container_of(list_next(&timer_func_head.list), struct timer_func_list_t, list)->expire_jiffies <= timer_jiffies)
|
||||
set_softirq_status(TIMER_SIRQ);
|
||||
set_softirq_status((1 << TIMER_SIRQ));
|
||||
|
||||
sched_update_jiffies();
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include <driver/timers/HPET/HPET.h>
|
||||
#include <process/process.h>
|
||||
|
||||
struct timer_func_list_t timer_func_head;
|
||||
|
||||
void test_timer()
|
||||
{
|
||||
printk_color(ORANGE, BLACK, "(test_timer)");
|
||||
@ -14,7 +16,7 @@ void timer_init()
|
||||
{
|
||||
timer_jiffies = 0;
|
||||
timer_func_init(&timer_func_head, NULL, NULL, -1UL);
|
||||
register_softirq(0, &do_timer_softirq, NULL);
|
||||
register_softirq(TIMER_SIRQ, &do_timer_softirq, NULL);
|
||||
|
||||
struct timer_func_list_t *tmp = (struct timer_func_list_t *)kmalloc(sizeof(struct timer_func_list_t), 0);
|
||||
timer_func_init(tmp, &test_timer, NULL, 5);
|
||||
@ -28,17 +30,18 @@ void do_timer_softirq(void *data)
|
||||
// if(current_pcb->pid==3)
|
||||
// kdebug("pid3 timer irq");
|
||||
struct timer_func_list_t *tmp = container_of(list_next(&timer_func_head.list), struct timer_func_list_t, list);
|
||||
|
||||
|
||||
while ((!list_empty(&timer_func_head.list)) && (tmp->expire_jiffies <= timer_jiffies))
|
||||
{
|
||||
if(current_pcb->pid==3)
|
||||
kdebug("pid3 timer do");
|
||||
if (current_pcb->pid == 2)
|
||||
kdebug("pid2 timer do");
|
||||
timer_func_del(tmp);
|
||||
tmp->func(tmp->data);
|
||||
kfree(tmp);
|
||||
tmp = container_of(list_next(&timer_func_head.list), struct timer_func_list_t, list);
|
||||
}
|
||||
|
||||
softirq_ack(TIMER_SIRQ);
|
||||
// printk_color(ORANGE, BLACK, "(HPET%ld)", timer_jiffies);
|
||||
}
|
||||
|
||||
@ -55,7 +58,8 @@ void timer_func_init(struct timer_func_list_t *timer_func, void (*func)(void *da
|
||||
list_init(&timer_func->list);
|
||||
timer_func->func = func;
|
||||
timer_func->data = data,
|
||||
timer_func->expire_jiffies = timer_jiffies + expire_ms / 5 + expire_ms % HPET0_INTERVAL ? 1 : 0; // 设置过期的时间片
|
||||
// timer_func->expire_jiffies = timer_jiffies + expire_ms / 5 + expire_ms % HPET0_INTERVAL ? 1 : 0; // 设置过期的时间片
|
||||
timer_func->expire_jiffies = cal_next_n_ms_jiffies(expire_ms); // 设置过期的时间片
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,46 +4,48 @@
|
||||
#include "HPET/HPET.h"
|
||||
#include "rtc/rtc.h"
|
||||
|
||||
uint64_t volatile timer_jiffies = 0; // 系统时钟计数
|
||||
uint64_t volatile timer_jiffies = 0; // 系统时钟计数
|
||||
|
||||
// 计算接下来n毫秒对应的系统时间片
|
||||
#define cal_next_n_ms_jiffies(expire_ms) (timer_jiffies + expire_ms / 5 + expire_ms % HPET0_INTERVAL ? 1 : 0)
|
||||
|
||||
void timer_init();
|
||||
|
||||
void do_timer_softirq(void* data);
|
||||
void do_timer_softirq(void *data);
|
||||
|
||||
/**
|
||||
* @brief 定时功能队列
|
||||
*
|
||||
*
|
||||
*/
|
||||
struct timer_func_list_t
|
||||
{
|
||||
struct List list;
|
||||
uint64_t expire_jiffies;
|
||||
void (*func)(void* data);
|
||||
void* data;
|
||||
}timer_func_head;
|
||||
void (*func)(void *data);
|
||||
void *data;
|
||||
};
|
||||
|
||||
extern struct timer_func_list_t timer_func_head;
|
||||
/**
|
||||
* @brief 初始化定时功能
|
||||
*
|
||||
*
|
||||
* @param timer_func 队列结构体
|
||||
* @param func 定时功能处理函数
|
||||
* @param data 传输的数据
|
||||
* @param expire_ms 定时时长(单位:ms)
|
||||
*/
|
||||
void timer_func_init(struct timer_func_list_t * timer_func, void (*func)(void*data), void*data,uint64_t expire_ms);
|
||||
void timer_func_init(struct timer_func_list_t *timer_func, void (*func)(void *data), void *data, uint64_t expire_ms);
|
||||
|
||||
/**
|
||||
* @brief 将定时功能添加到列表中
|
||||
*
|
||||
*
|
||||
* @param timer_func 待添加的定时功能
|
||||
*/
|
||||
void timer_func_add(struct timer_func_list_t* timer_func);
|
||||
void timer_func_add(struct timer_func_list_t *timer_func);
|
||||
|
||||
/**
|
||||
* @brief 将定时功能从列表中删除
|
||||
*
|
||||
* @param timer_func
|
||||
*
|
||||
* @param timer_func
|
||||
*/
|
||||
void timer_func_del(struct timer_func_list_t* timer_func);
|
||||
|
||||
|
||||
void timer_func_del(struct timer_func_list_t *timer_func);
|
||||
|
@ -70,13 +70,15 @@ void init_frame_buffer(bool level)
|
||||
*/
|
||||
static void video_refresh_framebuffer()
|
||||
{
|
||||
if(current_pcb->pid==3)
|
||||
kdebug("pid3 flush fb");
|
||||
|
||||
// kdebug("pid%d flush fb", current_pcb->pid);
|
||||
|
||||
memcpy((void *)sc_info.fb_vaddr, (void *)sc_info.double_fb_vaddr, (sc_info.length << 2));
|
||||
|
||||
// 新增下一个刷新定时任务
|
||||
struct timer_func_list_t *tmp = (struct timer_func_list_t *)kmalloc(sizeof(struct timer_func_list_t), 0);
|
||||
spin_lock(&video_timer_func_add_lock);
|
||||
timer_func_init(tmp, &video_refresh_framebuffer, NULL, REFRESH_INTERVAL);
|
||||
timer_func_init(tmp, &video_refresh_framebuffer, NULL, 10 * REFRESH_INTERVAL);
|
||||
timer_func_add(tmp);
|
||||
spin_unlock(&video_timer_func_add_lock);
|
||||
}
|
||||
@ -100,6 +102,5 @@ int video_init(bool level)
|
||||
struct timer_func_list_t *tmp = (struct timer_func_list_t *)kmalloc(sizeof(struct timer_func_list_t), 0);
|
||||
timer_func_init(tmp, &video_refresh_framebuffer, NULL, REFRESH_INTERVAL);
|
||||
timer_func_add(tmp);
|
||||
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include <common/glib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* @brief 初始化显示模块,需先低级初始化才能高级初始化
|
||||
* @param level 初始化等级
|
||||
|
Reference in New Issue
Block a user