diff --git a/Makefile b/Makefile index a941c7fc..1a87b4c1 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ export ARCH=__x86_64__ export ROOT_PATH=$(shell pwd) export DEBUG=DEBUG -export GLOBAL_CFLAGS := -mcmodel=large -fno-builtin -m64 -fno-stack-protector -D $(ARCH) +export GLOBAL_CFLAGS := -mcmodel=large -fno-builtin -m64 -fno-stack-protector -D $(ARCH) -O1 ifeq ($(DEBUG), DEBUG) GLOBAL_CFLAGS += -g diff --git a/kernel/Makefile b/kernel/Makefile index 5bae80f9..c813e863 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -10,7 +10,7 @@ LIB_FILES := $(foreach DIR,$(DIR_LIB),$(addprefix $(DIR)/,$(lib_patterns))) # 控制操作系统使用的中断控制器 _INTR_8259A_ _INTR_APIC_ PIC := _INTR_APIC_ -CFLAGS = $(GLOBAL_CFLAGS) -D $(PIC) -I $(shell pwd) -O3 +CFLAGS = $(GLOBAL_CFLAGS) -D $(PIC) -I $(shell pwd) export ASFLAGS := --64 diff --git a/kernel/common/printk.c b/kernel/common/printk.c index 46564fd4..a2414a80 100644 --- a/kernel/common/printk.c +++ b/kernel/common/printk.c @@ -10,8 +10,7 @@ #include #include #include "math.h" -#pragma GCC push_options -#pragma GCC optimize("O0") + struct printk_screen_info pos; extern ul VBE_FB_phys_addr; // 由bootloader传来的帧缓存区的物理地址 static spinlock_t printk_lock; @@ -46,6 +45,8 @@ static uint *get_pos_VBE_FB_addr(); */ static int cls(); +#pragma GCC push_options +#pragma GCC optimize("O0") /** * @brief 滚动窗口(尚不支持向下滚动) * @@ -54,7 +55,7 @@ static int cls(); * @param animation 是否包含滑动动画 */ static int scroll(bool direction, int pixels, bool animation); - +#pragma GCC pop_options /** * @brief 将数字按照指定的要求转换成对应的字符串(2~36进制) * @@ -960,4 +961,3 @@ int sprintk(char *buf, const char *fmt, ...) return count; } -#pragma GCC pop_options \ No newline at end of file