Remove long mode env
This commit is contained in:
parent
ab2934be1b
commit
e10fe99d05
@ -1,183 +0,0 @@
|
||||
section .multiboot
|
||||
header_start:
|
||||
dd 0xe85250d6 ; magic number (multiboot 2)
|
||||
dd 0 ; architecture 0 (protected mode i386)
|
||||
dd header_end - header_start ; header length
|
||||
; checksum
|
||||
dd 0x100000000 - (0xe85250d6 + 0 + (header_end - header_start))
|
||||
|
||||
; insert optional multiboot tags here
|
||||
|
||||
; required end tag
|
||||
dw 0 ; type
|
||||
dw 0 ; flags
|
||||
dd 8 ; size
|
||||
header_end:
|
||||
|
||||
global start
|
||||
extern long_mode_start
|
||||
|
||||
section .boot.text
|
||||
bits 32
|
||||
start:
|
||||
mov esp, stack_top
|
||||
|
||||
call check_multiboot
|
||||
call check_cpuid
|
||||
call check_long_mode
|
||||
|
||||
call set_up_page_tables
|
||||
call enable_paging
|
||||
|
||||
lgdt [gdt64.pointer]
|
||||
jmp 0x08:long_mode_start
|
||||
|
||||
; print `NO` to screen
|
||||
mov dword [0xb8000], 0x4f4f4f4e
|
||||
hlt
|
||||
|
||||
check_multiboot:
|
||||
cmp eax, 0x36d76289
|
||||
jne .no_multiboot
|
||||
ret
|
||||
.no_multiboot:
|
||||
mov al, "0"
|
||||
jmp error
|
||||
|
||||
check_cpuid:
|
||||
; Check if CPUID is supported by attempting to flip the ID bit (bit 21)
|
||||
; in the FLAGS register. If we can flip it, CPUID is available.
|
||||
|
||||
; Copy FLAGS in to EAX via stack
|
||||
pushfd
|
||||
pop eax
|
||||
|
||||
; Copy to ECX as well for comparing later on
|
||||
mov ecx, eax
|
||||
|
||||
; Flip the ID bit
|
||||
xor eax, 1 << 21
|
||||
|
||||
; Copy EAX to FLAGS via the stack
|
||||
push eax
|
||||
popfd
|
||||
|
||||
; Copy FLAGS back to EAX (with the flipped bit if CPUID is supported)
|
||||
pushfd
|
||||
pop eax
|
||||
|
||||
; Restore FLAGS from the old version stored in ECX (i.e. flipping the
|
||||
; ID bit back if it was ever flipped).
|
||||
push ecx
|
||||
popfd
|
||||
|
||||
; Compare EAX and ECX. If they are equal then that means the bit
|
||||
; wasn't flipped, and CPUID isn't supported.
|
||||
cmp eax, ecx
|
||||
je .no_cpuid
|
||||
ret
|
||||
.no_cpuid:
|
||||
mov al, "1"
|
||||
jmp error
|
||||
|
||||
check_long_mode:
|
||||
; test if extended processor info in available
|
||||
mov eax, 0x80000000 ; implicit argument for cpuid
|
||||
cpuid ; get highest supported argument
|
||||
cmp eax, 0x80000001 ; it needs to be at least 0x80000001
|
||||
jb .no_long_mode ; if it's less, the CPU is too old for long mode
|
||||
|
||||
; use extended info to test if long mode is available
|
||||
mov eax, 0x80000001 ; argument for extended processor info
|
||||
cpuid ; returns various feature bits in ecx and edx
|
||||
test edx, 1 << 29 ; test if the LM-bit is set in the D-register
|
||||
jz .no_long_mode ; If it's not set, there is no long mode
|
||||
ret
|
||||
.no_long_mode:
|
||||
mov al, "2"
|
||||
jmp error
|
||||
|
||||
set_up_page_tables:
|
||||
; map first P4 entry to P3 table
|
||||
mov eax, p3_table
|
||||
or eax, 0b11 ; present + writable
|
||||
mov [p4_table], eax
|
||||
|
||||
; map 256th P4 entry to P3 table
|
||||
mov eax, p3_table
|
||||
or eax, 0b11 ; present + writable
|
||||
mov [p4_table+256*8], eax
|
||||
|
||||
; map first P3 entry to P2 table
|
||||
mov eax, p2_table
|
||||
or eax, 0b11 ; present + writable
|
||||
mov [p3_table], eax
|
||||
|
||||
; map each P2 entry to a huge 2MiB page
|
||||
mov ecx, 0 ; counter variable
|
||||
|
||||
.map_p2_table:
|
||||
; map ecx-th P2 entry to a huge page that starts at address 2MiB*ecx
|
||||
mov eax, 0x200000 ; 2MiB
|
||||
mul ecx ; start address of ecx-th page
|
||||
or eax, 0b10000011 ; present + writable + huge
|
||||
mov [p2_table + ecx * 8], eax ; map ecx-th entry
|
||||
|
||||
inc ecx ; increase counter
|
||||
cmp ecx, 4 ; if counter == 4, we have mapped enough pages
|
||||
jne .map_p2_table ; else map the next entry
|
||||
|
||||
ret
|
||||
|
||||
enable_paging:
|
||||
; load P4 to cr3 register (cpu uses this to access the P4 table)
|
||||
mov eax, p4_table
|
||||
mov cr3, eax
|
||||
|
||||
; enable PAE-flag in cr4 (Physical Address Extension)
|
||||
mov eax, cr4
|
||||
or eax, 1 << 5
|
||||
mov cr4, eax
|
||||
|
||||
; set the long mode bit in the EFER MSR (model specific register)
|
||||
mov ecx, 0xC0000080
|
||||
rdmsr
|
||||
or eax, 1 << 8
|
||||
wrmsr
|
||||
|
||||
; enable paging in the cr0 register
|
||||
mov eax, cr0
|
||||
or eax, 1 << 31
|
||||
mov cr0, eax
|
||||
|
||||
ret
|
||||
|
||||
; Prints `ERR: ` and the given error code to screen and hangs.
|
||||
; parameter: error code (in ascii) in al
|
||||
error:
|
||||
mov dword [0xb8000], 0x4f524f45
|
||||
mov dword [0xb8004], 0x4f3a4f52
|
||||
mov dword [0xb8008], 0x4f204f20
|
||||
mov byte [0xb800a], al
|
||||
hlt
|
||||
|
||||
section .boot.bss
|
||||
align 4096
|
||||
p4_table:
|
||||
resb 4096
|
||||
p3_table:
|
||||
resb 4096
|
||||
p2_table:
|
||||
resb 4096
|
||||
stack_bottom:
|
||||
resb 4096*4
|
||||
stack_top:
|
||||
|
||||
section .boot.rodata
|
||||
gdt64:
|
||||
dq 0 ; zero entry
|
||||
dq (1<<43) | (1<<44) | (1<<47) | (1<<53) ; code segment
|
||||
dq (1<<43) | (1<<44) | (1<<45) | (1<<46) | (1<<47) | (1<<53) ; user code segment
|
||||
.pointer:
|
||||
dw $ - gdt64 - 1
|
||||
dq gdt64
|
@ -1,52 +0,0 @@
|
||||
ENTRY(start)
|
||||
|
||||
PHDRS {
|
||||
boot PT_LOAD FILEHDR PHDRS;
|
||||
kernel PT_NULL;
|
||||
}
|
||||
|
||||
SECTIONS {
|
||||
. = 1M;
|
||||
|
||||
.multiboot :
|
||||
{
|
||||
*(.multiboot)
|
||||
} :boot
|
||||
|
||||
.boot.text ALIGN (4K) :
|
||||
{
|
||||
*(.boot.text)
|
||||
} :boot
|
||||
|
||||
.boot.rodata ALIGN (4K) :
|
||||
{
|
||||
*(.boot.rodata)
|
||||
} :boot
|
||||
.boot.data ALIGN (4K) :
|
||||
{
|
||||
*(.boot.data)
|
||||
} :boot
|
||||
.boot.bss ALIGN (4K) :
|
||||
{
|
||||
*(.boot.bss)
|
||||
} :boot
|
||||
|
||||
. = 0xffff800000100000;
|
||||
|
||||
.text ALIGN (4K) : AT (ADDR (.text) - 0xfff800000000000)
|
||||
{
|
||||
*(.text)
|
||||
} :kernel
|
||||
.rodata ALIGN (4K) : AT (ADDR (.rodata) - 0xfff800000000000)
|
||||
{
|
||||
*(.rodata)
|
||||
} :kernel
|
||||
.data ALIGN (4K) : AT (ADDR (.data) - 0xfff800000000000)
|
||||
{
|
||||
*(.data)
|
||||
} :kernel
|
||||
.bss ALIGN (4K) : AT (ADDR (.bss) - 0xfff800000000000)
|
||||
{
|
||||
*(.bss)
|
||||
} :kernel
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
global long_mode_start
|
||||
extern kmain
|
||||
|
||||
section .boot.text
|
||||
bits 64
|
||||
long_mode_start:
|
||||
mov rax,kmain
|
||||
call rax
|
||||
loop: jmp loop
|
@ -1,31 +0,0 @@
|
||||
#include <stdint.h>
|
||||
|
||||
uint8_t port_byte_in(uint16_t port) {
|
||||
uint8_t result;
|
||||
asm("in %%dx, %%al":"=a"(result):"d"(port));
|
||||
return result;
|
||||
}
|
||||
|
||||
void port_byte_out(uint16_t port,uint8_t data) {
|
||||
asm("out %%al, %%dx":: "a"(data),"d"(port));
|
||||
}
|
||||
|
||||
uint16_t port_word_in(uint16_t port) {
|
||||
uint16_t result;
|
||||
asm("in %%dx, %%ax":"=a"(result):"d"(port));
|
||||
return result;
|
||||
}
|
||||
|
||||
void port_word_out(uint16_t port,uint16_t data) {
|
||||
asm("out %%ax, %%dx":: "a" (data), "d" (port));
|
||||
}
|
||||
|
||||
uint32_t port_long_in(uint16_t port) {
|
||||
uint32_t result;
|
||||
asm("inl %%dx, %%eax":"=a"(result):"d"(port));
|
||||
return result;
|
||||
}
|
||||
|
||||
void port_long_out(uint16_t port,uint32_t data) {
|
||||
asm("outl %%eax, %%dx":: "a" (data), "d" (port));
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
#ifndef PORTS_H
|
||||
#define PORTS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint8_t port_byte_in(uint16_t port);
|
||||
void port_byte_out(uint16_t port,uint8_t data);
|
||||
uint16_t port_word_in(uint16_t port);
|
||||
void port_word_out(uint16_t port,uint16_t data);
|
||||
uint32_t port_long_in(uint16_t port);
|
||||
void port_long_out(uint16_t port,uint32_t data);
|
||||
#endif
|
@ -1,84 +0,0 @@
|
||||
#include <grub/text_fb_info.h>
|
||||
#include "../vga.h"
|
||||
#include "../../cpu/i386/ports.h"
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#define xy_to_indx(x,y) ((x+(y*width))*2)
|
||||
static char* screen;
|
||||
static int width;
|
||||
static int height;
|
||||
static int x;
|
||||
static int y;
|
||||
static vga_colors fg_color;
|
||||
static vga_colors bg_color;
|
||||
|
||||
static void set_char(int x,int y,char c) {
|
||||
screen[xy_to_indx(x,y)]=c;
|
||||
screen[xy_to_indx(x,y)+1]=(bg_color<<4)|fg_color;
|
||||
}
|
||||
|
||||
void vga_clear() {
|
||||
for (int y=0;y<height;y++) {
|
||||
for (int x=0;x<width;x++) {
|
||||
set_char(x,y,' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void set_cursor(int x,int y) {
|
||||
int pos=(x+(y*width));
|
||||
port_byte_out(0x3D4,0xF);
|
||||
port_byte_out(0x3D5,pos&0xFF);
|
||||
port_byte_out(0x3D4,0xE);
|
||||
port_byte_out(0x3D5,(pos&0xFF00)>>8);
|
||||
}
|
||||
|
||||
void vga_init(text_fb_info framebuffer_info) {
|
||||
x=0;
|
||||
y=0;
|
||||
fg_color=VGA_WHITE;
|
||||
bg_color=VGA_BLACK;
|
||||
screen=framebuffer_info.address;
|
||||
width=framebuffer_info.width;
|
||||
height=framebuffer_info.height;
|
||||
port_byte_out(0x3D4,0xA);
|
||||
port_byte_out(0x3D5,(port_byte_in(0x3D5)&0xC0)|14);
|
||||
port_byte_out(0x3D4,0xB);
|
||||
port_byte_out(0x3D5,(port_byte_in(0x3D5)&0xE0)|15);
|
||||
set_cursor(0,0);
|
||||
vga_clear();
|
||||
}
|
||||
|
||||
void vga_write_string(const char* string) {
|
||||
for (size_t i=0;i<strlen(string);i++) {
|
||||
char c=string[i];
|
||||
if (c=='\n') {
|
||||
x=0;
|
||||
y++;
|
||||
} else {
|
||||
set_char(x,y,c);
|
||||
x++;
|
||||
}
|
||||
if (x==width) {
|
||||
x=0;
|
||||
y++;
|
||||
}
|
||||
if (y==height) {
|
||||
x=0;
|
||||
y=0;
|
||||
// char* pg1=(char*)((uint32_t)screen+0xfa0);
|
||||
// memcpy(pg1,&screen[xy_to_indx(0,1)],xy_to_indx(0,24));
|
||||
// vga_clear();
|
||||
// memcpy(&screen,pg1,xy_to_indx(0,25));
|
||||
}
|
||||
}
|
||||
set_cursor(x,y);
|
||||
}
|
||||
|
||||
void vga_backspace() {
|
||||
if (x!=0) {
|
||||
x--;
|
||||
set_char(x,y,' ');
|
||||
set_cursor(x,y);
|
||||
}
|
||||
}
|
286
kernel/kernel.c
286
kernel/kernel.c
@ -1,164 +1,164 @@
|
||||
// #include "../cpu/cpu_init.h"
|
||||
#include "../cpu/cpu_init.h"
|
||||
#include "../drivers/vga.h"
|
||||
// #include "../drivers/pci.h"
|
||||
// #include "../drivers/serial.h"
|
||||
// #include "../cpu/i386/ports.h"
|
||||
// #include "vfs.h"
|
||||
// #include "../fs/devfs.h"
|
||||
// #include "../fs/initrd.h"
|
||||
#include "../drivers/pci.h"
|
||||
#include "../drivers/serial.h"
|
||||
#include "../cpu/i386/ports.h"
|
||||
#include "vfs.h"
|
||||
#include "../fs/devfs.h"
|
||||
#include "../fs/initrd.h"`
|
||||
#include <grub/text_fb_info.h>
|
||||
// #include <stdlib.h>
|
||||
// #include <tasking.h>
|
||||
// #include <string.h>
|
||||
// #include <memory.h>
|
||||
#include <stdlib.h>
|
||||
#include <tasking.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <grub/multiboot.h>
|
||||
// #include "klog.h"
|
||||
// #include "elf.h"
|
||||
// #include <errno.h>
|
||||
// #include "../drivers/ide.h"
|
||||
// #include "parts.h"
|
||||
// #include "../fs/ext2.h"
|
||||
#include "klog.h"
|
||||
#include "elf.h"
|
||||
#include <errno.h>
|
||||
#include "../drivers/ide.h"
|
||||
#include "parts.h"
|
||||
#include "../fs/ext2.h"
|
||||
#include <stdint.h>
|
||||
|
||||
// static long initrd_sz;
|
||||
// static char* initrd;
|
||||
static long initrd_sz;
|
||||
static char* initrd;
|
||||
static multiboot_info_t* mbd;
|
||||
// typedef int (*func_ptr)();
|
||||
//
|
||||
// static int console_dev_drv(char* filename,int c,long pos,char wr) {
|
||||
// if (wr) {
|
||||
// if (c=='\f') {
|
||||
// vga_clear();
|
||||
// } else if (c=='\b') {
|
||||
// vga_backspace();
|
||||
// }
|
||||
// char str[2];
|
||||
// str[0]=(char)c;
|
||||
// str[1]='\0';
|
||||
// vga_write_string(str);
|
||||
// return 0;
|
||||
// } else {
|
||||
// return 0;
|
||||
// // return devbuf_get(kbd_buf);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// static int initrd_dev_drv(char* filename,int c,long pos,char wr) {
|
||||
// if (wr) {
|
||||
// return 0;
|
||||
// }
|
||||
// if (pos>=initrd_sz) {
|
||||
// return EOF;
|
||||
// }
|
||||
// return initrd[pos];
|
||||
// }
|
||||
//
|
||||
// static void read_initrd(multiboot_info_t* mbd) {
|
||||
// if ((mbd->flags&MULTIBOOT_INFO_MODS)!=0) {
|
||||
// uint32_t mods_count=mbd->mods_count;
|
||||
// if (mods_count>0) {
|
||||
// while (mods_count>0) {
|
||||
// multiboot_module_t* mods_addr=(multiboot_module_t*)(mbd->mods_addr+0xC0000000);
|
||||
// if (strcmp((char*)(mods_addr->cmdline+0xC0000000),"initrd")==0) {
|
||||
// initrd=malloc(sizeof(char)*(mods_addr->mod_end-mods_addr->mod_start));
|
||||
// initrd_sz=(mods_addr->mod_end-mods_addr->mod_start);
|
||||
// memcpy(initrd,(void*)mods_addr->mod_start+0xC0000000,initrd_sz);
|
||||
// };
|
||||
// mods_count--;
|
||||
// }
|
||||
// }
|
||||
// } 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() {
|
||||
// init_vfs();
|
||||
// init_devfs();
|
||||
// devfs_add(console_dev_drv,"console");
|
||||
// stdout=fopen("/dev/console","w");
|
||||
// stdin=fopen("/dev/console","r");
|
||||
// stderr=fopen("/dev/console","w");
|
||||
// read_initrd(mbd);
|
||||
// devfs_add(initrd_dev_drv,"initrd");
|
||||
// initrd_init();
|
||||
// mount("/initrd/","","initrd");
|
||||
// // Detect PCI
|
||||
// port_long_out(0xCF8,(1<<31));
|
||||
// uint32_t word=port_long_in(0xCFC);
|
||||
// port_long_out(0xCF8,(1<<31)|0x4);
|
||||
// if (word!=port_long_in(0xCFC)) {
|
||||
// // pci_init();
|
||||
// }
|
||||
// // Detect and initailize serial ports
|
||||
// serial_init();
|
||||
// FILE* file=fopen("/initrd/prog.elf","r");
|
||||
// elf_header header;
|
||||
// fread(&header,sizeof(elf_header),1,file);
|
||||
// if (header.magic!=ELF_MAGIC) {
|
||||
// klog("INFO","Invalid magic number for prog.elf");
|
||||
// fclose(file);
|
||||
// } else {
|
||||
// fseek(file,header.prog_hdr,SEEK_SET);
|
||||
// elf_pheader pheader;
|
||||
// fread(&pheader,sizeof(elf_pheader),1,file);
|
||||
// alloc_memory_virt(1,(void*)pheader.vaddr);
|
||||
// fseek(file,pheader.offset,SEEK_SET);
|
||||
// fread((void*)pheader.vaddr,pheader.filesz,1,file);
|
||||
// klog("INFO","VADDR:%x",pheader.vaddr);
|
||||
// func_ptr prog=(func_ptr)header.entry;
|
||||
// int val=prog();
|
||||
// klog("INFO","RAN PROG:%d",val);
|
||||
// }
|
||||
// ide_init();
|
||||
// load_parts("/dev/hda");
|
||||
// init_ext2();
|
||||
// mount("/","/dev/hda1","ext2");
|
||||
// klog("INFO","MOUNT");
|
||||
// FILE* f=fopen("/file","r");
|
||||
// char str[256];
|
||||
// fgets(str,256,f);
|
||||
// str[strlen(str)-1]='\0';
|
||||
// klog("INFO","Got string %s",str);
|
||||
// for(;;) {
|
||||
// yield();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
typedef int (*func_ptr)();
|
||||
|
||||
static int console_dev_drv(char* filename,int c,long pos,char wr) {
|
||||
if (wr) {
|
||||
if (c=='\f') {
|
||||
vga_clear();
|
||||
} else if (c=='\b') {
|
||||
vga_backspace();
|
||||
}
|
||||
char str[2];
|
||||
str[0]=(char)c;
|
||||
str[1]='\0';
|
||||
vga_write_string(str);
|
||||
return 0;
|
||||
} else {
|
||||
return 0;
|
||||
// return devbuf_get(kbd_buf);
|
||||
}
|
||||
}
|
||||
|
||||
static int initrd_dev_drv(char* filename,int c,long pos,char wr) {
|
||||
if (wr) {
|
||||
return 0;
|
||||
}
|
||||
if (pos>=initrd_sz) {
|
||||
return EOF;
|
||||
}
|
||||
return initrd[pos];
|
||||
}
|
||||
|
||||
static void read_initrd(multiboot_info_t* mbd) {
|
||||
if ((mbd->flags&MULTIBOOT_INFO_MODS)!=0) {
|
||||
uint32_t mods_count=mbd->mods_count;
|
||||
if (mods_count>0) {
|
||||
while (mods_count>0) {
|
||||
multiboot_module_t* mods_addr=(multiboot_module_t*)(mbd->mods_addr+0xC0000000);
|
||||
if (strcmp((char*)(mods_addr->cmdline+0xC0000000),"initrd")==0) {
|
||||
initrd=malloc(sizeof(char)*(mods_addr->mod_end-mods_addr->mod_start));
|
||||
initrd_sz=(mods_addr->mod_end-mods_addr->mod_start);
|
||||
memcpy(initrd,(void*)mods_addr->mod_start+0xC0000000,initrd_sz);
|
||||
};
|
||||
mods_count--;
|
||||
}
|
||||
}
|
||||
} 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() {
|
||||
init_vfs();
|
||||
init_devfs();
|
||||
devfs_add(console_dev_drv,"console");
|
||||
stdout=fopen("/dev/console","w");
|
||||
stdin=fopen("/dev/console","r");
|
||||
stderr=fopen("/dev/console","w");
|
||||
read_initrd(mbd);
|
||||
devfs_add(initrd_dev_drv,"initrd");
|
||||
initrd_init();
|
||||
mount("/initrd/","","initrd");
|
||||
// Detect PCI
|
||||
port_long_out(0xCF8,(1<<31));
|
||||
uint32_t word=port_long_in(0xCFC);
|
||||
port_long_out(0xCF8,(1<<31)|0x4);
|
||||
if (word!=port_long_in(0xCFC)) {
|
||||
// pci_init();
|
||||
}
|
||||
// Detect and initailize serial ports
|
||||
serial_init();
|
||||
FILE* file=fopen("/initrd/prog.elf","r");
|
||||
elf_header header;
|
||||
fread(&header,sizeof(elf_header),1,file);
|
||||
if (header.magic!=ELF_MAGIC) {
|
||||
klog("INFO","Invalid magic number for prog.elf");
|
||||
fclose(file);
|
||||
} else {
|
||||
fseek(file,header.prog_hdr,SEEK_SET);
|
||||
elf_pheader pheader;
|
||||
fread(&pheader,sizeof(elf_pheader),1,file);
|
||||
alloc_memory_virt(1,(void*)pheader.vaddr);
|
||||
fseek(file,pheader.offset,SEEK_SET);
|
||||
fread((void*)pheader.vaddr,pheader.filesz,1,file);
|
||||
klog("INFO","VADDR:%x",pheader.vaddr);
|
||||
func_ptr prog=(func_ptr)header.entry;
|
||||
int val=prog();
|
||||
klog("INFO","RAN PROG:%d",val);
|
||||
}
|
||||
ide_init();
|
||||
load_parts("/dev/hda");
|
||||
init_ext2();
|
||||
mount("/","/dev/hda1","ext2");
|
||||
klog("INFO","MOUNT");
|
||||
FILE* f=fopen("/file","r");
|
||||
char str[256];
|
||||
fgets(str,256,f);
|
||||
str[strlen(str)-1]='\0';
|
||||
klog("INFO","Got string %s",str);
|
||||
for(;;) {
|
||||
yield();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void func() {
|
||||
for (;;);
|
||||
}
|
||||
|
||||
void kmain(multiboot_info_t* header) {
|
||||
// void (*ptr)()=((uint64_t)func)+0x800000000000;
|
||||
// ptr();
|
||||
void (*ptr)()=((uint64_t)func)+0x800000000000;
|
||||
ptr();
|
||||
mbd=header;
|
||||
//cpu_init(mbd);
|
||||
cpu_init(mbd);
|
||||
text_fb_info info;
|
||||
// if (header->flags&MULTIBOOT_INFO_FRAMEBUFFER_INFO&&header->framebuffer_type==2) {
|
||||
// info.address=(char*)(((uint32_t)header->framebuffer_addr&0xFFFFFFFF)+0xC0000000);
|
||||
// info.width=header->framebuffer_width;
|
||||
// info.height=header->framebuffer_height;
|
||||
// } else {
|
||||
//info.address=(char*)0xB8000;
|
||||
if (header->flags&MULTIBOOT_INFO_FRAMEBUFFER_INFO&&header->framebuffer_type==2) {
|
||||
info.address=(char*)(((uint32_t)header->framebuffer_addr&0xFFFFFFFF)+0xC0000000);
|
||||
info.width=header->framebuffer_width;
|
||||
info.height=header->framebuffer_height;
|
||||
} else {
|
||||
info.address=(char*)0xB8000;
|
||||
info.address=(char*)0xffff8000000B8000;
|
||||
info.width=80;
|
||||
info.height=25;
|
||||
//}
|
||||
}
|
||||
vga_init(info);
|
||||
vga_write_string("OKAY\n");
|
||||
//createTask(init);
|
||||
// for (;;) {
|
||||
// yield();
|
||||
// }
|
||||
// static char* screen=(char*)0xB8000;
|
||||
// screen[0]='O';
|
||||
// screen[1]=0x2f;
|
||||
createTask(init);
|
||||
for (;;) {
|
||||
yield();
|
||||
}
|
||||
static char* screen=(char*)0xB8000;
|
||||
screen[0]='O';
|
||||
screen[1]=0x2f;
|
||||
for(;;);
|
||||
}
|
||||
|
394
out386
394
out386
@ -1,394 +0,0 @@
|
||||
|
||||
iso/boot/kernel.elf: file format elf32-i386
|
||||
iso/boot/kernel.elf
|
||||
architecture: i386, flags 0x00000112:
|
||||
EXEC_P, HAS_SYMS, D_PAGED
|
||||
start address 0xc010006b
|
||||
|
||||
Program Header:
|
||||
LOAD off 0x00001000 vaddr 0xc0100000 paddr 0x00100000 align 2**12
|
||||
filesz 0x0000a088 memsz 0x0014384c flags rwx
|
||||
|
||||
Sections:
|
||||
Idx Name Size VMA LMA File off Algn
|
||||
0 .text 00007212 c0100000 00100000 00001000 2**4
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
1 .rodata 00000674 c0108000 00108000 00009000 2**4
|
||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
||||
2 .eh_frame 00001588 c0108674 00108674 00009674 2**2
|
||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
||||
3 .data 00000088 c010a000 0010a000 0000b000 2**5
|
||||
CONTENTS, ALLOC, LOAD, DATA
|
||||
4 .bss 0013484c c010b000 0010b000 0000b088 2**12
|
||||
ALLOC
|
||||
5 .interrupt_stack 00004000 c023f84c 0023f84c 0000b088 2**0
|
||||
ALLOC
|
||||
6 .debug_info 00008758 00000000 00000000 0000b088 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
7 .debug_abbrev 00002572 00000000 00000000 000137e0 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
8 .debug_aranges 000003a0 00000000 00000000 00015d52 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
9 .debug_line 000041fa 00000000 00000000 000160f2 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
10 .debug_str 0000238c 00000000 00000000 0001a2ec 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
11 .comment 00000011 00000000 00000000 0001c678 2**0
|
||||
CONTENTS, READONLY
|
||||
12 .debug_ranges 00000160 00000000 00000000 0001c689 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
13 .debug_loc 00000f10 00000000 00000000 0001c7e9 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
SYMBOL TABLE:
|
||||
c0100000 l d .text 00000000 .text
|
||||
c0108000 l d .rodata 00000000 .rodata
|
||||
c0108674 l d .eh_frame 00000000 .eh_frame
|
||||
c010a000 l d .data 00000000 .data
|
||||
c010b000 l d .bss 00000000 .bss
|
||||
c023f84c l d .interrupt_stack 00000000 .interrupt_stack
|
||||
00000000 l d .debug_info 00000000 .debug_info
|
||||
00000000 l d .debug_abbrev 00000000 .debug_abbrev
|
||||
00000000 l d .debug_aranges 00000000 .debug_aranges
|
||||
00000000 l d .debug_line 00000000 .debug_line
|
||||
00000000 l d .debug_str 00000000 .debug_str
|
||||
00000000 l d .comment 00000000 .comment
|
||||
00000000 l d .debug_ranges 00000000 .debug_ranges
|
||||
00000000 l d .debug_loc 00000000 .debug_loc
|
||||
00000000 l df *ABS* 00000000 cpu/i386/boot.o
|
||||
00000001 l *ABS* 00000000 ALIGN
|
||||
00000002 l *ABS* 00000000 MEMINFO
|
||||
00000003 l *ABS* 00000000 FLAGS
|
||||
1badb002 l *ABS* 00000000 MAGIC
|
||||
e4524ffb l *ABS* 00000000 CHECKSUM
|
||||
c023b84c l .bss 00000000 stack_bottom
|
||||
c023f84c l .bss 00000000 stack_top
|
||||
c023f84c l .interrupt_stack 00000000 int_stack_bottom
|
||||
c010c000 l .bss 00000000 boot_page_directory
|
||||
c010d000 l .bss 00000000 boot_page_tables
|
||||
c010d000 l .bss 00000000 boot_page_table1
|
||||
c010e000 l .bss 00000000 boot_page_table2
|
||||
c01000ee l .text 00000000 no_multiboot
|
||||
c01000ee l .text 00000000 loop
|
||||
00000000 l df *ABS* 00000000 kernel.c
|
||||
c010b02c l O .bss 00000004 mbd
|
||||
00000000 l df *ABS* 00000000 parts.c
|
||||
c010f000 l O .bss 00000004 part_devs
|
||||
c010f004 l O .bss 00000004 parts
|
||||
c010f008 l O .bss 00000004 num_part_devs
|
||||
c010f00c l O .bss 00000004 max_part_devs
|
||||
00000000 l df *ABS* 00000000 vfs.c
|
||||
c010f01c l O .bss 00000004 drv_names
|
||||
c010f020 l O .bss 00000004 drvs
|
||||
c010f024 l O .bss 00000004 max_drvs
|
||||
c010f028 l O .bss 00000004 next_drv_indx
|
||||
c010f02c l O .bss 00000004 head_mapping
|
||||
c010f030 l O .bss 00000004 tail_mapping
|
||||
c01005ba l F .text 00000074 vfsstrcmp
|
||||
00000000 l df *ABS* 00000000 ide.c
|
||||
c010f040 l O .bss 00000800 ident
|
||||
c010f840 l O .bss 00000004 sect_data
|
||||
c010f844 l O .bss 00000004 last_read_sector
|
||||
c010f848 l O .bss 00000004 last_read_base
|
||||
c010f84c l O .bss 00000004 last_read_slave
|
||||
c0100ffb l F .text 000001d6 read_sect
|
||||
c01011d1 l F .text 00000222 write_sect
|
||||
c01013f3 l F .text 0000015f drv
|
||||
00000000 l df *ABS* 00000000 pci.c
|
||||
c010f850 l O .bss 00000004 max_devs
|
||||
c010195b l F .text 0000008d read_config
|
||||
c01019e8 l F .text 0000008b write_config
|
||||
c0101c2e l F .text 000000b3 checkDevice
|
||||
c0101ce1 l F .text 0000018a checkFunction
|
||||
00000000 l df *ABS* 00000000 serial.c
|
||||
c010f854 l O .bss 00000010 bufs
|
||||
c0101ee0 l F .text 00000048 data_port
|
||||
c0101f28 l F .text 00000048 int_port
|
||||
c0101f70 l F .text 00000048 fifo_port
|
||||
c0101fb8 l F .text 00000048 line_cmd_port
|
||||
c0102000 l F .text 00000048 modem_port
|
||||
c0102048 l F .text 00000048 line_stat_port
|
||||
c0102090 l F .text 00000048 scratch_port
|
||||
c01020d8 l F .text 00000077 configure_baud_rate
|
||||
c010214f l F .text 00000028 is_transmit_fifo_empty
|
||||
c0102177 l F .text 000000a9 configure
|
||||
c0102220 l F .text 000000b9 drv
|
||||
00000000 l df *ABS* 00000000 vga.c
|
||||
c010f864 l O .bss 00000004 screen
|
||||
c010f868 l O .bss 00000004 width
|
||||
c010f86c l O .bss 00000004 height
|
||||
c010f870 l O .bss 00000004 x
|
||||
c010f874 l O .bss 00000004 y
|
||||
c010f878 l O .bss 00000004 fg_color
|
||||
c010f87c l O .bss 00000004 bg_color
|
||||
c0102489 l F .text 00000065 set_char
|
||||
c0102533 l F .text 00000071 set_cursor
|
||||
00000000 l df *ABS* 00000000 cpu_init.c
|
||||
00000000 l df *ABS* 00000000 gdt.c
|
||||
c010f880 l O .bss 00000030 gdt
|
||||
c010f8b0 l O .bss 00000006 gdt_desc
|
||||
c010f8c0 l O .bss 00002069 tss
|
||||
c01027e3 l F .text 0000007a set_entry
|
||||
c010285d l F .text 000000f6 write_tss
|
||||
00000000 l df *ABS* 00000000 halt.c
|
||||
c0102a5b l .text 00000000 hltlabel
|
||||
00000000 l df *ABS* 00000000 idt.c
|
||||
c0111940 l O .bss 00000800 idt
|
||||
c0112140 l O .bss 00000006 idt_reg
|
||||
00000000 l df *ABS* 00000000 isr.c
|
||||
c0112160 l O .bss 00000400 interrupt_handlers
|
||||
c010a000 l O .data 00000080 exception_messages
|
||||
00000000 l df *ABS* 00000000 kmalloc.c
|
||||
c0112560 l O .bss 00100000 bitmap
|
||||
c010a080 l O .data 00000004 data
|
||||
c0103162 l F .text 00000045 get_bmap_bit
|
||||
c01031a7 l F .text 00000044 set_bmap_bit
|
||||
c01031eb l F .text 00000046 clear_bmap_bit
|
||||
00000000 l df *ABS* 00000000 paging.c
|
||||
c0213000 l O .bss 00001000 page_directory
|
||||
c0214000 l O .bss 00002000 kern_page_tables
|
||||
c0216000 l O .bss 00001000 kmalloc_page_tables
|
||||
c0217000 l O .bss 00002000 smap_page_tables
|
||||
c010a084 l O .data 00000004 smap
|
||||
c01033df l F .text 00000073 is_page_present
|
||||
00000000 l df *ABS* 00000000 pmem.c
|
||||
c0219000 l O .bss 00020000 bmap
|
||||
c010391c l F .text 00000057 get_bmap_bit
|
||||
c0103973 l F .text 00000056 set_bmap_bit
|
||||
c01039c9 l F .text 00000058 clear_bmap_bit
|
||||
00000000 l df *ABS* 00000000 ports.c
|
||||
00000000 l df *ABS* 00000000 tasking.c
|
||||
c0239000 l O .bss 00000004 currentTask
|
||||
c0239004 l O .bss 00000004 headTask
|
||||
c0103d46 l F .text 00000157 createTaskKmode
|
||||
00000000 l df *ABS* 00000000 devfs.c
|
||||
c0239008 l O .bss 00000004 devices
|
||||
c023900c l O .bss 00000004 dev_drivers
|
||||
c0239010 l O .bss 00000004 num_devices
|
||||
c0239014 l O .bss 00000004 max_devices
|
||||
00000000 l df *ABS* 00000000 ext2.c
|
||||
c0104476 l F .text 00000045 get_bmap_bit
|
||||
c01044bb l F .text 0000004a set_bmap_bit
|
||||
c010540c l F .text 00000871 drv
|
||||
00000000 l df *ABS* 00000000 initrd.c
|
||||
c0239018 l O .bss 00000004 names
|
||||
c023901c l O .bss 00000004 offsets
|
||||
c0239020 l O .bss 00000004 sizes
|
||||
c0239024 l O .bss 00000004 num_files
|
||||
c0239028 l O .bss 00000004 initrd_fd
|
||||
c0105d2d l F .text 00000144 drv
|
||||
00000000 l df *ABS* 00000000 cpu/i386/interrupt.asm
|
||||
c01060f0 l .text 00000000 isr_common_stub
|
||||
c0106115 l .text 00000000 irq_common_stub
|
||||
00000000 l df *ABS* 00000000 cpu/i386/paging_helpers.asm
|
||||
00000000 l df *ABS* 00000000 cpu/i386/seg_upd.asm
|
||||
c0106327 l .text 00000000 code_upd
|
||||
00000000 l df *ABS* 00000000 devbuf.c
|
||||
00000000 l df *ABS* 00000000 errno.c
|
||||
00000000 l df *ABS* 00000000 klog.c
|
||||
00000000 l df *ABS* 00000000 math.c
|
||||
00000000 l df *ABS* 00000000 stdlib.c
|
||||
c0239040 l O .bss 00002800 entries
|
||||
c023b840 l O .bss 00000004 num_used_entries
|
||||
c01065d6 l F .text 00000045 get_bmap_bit
|
||||
c010661b l F .text 00000046 set_bmap_bit
|
||||
c0106661 l F .text 00000048 clear_bmap_bit
|
||||
c01066a9 l F .text 0000016c reserve_block
|
||||
00000000 l df *ABS* 00000000 string.c
|
||||
c023b844 l O .bss 00000004 strtok_str
|
||||
c023b848 l O .bss 00000004 strtok_index
|
||||
c0106e7c l F .text 0000005a strtok_delim_check
|
||||
00000000 l df *ABS* 00000000 memory.c
|
||||
00000000 l df *ABS* 00000000 libgcc2.c
|
||||
00000000 l df *ABS* 00000000 libgcc2.c
|
||||
c01060ec g .text 00000000 readEip
|
||||
c0103799 g F .text 00000046 load_address_space
|
||||
c0102aa9 g F .text 00000021 load_idt
|
||||
c0106c0b g F .text 00000046 strcpy
|
||||
c0100f2a g F .text 00000044 printf
|
||||
c010f014 g O .bss 00000004 stdout
|
||||
c0106320 g .text 00000000 seg_upd
|
||||
c0103d0b g F .text 0000003b tasking_init
|
||||
c0106310 g .text 00000000 load_page_directory
|
||||
c0106156 g .text 00000000 isr4
|
||||
c0106227 g .text 00000000 isr27
|
||||
c010619f g .text 00000000 isr13
|
||||
c01022d9 g F .text 00000046 serial_int_handler_1
|
||||
c01045c3 g F .text 000000ed read_inode
|
||||
c01027a2 g F .text 0000002c cpu_init
|
||||
c01027ce g F .text 00000015 tss_stack_reset
|
||||
c0104a65 g F .text 0000006f set_sz
|
||||
c01062db g .text 00000000 irq12
|
||||
c01061f5 g .text 00000000 isr22
|
||||
c0103cf4 g F .text 00000017 port_long_out
|
||||
c0106587 g F .text 0000004f ceil
|
||||
c01061af g .text 00000000 isr15
|
||||
c0105c7d g F .text 000000b0 init_ext2
|
||||
c010b00c g O .bss 00000004 supblks
|
||||
c01052f9 g F .text 00000095 inode_for_fname
|
||||
c01062c7 g .text 00000000 irq10
|
||||
c01030d0 g F .text 0000001d isr_register_handler
|
||||
c01062ef g .text 00000000 irq14
|
||||
c010b010 g O .bss 00000004 blk_grps
|
||||
c0100a81 g F .text 00000094 fgets
|
||||
c010617d g .text 00000000 isr9
|
||||
c0106259 g .text 00000000 isr80
|
||||
c0100a68 g F .text 00000019 getc
|
||||
c01062b3 g .text 00000000 irq8
|
||||
c0106b16 g F .text 0000003f memcpy
|
||||
c01061ff g .text 00000000 isr23
|
||||
c01046b0 g F .text 00000115 write_inode
|
||||
c0103397 g F .text 00000048 kfree
|
||||
c010623b g .text 00000000 isr29
|
||||
c0105250 g F .text 00000006 free_dir_listing
|
||||
c0100c9f g F .text 0000001c puts
|
||||
c01040f7 g F .text 0000009d tasking_yield
|
||||
c0104b3e g F .text 00000121 read_char
|
||||
c0100fe5 g F .text 0000000b feof
|
||||
c0104c5f g F .text 00000105 append_char
|
||||
c0106815 g F .text 00000211 malloc
|
||||
c0100689 g F .text 000000ab register_fs
|
||||
c0103fcf g F .text 00000128 get_msg
|
||||
c010624f g .text 00000000 isr31
|
||||
c0106c51 g F .text 0000005f strrev
|
||||
c0102953 g F .text 00000029 allow_all_ports
|
||||
c01061eb g .text 00000000 isr21
|
||||
c01062d1 g .text 00000000 irq11
|
||||
c01029a5 g F .text 000000b2 gdt_init
|
||||
c0104505 g F .text 0000006f read_blk
|
||||
c0103ef8 g F .text 000000d7 send_msg
|
||||
c0106231 g .text 00000000 isr28
|
||||
c0104194 g F .text 00000187 devfs_drv
|
||||
c0106336 g F .text 00000054 devbuf_init
|
||||
c01025a4 g F .text 000000d5 vga_init
|
||||
c01070f8 g F .text 0000011a .hidden __umoddi3
|
||||
c0106175 g .text 00000000 isr8
|
||||
c010b014 g O .bss 00000004 blk_grp_num
|
||||
c010062e g F .text 0000005b init_vfs
|
||||
c0106295 g .text 00000000 irq5
|
||||
c010638a g F .text 00000065 devbuf_add
|
||||
c0106ff8 g F .text 000000ff .hidden __udivdi3
|
||||
c01063ef g F .text 000000e6 devbuf_get
|
||||
c01049fb g F .text 0000006a get_sz
|
||||
c01061e1 g .text 00000000 isr20
|
||||
c0100331 g F .text 00000289 load_parts
|
||||
c023f84c g .bss 00000000 _kernel_end
|
||||
c01061a7 g .text 00000000 isr14
|
||||
c010615d g .text 00000000 isr5
|
||||
c010b000 g O .bss 00000004 pci_num_devs
|
||||
c0103b5e g F .text 000000dd pmem_alloc
|
||||
c0104391 g F .text 000000e5 devfs_add
|
||||
c010b018 g O .bss 00000004 max_mnts
|
||||
c0100ee9 g F .text 00000041 fprintf
|
||||
c010629f g .text 00000000 irq6
|
||||
c010231f g F .text 0000003c serial_int_handler_2
|
||||
c010626d g .text 00000000 irq1
|
||||
c0102756 g F .text 0000004c vga_backspace
|
||||
c0104ad4 g F .text 0000006a inc_sz
|
||||
c0100f6e g F .text 00000030 fseek
|
||||
c0103ee0 g F .text 00000018 tasking_createTask
|
||||
c0106fbd g F .text 00000021 alloc_memory
|
||||
c0102a61 g F .text 00000048 idt_set_gate
|
||||
c010f010 g O .bss 00000004 stdin
|
||||
c0103e9d g F .text 0000000d tasking_get_errno_address
|
||||
c010b01c g O .bss 00000004 num_mnts
|
||||
c010006b g F .text 00000000 _start
|
||||
c0100ff0 g F .text 0000000b ferror
|
||||
c0104574 g F .text 0000004f write_blk
|
||||
c0101e6b g F .text 00000075 pci_init
|
||||
c0106141 g .text 00000000 isr1
|
||||
c0103cd9 g F .text 0000001b port_long_in
|
||||
c0106fde g F .text 00000019 alloc_memory_virt
|
||||
c01062bd g .text 00000000 irq9
|
||||
c0102aca g F .text 00000456 isr_install
|
||||
c010621d g .text 00000000 isr26
|
||||
c010b020 g O .bss 00000004 devs
|
||||
c010618f g .text 00000000 isr11
|
||||
c0106a26 g F .text 0000005c realloc
|
||||
c0106ed6 g F .text 000000e7 strtok
|
||||
c010431b g F .text 00000076 init_devfs
|
||||
c0106cb0 g F .text 00000091 int_to_ascii
|
||||
c0103c3b g F .text 00000027 pmem_free
|
||||
c0100b15 g F .text 00000086 fread
|
||||
c01062e5 g .text 00000000 irq13
|
||||
c0106197 g .text 00000000 isr12
|
||||
c0101a73 g F .text 000000d7 pci_get_dev_info
|
||||
c0100885 g F .text 0000018f fopen
|
||||
c0106083 g .text 00000000 switchTask
|
||||
c0106b55 g F .text 00000032 memset
|
||||
c0100f9e g F .text 0000000b ftell
|
||||
c010613a g .text 00000000 isr0
|
||||
c0106277 g .text 00000000 irq2
|
||||
c0100fa9 g F .text 0000003c fclose
|
||||
c0103c62 g F .text 0000001b port_byte_in
|
||||
c0103cba g F .text 0000001f port_word_out
|
||||
c01050b5 g F .text 0000019b get_dir_listing
|
||||
c0102f20 g F .text 000001b0 isr_handler
|
||||
c0100bff g F .text 0000001c putc
|
||||
c0106209 g .text 00000000 isr24
|
||||
c0100734 g F .text 00000151 mount
|
||||
c01061b9 g .text 00000000 isr16
|
||||
c0106b87 g F .text 0000005f strcmp
|
||||
c010235b g F .text 0000012e serial_init
|
||||
c010b008 g O .bss 00000004 next_pid
|
||||
c0105e71 g F .text 00000212 initrd_init
|
||||
c010538e g F .text 0000007e fname_for_inode
|
||||
c010614f g .text 00000000 isr3
|
||||
c010b004 g O .bss 00000004 pci_devs
|
||||
c0100a14 g F .text 00000054 fgetc
|
||||
c010f018 g O .bss 00000004 stderr
|
||||
c0103c7d g F .text 0000001f port_byte_out
|
||||
c0106164 g .text 00000000 isr6
|
||||
c010297c g F .text 00000029 block_all_ports
|
||||
c01062a9 g .text 00000000 irq7
|
||||
c01030ed g F .text 00000075 irq_handler
|
||||
c0100b9b g F .text 00000064 fputc
|
||||
c0103571 g F .text 000000f5 alloc_pages
|
||||
c01037df g F .text 0000013d paging_init
|
||||
c010000c g F .text 00000005 func
|
||||
c0103a21 g F .text 0000013d pmem_init
|
||||
c01061cd g .text 00000000 isr18
|
||||
c0106544 g F .text 00000043 ceilf
|
||||
c0106263 g .text 00000000 irq0
|
||||
c0100cbb g F .text 00000087 fwrite
|
||||
c0102a57 g F .text 0000000a halt
|
||||
c0103c9c g F .text 0000001e port_word_in
|
||||
c0101b4a g F .text 000000e4 pci_set_dev_info
|
||||
c0106187 g .text 00000000 isr10
|
||||
c0103231 g F .text 00000166 kmalloc
|
||||
c0104ec5 g F .text 000001f0 read_inode_contents
|
||||
c0106e1f g F .text 00000038 append
|
||||
c01000f0 g F .text 00000241 drv
|
||||
c0103666 g F .text 00000032 alloc_pages_virt
|
||||
c01061c3 g .text 00000000 isr17
|
||||
c0106148 g .text 00000000 isr2
|
||||
c0102679 g F .text 000000dd vga_write_string
|
||||
c010b024 g O .bss 00000004 blk_size
|
||||
c01061d7 g .text 00000000 isr19
|
||||
c0100011 g F .text 0000005a kmain
|
||||
c0106d41 g F .text 000000de hex_to_ascii
|
||||
c0106245 g .text 00000000 isr30
|
||||
c0106be6 g F .text 00000025 strlen
|
||||
c0100000 g .text 00000000 _kernel_start
|
||||
c0106e57 g F .text 00000025 backspace
|
||||
c0103eaa g F .text 00000036 isPrivleged
|
||||
c0103452 g F .text 0000011f map_pages
|
||||
c0101552 g F .text 00000409 ide_init
|
||||
c010b028 g O .bss 00000004 mnts
|
||||
c01062f9 g .text 00000000 irq15
|
||||
c0104d64 g F .text 00000161 write_char
|
||||
c0100c1b g F .text 00000084 fputs
|
||||
c010616b g .text 00000000 isr7
|
||||
c01047c5 g F .text 00000236 reserve_inode
|
||||
c0106213 g .text 00000000 isr25
|
||||
c01064d5 g F .text 0000001c __get_errno_address
|
||||
c024384c g .interrupt_stack 00000000 int_stack_top
|
||||
c01064f1 g F .text 00000053 klog
|
||||
c01024ee g F .text 00000045 vga_clear
|
||||
c0100d42 g F .text 000001a7 vfprintf
|
||||
c0103698 g F .text 00000101 new_address_space
|
||||
c010628b g .text 00000000 irq4
|
||||
c0106281 g .text 00000000 irq3
|
||||
c0106a82 g F .text 00000094 free
|
||||
c0105256 g F .text 000000a3 read_dir_entry
|
||||
|
||||
|
232
out64
232
out64
@ -1,232 +0,0 @@
|
||||
|
||||
iso/boot/kernel.elf: file format elf64-x86-64
|
||||
iso/boot/kernel.elf
|
||||
architecture: i386:x86-64, flags 0x00000012:
|
||||
EXEC_P, HAS_SYMS
|
||||
start address 0x0000000000101000
|
||||
|
||||
Program Header:
|
||||
LOAD off 0x0000000000000000 vaddr 0x00000000000ff000 paddr 0x00000000000ff000 align 2**12
|
||||
filesz 0x000000000000b000 memsz 0x000000000000b000 flags r--
|
||||
NULL off 0x000000000000b000 vaddr 0xffff800000100000 paddr 0xf000000000100000 align 2**5
|
||||
filesz 0x0000000000006920 memsz 0x000000000000aa28 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 .boot.text 00000126 0000000000101000 0000000000101000 00002000 2**0
|
||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
||||
2 .boot.rodata 00000022 0000000000102000 0000000000102000 00003000 2**0
|
||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
||||
3 .boot.bss 00007000 0000000000103000 0000000000103000 00004000 2**12
|
||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
||||
4 .text 00005c7c ffff800000100000 ffff800000100000 0000b000 2**0
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
5 .rodata 00000144 ffff800000106000 ffff800000106000 00010c80 2**3
|
||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
||||
6 .eh_frame 00000b58 ffff800000106148 ffff800000106148 00010dc8 2**3
|
||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
||||
7 .bss 00004110 ffff800000107000 ffff800000107000 00000000 2**5
|
||||
ALLOC
|
||||
8 .debug_info 0000563d 0000000000000000 0000000000000000 00011920 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
9 .debug_abbrev 000011bd 0000000000000000 0000000000000000 00016f5d 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
10 .debug_aranges 000002a0 0000000000000000 0000000000000000 0001811a 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
11 .debug_line 0000252f 0000000000000000 0000000000000000 000183ba 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
12 .debug_str 0000124d 0000000000000000 0000000000000000 0001a8e9 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
13 .comment 00000011 0000000000000000 0000000000000000 0001bb36 2**0
|
||||
CONTENTS, READONLY
|
||||
14 .debug_ranges 000001e0 0000000000000000 0000000000000000 0001bb47 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
SYMBOL TABLE:
|
||||
0000000000100000 l d .multiboot 0000000000000000 .multiboot
|
||||
0000000000101000 l d .boot.text 0000000000000000 .boot.text
|
||||
0000000000102000 l d .boot.rodata 0000000000000000 .boot.rodata
|
||||
0000000000103000 l d .boot.bss 0000000000000000 .boot.bss
|
||||
ffff800000100000 l d .text 0000000000000000 .text
|
||||
ffff800000106000 l d .rodata 0000000000000000 .rodata
|
||||
ffff800000106148 l d .eh_frame 0000000000000000 .eh_frame
|
||||
ffff800000107000 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 .boot.text 0000000000000000 check_multiboot
|
||||
000000000010103f l .boot.text 0000000000000000 check_multiboot.no_multiboot
|
||||
0000000000101046 l .boot.text 0000000000000000 check_cpuid
|
||||
000000000010105a l .boot.text 0000000000000000 check_cpuid.no_cpuid
|
||||
0000000000101061 l .boot.text 0000000000000000 check_long_mode
|
||||
000000000010107f l .boot.text 0000000000000000 check_long_mode.no_long_mode
|
||||
0000000000101083 l .boot.text 0000000000000000 set_up_page_tables
|
||||
00000000001010af l .boot.text 0000000000000000 set_up_page_tables.map_p2_table
|
||||
00000000001010c9 l .boot.text 0000000000000000 enable_paging
|
||||
00000000001010f4 l .boot.text 0000000000000000 error
|
||||
0000000000103000 l .boot.bss 0000000000000000 p4_table
|
||||
0000000000104000 l .boot.bss 0000000000000000 p3_table
|
||||
0000000000105000 l .boot.bss 0000000000000000 p2_table
|
||||
0000000000106000 l .boot.bss 0000000000000000 stack_bottom
|
||||
000000000010a000 l .boot.bss 0000000000000000 stack_top
|
||||
0000000000102000 l .boot.rodata 0000000000000000 gdt64
|
||||
0000000000102018 l .boot.rodata 0000000000000000 gdt64.pointer
|
||||
0000000000000000 l df *ABS* 0000000000000000 cpu/x86_64/long_start.asm
|
||||
0000000000101124 l .boot.text 0000000000000000 loop
|
||||
0000000000000000 l df *ABS* 0000000000000000 kernel.c
|
||||
ffff800000107000 l O .bss 0000000000000008 mbd
|
||||
0000000000000000 l df *ABS* 0000000000000000 parts.c
|
||||
ffff800000107008 l O .bss 0000000000000008 part_devs
|
||||
ffff800000107010 l O .bss 0000000000000008 parts
|
||||
ffff800000107018 l O .bss 0000000000000004 num_part_devs
|
||||
ffff80000010701c l O .bss 0000000000000004 max_part_devs
|
||||
0000000000000000 l df *ABS* 0000000000000000 vfs.c
|
||||
ffff800000107038 l O .bss 0000000000000008 drv_names
|
||||
ffff800000107040 l O .bss 0000000000000008 drvs
|
||||
ffff800000107048 l O .bss 0000000000000004 max_drvs
|
||||
ffff80000010704c l O .bss 0000000000000004 next_drv_indx
|
||||
ffff800000107050 l O .bss 0000000000000008 head_mapping
|
||||
ffff800000107058 l O .bss 0000000000000008 tail_mapping
|
||||
ffff8000001007f2 l F .text 000000000000009f vfsstrcmp
|
||||
0000000000000000 l df *ABS* 0000000000000000 vga.c
|
||||
ffff800000107060 l O .bss 0000000000000008 screen
|
||||
ffff800000107068 l O .bss 0000000000000004 width
|
||||
ffff80000010706c l O .bss 0000000000000004 height
|
||||
ffff800000107070 l O .bss 0000000000000004 x
|
||||
ffff800000107074 l O .bss 0000000000000004 y
|
||||
ffff800000107078 l O .bss 0000000000000004 fg_color
|
||||
ffff80000010707c l O .bss 0000000000000004 bg_color
|
||||
ffff80000010187c l F .text 0000000000000097 set_char
|
||||
ffff800000101975 l F .text 000000000000008c set_cursor
|
||||
0000000000000000 l df *ABS* 0000000000000000 ports.c
|
||||
0000000000000000 l df *ABS* 0000000000000000 devfs.c
|
||||
ffff800000107080 l O .bss 0000000000000008 devices
|
||||
ffff800000107088 l O .bss 0000000000000008 dev_drivers
|
||||
ffff800000107090 l O .bss 0000000000000004 num_devices
|
||||
ffff800000107094 l O .bss 0000000000000004 max_devices
|
||||
0000000000000000 l df *ABS* 0000000000000000 ext2.c
|
||||
ffff800000102266 l F .text 0000000000000048 get_bmap_bit
|
||||
ffff8000001022ae l F .text 000000000000004f set_bmap_bit
|
||||
ffff800000103988 l F .text 0000000000000da2 drv
|
||||
0000000000000000 l df *ABS* 0000000000000000 initrd.c
|
||||
ffff800000107098 l O .bss 0000000000000008 names
|
||||
ffff8000001070a0 l O .bss 0000000000000008 offsets
|
||||
ffff8000001070a8 l O .bss 0000000000000008 sizes
|
||||
ffff8000001070b0 l O .bss 0000000000000004 num_files
|
||||
ffff8000001070b8 l O .bss 0000000000000008 initrd_fd
|
||||
ffff800000104837 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
|
||||
ffff8000001070c0 l O .bss 0000000000004000 entries
|
||||
ffff80000010b0c0 l O .bss 0000000000000004 num_used_entries
|
||||
ffff800000104f2e l F .text 0000000000000048 get_bmap_bit
|
||||
ffff800000104f76 l F .text 000000000000004d set_bmap_bit
|
||||
ffff800000104fc3 l F .text 000000000000004d clear_bmap_bit
|
||||
ffff800000105010 l F .text 00000000000001e9 reserve_block
|
||||
0000000000000000 l df *ABS* 0000000000000000 string.c
|
||||
ffff80000010b0c8 l O .bss 0000000000000008 strtok_str
|
||||
ffff80000010b0d0 l O .bss 0000000000000008 strtok_index
|
||||
ffff800000105a17 l F .text 0000000000000098 strtok_delim_check
|
||||
0000000000000000 l df *ABS* 0000000000000000 memory.c
|
||||
ffff8000001056c9 g F .text 0000000000000067 strcpy
|
||||
ffff8000001016c7 g F .text 00000000000000e1 printf
|
||||
ffff800000107028 g O .bss 0000000000000008 stdout
|
||||
ffff80000010245d g F .text 000000000000027c read_inode
|
||||
ffff800000102d70 g F .text 0000000000000065 set_sz
|
||||
ffff800000101dc1 g F .text 0000000000000018 port_long_out
|
||||
ffff800000104ef3 g F .text 000000000000003b ceil
|
||||
ffff80000010472a g F .text 000000000000010d init_ext2
|
||||
ffff80000010b0d8 g O .bss 0000000000000008 supblks
|
||||
ffff80000010381b g F .text 00000000000000bd inode_for_fname
|
||||
ffff80000010b0e0 g O .bss 0000000000000008 blk_grps
|
||||
ffff800000100f1b g F .text 00000000000000cd fgets
|
||||
ffff800000100ef9 g F .text 0000000000000022 getc
|
||||
ffff800000105576 g F .text 000000000000005a memcpy
|
||||
ffff8000001026d9 g F .text 000000000000033a write_inode
|
||||
ffff800000103741 g F .text 000000000000000b free_dir_listing
|
||||
ffff80000010120e g F .text 0000000000000031 puts
|
||||
ffff800000102e49 g F .text 0000000000000184 read_char
|
||||
ffff80000010185a g F .text 0000000000000011 feof
|
||||
ffff800000102fcd g F .text 000000000000014c append_char
|
||||
ffff8000001051f9 g F .text 000000000000024d malloc
|
||||
ffff80000010091c g F .text 0000000000000159 register_fs
|
||||
ffff800000105730 g F .text 0000000000000089 strrev
|
||||
ffff8000001022fd g F .text 00000000000000c8 read_blk
|
||||
ffff800000101dd9 g F .text 000000000000022b devfs_drv
|
||||
ffff800000101a01 g F .text 000000000000013c vga_init
|
||||
ffff80000010b0e8 g O .bss 0000000000000008 blk_grp_num
|
||||
ffff800000100891 g F .text 000000000000008b init_vfs
|
||||
ffff800000102d1b g F .text 0000000000000055 get_sz
|
||||
ffff8000001003a5 g F .text 000000000000044d load_parts
|
||||
ffff8000001020b7 g F .text 00000000000001af devfs_add
|
||||
ffff80000010b0f0 g O .bss 0000000000000004 max_mnts
|
||||
ffff8000001015ec g F .text 00000000000000db fprintf
|
||||
ffff800000101cb1 g F .text 0000000000000087 vga_backspace
|
||||
ffff800000102dd5 g F .text 0000000000000074 inc_sz
|
||||
ffff8000001017a8 g F .text 0000000000000045 fseek
|
||||
ffff800000105c37 g F .text 0000000000000022 alloc_memory
|
||||
ffff800000107020 g O .bss 0000000000000008 stdin
|
||||
ffff80000010b0f4 g O .bss 0000000000000004 num_mnts
|
||||
ffff80000010186b g F .text 0000000000000011 ferror
|
||||
ffff8000001023c5 g F .text 0000000000000098 write_blk
|
||||
ffff800000101da8 g F .text 0000000000000019 port_long_in
|
||||
ffff800000105c59 g F .text 0000000000000023 alloc_memory_virt
|
||||
ffff80000010b0f8 g O .bss 0000000000000008 devs
|
||||
ffff800000105446 g F .text 0000000000000081 realloc
|
||||
ffff800000105aaf g F .text 0000000000000188 strtok
|
||||
ffff800000102004 g F .text 00000000000000b3 init_devfs
|
||||
ffff8000001057b9 g F .text 00000000000000c7 int_to_ascii
|
||||
ffff800000100fe8 g F .text 00000000000000bb fread
|
||||
ffff800000100c71 g F .text 000000000000020f fopen
|
||||
ffff8000001055d0 g F .text 0000000000000046 memset
|
||||
ffff8000001017ed g F .text 0000000000000012 ftell
|
||||
ffff8000001017ff g F .text 000000000000005b fclose
|
||||
ffff800000101d38 g F .text 000000000000001a port_byte_in
|
||||
ffff800000101d8b g F .text 000000000000001d port_word_out
|
||||
ffff80000010355f g F .text 00000000000001e2 get_dir_listing
|
||||
ffff80000010112f g F .text 000000000000002e putc
|
||||
ffff800000100a75 g F .text 00000000000001fc mount
|
||||
ffff800000105616 g F .text 0000000000000084 strcmp
|
||||
ffff800000104a14 g F .text 0000000000000380 initrd_init
|
||||
ffff8000001038d8 g F .text 00000000000000b0 fname_for_inode
|
||||
ffff800000100e80 g F .text 0000000000000079 fgetc
|
||||
ffff800000107030 g O .bss 0000000000000008 stderr
|
||||
ffff800000101d52 g F .text 000000000000001d port_byte_out
|
||||
ffff8000001010a3 g F .text 000000000000008c fputc
|
||||
ffff800000100000 g F .text 0000000000000006 func
|
||||
ffff800000104eba g F .text 0000000000000039 ceilf
|
||||
ffff80000010123f g F .text 00000000000000be fwrite
|
||||
ffff800000101d6f g F .text 000000000000001c port_word_in
|
||||
ffff80000010329e g F .text 00000000000002c1 read_inode_contents
|
||||
ffff80000010598f g F .text 0000000000000050 append
|
||||
0000000000101118 g .boot.text 0000000000000000 long_mode_start
|
||||
0000000000101000 g .boot.text 0000000000000000 start
|
||||
ffff800000100076 g F .text 000000000000032f drv
|
||||
ffff800000101b3d g F .text 0000000000000174 vga_write_string
|
||||
ffff80000010b100 g O .bss 0000000000000008 blk_size
|
||||
ffff800000100006 g F .text 0000000000000070 kmain
|
||||
ffff800000105880 g F .text 000000000000010f hex_to_ascii
|
||||
ffff80000010569a g F .text 000000000000002f strlen
|
||||
ffff8000001059df g F .text 0000000000000038 backspace
|
||||
ffff80000010b108 g O .bss 0000000000000008 mnts
|
||||
ffff800000103119 g F .text 0000000000000185 write_char
|
||||
ffff80000010115d g F .text 00000000000000b1 fputs
|
||||
ffff800000102a13 g F .text 0000000000000308 reserve_inode
|
||||
ffff800000104d94 g F .text 000000000000001a __get_errno_address
|
||||
ffff800000104dae g F .text 000000000000010c klog
|
||||
ffff800000101913 g F .text 0000000000000062 vga_clear
|
||||
ffff8000001012fd g F .text 00000000000002ef vfprintf
|
||||
ffff8000001054c7 g F .text 00000000000000af free
|
||||
ffff80000010374c g F .text 00000000000000cf read_dir_entry
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
C_SOURCES = $(wildcard *.c)
|
||||
OBJ = $(C_SOURCES:.c=.o)
|
||||
OBJ = $(C_SOURCES:.c=.o ../libc/libc.a)
|
||||
CFLAGS = -Wall -g -ffreestanding
|
||||
CC = i386-elf-gcc
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
int _start() {
|
||||
int x=17;
|
||||
return x+3;
|
||||
return x+strlen("Hi");
|
||||
}
|
||||
|
45
prog/out
Normal file
45
prog/out
Normal file
@ -0,0 +1,45 @@
|
||||
|
||||
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
|
||||
|
||||
|
0
prog/out64
Normal file
0
prog/out64
Normal file
Loading…
x
Reference in New Issue
Block a user