Skip to content

Commit

Permalink
Merge branch 'master' into zhouhanjie-patch_pipe2
Browse files Browse the repository at this point in the history
  • Loading branch information
fslongjin committed Sep 12, 2023
2 parents 2c36388 + 285de54 commit 9cc40f2
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 32 deletions.
27 changes: 17 additions & 10 deletions kernel/src/driver/pci/pci_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#include "exception/irq.h"
#include <common/errno.h>
#include <common/kprint.h>
#include "common/string.h"
#include "mm/slab.h"

// 现在pci设备的中断由自己进行控制,这些不执行内容的函数是为了适配旧的中断处理机制
void pci_irq_enable(ul irq_num)
{
Expand All @@ -11,7 +14,7 @@ void pci_irq_disable(ul irq_num)
{

}
void pci_irq_install(ul irq_num)
ul pci_irq_install(ul, void*)
{

}
Expand Down Expand Up @@ -42,14 +45,18 @@ uint16_t c_irq_install(ul irq_num,void (*pci_irq_handler)(ul irq_num, ul paramet
{
return EAGAIN;
}
hardware_intr_controller* pci_interrupt_controller = kmalloc(sizeof(hardware_intr_controller),0);
pci_interrupt_controller->enable = pci_irq_enable;
pci_interrupt_controller->disable = pci_irq_disable;
pci_interrupt_controller->install= pci_irq_install;
pci_interrupt_controller->uninstall= pci_irq_uninstall;
if(pci_irq_ack)

hardware_intr_controller* pci_interrupt_controller =
(hardware_intr_controller*)kmalloc(sizeof(hardware_intr_controller), 0);
if (pci_interrupt_controller) {
pci_interrupt_controller->enable = pci_irq_enable;
pci_interrupt_controller->disable = pci_irq_disable;
pci_interrupt_controller->install = pci_irq_install;
pci_interrupt_controller->uninstall = pci_irq_uninstall;
pci_interrupt_controller->ack = pci_irq_ack;
int namelen = sizeof(strlen(irq_name) + 1);
p->controller = pci_interrupt_controller;
}
size_t namelen = strlen(irq_name) + 1;
p->irq_name = (char *)kmalloc(namelen, 0);
memset(p->irq_name, 0, namelen);
strncpy(p->irq_name, irq_name, namelen);
Expand All @@ -73,12 +80,12 @@ void c_irq_uninstall(ul irq_num)
{
kerror("irq install for pci irq: invalid irq num: %ld.", irq_num);
}
if(p->irq_name!=NULL)
if(p->irq_name != NULL)
{
kfree(p->irq_name);
p->irq_name = NULL;
}
if(p->controller!=NULL)
if(p->controller != NULL)
{
kfree(p->controller);
p->controller = NULL;
Expand Down
1 change: 1 addition & 0 deletions kernel/src/driver/timers/HPET/HPET.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ static uint64_t test_tsc_end = 0;
extern uint64_t Cpu_tsc_freq; // 导出自cpu.c

extern struct rtc_time_t rtc_now; // 导出全局墙上时钟
extern uint64_t rs_update_timer_jiffies(uint64_t);

enum
{
Expand Down
10 changes: 7 additions & 3 deletions kernel/src/link.lds
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ SECTIONS
.text (text_start_pa): AT(text_start_pa - KERNEL_VMA)
{
_text = .;


/* any files' .text */
*(.text)


/* any files' .text.*, for example: rust .text._ZN* */
*(.text.*)

_etext = .;
}
. = ALIGN(32768);
Expand Down Expand Up @@ -73,4 +77,4 @@ SECTIONS
*(.eh_frame)

}
}
}
4 changes: 3 additions & 1 deletion tools/build_gcc_toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ case `cat /etc/os-release | grep '^NAME=' | cut -d'"' -f2` in
wget
;;
"Arch"*)
sudo pacman -S --needed --noconfirm gcc make flex wget texinfo libmpc gmp mpfr
sudo pacman -S --needed --noconfirm \
gcc make flex wget texinfo libmpc gmp mpfr \
diffutils pkgconf which unzip
;;
*)
;;
Expand Down
36 changes: 23 additions & 13 deletions tools/grub_auto_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,27 @@ export OBJCOPY=objcopy
if [ -d ${grub_dir_i386_efi}/bin ] && [ -d ${grub_dir_i386_legacy}/bin ] && [ -d ${grub_dir_x86_64_efi}/bin ] ; then
exit 0
fi
#仅支持Ubuntu/Debain下的自动安装
if ! hash 2>/dev/null apt-get; then
#仅支持Ubuntu/Debain, Arch下的自动安装
supported_package_manager="apt-get pacman"
packages=("make binutils bison gcc gettext flex bison automake autoconf wget" \
"make binutils bison gcc gettext flex bison automake autoconf wget")
update_options=("update" \
"-Sy")
install_options=("install -y" \
"-S --needed --noconfirm")
found_pm=0
pm_index=0
for pm in ${supported_package_manager}; do
if hash 2>/dev/null ${pm}; then
found_pm=1
break
fi
let pm_index=$pm_index+1
done
if [ ${found_pm} = "1" ]; then
echo "found package manager: ${pm}"
else
echo "找不到任何支持的包管理器: ${supported_package_manager}"
echo "脚本暂不支持对该系统下grub的安装,请手动完成"
exit 0
fi
Expand All @@ -35,17 +54,8 @@ fi

tar xvf grub-2.06.tar.xz
#安装对应依赖
sudo apt-get update
sudo apt-get install -y \
make \
binutils \
bison \
gcc \
gettext \
flex \
bison \
automake \
autoconf
sudo ${pm} ${update_options[$pm_index]}
sudo ${pm} ${install_options[$pm_index]} ${packages[$pm_index]}

cd grub-2.06
echo "开始安装grub2.06"
Expand Down
9 changes: 4 additions & 5 deletions user/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,12 @@ $(user_sub_dirs): ECHO sys_api_lib

$(MAKE) -C $@ all CFLAGS="$(CFLAGS)" tmp_output_dir="$(tmp_output_dir)" output_dir="$(output_dir)" sys_libs_dir="$(shell pwd)/libs"

app: $(user_sub_dirs)
$(MAKE) dadk_run
app: $(user_sub_dirs) dadk_run

all: install_dadk app

$(shell if [ ! -e $(tmp_output_dir) ];then mkdir -p $(tmp_output_dir); fi)
$(shell if [ ! -e $(output_dir) ];then mkdir -p $(output_dir); fi)
all: make_output_dir

$(MAKE) app

@echo 用户态程序编译完成

Expand Down

0 comments on commit 9cc40f2

Please sign in to comment.