edited for video record
This commit is contained in:
parent
940e805afe
commit
2f0af2cd1e
2
Makefile
2
Makefile
@ -23,7 +23,7 @@ OBJDUMP := objdump
|
||||
# 查询可重定位文件符号表
|
||||
NM := nm
|
||||
|
||||
DEFS := -D USE_FBCON
|
||||
DEFS :=
|
||||
|
||||
# gcc的相关命令参数
|
||||
# $(DEFS) 定义一些可能的参数
|
||||
|
||||
@ -112,7 +112,7 @@ int init_bga(pci_dev_t *dev) {
|
||||
}
|
||||
|
||||
bga_buf_paddr = pci_read_bar(dev, 0) & 0xfffffff0;
|
||||
bga_set_resolution(800, 600);
|
||||
bga_set_resolution(1024, 768);
|
||||
kprintf("bga buf paddr=%p; buf size= %d KB\n", bga_buf_paddr,
|
||||
bga_screen_buffer_size / 1024);
|
||||
kprintf("bga mapped in kernel cr3=%p\n", read_cr3());
|
||||
|
||||
@ -141,6 +141,7 @@ static u32 exec_elfcpy(u32 fd, Elf32_Phdr Echo_Phdr, u32 attribute) // 这部分
|
||||
// 已初始化数据段拷贝完毕,剩下的是未初始化的数据段,在内存中填0
|
||||
*((u8 *)lin_addr) = 0; // memset((void*)lin_addr,0,1);
|
||||
}
|
||||
if (!(lin_addr & 0x3f)) kprintf(".");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -158,6 +159,7 @@ static u32 exec_load(u32 fd, const Elf32_Ehdr *Echo_Ehdr, const Elf32_Phdr Echo_
|
||||
kprintf("\x1b[31;47mexec_load: elf ERROR!\x1b[m", 0x74);
|
||||
return -1;
|
||||
}
|
||||
kprintf("loading elf from file");
|
||||
|
||||
// 我们还不能确定elf中一共能有几个program,但就目前我们查看过的elf文件中,只出现过两中program,一种.text(R-E)和一种.data(RW-)
|
||||
for (ph_num = 0; ph_num < Echo_Ehdr->e_phnum; ph_num++)
|
||||
@ -186,6 +188,7 @@ static u32 exec_load(u32 fd, const Elf32_Ehdr *Echo_Ehdr, const Elf32_Phdr Echo_
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
kprintf("[\x1b[32mok\x1b[0m]\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -151,9 +151,9 @@ void initial()
|
||||
do_vclose(stdout);
|
||||
do_vclose(stderr);
|
||||
#ifdef USE_FBCON
|
||||
exec("orange/shell_0.bin");
|
||||
exec("orange/shell_chn.bin");
|
||||
#else
|
||||
exec("orange/shell_1.bin");
|
||||
exec("orange/shell_mix.bin");
|
||||
#endif
|
||||
while (1)
|
||||
;
|
||||
|
||||
@ -10,8 +10,8 @@ static void kprintfputch(int ch, int *cnt)
|
||||
{
|
||||
write_serial(ch);
|
||||
#ifndef USE_FBCON
|
||||
char _ch = ch;
|
||||
tty_write(cur_ntty, &_ch, 1);
|
||||
// char _ch = ch;
|
||||
//tty_write(cur_ntty, &_ch, 1);
|
||||
#endif
|
||||
(*cnt)++;
|
||||
}
|
||||
|
||||
@ -6,11 +6,13 @@ USERLIB_OBJS := $(patsubst %.c, $(OBJDIR)/%.o, $(USERLIB_SRCS))
|
||||
USERLIB_OBJS := $(patsubst %.asm, $(OBJDIR)/%.o, $(USERLIB_OBJS))
|
||||
|
||||
# 这里给我整不会了,文件名只能长度为16位,否则会寄,原因还挺难找
|
||||
USER_SRCS := user/shell_1.c \
|
||||
user/shell_0.c \
|
||||
user/test.c \
|
||||
user/test2.c \
|
||||
user/chtest.c \
|
||||
USER_SRCS := user/shell_2con.c \
|
||||
user/shell_chn.c \
|
||||
user/shell_mix.c \
|
||||
user/shell_uart.c \
|
||||
user/test2con.c \
|
||||
user/testchn.c \
|
||||
user/testscr.c \
|
||||
|
||||
USER_BINS := $(patsubst %.c, $(OBJDIR)/%.bin, $(USER_SRCS))
|
||||
USER_BASENAMES := $(patsubst $(OBJDIR)/user/%, %, $(USER_BINS))
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
#include "stdio.h"
|
||||
|
||||
int global=0;
|
||||
|
||||
char *str2,*str3;
|
||||
|
||||
|
||||
void pthread_test1()
|
||||
{
|
||||
int i;
|
||||
//pthread(pthread_test2);
|
||||
while(1)
|
||||
{
|
||||
printf("pth1");
|
||||
printf("%d",++global);
|
||||
printf(" ");
|
||||
i=10000000;
|
||||
while(--i){}
|
||||
}
|
||||
}
|
||||
|
||||
/*======================================================================*
|
||||
Syscall Pthread Test
|
||||
added by xw, 18/4/27
|
||||
*======================================================================*/
|
||||
|
||||
int main(int arg,char *argv[])
|
||||
{
|
||||
int i=0;
|
||||
|
||||
pthread(pthread_test1);
|
||||
while(1)
|
||||
{
|
||||
printf("init");
|
||||
printf("%d",++global);
|
||||
printf(" ");
|
||||
i=10000000;
|
||||
while(--i){}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -43,7 +43,6 @@ int main(int arg, char *argv[])
|
||||
printf("\nminiOS:/ $ ");
|
||||
if (gets(buf) && strlen(buf) != 0)
|
||||
{
|
||||
printf("received\n");
|
||||
if (exec(buf) != 0)
|
||||
{
|
||||
printf("exec failed: file not found!\n");
|
||||
31
user/shell_mix.c
Normal file
31
user/shell_mix.c
Normal file
@ -0,0 +1,31 @@
|
||||
#include "type.h"
|
||||
#include "const.h"
|
||||
#include "protect.h"
|
||||
#include "string.h"
|
||||
#include "proc.h"
|
||||
#include "global.h"
|
||||
#include "proto.h"
|
||||
#include "stdio.h"
|
||||
|
||||
int main(int arg, char *argv[])
|
||||
{
|
||||
int stdin = open("dev_tty2", O_RDWR);
|
||||
int stdout = open("dev_tty0", O_RDWR);
|
||||
int stderr = open("dev_tty0", O_RDWR);
|
||||
|
||||
char buf[1024];
|
||||
int pid;
|
||||
int times = 0;
|
||||
while (1)
|
||||
{
|
||||
printf("miniOS:/ $ ");
|
||||
if (gets(buf) && strlen(buf) != 0)
|
||||
{
|
||||
if (exec(buf) != 0)
|
||||
{
|
||||
printf("exec failed: file not found!\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
user/shell_uart.c
Normal file
31
user/shell_uart.c
Normal file
@ -0,0 +1,31 @@
|
||||
#include "type.h"
|
||||
#include "const.h"
|
||||
#include "protect.h"
|
||||
#include "string.h"
|
||||
#include "proc.h"
|
||||
#include "global.h"
|
||||
#include "proto.h"
|
||||
#include "stdio.h"
|
||||
|
||||
int main(int arg, char *argv[])
|
||||
{
|
||||
int stdin = open("dev_tty2", O_RDWR);
|
||||
int stdout = open("dev_tty2", O_RDWR);
|
||||
int stderr = open("dev_tty2", O_RDWR);
|
||||
|
||||
char buf[1024];
|
||||
int pid;
|
||||
int times = 0;
|
||||
while (1)
|
||||
{
|
||||
printf("\nminiOS:/ $ ");
|
||||
if (gets(buf) && strlen(buf) != 0)
|
||||
{
|
||||
if (exec(buf) != 0)
|
||||
{
|
||||
printf("exec failed: file not found!\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
86
user/test.c
86
user/test.c
@ -1,86 +0,0 @@
|
||||
#include "type.h"
|
||||
#include "const.h"
|
||||
#include "protect.h"
|
||||
#include "string.h"
|
||||
#include "proc.h"
|
||||
#include "global.h"
|
||||
#include "proto.h"
|
||||
#include "stdio.h"
|
||||
|
||||
int main(int arg, char *argv[])
|
||||
{
|
||||
int stdin = open("dev_tty0", O_RDWR);
|
||||
int stdout = open("dev_tty0", O_RDWR);
|
||||
int stderr = open("dev_tty0", O_RDWR);
|
||||
|
||||
char buf[1024];
|
||||
int pid;
|
||||
int times = 0;
|
||||
for (int i = 0; i < 50; ++i)
|
||||
{
|
||||
printf("test %d\n", i);
|
||||
for (int j = 0; j < 2000000; ++ j);
|
||||
}
|
||||
// for (int i = 0; i < 2; ++i)
|
||||
// {
|
||||
// printf("\x1b[42;31m1111111111");
|
||||
// // printf("\x1b[m1111111111");
|
||||
// printf("2222222222");
|
||||
// printf("3333333333");
|
||||
// printf("4444444444");
|
||||
// printf("5555555555");
|
||||
// printf("6666666666");
|
||||
// printf("7777777777");
|
||||
// // printf("\x1b[5F");
|
||||
// printf("8888888888");
|
||||
// printf("9999999999\r\b\b\n");
|
||||
// }
|
||||
printf("\x1b[33m");
|
||||
|
||||
for (int i = 0; i < 40; i++)
|
||||
{
|
||||
printf("%d", i);
|
||||
printf("11111111111111111\n");
|
||||
}
|
||||
printf("\x1b[31;47m555555555555\x1b[m");
|
||||
|
||||
// Cursor Up
|
||||
// printf("\x1b[2A");
|
||||
|
||||
// Cursor down
|
||||
// printf("\x1b[2B");
|
||||
|
||||
// Cursor Forward
|
||||
// printf("\x1b[20C");
|
||||
|
||||
// Cursor Back
|
||||
// printf("\x1b[2D");
|
||||
|
||||
// Cursor Next Line
|
||||
// printf("\x1b[3E");
|
||||
|
||||
// Cursor Previous Line
|
||||
// printf("\x1b[3F");
|
||||
|
||||
// Cursor Horizontal Absolute
|
||||
// printf("\x1b[2G");
|
||||
|
||||
// Cursor Position ; H or f
|
||||
// printf("\x1b[3;5H");
|
||||
|
||||
// Erase in Display
|
||||
// printf("\x1b[3J");
|
||||
|
||||
// Erase in Line
|
||||
// printf("\x1b[K");
|
||||
|
||||
// Scroll Up
|
||||
// printf("\x1b[13S");
|
||||
|
||||
// Scroll Down
|
||||
// printf("\x1b[13T");
|
||||
|
||||
while (1)
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
29
user/testscr.c
Normal file
29
user/testscr.c
Normal file
@ -0,0 +1,29 @@
|
||||
#include "type.h"
|
||||
#include "const.h"
|
||||
#include "protect.h"
|
||||
#include "string.h"
|
||||
#include "proc.h"
|
||||
#include "global.h"
|
||||
#include "proto.h"
|
||||
#include "stdio.h"
|
||||
|
||||
int main(int arg, char *argv[])
|
||||
{
|
||||
int stdin = open("dev_tty0", O_RDWR);
|
||||
int stdout = open("dev_tty0", O_RDWR);
|
||||
int stderr = open("dev_tty0", O_RDWR);
|
||||
|
||||
for (int i = 0; i < 40; i++)
|
||||
{
|
||||
printf("%02d ", i);
|
||||
}
|
||||
for (int i = 0; i < 50; ++i)
|
||||
{
|
||||
printf("test %d\n", i);
|
||||
for (int j = 0; j < 2000000; ++ j);
|
||||
}
|
||||
|
||||
while (1)
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user