移植dns查询工具dog的--tcp功能 (#652)

* add dog, modify user/Makefile and user.sysconfig

* add dog, modify user/Makefile and user.sysconfig

* fix tty unicode

* 修正无法正确编译dog的问题

---------

Co-authored-by: val213 <val213666@gmail.com>
Co-authored-by: GnoCiYeH <heyicong@dragonos.org>
Co-authored-by: longjin <longjin@DragonOS.org>
This commit is contained in:
Val213
2024-03-25 13:04:53 +08:00
committed by GitHub
parent 911132c4b8
commit 7c958c9ef0
8 changed files with 86 additions and 48 deletions

View File

@ -1,7 +1,7 @@
# 导入环境变量
include ../env.mk
include ./env.mk
export ARCH ?= x86_64
# export ARCH ?= x86_64
# 如果是x86_64, 则使用x86_64-unknown-none.json作为target
ifeq ($(ARCH), x86_64)
export TARGET_JSON=arch/x86_64/x86_64-unknown-none.json

44
kernel/env.mk Normal file
View File

@ -0,0 +1,44 @@
include ../env.mk
# 设置编译器
ifeq ($(ARCH), x86_64)
# 如果 x86_64时DragonOS_GCC 为空,那么设置为默认值
export DragonOS_GCC?=$(HOME)/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin
export CC=$(DragonOS_GCC)/x86_64-elf-gcc
export LD=ld
export AS=$(DragonOS_GCC)/x86_64-elf-as
export NM=$(DragonOS_GCC)/x86_64-elf-nm
export AR=$(DragonOS_GCC)/x86_64-elf-ar
export OBJCOPY=$(DragonOS_GCC)/x86_64-elf-objcopy
else ifeq ($(ARCH), riscv64)
export CC=riscv64-unknown-elf-gcc
# binutils版本需要>=2.38
# 而ubuntu的unknown-elf的版本比较旧所以使用了riscv64-linux-gnu-ld
export LD=riscv64-linux-gnu-ld
export AS=riscv64-unknown-elf-as
export NM=riscv64-unknown-elf-nm
export AR=riscv64-unknown-elf-ar
export OBJCOPY=riscv64-unknown-elf-objcopy
endif
export DEBUG=DEBUG
export CFLAGS_DEFINE_ARCH="__$(ARCH)__"
export GLOBAL_CFLAGS := -fno-builtin -fno-stack-protector -D $(CFLAGS_DEFINE_ARCH) -D $(EMULATOR) -O1
ifeq ($(ARCH), x86_64)
GLOBAL_CFLAGS += -mcmodel=large -m64
else ifeq ($(ARCH), riscv64)
GLOBAL_CFLAGS += -mcmodel=medany -march=rv64imac -mabi=lp64
endif
ifeq ($(DEBUG), DEBUG)
GLOBAL_CFLAGS += -g
endif

View File

@ -347,7 +347,7 @@ impl VirtualConsoleData {
/// !!! 注意该函数返回true时元组的第一个数据是无效数据未转换完成
fn translate_unicode(&mut self, c: u32) -> (Option<u32>, bool) {
// 收到的字符不是首个
if (c & 0xc8) == 0x80 {
if (c & 0xc0) == 0x80 {
// 已经不需要继续的字符了,说明这个字符是非法的
if self.utf_count == 0 {
return (Some(0xfffd), false);