summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/multiboot.s4
-rw-r--r--asm/x86.h100
-rw-r--r--asm/x86.s137
-rw-r--r--doxy.cfg14
-rw-r--r--driver/keyboard.c2
-rw-r--r--driver/mouse.c2
-rw-r--r--driver/pci.c2
-rw-r--r--driver/serial.c20
-rw-r--r--driver/serial.h32
-rw-r--r--kernel/interrupts.c8
-rw-r--r--kernel/kernel.c8
-rw-r--r--kernel/mp.c2
-rw-r--r--kernel/ringbuffer.c16
-rw-r--r--kernel/smp.c4
-rw-r--r--kernel/spinlock.c2
-rw-r--r--kernel/task.c2
-rw-r--r--kernel/timer.c2
-rw-r--r--kernel/vmem.c4
-rw-r--r--kernel/x86.c140
-rw-r--r--kernel/x86.h34
-rw-r--r--userspace/Makefile2
21 files changed, 314 insertions, 223 deletions
diff --git a/asm/multiboot.s b/asm/multiboot.s
index 1d808a3..54cffbb 100644
--- a/asm/multiboot.s
+++ b/asm/multiboot.s
@@ -1,6 +1,10 @@
# https://www.gnu.org/software/grub/manual/multiboot/multiboot.html#Boot-information-format
# http://wiki.osdev.org/Bare_Bones
+# Fill Multiboot Haeder, init stack and call kernel_main passing to params:
+# eax - magic number
+# ebx - multiboot structure
+
# Declare constants used for creating a multiboot header.
.set ALIGN, 1<<0 # align loaded modules on page boundaries
.set MEMINFO, 1<<1 # provide memory map
diff --git a/asm/x86.h b/asm/x86.h
new file mode 100644
index 0000000..8e6a741
--- /dev/null
+++ b/asm/x86.h
@@ -0,0 +1,100 @@
+#ifndef FOOLOS_X86_H
+#define FOOLOS_X86_H
+
+/**
+ * @file
+ *
+ * X86 32-bit Basics
+ * =================
+ *
+ * **All the functions are very specific to the targeted x86 architecture.**
+ *
+ * This is the header of our basic **x86** function definitions.
+ * Most of the functions are implemented in assembler in the file _asm/x86.s_,
+ * however a few short helper functions are defined in this header itself:
+ *
+ * * x86_set_page_directory()
+ * * x86_paging_enable()
+ * * x86_paging_disable()
+ *
+ *
+ * Reading and Writing Ports
+ * -------------------------
+ *
+ * The functions of the form x86_outX() and x86_inX(), where the X
+ * indicates the value size allow reading and writing ports.
+ *
+ * * x86_outb() / x86_inb()
+ * * x86_outw() / x86_inw()
+ * * x86_outl() / x86_inl()
+ *
+ * The sizes are:
+ *
+ * * b - byte (8 bit)
+ * * w - word (16 bit)
+ * * l - double word (32 bit)
+ *
+ * Remember, that the port address is always 32 bits wide.
+ *
+ * Dependencies
+ * ------------
+ *
+ * All we need are uint32_t, uint16_t and uint8_t as provided by <stdint.h>
+ *
+ * References
+ * ----------
+ * * http://wiki.osdev.org/Interrupt_Service_Routines
+ * * https://wiki.osdev.org/CPU_Registers_x86
+ * * ...
+ *
+ */
+
+// we need uint32_t, uint16_t, uint8_t //
+#include <stdint.h>
+
+/** write byte to port */
+void x86_outb (uint32_t port, uint8_t data);
+
+/** read byte from port */
+uint8_t x86_inb (uint32_t port);
+
+/** write word to port */
+void x86_outw (uint32_t port, uint16_t data);
+
+/** read word from port */
+uint16_t x86_inw (uint32_t port);
+
+/** write double word to port */
+void x86_outl (uint32_t port, uint32_t data);
+
+/** read double word from port */
+uint32_t x86_inl (uint32_t port);
+
+/** disable interrupts */
+void x86_cli ();
+
+/** enable interrupts */
+void x86_sti ();
+
+/** xchg - this can be used for semaphors and simlar */
+uint8_t x86_xchg (uint8_t *addr, uint8_t val);
+
+/** invlpg - invalidate translation lookaside buffer */
+void x86_invlpg(uint32_t addr);
+
+/** read value from control register specified by num */
+uint32_t x86_get_cr(uint8_t num);
+
+/** write given value to the control register specified by num */
+void x86_set_cr(uint8_t num, uint32_t value);
+
+/** Set the address of the page directory. This is required **before** enabling paging */
+static inline void x86_set_page_directory(uint32_t pdir_addr) {x86_set_cr(3,pdir_addr);}
+
+/** Enable paging */
+static inline void x86_paging_enable() {x86_set_cr(0,x86_get_cr(0)| 0x80000000);}
+
+/** Disable paging */
+static inline void x86_paging_disable() {x86_set_cr(0,x86_get_cr(0)&~0x80000000);}
+
+#endif
diff --git a/asm/x86.s b/asm/x86.s
new file mode 100644
index 0000000..a5bcb1c
--- /dev/null
+++ b/asm/x86.s
@@ -0,0 +1,137 @@
+// Basic low-level x86 32-bit calls //
+
+// reading and writing ports
+
+.global x86_outb // 8 bit out
+.global x86_inb // 8 bit in
+.global x86_outw // 16 bit out
+.global x86_inw // 16 bit in
+.global x86_outl // 32 bit out
+.global x86_inl // 32 bit in
+
+// interrupts
+
+.global x86_cli // disable interrupts
+.global x86_sti // enable interrupts
+
+// xchg
+.global x86_xchg // exchange (for semaphors etc.)
+
+// invlpg
+.global x86_invlpg // invalidate translation lookaside buffer (tlb)
+
+// control registers
+.global x86_get_cr
+.global x86_set_cr
+
+x86_outb:
+ mov 4(%esp), %edx
+ mov 8(%esp), %eax
+ outb %al,%dx
+ ret
+
+x86_inb:
+ mov 4(%esp), %edx
+ inb %dx,%al
+ ret
+
+x86_outw:
+ mov 4(%esp), %edx
+ mov 8(%esp), %eax
+ outw %ax,%dx
+ ret
+
+x86_inw:
+ mov 4(%esp), %edx
+ inw %dx,%ax
+ ret
+
+x86_outl:
+ mov 4(%esp), %edx
+ mov 8(%esp), %eax
+ outl %eax,%dx
+ ret
+
+x86_inl:
+ mov 4(%esp), %edx
+ inl %dx,%eax
+ ret
+
+x86_cli:
+ cli
+ ret
+
+x86_sti:
+ sti
+ ret
+
+x86_xchg:
+// -- uint8_t result;
+// --
+// -- // The + in "+m" denotes a read-modify-write operand.
+// -- asm volatile("lock xchgb %0, %1" :
+// -- "+m" (*addr), "=a" (result) :
+// -- "1" (val) :
+// -- "cc");
+// --
+// -- return result;
+// -- }
+ ret
+
+x86_get_cr:
+ mov 4(%esp), %ecx
+ cmp %ecx,0
+ je get_cr0
+ cmp %ecx,2
+ je get_cr2
+ cmp %ecx,3
+ je get_cr3
+ cmp %ecx,4
+ je get_cr4
+ ret
+
+x86_set_cr:
+ mov 4(%esp), %eax
+ mov 8(%esp), %ecx
+ cmp %ecx,0
+ je set_cr0
+ cmp %ecx,2
+ je set_cr2
+ cmp %ecx,3
+ je set_cr3
+ cmp %ecx,4
+ je set_cr4
+ ret
+
+get_cr0:
+ mov %cr0,%eax
+ ret
+
+get_cr2:
+ mov %cr2,%eax
+ ret
+
+get_cr3:
+ mov %cr3,%eax
+ ret
+
+get_cr4:
+ mov %cr4,%eax
+ ret
+
+set_cr0:
+ mov %eax,%cr0
+ ret
+
+set_cr2:
+ mov %eax,%cr2
+ ret
+
+set_cr3:
+ mov %eax,%cr3
+ ret
+
+set_cr4:
+ mov %eax,%cr4
+ ret
+
diff --git a/doxy.cfg b/doxy.cfg
index ae15742..4df6982 100644
--- a/doxy.cfg
+++ b/doxy.cfg
@@ -453,7 +453,7 @@ EXTRACT_PACKAGE = NO
# included in the documentation.
# The default value is: NO.
-EXTRACT_STATIC = NO
+EXTRACT_STATIC = YES
# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
# locally in source files will be included in the documentation. If set to NO,
@@ -873,7 +873,7 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.
-EXCLUDE = xxx userspace
+EXCLUDE = xxx #userspace
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
@@ -995,32 +995,32 @@ USE_MDFILE_AS_MAINPAGE = README.md
# also VERBATIM_HEADERS is set to NO.
# The default value is: NO.
-SOURCE_BROWSER = NO
+SOURCE_BROWSER = YES
# Setting the INLINE_SOURCES tag to YES will include the body of functions,
# classes and enums directly into the documentation.
# The default value is: NO.
-INLINE_SOURCES = NO
+INLINE_SOURCES = YES
# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
# special comment blocks from generated source code fragments. Normal C, C++ and
# Fortran comments will always remain visible.
# The default value is: YES.
-STRIP_CODE_COMMENTS = YES
+STRIP_CODE_COMMENTS = NO
# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
# function all documented functions referencing it will be listed.
# The default value is: NO.
-REFERENCED_BY_RELATION = NO
+REFERENCED_BY_RELATION = YES
# If the REFERENCES_RELATION tag is set to YES then for each documented function
# all documented entities called/used by that function will be listed.
# The default value is: NO.
-REFERENCES_RELATION = NO
+REFERENCES_RELATION = YES
# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
# to YES then the hyperlinks from functions in REFERENCES_RELATION and
diff --git a/driver/keyboard.c b/driver/keyboard.c
index 55e3c41..d35ef6d 100644
--- a/driver/keyboard.c
+++ b/driver/keyboard.c
@@ -3,7 +3,7 @@
#define FOOLOS_MODULE_NAME "keyboard"
#include <stdbool.h>
-#include "kernel/x86.h"
+#include "asm/x86.h"
#include "lib/logger/log.h"
static bool ctrl_l=false;
diff --git a/driver/mouse.c b/driver/mouse.c
index d4dbb56..23619a4 100644
--- a/driver/mouse.c
+++ b/driver/mouse.c
@@ -7,7 +7,7 @@
#include "lib/logger/log.h"
#include <stdint.h>
-#include "kernel/x86.h"
+#include "asm/x86.h"
static volatile uint8_t mouse_cycle;
static volatile uint8_t mouse_byte[3];
diff --git a/driver/pci.c b/driver/pci.c
index 677f445..a8cd68b 100644
--- a/driver/pci.c
+++ b/driver/pci.c
@@ -1,7 +1,7 @@
#define FOOLOS_MODULE_NAME "pci"
#include "kernel/kernel.h"
-#include "kernel/x86.h"
+#include "asm/x86.h"
#include "e1000.h"
#include "lib/logger/log.h" // logger facilities
diff --git a/driver/serial.c b/driver/serial.c
index 1a36bf5..6e6a4bb 100644
--- a/driver/serial.c
+++ b/driver/serial.c
@@ -1,10 +1,13 @@
#define FOOLOS_MODULE_NAME "serial"
#include "serial.h"
-#define PORT 0x3f8 /* COM1 */
+#include "asm/x86.h" // provides x86_inb() and x86_outb()
-void serial_init() {
+/** COM1 Port */
+static const PORT=0x3f8;
+void serial_init()
+{
x86_outb(PORT + 1, 0x00); // Disable all interrupts
x86_outb(PORT + 3, 0x80); // Enable DLAB (set baud rate divisor)
x86_outb(PORT + 0, 0x03); // Set divisor to 3 (lo byte) 38400 baud
@@ -13,23 +16,26 @@ void serial_init() {
x86_outb(PORT + 2, 0xC7); // Enable FIFO, clear them, with 14-byte threshold
x86_outb(PORT + 4, 0x0B); // IRQs enabled, RTS/DSR set
-// log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"COM 1 - initialized");
}
-int serial_received() {
+static uint32_t serial_received()
+{
return x86_inb(PORT + 5) & 1;
}
-char serial_read() {
+uint8_t serial_read()
+{
while (serial_received() == 0);
return x86_inb(PORT);
}
-int is_transmit_empty() {
+static uint32_t is_transmit_empty()
+{
return x86_inb(PORT + 5) & 0x20;
}
-void serial_write(char a) {
+void serial_write(uint8_t a)
+{
while (is_transmit_empty() == 0);
x86_outb(PORT,a);
}
diff --git a/driver/serial.h b/driver/serial.h
index 2e10af8..c6841f2 100644
--- a/driver/serial.h
+++ b/driver/serial.h
@@ -1,18 +1,38 @@
+#ifndef FOOLOS_SERIAL_H
+#define FOOLOS_SERIAL_H
/**
* @file
- * Serial Port Driver for COM1
+ * MINIMALISTIC SERIAL PORT DRIVER for COM1
+ * ========================================
+ * Call serial_init() **once** before _reading_ or _writing_ with
+ * serial_read() or serial_write().
*
- * https://wiki.osdev.org/Serial_Ports
+ * Blocking
+ * --------
+ * Please note that the calls will block if the buffers
+ * are full (and not read on the other end) _or_ no data is available
+ * for reading.
*
- * Call serial_init() once before reading and writing with serial_read()
- * and serial_write(). Note that reading and writing might block.
+ * Dependencies
+ * ------------
+ * The implmentation relies on x86_inb() and x86_outb()
+ * to be defined in _asm/x86.h_.
+ *
+ * Reference
+ * ---------
+ * The implementation was ruthlessly copied from here: https://wiki.osdev.org/Serial_Ports
*/
+// We need uint8_t and uint_32t //
+#include <stdint.h>
+
/** Initialize COM1 **/
void serial_init();
/** read one byte from COM1 (blocking) **/
-char serial_read();
+uint8_t serial_read();
/** write one byte from COM1 (blocking) **/
-void serial_write(char a);
+void serial_write(uint8_t a);
+
+#endif
diff --git a/kernel/interrupts.c b/kernel/interrupts.c
index 74599c3..41d0a9c 100644
--- a/kernel/interrupts.c
+++ b/kernel/interrupts.c
@@ -5,7 +5,7 @@
#include "asm/asm.h"
#include "driver/mouse.h"
#include "interrupts.h"
-#include "x86.h"
+#include "asm/x86.h"
void errlog(uint32_t error_code)
{
@@ -90,7 +90,7 @@ void exception_handle_14(uint32_t error_code,uint32_t eip,uint16_t cs,uint16_t u
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"error_code_U/S: %d",error_code&4?1:0);
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"error_code_RSVD: %d",error_code&8?1:0);
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"error_code_I/D: %d",error_code&16?1:0);
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"at addr: 0x%08X",x86_get_cr2());
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"at addr: 0x%08X",x86_get_cr(2));
deflog(eip,cs,flags);
panic(FOOLOS_MODULE_NAME,"Exception: Fault: Page Fault");
@@ -166,8 +166,8 @@ void int_init(uint16_t sel)
int_install();
// now we can enable interrupts back again
- // x86_int_enable();
- x86_int_disable();
+ // x86_sti();
+ x86_cli();
}
void int_install()
diff --git a/kernel/kernel.c b/kernel/kernel.c
index 03862a9..b23a6d9 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -23,13 +23,11 @@
/* F00L 0S Entry point (called directly from asm/multiboot.asm */
void kernel_main(uint32_t eax,uint32_t ebx)
{
- // SERIAL PORT
serial_init();
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"COM 1 - initialized");
- // PR
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%s - compiled on %s at %s",
- KERNEL_NAME,__DATE__,__TIME__);
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"git revision: %s",GIT_REVISION);
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%s - BUILD: git-%s (%s %s)",
+ KERNEL_NAME,GIT_REVISION,__DATE__,__TIME__);
// PIT TIMER
timer_init();
diff --git a/kernel/mp.c b/kernel/mp.c
index abea5cb..76754b8 100644
--- a/kernel/mp.c
+++ b/kernel/mp.c
@@ -2,7 +2,7 @@
#include <stdbool.h>
-#include "x86.h"
+#include "asm/x86.h"
#include "lib/logger/log.h" // logger facilities
#include "smp.h"
diff --git a/kernel/ringbuffer.c b/kernel/ringbuffer.c
index 31185dc..099e96a 100644
--- a/kernel/ringbuffer.c
+++ b/kernel/ringbuffer.c
@@ -20,11 +20,11 @@ ringbuffer ringbuffer_init(uint32_t size)
bool ringbuffer_put(ringbuffer* f,uint8_t c)
{
- x86_int_disable();
+ x86_cli();
if((f->back-1+f->size)%f->size==f->front)
{
- x86_int_enable();
+ x86_sti();
return false;
}
@@ -33,30 +33,30 @@ bool ringbuffer_put(ringbuffer* f,uint8_t c)
f->back+=f->size;
f->back%=f->size;
- x86_int_enable();
+ x86_sti();
return true;
}
bool ringbuffer_has(ringbuffer* f)
{
- x86_int_disable();
+ x86_cli();
bool res=true;
if(f->front==f->back)
res=false;
- x86_int_enable();
+ x86_sti();
return res;
}
uint8_t ringbuffer_get(ringbuffer* f) // non blocking . please check first
{
- x86_int_disable();
+ x86_cli();
char c;
if(f->front==f->back)
{
- x86_int_enable();
+ x86_sti();
return ' ';
}
@@ -66,6 +66,6 @@ uint8_t ringbuffer_get(ringbuffer* f) // non blocking . please check first
f->front+=f->size;
f->front%=f->size;
- x86_int_enable();
+ x86_sti();
return c;
}
diff --git a/kernel/smp.c b/kernel/smp.c
index 08af652..a562df3 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -10,7 +10,7 @@
#include "smp.h"
#include "mem.h"
#include "spinlock.h"
-#include "x86.h"
+#include "asm/x86.h"
#define FOOLOS_APIC_SPUR_INT 0x00f0
#define FOOLOS_APIC_INT_COMMAND_LOW 0x0300
@@ -27,7 +27,7 @@ uint32_t local_apic_addr;
void smp_main()
{
- x86_int_disable();
+ x86_cli();
while(1);
// log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"local apic_addr:0x%08X",local_apic_addr);
diff --git a/kernel/spinlock.c b/kernel/spinlock.c
index f97b7db..2a546a8 100644
--- a/kernel/spinlock.c
+++ b/kernel/spinlock.c
@@ -4,7 +4,7 @@
#include "kernel.h"
#include "lib/logger/log.h"
-#include "x86.h"
+#include "asm/x86.h"
// https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html
diff --git a/kernel/task.c b/kernel/task.c
index be9ddd9..3c1e067 100644
--- a/kernel/task.c
+++ b/kernel/task.c
@@ -7,7 +7,7 @@
#include "lib/logger/log.h" // logger facilities
#include "mem.h"
#include "timer.h"
-#include "x86.h"
+#include "asm/x86.h"
#include "vmem.h"
#include "syscalls.h"
diff --git a/kernel/timer.c b/kernel/timer.c
index 3f7ab0f..e5e26b4 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -32,7 +32,7 @@
#define FOOLOS_MODULE_NAME "timer"
#include "timer.h"
-#include "x86.h"
+#include "asm/x86.h"
#include "lib/logger/log.h"
// TODO: use mutex? do we need volatile at all!??
diff --git a/kernel/vmem.c b/kernel/vmem.c
index 3d3456b..fb19e75 100644
--- a/kernel/vmem.c
+++ b/kernel/vmem.c
@@ -3,7 +3,7 @@
#include <stdlib.h>
#include "kernel.h"
-#include "x86.h"
+#include "asm/x86.h"
#include "mem.h"
#include "vmem.h"
#include "lib/logger/log.h" // logger facilities
@@ -491,7 +491,7 @@ pdirectory* vmem_new_space_dir(pdirectory *copy_dir)
void vmem_set_dir(pdirectory *dir)
{
- x86_set_pdbr(dir);
+ x86_set_page_directory(dir);
}
pdirectory* vmem_init(uint32_t kernel_blocks, uint32_t frameb_addr)
diff --git a/kernel/x86.c b/kernel/x86.c
deleted file mode 100644
index d664657..0000000
--- a/kernel/x86.c
+++ /dev/null
@@ -1,140 +0,0 @@
-#define FOOLOS_MODULE_NAME "x86"
-
-#include "x86.h"
-#include "timer.h"
-#include "lib/logger/log.h"
-
-//
-// suffix (b, w, l, q for byte, word, dword, and qword).
-//
-
-// disable interrupts
-void x86_int_disable()
-{
- asm volatile("cli");
-}
-
-// enable interrupts
-void x86_int_enable()
-{
- asm volatile("sti");
-}
-
-// get control registers (cr0-cr4)
-uint32_t x86_get_cr0()
-{
- uint32_t cr;
- asm volatile("mov %%cr0, %0": "=b"(cr));
- return cr;
-}
-
-uint32_t x86_get_cr1()
-{
- uint32_t cr=0;
-
- // reading the reserved cr1 register results in crash.
- // (at least on emulators)
- // asm volatile("mov %%cr1, %0": "=b"(cr));
-
- return cr;
-}
-
-uint32_t x86_get_cr2()
-{
- uint32_t cr;
- asm volatile("mov %%cr2, %0": "=b"(cr));
- return cr;
-}
-
-uint32_t x86_get_cr3()
-{
- uint32_t cr=0;
- asm volatile("mov %%cr3, %0": "=b"(cr));
- return cr;
-}
-
-uint32_t x86_get_cr4()
-{
- uint32_t cr;
- asm volatile("mov %%cr4, %0": "=b"(cr));
- return cr;
-}
-void x86_outb(uint32_t port, uint8_t data)
-{
- asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
-}
-
-uint8_t x86_inb(uint32_t port)
-{
- uint8_t data;
- asm volatile("inb %w1,%0" : "=a" (data) : "d" (port));
- return data;
-}
-
-void x86_outw(uint32_t port, uint16_t data)
-{
- asm volatile("outw %0,%w1" : : "a" (data), "d" (port));
-}
-
-uint16_t x86_inw(uint32_t port)
-{
- uint16_t data;
- asm volatile("inw %w1,%0" : "=a" (data) : "d" (port));
- return data;
-}
-
-void x86_outl(uint32_t port, uint32_t data)
-{
- asm volatile("outl %0,%w1" : : "a" (data), "d" (port));
-}
-
-uint32_t x86_inl(uint32_t port)
-{
- uint32_t data;
- asm volatile("inl %w1,%0" : "=a" (data) : "d" (port));
- return data;
-}
-
-
-void x86_set_pdbr(uint32_t addr)
-{
- asm volatile("mov %0, %%cr3":: "b"(addr));
-
-}
-
-// enable PT bit in CR0
-void x86_paging_enable()
-{
- uint32_t cr0=x86_get_cr0();
- cr0 |= 0x80000000; // enable paging
- asm volatile("mov %0, %%cr0":: "b"(cr0));
-}
-
-// disable PT bit in CR0
-void x86_paging_disable()
-{
- uint32_t cr0=x86_get_cr0();
- cr0 &= ~0x80000000;
- asm volatile("mov %0, %%cr0":: "b"(cr0));
-}
-
-void x86_flush_tlb(uint32_t addr)
-{
- asm volatile("invlpg (%0)" ::"r" (addr) : "memory");
-}
-
-//xchg
-uint8_t x86_xchg(uint8_t *addr, uint8_t val)
-{
-
- uint8_t result;
-
- // The + in "+m" denotes a read-modify-write operand.
- asm volatile("lock xchgb %0, %1" :
- "+m" (*addr), "=a" (result) :
- "1" (val) :
- "cc");
-
- //log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"xchg val:%d with addr:0x%08X : result: %d",val,addr,result);
- return result;
-}
diff --git a/kernel/x86.h b/kernel/x86.h
deleted file mode 100644
index b634722..0000000
--- a/kernel/x86.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef FOOLOS_X86_H
-#define FOOLOS_X86_H
-
-#include <stdint.h>
-
-// http://wiki.osdev.org/Interrupt_Service_Routines
-
-// TODO : Real sleep()!
-
-void x86_outb(uint32_t port, uint8_t data);
-uint8_t x86_inb(uint32_t port);
-
-void x86_outw(uint32_t port, uint16_t data);
-uint16_t x86_inw(uint32_t port);
-
-void x86_outl(uint32_t port, uint32_t data);
-uint32_t x86_inl(uint32_t port);
-
-void x86_set_pdbr(uint32_t addr);
-void x86_paging_enable();
-void x86_flush_tlb(uint32_t addr);
-
-void x86_int_enable();
-void x86_int_disable();
-
-uint32_t x86_get_cr0();
-uint32_t x86_get_cr1();
-uint32_t x86_get_cr2();
-uint32_t x86_get_cr3();
-uint32_t x86_get_cr4();
-
-uint8_t x86_xchg(uint8_t *addr, uint8_t val);
-
-#endif
diff --git a/userspace/Makefile b/userspace/Makefile
index 85c7982..a8aa418 100644
--- a/userspace/Makefile
+++ b/userspace/Makefile
@@ -1,4 +1,4 @@
-IMAGESIZE=30000 #ext2.img size in Kb (30Megs)
+IMAGESIZE=10000 #ext2.img size in Kb
#######################