Essentially merge ext-prog-libc
This commit is contained in:
parent
5cb95d816f
commit
3691d6b1f5
2
Makefile
2
Makefile
@ -15,7 +15,7 @@ NASM = $(shell cat psinfo/$(PLAT)/nasm.txt)
|
|||||||
EMU = $(shell cat psinfo/$(PLAT)/emu.txt)
|
EMU = $(shell cat psinfo/$(PLAT)/emu.txt)
|
||||||
GDB = $(shell cat psinfo/$(PLAT)/gdb.txt)
|
GDB = $(shell cat psinfo/$(PLAT)/gdb.txt)
|
||||||
CFLAGS = -Isysroot/usr/include -Wextra -Wall -Wno-unused-parameter -g -ffreestanding
|
CFLAGS = -Isysroot/usr/include -Wextra -Wall -Wno-unused-parameter -g -ffreestanding
|
||||||
QFLAGS = -hda image.img -m 2G -boot d -cdrom os.iso #-chardev socket,id=s1,port=3000,host=localhost -serial chardev:s1
|
QFLAGS = -hda ext2.img -m 2G -boot d -cdrom os.iso -serial vc #-chardev socket,id=s1,port=3000,host=localhost -serial chardev:s1
|
||||||
|
|
||||||
.PHONY: sysroot
|
.PHONY: sysroot
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ void initrd_init() {
|
|||||||
names=malloc(sizeof(char*)*32);
|
names=malloc(sizeof(char*)*32);
|
||||||
offsets=malloc(sizeof(uint32_t)*32);
|
offsets=malloc(sizeof(uint32_t)*32);
|
||||||
sizes=malloc(sizeof(long)*32);
|
sizes=malloc(sizeof(long)*32);
|
||||||
for (uint32_t i=0;;i++) {
|
for (uint32_t i=0;i<1;i++) {
|
||||||
if (i==max_files) {
|
if (i==max_files) {
|
||||||
names=realloc(names,sizeof(char*)*(max_files+32));
|
names=realloc(names,sizeof(char*)*(max_files+32));
|
||||||
offsets=realloc(offsets,sizeof(uint32_t)*(max_files+32));
|
offsets=realloc(offsets,sizeof(uint32_t)*(max_files+32));
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
Hello!
|
|
||||||
This is hi.txt!
|
|
@ -1 +0,0 @@
|
|||||||
This is another file!
|
|
@ -1 +0,0 @@
|
|||||||
File 1
|
|
@ -2,5 +2,6 @@ timeout=0
|
|||||||
|
|
||||||
menuentry "My OS" {
|
menuentry "My OS" {
|
||||||
multiboot2 /boot/kernel.elf
|
multiboot2 /boot/kernel.elf
|
||||||
|
module2 /boot/initrd initrd
|
||||||
boot
|
boot
|
||||||
}
|
}
|
||||||
|
100
kernel/kernel.c
100
kernel/kernel.c
@ -23,6 +23,7 @@
|
|||||||
static long initrd_sz;
|
static long initrd_sz;
|
||||||
static char* initrd;
|
static char* initrd;
|
||||||
typedef int (*func_ptr)();
|
typedef int (*func_ptr)();
|
||||||
|
static struct multiboot_boot_header_tag* tags;
|
||||||
|
|
||||||
static int console_dev_drv(char* filename,int c,long pos,char wr) {
|
static int console_dev_drv(char* filename,int c,long pos,char wr) {
|
||||||
if (wr) {
|
if (wr) {
|
||||||
@ -49,32 +50,25 @@ static int initrd_dev_drv(char* filename,int c,long pos,char wr) {
|
|||||||
if (pos>=initrd_sz) {
|
if (pos>=initrd_sz) {
|
||||||
return EOF;
|
return EOF;
|
||||||
}
|
}
|
||||||
return initrd[pos];
|
return (initrd[pos]&0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static void read_initrd(multiboot_info_t* mbd) {
|
static void read_initrd(struct multiboot_boot_header_tag* tags) {
|
||||||
// if ((mbd->flags&MULTIBOOT_INFO_MODS)!=0) {
|
|
||||||
// uint32_t mods_count=mbd->mods_count;
|
struct multiboot_tag* tag=(struct multiboot_tag*)(tags+1);
|
||||||
// if (mods_count>0) {
|
while (tag->type!=0) {
|
||||||
// while (mods_count>0) {
|
switch (tag->type) {
|
||||||
// multiboot_module_t* mods_addr=(multiboot_module_t*)(mbd->mods_addr+0xC0000000);
|
case MULTIBOOT_TAG_TYPE_MODULE: {
|
||||||
// if (strcmp((char*)(mods_addr->cmdline+0xC0000000),"initrd")==0) {
|
struct multiboot_tag_module* mod=(struct multiboot_tag_module*) tag;
|
||||||
// initrd=malloc(sizeof(char)*(mods_addr->mod_end-mods_addr->mod_start));
|
initrd=malloc(sizeof(char)*(mod->mod_end-mod->mod_start));
|
||||||
// initrd_sz=(mods_addr->mod_end-mods_addr->mod_start);
|
initrd_sz=mod->mod_end-mod->mod_start;
|
||||||
// memcpy(initrd,(void*)mods_addr->mod_start+0xC0000000,initrd_sz);
|
memcpy(initrd,mod->mod_start+0xC0000000,mod->mod_end-mod->mod_start);
|
||||||
// };
|
klog("INFO","Got module called %s at start address %x and end address %x",mod->cmdline,mod->mod_start,mod->mod_end);
|
||||||
// mods_count--;
|
}
|
||||||
// }
|
}
|
||||||
// }
|
tag=(struct multiboot_tag*)((char*)tag+((tag->size+7)&0xFFFFFFF8));
|
||||||
// } else {
|
}
|
||||||
// klog("PANIC","Cannnot load initrd. No modules found!");
|
}
|
||||||
// for(;;) {}
|
|
||||||
// }
|
|
||||||
// if (!initrd) {
|
|
||||||
// klog("PANIC","Cannnot load initrd. Initrd module not found!");
|
|
||||||
// for(;;) {}
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
static void init() {
|
static void init() {
|
||||||
init_vfs();
|
init_vfs();
|
||||||
@ -83,10 +77,10 @@ static void init() {
|
|||||||
stdout=fopen("/dev/console","w");
|
stdout=fopen("/dev/console","w");
|
||||||
stdin=fopen("/dev/console","r");
|
stdin=fopen("/dev/console","r");
|
||||||
stderr=fopen("/dev/console","w");
|
stderr=fopen("/dev/console","w");
|
||||||
// read_initrd(mbd);
|
read_initrd(tags);
|
||||||
// devfs_add(initrd_dev_drv,"initrd");
|
devfs_add(initrd_dev_drv,"initrd");
|
||||||
// initrd_init();
|
initrd_init();
|
||||||
// mount("/initrd/","","initrd");
|
mount("/initrd/","","initrd");
|
||||||
// Detect PCI
|
// Detect PCI
|
||||||
port_long_out(0xCF8,(1<<31));
|
port_long_out(0xCF8,(1<<31));
|
||||||
uint32_t word=port_long_in(0xCFC);
|
uint32_t word=port_long_in(0xCFC);
|
||||||
@ -96,28 +90,35 @@ static void init() {
|
|||||||
}
|
}
|
||||||
// Detect and initailize serial ports
|
// Detect and initailize serial ports
|
||||||
serial_init();
|
serial_init();
|
||||||
// FILE* file=fopen("/initrd/prog.elf","r");
|
FILE* file=fopen("/initrd/prog.elf","r");
|
||||||
// elf_header header;
|
elf_header header;
|
||||||
// fread(&header,sizeof(elf_header),1,file);
|
fread(&header,sizeof(elf_header),1,file);
|
||||||
// if (header.magic!=ELF_MAGIC) {
|
if (header.magic!=ELF_MAGIC) {
|
||||||
// klog("INFO","Invalid magic number for prog.elf");
|
klog("INFO","Invalid magic number for prog.elf");
|
||||||
// fclose(file);
|
fclose(file);
|
||||||
// } else {
|
} else {
|
||||||
// fseek(file,header.prog_hdr,SEEK_SET);
|
klog("INFO","ENTRY: %x",header.entry);
|
||||||
// elf_pheader pheader;
|
for (int i=0;i<header.pheader_ent_nm;i++) {
|
||||||
// fread(&pheader,sizeof(elf_pheader),1,file);
|
elf_pheader pheader;
|
||||||
// alloc_memory_virt(1,(void*)pheader.vaddr);
|
fseek(file,(header.prog_hdr)+(header.pheader_ent_sz*i),SEEK_SET);
|
||||||
// fseek(file,pheader.offset,SEEK_SET);
|
fread(&pheader,sizeof(elf_pheader),1,file);
|
||||||
// fread((void*)pheader.vaddr,pheader.filesz,1,file);
|
alloc_memory_virt(((pheader.memsz)/4096)+1,(void*)pheader.vaddr);
|
||||||
// klog("INFO","VADDR:%x",pheader.vaddr);
|
memset((void*)pheader.vaddr,0xAA,pheader.memsz);
|
||||||
// func_ptr prog=(func_ptr)header.entry;
|
if (pheader.filesz>0) {
|
||||||
// int val=prog();
|
fseek(file,pheader.offset,SEEK_SET);
|
||||||
// klog("INFO","RAN PROG:%d",val);
|
klog("INFO","fread((void*)%x,%x,1,file)",pheader.vaddr,pheader.filesz);
|
||||||
// }
|
fread((void*)pheader.vaddr,pheader.filesz,1,file);
|
||||||
|
}
|
||||||
|
klog("INFO","OFF:%x VADDR:%x FILESZ:%x MEMSZ:%x",pheader.offset, pheader.vaddr,pheader.filesz,pheader.memsz);
|
||||||
|
}
|
||||||
|
func_ptr prog=(func_ptr)header.entry;
|
||||||
|
int val=prog();
|
||||||
|
klog("INFO","RAN PROG:%d",val);
|
||||||
|
}
|
||||||
ide_init();
|
ide_init();
|
||||||
load_parts("/dev/hda");
|
// load_parts("/dev/hda");
|
||||||
init_ext2();
|
init_ext2();
|
||||||
mount("/","/dev/hda1","ext2");
|
mount("/","/dev/hda","ext2");
|
||||||
klog("INFO","MOUNT");
|
klog("INFO","MOUNT");
|
||||||
FILE* f=fopen("/file","r");
|
FILE* f=fopen("/file","r");
|
||||||
char str[256];
|
char str[256];
|
||||||
@ -129,7 +130,8 @@ static void init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void kmain(struct multiboot_boot_header_tag* tags) {
|
void kmain(struct multiboot_boot_header_tag* hdr) {
|
||||||
|
tags=hdr;
|
||||||
cpu_init(tags);
|
cpu_init(tags);
|
||||||
text_fb_info info;
|
text_fb_info info;
|
||||||
// if (header->flags&MULTIBOOT_INFO_FRAMEBUFFER_INFO&&header->framebuffer_type==2) {
|
// if (header->flags&MULTIBOOT_INFO_FRAMEBUFFER_INFO&&header->framebuffer_type==2) {
|
||||||
|
33
log
Normal file
33
log
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
[INFO] First PS/2 port OK
|
||||||
|
[INFO] Keyboard on PS/2 port 1
|
||||||
|
[INFO] Registered keyboard driver on PS/2 port 1
|
||||||
|
[INFO] Finished initializing PS/2 driver
|
||||||
|
[INFO] Scanning for serial ports
|
||||||
|
[INFO] Found COM1
|
||||||
|
[INFO] Found COM2
|
||||||
|
[INFO] Scanning for parallel ports
|
||||||
|
[INFO] Found LPT1
|
||||||
|
[INFO] Found PCI device. Class code:0x6, Subclass:0x0 Prog IF:0x0
|
||||||
|
[INFO] Found PCI device. Class code:0x6, Subclass:0x1 Prog IF:0x0
|
||||||
|
[INFO] Found PCI device. Class code:0x1, Subclass:0x1 Prog IF:0x80
|
||||||
|
[INFO] Found PCI device. Class code:0x6, Subclass:0x80 Prog IF:0x0
|
||||||
|
[INFO] Found PCI device. Class code:0x3, Subclass:0x0 Prog IF:0x0
|
||||||
|
[INFO] Found PCI device. Class code:0x2, Subclass:0x0 Prog IF:0x0
|
||||||
|
[INFO] Found network controller, detecting type
|
||||||
|
[INFO] Unknown network card
|
||||||
|
>pci list (Shows PCI devices and types)
|
||||||
|
PCI device 0:
|
||||||
|
Main class:Bridge
|
||||||
|
PCI device 1:
|
||||||
|
Main class:Bridge
|
||||||
|
PCI device 2:
|
||||||
|
Main class:Storage
|
||||||
|
PCI device 3:
|
||||||
|
Main class:Bridge
|
||||||
|
PCI device 4:
|
||||||
|
Main class:Display
|
||||||
|
PCI device 5:
|
||||||
|
Main class:Network
|
||||||
|
>cat /hi.txt (Outputs contents of file)
|
||||||
|
Hello!
|
||||||
|
This is hi.txt!
|
216
out
216
out
@ -1,216 +0,0 @@
|
|||||||
|
|
||||||
iso/boot/kernel.elf: file format elf64-x86-64
|
|
||||||
iso/boot/kernel.elf
|
|
||||||
architecture: i386:x86-64, flags 0x00000112:
|
|
||||||
EXEC_P, HAS_SYMS, D_PAGED
|
|
||||||
start address 0x0000000000101000
|
|
||||||
|
|
||||||
Program Header:
|
|
||||||
LOAD off 0x0000000000001000 vaddr 0x0000000000100000 paddr 0x0000000000100000 align 2**12
|
|
||||||
filesz 0x000000000000a000 memsz 0x000000000000a000 flags r--
|
|
||||||
LOAD off 0x000000000000b000 vaddr 0xffff80000010a000 paddr 0x000000000010a000 align 2**5
|
|
||||||
filesz 0x0000000000006bc0 memsz 0x000000000000b0f0 flags rwx
|
|
||||||
|
|
||||||
Sections:
|
|
||||||
Idx Name Size VMA LMA File off Algn
|
|
||||||
0 .multiboot 00000018 0000000000100000 0000000000100000 00001000 2**0
|
|
||||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
|
||||||
1 .boottext 00000126 0000000000101000 0000000000101000 00002000 2**0
|
|
||||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
|
||||||
2 .bootrodata 00000022 0000000000102000 0000000000102000 00003000 2**0
|
|
||||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
|
||||||
3 .bootbss 00007000 0000000000103000 0000000000103000 00004000 2**12
|
|
||||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
|
||||||
4 .text 00005754 ffff80000010a000 000000000010a000 0000b000 2**0
|
|
||||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
|
||||||
5 .rodata 0000013c ffff800000110000 0000000000110000 00011000 2**3
|
|
||||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
|
||||||
6 .eh_frame 00000a80 ffff800000110140 0000000000110140 00011140 2**3
|
|
||||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
|
||||||
7 .bss 000040f0 ffff800000111000 0000000000111000 00011bc0 2**5
|
|
||||||
ALLOC
|
|
||||||
8 .debug_info 000050a7 0000000000000000 0000000000000000 00011bc0 2**0
|
|
||||||
CONTENTS, READONLY, DEBUGGING
|
|
||||||
9 .debug_abbrev 0000100f 0000000000000000 0000000000000000 00016c67 2**0
|
|
||||||
CONTENTS, READONLY, DEBUGGING
|
|
||||||
10 .debug_aranges 00000270 0000000000000000 0000000000000000 00017c76 2**0
|
|
||||||
CONTENTS, READONLY, DEBUGGING
|
|
||||||
11 .debug_line 00002229 0000000000000000 0000000000000000 00017ee6 2**0
|
|
||||||
CONTENTS, READONLY, DEBUGGING
|
|
||||||
12 .debug_str 000010f9 0000000000000000 0000000000000000 0001a10f 2**0
|
|
||||||
CONTENTS, READONLY, DEBUGGING
|
|
||||||
13 .comment 00000011 0000000000000000 0000000000000000 0001b208 2**0
|
|
||||||
CONTENTS, READONLY
|
|
||||||
14 .debug_ranges 000001e0 0000000000000000 0000000000000000 0001b219 2**0
|
|
||||||
CONTENTS, READONLY, DEBUGGING
|
|
||||||
SYMBOL TABLE:
|
|
||||||
0000000000100000 l d .multiboot 0000000000000000 .multiboot
|
|
||||||
0000000000101000 l d .boottext 0000000000000000 .boottext
|
|
||||||
0000000000102000 l d .bootrodata 0000000000000000 .bootrodata
|
|
||||||
0000000000103000 l d .bootbss 0000000000000000 .bootbss
|
|
||||||
ffff80000010a000 l d .text 0000000000000000 .text
|
|
||||||
ffff800000110000 l d .rodata 0000000000000000 .rodata
|
|
||||||
ffff800000110140 l d .eh_frame 0000000000000000 .eh_frame
|
|
||||||
ffff800000111000 l d .bss 0000000000000000 .bss
|
|
||||||
0000000000000000 l d .debug_info 0000000000000000 .debug_info
|
|
||||||
0000000000000000 l d .debug_abbrev 0000000000000000 .debug_abbrev
|
|
||||||
0000000000000000 l d .debug_aranges 0000000000000000 .debug_aranges
|
|
||||||
0000000000000000 l d .debug_line 0000000000000000 .debug_line
|
|
||||||
0000000000000000 l d .debug_str 0000000000000000 .debug_str
|
|
||||||
0000000000000000 l d .comment 0000000000000000 .comment
|
|
||||||
0000000000000000 l d .debug_ranges 0000000000000000 .debug_ranges
|
|
||||||
0000000000000000 l df *ABS* 0000000000000000 cpu/x86_64/boot.asm
|
|
||||||
0000000000100000 l .multiboot 0000000000000000 header_start
|
|
||||||
0000000000100018 l .multiboot 0000000000000000 header_end
|
|
||||||
0000000000101037 l .boottext 0000000000000000 check_multiboot
|
|
||||||
000000000010103f l .boottext 0000000000000000 check_multiboot.no_multiboot
|
|
||||||
0000000000101046 l .boottext 0000000000000000 check_cpuid
|
|
||||||
000000000010105a l .boottext 0000000000000000 check_cpuid.no_cpuid
|
|
||||||
0000000000101061 l .boottext 0000000000000000 check_long_mode
|
|
||||||
000000000010107f l .boottext 0000000000000000 check_long_mode.no_long_mode
|
|
||||||
0000000000101083 l .boottext 0000000000000000 set_up_page_tables
|
|
||||||
00000000001010af l .boottext 0000000000000000 set_up_page_tables.map_p2_table
|
|
||||||
00000000001010c9 l .boottext 0000000000000000 enable_paging
|
|
||||||
00000000001010f4 l .boottext 0000000000000000 error
|
|
||||||
0000000000103000 l .bootbss 0000000000000000 p4_table
|
|
||||||
0000000000104000 l .bootbss 0000000000000000 p3_table
|
|
||||||
0000000000105000 l .bootbss 0000000000000000 p2_table
|
|
||||||
0000000000106000 l .bootbss 0000000000000000 stack_bottom
|
|
||||||
000000000010a000 l .bootbss 0000000000000000 stack_top
|
|
||||||
0000000000102000 l .bootrodata 0000000000000000 gdt64
|
|
||||||
0000000000102018 l .bootrodata 0000000000000000 gdt64.pointer
|
|
||||||
0000000000000000 l df *ABS* 0000000000000000 cpu/x86_64/long_start.asm
|
|
||||||
0000000000101124 l .boottext 0000000000000000 loop
|
|
||||||
0000000000000000 l df *ABS* 0000000000000000 kernel.c
|
|
||||||
0000000000000000 l df *ABS* 0000000000000000 parts.c
|
|
||||||
ffff800000111000 l O .bss 0000000000000008 part_devs
|
|
||||||
ffff800000111008 l O .bss 0000000000000008 parts
|
|
||||||
ffff800000111010 l O .bss 0000000000000004 num_part_devs
|
|
||||||
ffff800000111014 l O .bss 0000000000000004 max_part_devs
|
|
||||||
0000000000000000 l df *ABS* 0000000000000000 vfs.c
|
|
||||||
ffff800000111030 l O .bss 0000000000000008 drv_names
|
|
||||||
ffff800000111038 l O .bss 0000000000000008 drvs
|
|
||||||
ffff800000111040 l O .bss 0000000000000004 max_drvs
|
|
||||||
ffff800000111044 l O .bss 0000000000000004 next_drv_indx
|
|
||||||
ffff800000111048 l O .bss 0000000000000008 head_mapping
|
|
||||||
ffff800000111050 l O .bss 0000000000000008 tail_mapping
|
|
||||||
ffff80000010a786 l F .text 000000000000009f vfsstrcmp
|
|
||||||
0000000000000000 l df *ABS* 0000000000000000 ports.c
|
|
||||||
0000000000000000 l df *ABS* 0000000000000000 devfs.c
|
|
||||||
ffff800000111058 l O .bss 0000000000000008 devices
|
|
||||||
ffff800000111060 l O .bss 0000000000000008 dev_drivers
|
|
||||||
ffff800000111068 l O .bss 0000000000000004 num_devices
|
|
||||||
ffff80000011106c l O .bss 0000000000000004 max_devices
|
|
||||||
0000000000000000 l df *ABS* 0000000000000000 ext2.c
|
|
||||||
ffff80000010bd3e l F .text 0000000000000048 get_bmap_bit
|
|
||||||
ffff80000010bd86 l F .text 000000000000004f set_bmap_bit
|
|
||||||
ffff80000010d460 l F .text 0000000000000da2 drv
|
|
||||||
0000000000000000 l df *ABS* 0000000000000000 initrd.c
|
|
||||||
ffff800000111070 l O .bss 0000000000000008 names
|
|
||||||
ffff800000111078 l O .bss 0000000000000008 offsets
|
|
||||||
ffff800000111080 l O .bss 0000000000000008 sizes
|
|
||||||
ffff800000111088 l O .bss 0000000000000004 num_files
|
|
||||||
ffff800000111090 l O .bss 0000000000000008 initrd_fd
|
|
||||||
ffff80000010e30f l F .text 00000000000001dd drv
|
|
||||||
0000000000000000 l df *ABS* 0000000000000000 errno.c
|
|
||||||
0000000000000000 l df *ABS* 0000000000000000 klog.c
|
|
||||||
0000000000000000 l df *ABS* 0000000000000000 math.c
|
|
||||||
0000000000000000 l df *ABS* 0000000000000000 stdlib.c
|
|
||||||
ffff8000001110a0 l O .bss 0000000000004000 entries
|
|
||||||
ffff8000001150a0 l O .bss 0000000000000004 num_used_entries
|
|
||||||
ffff80000010ea06 l F .text 0000000000000048 get_bmap_bit
|
|
||||||
ffff80000010ea4e l F .text 000000000000004d set_bmap_bit
|
|
||||||
ffff80000010ea9b l F .text 000000000000004d clear_bmap_bit
|
|
||||||
ffff80000010eae8 l F .text 00000000000001e9 reserve_block
|
|
||||||
0000000000000000 l df *ABS* 0000000000000000 string.c
|
|
||||||
ffff8000001150a8 l O .bss 0000000000000008 strtok_str
|
|
||||||
ffff8000001150b0 l O .bss 0000000000000008 strtok_index
|
|
||||||
ffff80000010f4ef l F .text 0000000000000098 strtok_delim_check
|
|
||||||
0000000000000000 l df *ABS* 0000000000000000 memory.c
|
|
||||||
ffff80000010f1a1 g F .text 0000000000000067 strcpy
|
|
||||||
ffff80000010b65b g F .text 00000000000000e1 printf
|
|
||||||
ffff800000111020 g O .bss 0000000000000008 stdout
|
|
||||||
ffff80000010bf35 g F .text 000000000000027c read_inode
|
|
||||||
ffff80000010c848 g F .text 0000000000000065 set_sz
|
|
||||||
ffff80000010b899 g F .text 0000000000000018 port_long_out
|
|
||||||
ffff80000010e9cb g F .text 000000000000003b ceil
|
|
||||||
ffff80000010e202 g F .text 000000000000010d init_ext2
|
|
||||||
ffff8000001150b8 g O .bss 0000000000000008 supblks
|
|
||||||
ffff80000010d2f3 g F .text 00000000000000bd inode_for_fname
|
|
||||||
ffff8000001150c0 g O .bss 0000000000000008 blk_grps
|
|
||||||
ffff80000010aeaf g F .text 00000000000000cd fgets
|
|
||||||
ffff80000010ae8d g F .text 0000000000000022 getc
|
|
||||||
ffff80000010f04e g F .text 000000000000005a memcpy
|
|
||||||
ffff80000010c1b1 g F .text 000000000000033a write_inode
|
|
||||||
ffff80000010d219 g F .text 000000000000000b free_dir_listing
|
|
||||||
ffff80000010b1a2 g F .text 0000000000000031 puts
|
|
||||||
ffff80000010c921 g F .text 0000000000000184 read_char
|
|
||||||
ffff80000010b7ee g F .text 0000000000000011 feof
|
|
||||||
ffff80000010caa5 g F .text 000000000000014c append_char
|
|
||||||
ffff80000010ecd1 g F .text 000000000000024d malloc
|
|
||||||
ffff80000010a8b0 g F .text 0000000000000159 register_fs
|
|
||||||
ffff80000010f208 g F .text 0000000000000089 strrev
|
|
||||||
ffff80000010bdd5 g F .text 00000000000000c8 read_blk
|
|
||||||
ffff80000010b8b1 g F .text 000000000000022b devfs_drv
|
|
||||||
ffff8000001150c8 g O .bss 0000000000000008 blk_grp_num
|
|
||||||
ffff80000010a825 g F .text 000000000000008b init_vfs
|
|
||||||
ffff80000010c7f3 g F .text 0000000000000055 get_sz
|
|
||||||
ffff80000010a339 g F .text 000000000000044d load_parts
|
|
||||||
ffff80000010bb8f g F .text 00000000000001af devfs_add
|
|
||||||
ffff8000001150d0 g O .bss 0000000000000004 max_mnts
|
|
||||||
ffff80000010b580 g F .text 00000000000000db fprintf
|
|
||||||
ffff80000010c8ad g F .text 0000000000000074 inc_sz
|
|
||||||
ffff80000010b73c g F .text 0000000000000045 fseek
|
|
||||||
ffff80000010f70f g F .text 0000000000000022 alloc_memory
|
|
||||||
ffff800000111018 g O .bss 0000000000000008 stdin
|
|
||||||
ffff8000001150d4 g O .bss 0000000000000004 num_mnts
|
|
||||||
ffff80000010b7ff g F .text 0000000000000011 ferror
|
|
||||||
ffff80000010be9d g F .text 0000000000000098 write_blk
|
|
||||||
ffff80000010b880 g F .text 0000000000000019 port_long_in
|
|
||||||
ffff80000010f731 g F .text 0000000000000023 alloc_memory_virt
|
|
||||||
ffff8000001150d8 g O .bss 0000000000000008 devs
|
|
||||||
ffff80000010ef1e g F .text 0000000000000081 realloc
|
|
||||||
ffff80000010f587 g F .text 0000000000000188 strtok
|
|
||||||
ffff80000010badc g F .text 00000000000000b3 init_devfs
|
|
||||||
ffff80000010f291 g F .text 00000000000000c7 int_to_ascii
|
|
||||||
ffff80000010af7c g F .text 00000000000000bb fread
|
|
||||||
ffff80000010ac05 g F .text 000000000000020f fopen
|
|
||||||
ffff80000010f0a8 g F .text 0000000000000046 memset
|
|
||||||
ffff80000010b781 g F .text 0000000000000012 ftell
|
|
||||||
ffff80000010b793 g F .text 000000000000005b fclose
|
|
||||||
ffff80000010b810 g F .text 000000000000001a port_byte_in
|
|
||||||
ffff80000010b863 g F .text 000000000000001d port_word_out
|
|
||||||
ffff80000010d037 g F .text 00000000000001e2 get_dir_listing
|
|
||||||
ffff80000010b0c3 g F .text 000000000000002e putc
|
|
||||||
ffff80000010aa09 g F .text 00000000000001fc mount
|
|
||||||
ffff80000010f0ee g F .text 0000000000000084 strcmp
|
|
||||||
ffff80000010e4ec g F .text 0000000000000380 initrd_init
|
|
||||||
ffff80000010d3b0 g F .text 00000000000000b0 fname_for_inode
|
|
||||||
ffff80000010ae14 g F .text 0000000000000079 fgetc
|
|
||||||
ffff800000111028 g O .bss 0000000000000008 stderr
|
|
||||||
ffff80000010b82a g F .text 000000000000001d port_byte_out
|
|
||||||
ffff80000010b037 g F .text 000000000000008c fputc
|
|
||||||
ffff80000010e992 g F .text 0000000000000039 ceilf
|
|
||||||
ffff80000010b1d3 g F .text 00000000000000be fwrite
|
|
||||||
ffff80000010b847 g F .text 000000000000001c port_word_in
|
|
||||||
ffff80000010cd76 g F .text 00000000000002c1 read_inode_contents
|
|
||||||
ffff80000010f467 g F .text 0000000000000050 append
|
|
||||||
0000000000101118 g .boottext 0000000000000000 long_mode_start
|
|
||||||
0000000000101000 g .boottext 0000000000000000 start
|
|
||||||
ffff80000010a00a g F .text 000000000000032f drv
|
|
||||||
ffff8000001150e0 g O .bss 0000000000000008 blk_size
|
|
||||||
ffff80000010a000 g F .text 000000000000000a kmain
|
|
||||||
ffff80000010f358 g F .text 000000000000010f hex_to_ascii
|
|
||||||
ffff80000010f172 g F .text 000000000000002f strlen
|
|
||||||
ffff80000010f4b7 g F .text 0000000000000038 backspace
|
|
||||||
ffff8000001150e8 g O .bss 0000000000000008 mnts
|
|
||||||
ffff80000010cbf1 g F .text 0000000000000185 write_char
|
|
||||||
ffff80000010b0f1 g F .text 00000000000000b1 fputs
|
|
||||||
ffff80000010c4eb g F .text 0000000000000308 reserve_inode
|
|
||||||
ffff80000010e86c g F .text 000000000000001a __get_errno_address
|
|
||||||
ffff80000010e886 g F .text 000000000000010c klog
|
|
||||||
ffff80000010b291 g F .text 00000000000002ef vfprintf
|
|
||||||
ffff80000010ef9f g F .text 00000000000000af free
|
|
||||||
ffff80000010d224 g F .text 00000000000000cf read_dir_entry
|
|
||||||
|
|
||||||
|
|
@ -1,4 +1,10 @@
|
|||||||
|
#include "../libc/string.h"
|
||||||
|
|
||||||
int _start() {
|
int _start() {
|
||||||
int x=17;
|
int x=17;
|
||||||
return x+strlen("Hi");
|
char str[2];
|
||||||
|
str[0]='h';
|
||||||
|
str[1]='\0';
|
||||||
|
char* vga=0xC00B8000;
|
||||||
|
return x+strlen(str);
|
||||||
}
|
}
|
||||||
|
45
prog/out
45
prog/out
@ -1,45 +0,0 @@
|
|||||||
|
|
||||||
prog.elf: file format elf32-i386
|
|
||||||
prog.elf
|
|
||||||
architecture: i386, flags 0x00000112:
|
|
||||||
EXEC_P, HAS_SYMS, D_PAGED
|
|
||||||
start address 0x08048054
|
|
||||||
|
|
||||||
Program Header:
|
|
||||||
LOAD off 0x00000000 vaddr 0x08048000 paddr 0x08048000 align 2**12
|
|
||||||
filesz 0x000000a4 memsz 0x000000a4 flags r-x
|
|
||||||
|
|
||||||
Sections:
|
|
||||||
Idx Name Size VMA LMA File off Algn
|
|
||||||
0 .text 00000015 08048054 08048054 00000054 2**0
|
|
||||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
|
||||||
1 .eh_frame 00000038 0804806c 0804806c 0000006c 2**2
|
|
||||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
|
||||||
2 .comment 00000011 00000000 00000000 000000a4 2**0
|
|
||||||
CONTENTS, READONLY
|
|
||||||
3 .debug_aranges 00000020 00000000 00000000 000000b5 2**0
|
|
||||||
CONTENTS, READONLY, DEBUGGING
|
|
||||||
4 .debug_info 00000055 00000000 00000000 000000d5 2**0
|
|
||||||
CONTENTS, READONLY, DEBUGGING
|
|
||||||
5 .debug_abbrev 0000004c 00000000 00000000 0000012a 2**0
|
|
||||||
CONTENTS, READONLY, DEBUGGING
|
|
||||||
6 .debug_line 0000003f 00000000 00000000 00000176 2**0
|
|
||||||
CONTENTS, READONLY, DEBUGGING
|
|
||||||
7 .debug_str 00000074 00000000 00000000 000001b5 2**0
|
|
||||||
CONTENTS, READONLY, DEBUGGING
|
|
||||||
SYMBOL TABLE:
|
|
||||||
08048054 l d .text 00000000 .text
|
|
||||||
0804806c l d .eh_frame 00000000 .eh_frame
|
|
||||||
00000000 l d .comment 00000000 .comment
|
|
||||||
00000000 l d .debug_aranges 00000000 .debug_aranges
|
|
||||||
00000000 l d .debug_info 00000000 .debug_info
|
|
||||||
00000000 l d .debug_abbrev 00000000 .debug_abbrev
|
|
||||||
00000000 l d .debug_line 00000000 .debug_line
|
|
||||||
00000000 l d .debug_str 00000000 .debug_str
|
|
||||||
00000000 l df *ABS* 00000000 main.c
|
|
||||||
08048054 g F .text 00000015 _start
|
|
||||||
080490a4 g .eh_frame 00000000 __bss_start
|
|
||||||
080490a4 g .eh_frame 00000000 _edata
|
|
||||||
080490a4 g .eh_frame 00000000 _end
|
|
||||||
|
|
||||||
|
|
56
qemu.log
Normal file
56
qemu.log
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
CPU Reset (CPU 0)
|
||||||
|
EAX=00000000 EBX=00000000 ECX=00000000 EDX=00000000
|
||||||
|
ESI=00000000 EDI=00000000 EBP=00000000 ESP=00000000
|
||||||
|
EIP=00000000 EFL=00000000 [-------] CPL=0 II=0 A20=0 SMM=0 HLT=0
|
||||||
|
ES =0000 00000000 00000000 00000000
|
||||||
|
CS =0000 00000000 00000000 00000000
|
||||||
|
SS =0000 00000000 00000000 00000000
|
||||||
|
DS =0000 00000000 00000000 00000000
|
||||||
|
FS =0000 00000000 00000000 00000000
|
||||||
|
GS =0000 00000000 00000000 00000000
|
||||||
|
LDT=0000 00000000 00000000 00000000
|
||||||
|
TR =0000 00000000 00000000 00000000
|
||||||
|
GDT= 00000000 00000000
|
||||||
|
IDT= 00000000 00000000
|
||||||
|
CR0=00000000 CR2=00000000 CR3=00000000 CR4=00000000
|
||||||
|
DR0=00000000 DR1=00000000 DR2=00000000 DR3=00000000
|
||||||
|
DR6=00000000 DR7=00000000
|
||||||
|
CCS=00000000 CCD=00000000 CCO=DYNAMIC
|
||||||
|
EFER=0000000000000000
|
||||||
|
FCW=0000 FSW=0000 [ST=0] FTW=ff MXCSR=00000000
|
||||||
|
FPR0=0000000000000000 0000 FPR1=0000000000000000 0000
|
||||||
|
FPR2=0000000000000000 0000 FPR3=0000000000000000 0000
|
||||||
|
FPR4=0000000000000000 0000 FPR5=0000000000000000 0000
|
||||||
|
FPR6=0000000000000000 0000 FPR7=0000000000000000 0000
|
||||||
|
XMM00=00000000000000000000000000000000 XMM01=00000000000000000000000000000000
|
||||||
|
XMM02=00000000000000000000000000000000 XMM03=00000000000000000000000000000000
|
||||||
|
XMM04=00000000000000000000000000000000 XMM05=00000000000000000000000000000000
|
||||||
|
XMM06=00000000000000000000000000000000 XMM07=00000000000000000000000000000000
|
||||||
|
CPU Reset (CPU 0)
|
||||||
|
EAX=00000000 EBX=00000000 ECX=00000000 EDX=00000663
|
||||||
|
ESI=00000000 EDI=00000000 EBP=00000000 ESP=00000000
|
||||||
|
EIP=0000fff0 EFL=00000002 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=0
|
||||||
|
ES =0000 00000000 0000ffff 00009300
|
||||||
|
CS =f000 ffff0000 0000ffff 00009b00
|
||||||
|
SS =0000 00000000 0000ffff 00009300
|
||||||
|
DS =0000 00000000 0000ffff 00009300
|
||||||
|
FS =0000 00000000 0000ffff 00009300
|
||||||
|
GS =0000 00000000 0000ffff 00009300
|
||||||
|
LDT=0000 00000000 0000ffff 00008200
|
||||||
|
TR =0000 00000000 0000ffff 00008b00
|
||||||
|
GDT= 00000000 0000ffff
|
||||||
|
IDT= 00000000 0000ffff
|
||||||
|
CR0=60000010 CR2=00000000 CR3=00000000 CR4=00000000
|
||||||
|
DR0=00000000 DR1=00000000 DR2=00000000 DR3=00000000
|
||||||
|
DR6=ffff0ff0 DR7=00000400
|
||||||
|
CCS=00000000 CCD=00000000 CCO=DYNAMIC
|
||||||
|
EFER=0000000000000000
|
||||||
|
FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80
|
||||||
|
FPR0=0000000000000000 0000 FPR1=0000000000000000 0000
|
||||||
|
FPR2=0000000000000000 0000 FPR3=0000000000000000 0000
|
||||||
|
FPR4=0000000000000000 0000 FPR5=0000000000000000 0000
|
||||||
|
FPR6=0000000000000000 0000 FPR7=0000000000000000 0000
|
||||||
|
XMM00=00000000000000000000000000000000 XMM01=00000000000000000000000000000000
|
||||||
|
XMM02=00000000000000000000000000000000 XMM03=00000000000000000000000000000000
|
||||||
|
XMM04=00000000000000000000000000000000 XMM05=00000000000000000000000000000000
|
||||||
|
XMM06=00000000000000000000000000000000 XMM07=00000000000000000000000000000000
|
Loading…
Reference in New Issue
Block a user