Import backup from 2004-06-07
This commit is contained in:
parent
b5ba5b63fe
commit
802a07ebfe
6
Makefile
6
Makefile
@ -1,6 +1,6 @@
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
# Author: Josh Holtrop / Benjamen R. Meyer #
|
# Author: Josh Holtrop / Benjamen R. Meyer #
|
||||||
# Date: 02/15/04 Modified: 05/21/04 #
|
# Date: 02/15/04 Modified: 06/07/04 #
|
||||||
# Purpose: To build Josh Holtrop's OS (HOS) using GNU make #
|
# Purpose: To build Josh Holtrop's OS (HOS) using GNU make #
|
||||||
# Note: This makefile is for use on Linux & other Unix-like systems #
|
# Note: This makefile is for use on Linux & other Unix-like systems #
|
||||||
#####################################################################
|
#####################################################################
|
||||||
@ -34,8 +34,8 @@ all:
|
|||||||
@echo "Type 'make install' to install to a floppy in drive '/dev/fd0'"
|
@echo "Type 'make install' to install to a floppy in drive '/dev/fd0'"
|
||||||
@echo "Type 'make install_img' to create a floppy image and install to it."
|
@echo "Type 'make install_img' to create a floppy image and install to it."
|
||||||
|
|
||||||
cd boot; make
|
make -C boot
|
||||||
cd kernel; make
|
make -C kernel
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
# Clean up the source directory of any binaries #
|
# Clean up the source directory of any binaries #
|
||||||
|
@ -29,4 +29,4 @@ stage2: stage2.asm
|
|||||||
# Clean #
|
# Clean #
|
||||||
#########
|
#########
|
||||||
clean:
|
clean:
|
||||||
- rm *.bin
|
- rm *.bin *~
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
# Author: Josh Holtrop / Benjamen R. Meyer #
|
# Author: Josh Holtrop / Benjamen R. Meyer #
|
||||||
# Date: 02/15/04 Modified: 05/21/04 #
|
# Date: 02/15/04 Modified: 06/07/04 #
|
||||||
# Purpose: To build Josh Holtrop's OS (HOS) using GNU make #
|
# Purpose: To build Josh Holtrop's OS (HOS) using GNU make #
|
||||||
# Note: This makefile is for use on Linux & other Unix-like systems #
|
# Note: This makefile is for use on Linux & other Unix-like systems #
|
||||||
#####################################################################
|
#####################################################################
|
||||||
@ -30,7 +30,7 @@ LD_FLAGS=-nodefaultlibs -nostdlib --no-demangle -T link.ld
|
|||||||
# Linking the kernel together #
|
# Linking the kernel together #
|
||||||
###############################
|
###############################
|
||||||
all: Asm_Kernel Asm_Functions C_Kernel
|
all: Asm_Kernel Asm_Functions C_Kernel
|
||||||
$(LD) $(LD_FLAGS) -o kernel.bin -Map ./lst/LDout.doc ks.o kernel.o asmfuncs.o fdc.o keyboard.o kio.o mm.o mouse.o stdfont.o video.o vmm.o rtc.o pic.o io.o cstring.o string.o cmos.o hos_defines.o vfs.o devfs.o
|
$(LD) $(LD_FLAGS) -o kernel.bin -Map ./lst/LDout.doc ks.o kernel.o asmfuncs.o fdc.o keyboard.o kio.o mm.o mouse.o stdfont.o video.o vmm.o rtc.o pic.o io.o cstring.o string.o cmos.o hos_defines.o vfs.o devfs.o Device.o DeviceFolder.o
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
# Assembly Kernel Loader #
|
# Assembly Kernel Loader #
|
||||||
@ -66,9 +66,11 @@ C_Kernel:
|
|||||||
$(CPP) $(CPP_FLAGS) -c hos_defines.cpp -o hos_defines.o
|
$(CPP) $(CPP_FLAGS) -c hos_defines.cpp -o hos_defines.o
|
||||||
$(CPP) $(CPP_FLAGS) -c fs/vfs.cpp -o vfs.o
|
$(CPP) $(CPP_FLAGS) -c fs/vfs.cpp -o vfs.o
|
||||||
$(CPP) $(CPP_FLAGS) -c fs/devfs.cpp -o devfs.o
|
$(CPP) $(CPP_FLAGS) -c fs/devfs.cpp -o devfs.o
|
||||||
|
$(CPP) $(CPP_FLAGS) -c fs/Device.cpp -o Device.o
|
||||||
|
$(CPP) $(CPP_FLAGS) -c fs/DeviceFolder.cpp -o DeviceFolder.o
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
# Clean up the source directory of any binaries #
|
# Clean up the source directory of any binaries #
|
||||||
#################################################
|
#################################################
|
||||||
clean:
|
clean:
|
||||||
- rm *.o ./lst/*.lst ./lst/*.doc *.bin
|
- rm *.s *.o *.bin *~ block/*~ char/*~ fs/*~ lang/*~ mm/*~ sys/*~ video/*~
|
||||||
|
@ -10,17 +10,28 @@
|
|||||||
|
|
||||||
#include "hos_defines.h"
|
#include "hos_defines.h"
|
||||||
#include "lang/string.h"
|
#include "lang/string.h"
|
||||||
|
#include "lang/LinkedList.h"
|
||||||
|
|
||||||
|
#define DEVICE_FOLDER 0
|
||||||
|
#define DEVICE_BLOCK 1
|
||||||
|
#define DEVICE_CHAR 2
|
||||||
|
#define DEVICE_LINK 3
|
||||||
|
|
||||||
class Device
|
class Device
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
union
|
||||||
|
{
|
||||||
dword myMajor;
|
dword myMajor;
|
||||||
|
LinkedList<Device> *folder;
|
||||||
|
string *link;
|
||||||
|
};
|
||||||
dword myMinor;
|
dword myMinor;
|
||||||
char myType; //'d'irectory,'l'ink,'b'lock,'c'har,'a'vail
|
word permissions; //9-bit permissions | (type << 12)
|
||||||
string myName;
|
string myName;
|
||||||
public:
|
public:
|
||||||
Device();
|
// Device();
|
||||||
Device(string name, dword major, dword minor, char type);
|
// Device(string name, dword major, dword minor, char type);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,13 +9,14 @@
|
|||||||
#define __HOS_DEVICEFOLDER__ __HOS_DEVICEFOLDER__
|
#define __HOS_DEVICEFOLDER__ __HOS_DEVICEFOLDER__
|
||||||
|
|
||||||
#include "lang/LinkedList.h"
|
#include "lang/LinkedList.h"
|
||||||
|
#include "Device.h"
|
||||||
|
|
||||||
class DeviceFolder
|
class DeviceFolder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LinkedList<Device> devices;
|
LinkedList<Device> devices;
|
||||||
LinkedList<DeviceFolder> folders;
|
LinkedList<DeviceFolder> folders;
|
||||||
DeviceFolder();
|
// DeviceFolder();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,11 +6,14 @@
|
|||||||
// Modified: 06/03/04
|
// Modified: 06/03/04
|
||||||
|
|
||||||
#include "devfs.h"
|
#include "devfs.h"
|
||||||
|
#include "Device.h"
|
||||||
|
#include "DeviceFolder.h"
|
||||||
|
|
||||||
|
DeviceFolder *dev;
|
||||||
|
|
||||||
void devfs_init()
|
void devfs_init()
|
||||||
{
|
{
|
||||||
|
dev = new DeviceFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
#ifndef __HOS_DEVFS__
|
#ifndef __HOS_DEVFS__
|
||||||
#define __HOS_DEVFS__ __HOS_DEVFS__
|
#define __HOS_DEVFS__ __HOS_DEVFS__
|
||||||
|
|
||||||
|
#include "Device.h"
|
||||||
|
|
||||||
void devfs_init();
|
void devfs_init();
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
// Date: 05/22/04
|
// Date: 05/22/04
|
||||||
// Modified: 06/03/04
|
// Modified: 06/03/04
|
||||||
|
|
||||||
|
#ifndef __HOS_LINKEDLIST__
|
||||||
|
#define __HOS_LINKEDLIST__ __HOS_LINKEDLIST__
|
||||||
|
|
||||||
template <typename Element>
|
template <typename Element>
|
||||||
class LinkedList
|
class LinkedList
|
||||||
{
|
{
|
||||||
@ -199,3 +202,5 @@ Element & LinkedList<Element>::operator[](int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// implements c++ string object for HOS
|
// implements c++ string object for HOS
|
||||||
// Author: Josh Holtrop
|
// Author: Josh Holtrop
|
||||||
// Date: 06/01/04
|
// Date: 06/01/04
|
||||||
// Modified: 06/01/04
|
// Modified: 06/07/04
|
||||||
|
|
||||||
#include "string.h" //string class declaration
|
#include "string.h" //string class declaration
|
||||||
#include "asmfuncs.h" //memcpy(void *dest, void *src, int n), strlen(char *str)
|
#include "asmfuncs.h" //memcpy(void *dest, void *src, int n), strlen(char *str)
|
||||||
@ -198,14 +198,14 @@ string::string(char chr, const string & str1)
|
|||||||
|
|
||||||
const char & string::operator[](unsigned int index) const
|
const char & string::operator[](unsigned int index) const
|
||||||
{
|
{
|
||||||
if (index >= 0 && index < myLength)
|
if (index < myLength)
|
||||||
return myChars[index];
|
return myChars[index];
|
||||||
return *myChars; //if index is invalid, return a pointer to the trailing 0
|
return *myChars; //if index is invalid, return a pointer to the trailing 0
|
||||||
}
|
}
|
||||||
|
|
||||||
char & string::operator[](unsigned int index)
|
char & string::operator[](unsigned int index)
|
||||||
{
|
{
|
||||||
if (index >= 0 && index < myLength)
|
if (index < myLength)
|
||||||
return myChars[index];
|
return myChars[index];
|
||||||
return *myChars; //if index is invalid, return a pointer to the trailing 0
|
return *myChars; //if index is invalid, return a pointer to the trailing 0
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// implements c++ string object for HOS
|
// implements c++ string object for HOS
|
||||||
// Author: Josh Holtrop
|
// Author: Josh Holtrop
|
||||||
// Date: 06/01/04
|
// Date: 06/01/04
|
||||||
// Modified: 06/03/04
|
// Modified: 06/07/04
|
||||||
|
|
||||||
|
|
||||||
#ifndef __HOS_STRING__
|
#ifndef __HOS_STRING__
|
||||||
|
356
kernel/lst/LDout.doc
Normal file
356
kernel/lst/LDout.doc
Normal file
@ -0,0 +1,356 @@
|
|||||||
|
|
||||||
|
Memory Configuration
|
||||||
|
|
||||||
|
Name Origin Length Attributes
|
||||||
|
*default* 0x0000000000000000 0xffffffffffffffff
|
||||||
|
|
||||||
|
Linker script and memory map
|
||||||
|
|
||||||
|
|
||||||
|
.text 0x00000000c0106000 0x4000
|
||||||
|
0x00000000c0106000 code = .
|
||||||
|
0x00000000c0106000 _code = .
|
||||||
|
0x00000000c0106000 __code = .
|
||||||
|
*(.text)
|
||||||
|
.text 0x00000000c0106000 0x384 ks.o
|
||||||
|
0x00000000c0106000 _start
|
||||||
|
.text 0x00000000c0106384 0x517 kernel.o
|
||||||
|
0x00000000c0106384 _k_init
|
||||||
|
0x00000000c010664c _isr
|
||||||
|
*fill* 0x00000000c010689b 0x5 00
|
||||||
|
.text 0x00000000c01068a0 0x308 asmfuncs.o
|
||||||
|
0x00000000c01068be _read_cr3
|
||||||
|
0x00000000c01068c2 _strcmp
|
||||||
|
0x00000000c01069d1 _puts
|
||||||
|
0x00000000c0106958 _memsetd
|
||||||
|
0x00000000c0106986 _invlpg_
|
||||||
|
0x00000000c01069f0 _putDecu
|
||||||
|
0x00000000c0106914 _memcpyd
|
||||||
|
0x00000000c01068fd _memcpy
|
||||||
|
0x00000000c010692b _memset
|
||||||
|
0x00000000c01068ba _read_cr2
|
||||||
|
0x00000000c010698e _writeCursorPosition
|
||||||
|
0x00000000c0106941 _memsetw
|
||||||
|
0x00000000c0106ab8 _putDec
|
||||||
|
0x00000000c01068e8 _strcpy
|
||||||
|
0x00000000c010696e _strlen
|
||||||
|
0x00000000c01069b4 _getCursorPosition
|
||||||
|
0x00000000c01068a0 _write_cr0
|
||||||
|
0x00000000c01068af _write_cr3
|
||||||
|
0x00000000c01068ab _read_cr0
|
||||||
|
.text 0x00000000c0106ba8 0x69a keyboard.o
|
||||||
|
0x00000000c01070dc __Z9kbdGetKeyv
|
||||||
|
0x00000000c0107172 __Z13kbd_resetLEDsv
|
||||||
|
0x00000000c010712e __Z10kbdWaitKeyv
|
||||||
|
0x00000000c0106ba8 __Z12isr_keyboardv
|
||||||
|
*fill* 0x00000000c0107242 0x2 00
|
||||||
|
.text 0x00000000c0107244 0x665 kio.o
|
||||||
|
0x00000000c01077f4 _kio_drawConsoleChar
|
||||||
|
0x00000000c01073ae _putc
|
||||||
|
0x00000000c01075fa _kio_console_cls
|
||||||
|
0x00000000c01074ea _putHex
|
||||||
|
0x00000000c0107882 _kio_writeCursorPosition
|
||||||
|
0x00000000c0107596 _kio_console_scroll
|
||||||
|
0x00000000c0107654 _kio_drawConsole
|
||||||
|
0x00000000c0107878 _kio_getCursorPosition
|
||||||
|
0x00000000c0107244 _kio_init
|
||||||
|
0x00000000c010726e _printf
|
||||||
|
0x00000000c010755e _kio_putBCD
|
||||||
|
*fill* 0x00000000c01078a9 0x3 00
|
||||||
|
.text 0x00000000c01078ac 0x350 mm.o
|
||||||
|
0x00000000c01078ac __Z7mm_initv
|
||||||
|
0x00000000c0107a8e __Z8mm_pfreej
|
||||||
|
0x00000000c0107a50 __Z9mm_pfreenjj
|
||||||
|
0x00000000c0107be8 __Z14mm_getTotalMemv
|
||||||
|
0x00000000c0107ad8 __Z9mm_pallocv
|
||||||
|
0x00000000c0107b80 __Z10mm_freememv
|
||||||
|
0x00000000c0107bf2 __Z15mm_getTotalMegsv
|
||||||
|
.text 0x00000000c0107bfc 0x201 mouse.o
|
||||||
|
0x00000000c0107bfc __Z10mouse_initv
|
||||||
|
0x00000000c0107ca6 __Z9isr_mousev
|
||||||
|
*fill* 0x00000000c0107dfd 0x3 00
|
||||||
|
.text 0x00000000c0107e00 0x8f stdfont.o
|
||||||
|
0x00000000c0107e60 __Z17stdfont_getBitmapj
|
||||||
|
0x00000000c0107e00 __Z20stdfont_getFontWidthj
|
||||||
|
0x00000000c0107e30 __Z21stdfont_getFontHeightj
|
||||||
|
*fill* 0x00000000c0107e8f 0x1 00
|
||||||
|
.text 0x00000000c0107e90 0x669 video.o
|
||||||
|
0x00000000c0108370 __Z13video_psetp32ij
|
||||||
|
0x00000000c0108184 __Z10video_vertiiij
|
||||||
|
0x00000000c010838c __Z15video_psetpnullij
|
||||||
|
0x00000000c0108068 __Z11video_horiziiij
|
||||||
|
0x00000000c01083a2 __Z15video_getHeightv
|
||||||
|
0x00000000c01083c2 __Z20video_getPhysBasePtrv
|
||||||
|
0x00000000c0107e90 __Z10video_initv
|
||||||
|
0x00000000c010823c __Z10video_rectiiiij
|
||||||
|
0x00000000c01083d6 __Z10video_lineiiiij
|
||||||
|
0x00000000c0108392 __Z14video_getWidthv
|
||||||
|
0x00000000c01083b2 __Z21video_getBitsPerPixelv
|
||||||
|
0x00000000c0108168 __Z11video_psetiij
|
||||||
|
0x00000000c01082dc __Z13video_psetp16ij
|
||||||
|
0x00000000c0108294 __Z11video_rectfiiiij
|
||||||
|
0x00000000c0108110 __Z10video_psetiij
|
||||||
|
0x00000000c0108322 __Z13video_psetp24ij
|
||||||
|
0x00000000c0107f82 __Z16video_renderChariiiijij
|
||||||
|
0x00000000c01083cc __Z10video_Modev
|
||||||
|
*fill* 0x00000000c01084f9 0x3 00
|
||||||
|
.text 0x00000000c01084fc 0x7d5 vmm.o
|
||||||
|
0x00000000c0108aa2 __Z21vmm_addHeapEntryBlockv
|
||||||
|
0x00000000c0108b64 __Z20vmm_getLastHeapEntryv
|
||||||
|
0x00000000c01088c4 __Z21vmm_coalesceHeapEntryP9HeapEntry
|
||||||
|
0x00000000c0108c96 __Z22vmm_getHeapEntryByBasej
|
||||||
|
0x00000000c0108816 __Z16vmm_getFreeChunkj
|
||||||
|
0x00000000c0108c4c __Z4freePv
|
||||||
|
0x00000000c010898e __Z12vmm_moreCorej
|
||||||
|
0x00000000c01087a2 __Z6mallocj
|
||||||
|
0x00000000c0108c14 __Z19vmm_heapEntriesLeftv
|
||||||
|
0x00000000c01084fc __Z8vmm_initv
|
||||||
|
0x00000000c0108b94 __Z25vmm_getFirstHoleHeapEntryj
|
||||||
|
0x00000000c01085a4 __Z12vmm_heb_initP14HeapEntryBlock
|
||||||
|
0x00000000c0108a86 __Z17vmm_nextHeapEntryv
|
||||||
|
0x00000000c0108620 __Z8vmm_map1jj
|
||||||
|
0x00000000c01086f8 __Z8vmm_mapnjjj
|
||||||
|
0x00000000c0108774 __Z10vmm_unmapnjj
|
||||||
|
0x00000000c0108732 __Z10vmm_unmap1j
|
||||||
|
0x00000000c0108bda __Z27vmm_getFirstUnusedHeapEntryv
|
||||||
|
*fill* 0x00000000c0108cd1 0x3 00
|
||||||
|
.text 0x00000000c0108cd4 0x269 rtc.o
|
||||||
|
0x00000000c0108cfe __Z13rtc_readMonthv
|
||||||
|
0x00000000c0108ed4 __Z11rtc_setHourh
|
||||||
|
0x00000000c0108cd4 __Z11rtc_readDayv
|
||||||
|
0x00000000c0108e04 __Z12rtc_setMonthh
|
||||||
|
0x00000000c0108ea0 __Z13rtc_setMinuteh
|
||||||
|
0x00000000c0108dd0 __Z10rtc_setDayh
|
||||||
|
0x00000000c0108da6 __Z12rtc_readHourv
|
||||||
|
0x00000000c0108d28 __Z12rtc_readYearv
|
||||||
|
0x00000000c0108d52 __Z14rtc_readSecondv
|
||||||
|
0x00000000c0108e38 __Z11rtc_setYearh
|
||||||
|
0x00000000c0108d7c __Z14rtc_readMinutev
|
||||||
|
0x00000000c0108e6c __Z13rtc_setSecondh
|
||||||
|
*fill* 0x00000000c0108f3d 0x3 00
|
||||||
|
.text 0x00000000c0108f40 0x121 pic.o
|
||||||
|
0x00000000c0108f40 __Z9pic_remapii
|
||||||
|
*fill* 0x00000000c0109061 0x3 00
|
||||||
|
.text 0x00000000c0109064 0x15d cstring.o
|
||||||
|
0x00000000c010908c __Z12string_splitPcc
|
||||||
|
0x00000000c0109064 __Z6strcatPcPKc
|
||||||
|
0x00000000c01090ea __Z14string_advancePc
|
||||||
|
0x00000000c0109146 __Z5ucasePc
|
||||||
|
0x00000000c0109104 __Z5rtrimPc
|
||||||
|
0x00000000c0109184 __Z5lcasePc
|
||||||
|
*fill* 0x00000000c01091c1 0x3 00
|
||||||
|
.text 0x00000000c01091c4 0xc7d string.o
|
||||||
|
0x00000000c01099ac __ZN6stringC1ERKS_S1_
|
||||||
|
0x00000000c0109780 __ZN6stringmIEPKc
|
||||||
|
0x00000000c0109354 __ZN6stringC1EPKc
|
||||||
|
0x00000000c0109d26 __ZN6stringC2EcRKS_
|
||||||
|
0x00000000c0109aa6 __ZN6stringC1ERKS_PKc
|
||||||
|
0x00000000c0109264 __ZN6stringC2ERKS_
|
||||||
|
0x00000000c01093a8 __ZN6stringaSERKS_
|
||||||
|
0x00000000c0109300 __ZN6stringC2EPKc
|
||||||
|
0x00000000c01091c4 __ZN6stringC2Ev
|
||||||
|
0x00000000c0109622 __ZN6stringpLEPKc
|
||||||
|
0x00000000c0109936 __ZN6stringC2ERKS_S1_
|
||||||
|
0x00000000c0109e14 __ZN6stringixEj
|
||||||
|
0x00000000c0109c3e __ZN6stringC2ERKS_c
|
||||||
|
0x00000000c0109490 __ZNK6string4dataEv
|
||||||
|
0x00000000c0109cb2 __ZN6stringC1ERKS_c
|
||||||
|
0x00000000c0109d86 __ZN6stringC1EcRKS_
|
||||||
|
0x00000000c0109de6 __ZNK6stringixEj
|
||||||
|
0x00000000c0109244 __ZN6stringD1Ev
|
||||||
|
0x00000000c0109b2a __ZN6stringC2EPKcRKS_
|
||||||
|
0x00000000c01096de __ZN6stringmIERKS_
|
||||||
|
0x00000000c010950e __ZNK6stringeqEPKc
|
||||||
|
0x00000000c0109224 __ZN6stringD2Ev
|
||||||
|
0x00000000c010949a __ZNK6string4sizeEv
|
||||||
|
0x00000000c0109a22 __ZN6stringC2ERKS_PKc
|
||||||
|
0x00000000c01098c6 __ZN6stringmIEc
|
||||||
|
0x00000000c01092b2 __ZN6stringC1ERKS_
|
||||||
|
0x00000000c0109bb4 __ZN6stringC1EPKcRKS_
|
||||||
|
0x00000000c01094a6 __ZNK6stringeqERKS_
|
||||||
|
0x00000000c0109842 __ZN6stringpLEc
|
||||||
|
0x00000000c0109580 __ZN6stringpLERKS_
|
||||||
|
0x00000000c0109418 __ZN6stringaSEPKc
|
||||||
|
0x00000000c01091f4 __ZN6stringC1Ev
|
||||||
|
*fill* 0x00000000c0109e41 0x3 00
|
||||||
|
.text 0x00000000c0109e44 0xe5 cmos.o
|
||||||
|
0x00000000c0109e9c __Z11cmos_gethd0v
|
||||||
|
0x00000000c0109e44 __Z11cmos_getfd0v
|
||||||
|
0x00000000c0109e70 __Z11cmos_getfd1v
|
||||||
|
0x00000000c0109ec8 __Z11cmos_gethd1v
|
||||||
|
*fill* 0x00000000c0109f29 0x3 00
|
||||||
|
.text 0x00000000c0109f2c 0x58 hos_defines.o
|
||||||
|
0x00000000c0109f58 __ZdlPv
|
||||||
|
0x00000000c0109f42 __Znaj
|
||||||
|
0x00000000c0109f2c __Znwj
|
||||||
|
0x00000000c0109f6e __ZdaPv
|
||||||
|
.text 0x00000000c0109f84 0x1a vfs.o
|
||||||
|
0x00000000c0109f84 __Z8vfs_initv
|
||||||
|
*fill* 0x00000000c0109f9e 0x2 00
|
||||||
|
.text 0x00000000c0109fa0 0x2d devfs.o
|
||||||
|
0x00000000c0109fa0 __Z10devfs_initv
|
||||||
|
*fill* 0x00000000c0109fcd 0x3 00
|
||||||
|
0x00000000c010a000 . = ALIGN (0x1000)
|
||||||
|
*fill* 0x00000000c0109fd0 0x80b237400000030 00
|
||||||
|
|
||||||
|
.gnu.linkonce.t._ZN12DeviceFolderC1Ev
|
||||||
|
0x00000000c010a000 0x28
|
||||||
|
.gnu.linkonce.t._ZN12DeviceFolderC1Ev
|
||||||
|
0x00000000c010a000 0x28 devfs.o
|
||||||
|
0x00000000c010a000 __ZN12DeviceFolderC1Ev
|
||||||
|
|
||||||
|
.gnu.linkonce.t._ZN10LinkedListI6DeviceEC1Ev
|
||||||
|
0x00000000c010a028 0x43
|
||||||
|
.gnu.linkonce.t._ZN10LinkedListI6DeviceEC1Ev
|
||||||
|
0x00000000c010a028 0x43 devfs.o
|
||||||
|
0x00000000c010a028 __ZN10LinkedListI6DeviceEC1Ev
|
||||||
|
|
||||||
|
.gnu.linkonce.t._ZN10LinkedListI12DeviceFolderEC1Ev
|
||||||
|
0x00000000c010a06c 0x43
|
||||||
|
.gnu.linkonce.t._ZN10LinkedListI12DeviceFolderEC1Ev
|
||||||
|
0x00000000c010a06c 0x43 devfs.o
|
||||||
|
0x00000000c010a06c __ZN10LinkedListI12DeviceFolderEC1Ev
|
||||||
|
|
||||||
|
.gnu.linkonce.t._ZN10LinkedListI6DeviceE10LinkedNodeC1Ev
|
||||||
|
0x00000000c010a0b0 0x2a
|
||||||
|
.gnu.linkonce.t._ZN10LinkedListI6DeviceE10LinkedNodeC1Ev
|
||||||
|
0x00000000c010a0b0 0x2a devfs.o
|
||||||
|
0x00000000c010a0b0 __ZN10LinkedListI6DeviceE10LinkedNodeC1Ev
|
||||||
|
|
||||||
|
.gnu.linkonce.t._ZN10LinkedListI12DeviceFolderE10LinkedNodeC1Ev
|
||||||
|
0x00000000c010a0da 0x2a
|
||||||
|
.gnu.linkonce.t._ZN10LinkedListI12DeviceFolderE10LinkedNodeC1Ev
|
||||||
|
0x00000000c010a0da 0x2a devfs.o
|
||||||
|
0x00000000c010a0da __ZN10LinkedListI12DeviceFolderE10LinkedNodeC1Ev
|
||||||
|
|
||||||
|
.gnu.linkonce.t._ZN6DeviceC1Ev
|
||||||
|
0x00000000c010a104 0x1a
|
||||||
|
.gnu.linkonce.t._ZN6DeviceC1Ev
|
||||||
|
0x00000000c010a104 0x1a devfs.o
|
||||||
|
0x00000000c010a104 __ZN6DeviceC1Ev
|
||||||
|
|
||||||
|
.data 0x00000000c010a120 0xee0
|
||||||
|
0x00000000c010a120 data = .
|
||||||
|
0x00000000c010a120 _data = .
|
||||||
|
0x00000000c010a120 __data = .
|
||||||
|
*(.data)
|
||||||
|
.data 0x00000000c010a120 0x18 stdfont.o
|
||||||
|
0x00000000c010a120 _fonts
|
||||||
|
.data 0x00000000c010a138 0x10 video.o
|
||||||
|
0x00000000c010a138 _vid_ptr16
|
||||||
|
0x00000000c010a144 _video_psetp
|
||||||
|
0x00000000c010a140 _vid_ptr32
|
||||||
|
0x00000000c010a13c _vid_ptr24
|
||||||
|
.data 0x00000000c010a148 0x4 vmm.o
|
||||||
|
0x00000000c010a148 _firstHeapEntry
|
||||||
|
0x00000000c010b000 . = ALIGN (0x1000)
|
||||||
|
*fill* 0x00000000c010a14c 0x8117cc000000eb4 00
|
||||||
|
|
||||||
|
.rodata 0x00000000c010b000 0x2000
|
||||||
|
0x00000000c010b000 rodata = .
|
||||||
|
0x00000000c010b000 _rodata = .
|
||||||
|
0x00000000c010b000 __rodata = .
|
||||||
|
*(.rodata)
|
||||||
|
.rodata 0x00000000c010b000 0x121 kernel.o
|
||||||
|
*fill* 0x00000000c010b121 0x1f 00
|
||||||
|
.rodata 0x00000000c010b140 0x141 keyboard.o
|
||||||
|
*fill* 0x00000000c010b281 0x3 00
|
||||||
|
.rodata 0x00000000c010b284 0x1e4 kio.o
|
||||||
|
*fill* 0x00000000c010b468 0x18 00
|
||||||
|
.rodata 0x00000000c010b480 0x1200 stdfont.o
|
||||||
|
.rodata 0x00000000c010c680 0x4 vfs.o
|
||||||
|
0x00000000c010d000 . = ALIGN (0x1000)
|
||||||
|
*fill* 0x00000000c010c684 0x8117d140000097c 00
|
||||||
|
|
||||||
|
.bss 0x00000000c010d000 0x22000
|
||||||
|
0x00000000c010d000 bss = .
|
||||||
|
0x00000000c010d000 _bss = .
|
||||||
|
0x00000000c010d000 __bss = .
|
||||||
|
*(.bss)
|
||||||
|
.bss 0x00000000c010d000 0x4 kernel.o
|
||||||
|
0x00000000c010d000 _timer
|
||||||
|
*fill* 0x00000000c010d004 0x4 00
|
||||||
|
*fill* 0x00000000c010d008 0x18 00
|
||||||
|
.bss 0x00000000c010d020 0x12b keyboard.o
|
||||||
|
0x00000000c010d040 _kbdBuffer
|
||||||
|
0x00000000c010d148 _kbdExt
|
||||||
|
0x00000000c010d021 _kbdAscii
|
||||||
|
0x00000000c010d149 _kbdExt2
|
||||||
|
0x00000000c010d14a _ackReason
|
||||||
|
0x00000000c010d140 _kbdBufferStart
|
||||||
|
0x00000000c010d022 _kbdScan
|
||||||
|
0x00000000c010d144 _kbdBufferLen
|
||||||
|
0x00000000c010d020 _kbdFlags
|
||||||
|
*fill* 0x00000000c010d14b 0x15 00
|
||||||
|
.bss 0x00000000c010d160 0xfc0 kio.o
|
||||||
|
0x00000000c010d180 _console_memory
|
||||||
|
0x00000000c010d160 _graphical
|
||||||
|
0x00000000c010d164 _cursorPosition
|
||||||
|
.bss 0x00000000c010e120 0x20020 mm.o
|
||||||
|
0x00000000c010e124 _mm_megabytes
|
||||||
|
0x00000000c010e140 _page_bitmap
|
||||||
|
0x00000000c010e120 _mm_totalmem
|
||||||
|
.bss 0x00000000c012e140 0x1c mouse.o
|
||||||
|
0x00000000c012e144 _mouse_y
|
||||||
|
0x00000000c012e148 _mouse_bytesRead
|
||||||
|
0x00000000c012e140 _mouse_x
|
||||||
|
0x00000000c012e14c _mouse_inbuffer
|
||||||
|
*fill* 0x00000000c012e15c 0x4 00
|
||||||
|
.bss 0x00000000c012e160 0x104 video.o
|
||||||
|
0x00000000c012e160 _video_mode
|
||||||
|
0x00000000c012e260 _videoMode
|
||||||
|
.bss 0x00000000c012e264 0x4 devfs.o
|
||||||
|
0x00000000c012e264 _dev
|
||||||
|
0x00000000c012f000 . = ALIGN (0x1000)
|
||||||
|
*fill* 0x00000000c012e268 0x8117e7800000d98 00
|
||||||
|
0x00000000c012f000 end = .
|
||||||
|
0x00000000c012f000 _end = .
|
||||||
|
0x00000000c012f000 __end = .
|
||||||
|
LOAD ks.o
|
||||||
|
LOAD kernel.o
|
||||||
|
LOAD asmfuncs.o
|
||||||
|
LOAD fdc.o
|
||||||
|
LOAD keyboard.o
|
||||||
|
LOAD kio.o
|
||||||
|
LOAD mm.o
|
||||||
|
LOAD mouse.o
|
||||||
|
LOAD stdfont.o
|
||||||
|
LOAD video.o
|
||||||
|
LOAD vmm.o
|
||||||
|
LOAD rtc.o
|
||||||
|
LOAD pic.o
|
||||||
|
LOAD io.o
|
||||||
|
LOAD cstring.o
|
||||||
|
LOAD string.o
|
||||||
|
LOAD cmos.o
|
||||||
|
LOAD hos_defines.o
|
||||||
|
LOAD vfs.o
|
||||||
|
LOAD devfs.o
|
||||||
|
LOAD Device.o
|
||||||
|
LOAD DeviceFolder.o
|
||||||
|
OUTPUT(kernel.bin binary)
|
||||||
|
|
||||||
|
.note.GNU-stack
|
||||||
|
0x0000000000000000 0x0
|
||||||
|
|
||||||
|
.comment 0x0000000000000000 0x3fc
|
||||||
|
.comment 0x0000000000000000 0x33 kernel.o
|
||||||
|
.comment 0x0000000000000033 0x33 fdc.o
|
||||||
|
.comment 0x0000000000000066 0x33 keyboard.o
|
||||||
|
.comment 0x0000000000000099 0x33 kio.o
|
||||||
|
.comment 0x00000000000000cc 0x33 mm.o
|
||||||
|
.comment 0x00000000000000ff 0x33 mouse.o
|
||||||
|
.comment 0x0000000000000132 0x33 stdfont.o
|
||||||
|
.comment 0x0000000000000165 0x33 video.o
|
||||||
|
.comment 0x0000000000000198 0x33 vmm.o
|
||||||
|
.comment 0x00000000000001cb 0x33 rtc.o
|
||||||
|
.comment 0x00000000000001fe 0x33 pic.o
|
||||||
|
.comment 0x0000000000000231 0x33 io.o
|
||||||
|
.comment 0x0000000000000264 0x33 cstring.o
|
||||||
|
.comment 0x0000000000000297 0x33 string.o
|
||||||
|
.comment 0x00000000000002ca 0x33 cmos.o
|
||||||
|
.comment 0x00000000000002fd 0x33 hos_defines.o
|
||||||
|
.comment 0x0000000000000330 0x33 vfs.o
|
||||||
|
.comment 0x0000000000000363 0x33 devfs.o
|
||||||
|
.comment 0x0000000000000396 0x33 Device.o
|
||||||
|
.comment 0x00000000000003c9 0x33 DeviceFolder.o
|
510
kernel/lst/asmfuncs.lst
Normal file
510
kernel/lst/asmfuncs.lst
Normal file
@ -0,0 +1,510 @@
|
|||||||
|
1 ; asmfuncs.asm
|
||||||
|
2 ; Josh Holtrop
|
||||||
|
3 ; Created: 10/23/03
|
||||||
|
4 ; Modified: 02/26/04
|
||||||
|
5
|
||||||
|
6 [extern _putc]
|
||||||
|
7 [extern _console_memory]
|
||||||
|
8 [extern _cursorPosition]
|
||||||
|
9 [extern _video_drawConsole]
|
||||||
|
10 [extern _videoMode]
|
||||||
|
11
|
||||||
|
12 %macro jzfar 1
|
||||||
|
13 jnz %%skip
|
||||||
|
14 jmp %1
|
||||||
|
15 %%skip:
|
||||||
|
16
|
||||||
|
17 %endmacro
|
||||||
|
18
|
||||||
|
19 ;stores the parameter to the CR0 register
|
||||||
|
20 ;extern dword write_cr0(dword cr0);
|
||||||
|
21 [global _write_cr0]
|
||||||
|
22 _write_cr0:
|
||||||
|
23 00000000 55 push ebp
|
||||||
|
24 00000001 89E5 mov ebp, esp
|
||||||
|
25 00000003 8B4508 mov eax, [ebp+8]
|
||||||
|
26 00000006 0F22C0 mov cr0, eax
|
||||||
|
27 00000009 5D pop ebp
|
||||||
|
28 0000000A C3 ret
|
||||||
|
29
|
||||||
|
30 ;returns the value in the CR0 register
|
||||||
|
31 ;extern dword read_cr0();
|
||||||
|
32 [global _read_cr0]
|
||||||
|
33 _read_cr0:
|
||||||
|
34 0000000B 0F20C0 mov eax, cr0;
|
||||||
|
35 0000000E C3 ret
|
||||||
|
36
|
||||||
|
37 ;stores the parameter to the CR3 register
|
||||||
|
38 ;extern dword write_cr3(dword cr3);
|
||||||
|
39 [global _write_cr3]
|
||||||
|
40 _write_cr3:
|
||||||
|
41 0000000F 55 push ebp
|
||||||
|
42 00000010 89E5 mov ebp, esp
|
||||||
|
43 00000012 8B4508 mov eax, [ebp+8]
|
||||||
|
44 00000015 0F22D8 mov cr3, eax
|
||||||
|
45 00000018 5D pop ebp
|
||||||
|
46 00000019 C3 ret
|
||||||
|
47
|
||||||
|
48
|
||||||
|
49 ;returns the value in the CR2 register
|
||||||
|
50 ;extern dword read_cr2();
|
||||||
|
51 [global _read_cr2]
|
||||||
|
52 _read_cr2:
|
||||||
|
53 0000001A 0F20D0 mov eax, cr2;
|
||||||
|
54 0000001D C3 ret
|
||||||
|
55
|
||||||
|
56
|
||||||
|
57
|
||||||
|
58 ;returns the value in the CR3 register
|
||||||
|
59 ;extern dword read_cr3();
|
||||||
|
60 [global _read_cr3]
|
||||||
|
61 _read_cr3:
|
||||||
|
62 0000001E 0F20D8 mov eax, cr3;
|
||||||
|
63 00000021 C3 ret
|
||||||
|
64
|
||||||
|
65
|
||||||
|
66 ;compares one string to another
|
||||||
|
67 ;returns 0 if the strings are different
|
||||||
|
68 ;extern dword strcmp(char *str1, char *str2);
|
||||||
|
69 [global _strcmp]
|
||||||
|
70 _strcmp:
|
||||||
|
71 00000022 55 push ebp
|
||||||
|
72 00000023 89E5 mov ebp, esp
|
||||||
|
73 00000025 56 push esi
|
||||||
|
74 00000026 57 push edi
|
||||||
|
75
|
||||||
|
76 00000027 8B7508 mov esi, [ebp+8]
|
||||||
|
77 0000002A 8B7D0C mov edi, [ebp+12]
|
||||||
|
78 strcmp_loop1:
|
||||||
|
79 0000002D AC lodsb
|
||||||
|
80 0000002E 8A27 mov ah, [edi]
|
||||||
|
81 00000030 47 inc edi
|
||||||
|
82 00000031 38C4 cmp ah, al
|
||||||
|
83 00000033 750D jnz strcmp_ne
|
||||||
|
84 00000035 08C0 or al, al
|
||||||
|
85 00000037 7402 jz strcmp_e
|
||||||
|
86 00000039 EBF2 jmp strcmp_loop1
|
||||||
|
87 strcmp_e:
|
||||||
|
88 0000003B B801000000 mov eax, 1
|
||||||
|
89 00000040 EB02 jmp short strcmp_done
|
||||||
|
90 strcmp_ne:
|
||||||
|
91 00000042 31C0 xor eax, eax
|
||||||
|
92 strcmp_done:
|
||||||
|
93
|
||||||
|
94 00000044 5F pop edi
|
||||||
|
95 00000045 5E pop esi
|
||||||
|
96 00000046 5D pop ebp
|
||||||
|
97 00000047 C3 ret
|
||||||
|
98
|
||||||
|
99 ;copies a string from the source to the destination parameter
|
||||||
|
100 ;extern void strcpy(char *dest, char *src);
|
||||||
|
101 [global _strcpy]
|
||||||
|
102 _strcpy:
|
||||||
|
103 00000048 55 push ebp
|
||||||
|
104 00000049 89E5 mov ebp, esp
|
||||||
|
105 0000004B 56 push esi
|
||||||
|
106 0000004C 57 push edi
|
||||||
|
107 0000004D 8B7D08 mov edi, [ebp+8]
|
||||||
|
108 00000050 8B750C mov esi, [ebp+12]
|
||||||
|
109 strcpyloop:
|
||||||
|
110 00000053 AC lodsb
|
||||||
|
111 00000054 AA stosb
|
||||||
|
112 00000055 08C0 or al, al
|
||||||
|
113 00000057 75FA jnz strcpyloop
|
||||||
|
114 00000059 5F pop edi
|
||||||
|
115 0000005A 5E pop esi
|
||||||
|
116 0000005B 5D pop ebp
|
||||||
|
117 0000005C C3 ret
|
||||||
|
118
|
||||||
|
119 ;copies memory of n bytes from src to destination
|
||||||
|
120 ;void memcpy(void *dest, void *src, dword n);
|
||||||
|
121 [global _memcpy]
|
||||||
|
122 _memcpy:
|
||||||
|
123 0000005D 55 push ebp
|
||||||
|
124 0000005E 89E5 mov ebp, esp
|
||||||
|
125 00000060 56 push esi
|
||||||
|
126 00000061 57 push edi
|
||||||
|
127 00000062 51 push ecx
|
||||||
|
128 00000063 8B7D08 mov edi, [ebp+8]
|
||||||
|
129 00000066 8B750C mov esi, [ebp+12]
|
||||||
|
130 00000069 8B4D10 mov ecx, [ebp+16]
|
||||||
|
131
|
||||||
|
132 0000006C FC cld
|
||||||
|
133 0000006D F3A4 rep movsb
|
||||||
|
134
|
||||||
|
135 0000006F 59 pop ecx
|
||||||
|
136 00000070 5F pop edi
|
||||||
|
137 00000071 5E pop esi
|
||||||
|
138 00000072 5D pop ebp
|
||||||
|
139 00000073 C3 ret
|
||||||
|
140
|
||||||
|
141
|
||||||
|
142 ;copies memory of n dwords (n*4 bytes) from src to destination
|
||||||
|
143 ;void memcpyd(void *dest, void *src, dword n);
|
||||||
|
144 [global _memcpyd]
|
||||||
|
145 _memcpyd:
|
||||||
|
146 00000074 55 push ebp
|
||||||
|
147 00000075 89E5 mov ebp, esp
|
||||||
|
148 00000077 56 push esi
|
||||||
|
149 00000078 57 push edi
|
||||||
|
150 00000079 51 push ecx
|
||||||
|
151 0000007A 8B7D08 mov edi, [ebp+8]
|
||||||
|
152 0000007D 8B750C mov esi, [ebp+12]
|
||||||
|
153 00000080 8B4D10 mov ecx, [ebp+16]
|
||||||
|
154
|
||||||
|
155 00000083 FC cld
|
||||||
|
156 00000084 F3A5 rep movsd
|
||||||
|
157
|
||||||
|
158 00000086 59 pop ecx
|
||||||
|
159 00000087 5F pop edi
|
||||||
|
160 00000088 5E pop esi
|
||||||
|
161 00000089 5D pop ebp
|
||||||
|
162 0000008A C3 ret
|
||||||
|
163
|
||||||
|
164
|
||||||
|
165 ;sets num bytes at buffer to the value of c
|
||||||
|
166 ;void *memset(void *buffer, int c, int num);
|
||||||
|
167 [global _memset]
|
||||||
|
168 _memset:
|
||||||
|
169 0000008B 55 push ebp
|
||||||
|
170 0000008C 89E5 mov ebp, esp
|
||||||
|
171 0000008E 57 push edi
|
||||||
|
172 0000008F 51 push ecx
|
||||||
|
173 00000090 8B7D08 mov edi, [ebp+8]
|
||||||
|
174 00000093 57 push edi ;save for return address
|
||||||
|
175 00000094 8B450C mov eax, [ebp+12]
|
||||||
|
176 00000097 8B4D10 mov ecx, [ebp+16]
|
||||||
|
177
|
||||||
|
178 0000009A F3AA rep stosb
|
||||||
|
179
|
||||||
|
180 0000009C 58 pop eax
|
||||||
|
181 0000009D 59 pop ecx
|
||||||
|
182 0000009E 5F pop edi
|
||||||
|
183 0000009F 5D pop ebp
|
||||||
|
184 000000A0 C3 ret
|
||||||
|
185
|
||||||
|
186
|
||||||
|
187 ;sets num words at buffer to the value of c
|
||||||
|
188 ;void *memsetw(void *buffer, int c, int num);
|
||||||
|
189 [global _memsetw]
|
||||||
|
190 _memsetw:
|
||||||
|
191 000000A1 55 push ebp
|
||||||
|
192 000000A2 89E5 mov ebp, esp
|
||||||
|
193 000000A4 57 push edi
|
||||||
|
194 000000A5 51 push ecx
|
||||||
|
195 000000A6 8B7D08 mov edi, [ebp+8]
|
||||||
|
196 000000A9 57 push edi ;save for return address
|
||||||
|
197 000000AA 8B450C mov eax, [ebp+12]
|
||||||
|
198 000000AD 8B4D10 mov ecx, [ebp+16]
|
||||||
|
199
|
||||||
|
200 000000B0 F366AB rep stosw
|
||||||
|
201
|
||||||
|
202 000000B3 58 pop eax
|
||||||
|
203 000000B4 59 pop ecx
|
||||||
|
204 000000B5 5F pop edi
|
||||||
|
205 000000B6 5D pop ebp
|
||||||
|
206 000000B7 C3 ret
|
||||||
|
207
|
||||||
|
208
|
||||||
|
209 ;sets num dwords at buffer to the value of c
|
||||||
|
210 ;void *memsetd(void *buffer, int c, int num);
|
||||||
|
211 [global _memsetd]
|
||||||
|
212 _memsetd:
|
||||||
|
213 000000B8 55 push ebp
|
||||||
|
214 000000B9 89E5 mov ebp, esp
|
||||||
|
215 000000BB 57 push edi
|
||||||
|
216 000000BC 51 push ecx
|
||||||
|
217 000000BD 8B7D08 mov edi, [ebp+8]
|
||||||
|
218 000000C0 57 push edi ;save for return address
|
||||||
|
219 000000C1 8B450C mov eax, [ebp+12]
|
||||||
|
220 000000C4 8B4D10 mov ecx, [ebp+16]
|
||||||
|
221
|
||||||
|
222 000000C7 F3AB rep stosd
|
||||||
|
223
|
||||||
|
224 000000C9 58 pop eax
|
||||||
|
225 000000CA 59 pop ecx
|
||||||
|
226 000000CB 5F pop edi
|
||||||
|
227 000000CC 5D pop ebp
|
||||||
|
228 000000CD C3 ret
|
||||||
|
229
|
||||||
|
230
|
||||||
|
231 ;returns the number of characters in a string
|
||||||
|
232 ;extern dword strlen(char *str);
|
||||||
|
233 [global _strlen]
|
||||||
|
234 _strlen:
|
||||||
|
235 000000CE 55 push ebp
|
||||||
|
236 000000CF 89E5 mov ebp, esp
|
||||||
|
237 000000D1 56 push esi
|
||||||
|
238 000000D2 53 push ebx
|
||||||
|
239 000000D3 8B7508 mov esi, [ebp+8]
|
||||||
|
240 000000D6 31DB xor ebx, ebx
|
||||||
|
241 strlenloop:
|
||||||
|
242 000000D8 AC lodsb
|
||||||
|
243 000000D9 08C0 or al, al
|
||||||
|
244 000000DB 7403 jz strlendone
|
||||||
|
245 000000DD 43 inc ebx
|
||||||
|
246 000000DE EBF8 jmp strlenloop
|
||||||
|
247 strlendone:
|
||||||
|
248 000000E0 89D8 mov eax, ebx
|
||||||
|
249 000000E2 5B pop ebx
|
||||||
|
250 000000E3 5E pop esi
|
||||||
|
251 000000E4 5D pop ebp
|
||||||
|
252 000000E5 C3 ret
|
||||||
|
253
|
||||||
|
254 ;this function invalidates the page directory/table entry that
|
||||||
|
255 ; would be used to access the memory address given in the parameter
|
||||||
|
256 ;extern void invlpg_(dword addr);
|
||||||
|
257 [global _invlpg_]
|
||||||
|
258 _invlpg_:
|
||||||
|
259 000000E6 8B442404 mov eax, [esp+4]
|
||||||
|
260 000000EA 0F0138 invlpg [eax]
|
||||||
|
261 000000ED C3 ret
|
||||||
|
262
|
||||||
|
263
|
||||||
|
264 ;
|
||||||
|
265 ;void writeCursorPosition(word pos)
|
||||||
|
266 ;
|
||||||
|
267 [global _writeCursorPosition]
|
||||||
|
268 _writeCursorPosition:
|
||||||
|
269 000000EE 55 push ebp
|
||||||
|
270 000000EF 89E5 mov ebp, esp
|
||||||
|
271
|
||||||
|
272 000000F1 50 push eax
|
||||||
|
273 000000F2 53 push ebx
|
||||||
|
274 000000F3 52 push edx
|
||||||
|
275
|
||||||
|
276 000000F4 8B4508 mov eax, [ebp+8] ;cursor position in ax
|
||||||
|
277
|
||||||
|
278 000000F7 88C3 mov bl, al
|
||||||
|
279 000000F9 66BAD403 mov dx, 0x03D4
|
||||||
|
280 000000FD B00E mov al, 0x0E
|
||||||
|
281 000000FF EE out dx, al
|
||||||
|
282
|
||||||
|
283 00000100 6642 inc dx
|
||||||
|
284 00000102 88E0 mov al, ah
|
||||||
|
285 00000104 EE out dx, al
|
||||||
|
286
|
||||||
|
287 00000105 664A dec dx
|
||||||
|
288 00000107 B00F mov al, 0x0F
|
||||||
|
289 00000109 EE out dx, al
|
||||||
|
290
|
||||||
|
291 0000010A 6642 inc dx
|
||||||
|
292 0000010C 88D8 mov al, bl
|
||||||
|
293 0000010E EE out dx, al
|
||||||
|
294
|
||||||
|
295 0000010F 5A pop edx
|
||||||
|
296 00000110 5B pop ebx
|
||||||
|
297 00000111 58 pop eax
|
||||||
|
298 00000112 5D pop ebp
|
||||||
|
299
|
||||||
|
300 00000113 C3 ret
|
||||||
|
301
|
||||||
|
302
|
||||||
|
303 ;
|
||||||
|
304 ;word getCursorPosition()
|
||||||
|
305 ;
|
||||||
|
306 [global _getCursorPosition]
|
||||||
|
307 _getCursorPosition:
|
||||||
|
308 00000114 53 push ebx
|
||||||
|
309 00000115 52 push edx
|
||||||
|
310
|
||||||
|
311 00000116 31C0 xor eax, eax
|
||||||
|
312 00000118 66BAD403 mov dx, 0x03D4
|
||||||
|
313 0000011C B00E mov al, 0x0E
|
||||||
|
314 0000011E EE out dx, al
|
||||||
|
315
|
||||||
|
316 0000011F 6642 inc dx
|
||||||
|
317 00000121 EC in al, dx
|
||||||
|
318 00000122 88C3 mov bl, al
|
||||||
|
319
|
||||||
|
320 00000124 664A dec dx
|
||||||
|
321 00000126 B00F mov al, 0x0F
|
||||||
|
322 00000128 EE out dx, al
|
||||||
|
323
|
||||||
|
324 00000129 6642 inc dx
|
||||||
|
325 0000012B EC in al, dx
|
||||||
|
326 0000012C 88DC mov ah, bl
|
||||||
|
327
|
||||||
|
328 0000012E 5A pop edx
|
||||||
|
329 0000012F 5B pop ebx
|
||||||
|
330
|
||||||
|
331 00000130 C3 ret
|
||||||
|
332
|
||||||
|
333
|
||||||
|
334 ;
|
||||||
|
335 ;int puts(char *str)
|
||||||
|
336 ;
|
||||||
|
337 [global _puts]
|
||||||
|
338 _puts:
|
||||||
|
339 00000131 55 push ebp
|
||||||
|
340 00000132 89E5 mov ebp, esp
|
||||||
|
341 00000134 56 push esi
|
||||||
|
342 00000135 50 push eax
|
||||||
|
343 00000136 8B7508 mov esi, [ebp+8] ;esi = to string
|
||||||
|
344 puts_loop:
|
||||||
|
345 00000139 AC lodsb
|
||||||
|
346 0000013A 3C00 cmp al, 0
|
||||||
|
347 0000013C 740E jz puts_done
|
||||||
|
348 0000013E 50 push eax
|
||||||
|
349 0000013F E8(00000000) call _putc
|
||||||
|
350 00000144 81C404000000 add esp, 4
|
||||||
|
351 0000014A EBED jmp puts_loop
|
||||||
|
352
|
||||||
|
353 puts_done:
|
||||||
|
354 0000014C 58 pop eax
|
||||||
|
355 0000014D 5E pop esi
|
||||||
|
356 0000014E 5D pop ebp
|
||||||
|
357 0000014F C3 ret
|
||||||
|
358
|
||||||
|
359
|
||||||
|
360
|
||||||
|
361
|
||||||
|
362 [global _putDecu]
|
||||||
|
363 _putDecu:
|
||||||
|
364 00000150 55 push ebp
|
||||||
|
365 00000151 89E5 mov ebp, esp
|
||||||
|
366 00000153 81EC18000000 sub esp, 24
|
||||||
|
367 00000159 C745FC01000000 mov DWORD [ebp-4], 1
|
||||||
|
368 00000160 C645FB00 mov BYTE [ebp-5], 0
|
||||||
|
369 L2:
|
||||||
|
370 00000164 8B5508 mov edx, DWORD [ebp+8]
|
||||||
|
371 00000167 B8CDCCCCCC mov eax, -858993459
|
||||||
|
372 0000016C F7E2 mul edx
|
||||||
|
373 0000016E 89D0 mov eax, edx
|
||||||
|
374 00000170 C1E803 shr eax, 3
|
||||||
|
375 00000173 3B45FC cmp eax, DWORD [ebp-4]
|
||||||
|
376 00000176 7305 jae L4
|
||||||
|
377 00000178 E912000000 jmp L3
|
||||||
|
378 L4:
|
||||||
|
379 0000017D 8B45FC mov eax, DWORD [ebp-4]
|
||||||
|
380 00000180 89C2 mov edx, eax
|
||||||
|
381 00000182 C1E202 sal edx, 2
|
||||||
|
382 00000185 01C2 add edx, eax
|
||||||
|
383 00000187 8D0412 lea eax, [edx+edx]
|
||||||
|
384 0000018A 8945FC mov DWORD [ebp-4], eax
|
||||||
|
385 0000018D EBD5 jmp L2
|
||||||
|
386 L3:
|
||||||
|
387 0000018F 90 nop
|
||||||
|
388 L5:
|
||||||
|
389 00000190 817DFC01000000 cmp DWORD [ebp-4], 1
|
||||||
|
390 00000197 7705 ja L7
|
||||||
|
391 00000199 E959000000 jmp L6
|
||||||
|
392 L7:
|
||||||
|
393 0000019E 8B5508 mov edx, DWORD [ebp+8]
|
||||||
|
394 000001A1 89D0 mov eax, edx
|
||||||
|
395 000001A3 BA00000000 mov edx, 0
|
||||||
|
396 000001A8 F775FC div DWORD [ebp-4]
|
||||||
|
397 000001AB 8945F4 mov DWORD [ebp-12], eax
|
||||||
|
398 000001AE 8A45F4 mov al, BYTE [ebp-12]
|
||||||
|
399 000001B1 8845FB mov BYTE [ebp-5], al
|
||||||
|
400 000001B4 B800000000 mov eax, 0
|
||||||
|
401 000001B9 8A45FB mov al, BYTE [ebp-5]
|
||||||
|
402 000001BC 0FAF45FC imul eax, DWORD [ebp-4]
|
||||||
|
403 000001C0 294508 sub DWORD [ebp+8], eax
|
||||||
|
404 000001C3 8B55FC mov edx, DWORD [ebp-4]
|
||||||
|
405 000001C6 B8CDCCCCCC mov eax, -858993459
|
||||||
|
406 000001CB F7E2 mul edx
|
||||||
|
407 000001CD 89D0 mov eax, edx
|
||||||
|
408 000001CF C1E803 shr eax, 3
|
||||||
|
409 000001D2 8945FC mov DWORD [ebp-4], eax
|
||||||
|
410 000001D5 8D45FB lea eax, [ebp-5]
|
||||||
|
411 000001D8 800030 add BYTE [eax], 48
|
||||||
|
412 000001DB 81EC0C000000 sub esp, 12
|
||||||
|
413 000001E1 B800000000 mov eax, 0
|
||||||
|
414 000001E6 8A45FB mov al, BYTE [ebp-5]
|
||||||
|
415 000001E9 50 push eax
|
||||||
|
416 000001EA E8(00000000) call _putc
|
||||||
|
417 000001EF 81C410000000 add esp, 16
|
||||||
|
418 000001F5 EB99 jmp L5
|
||||||
|
419 L6:
|
||||||
|
420 000001F7 81EC0C000000 sub esp, 12
|
||||||
|
421 000001FD 8A4508 mov al, BYTE [ebp+8]
|
||||||
|
422 00000200 0530000000 add eax, 48
|
||||||
|
423 00000205 25FF000000 and eax, 255
|
||||||
|
424 0000020A 50 push eax
|
||||||
|
425 0000020B E8(00000000) call _putc
|
||||||
|
426 00000210 81C410000000 add esp, 16
|
||||||
|
427 00000216 C9 leave
|
||||||
|
428 00000217 C3 ret
|
||||||
|
429
|
||||||
|
430
|
||||||
|
431
|
||||||
|
432
|
||||||
|
433 [global _putDec]
|
||||||
|
434 _putDec:
|
||||||
|
435 00000218 55 push ebp
|
||||||
|
436 00000219 89E5 mov ebp, esp
|
||||||
|
437 0000021B 81EC18000000 sub esp, 24
|
||||||
|
438 00000221 817D0800000000 cmp DWORD [ebp+8], 0
|
||||||
|
439 00000228 7919 jns L9
|
||||||
|
440 0000022A 81EC0C000000 sub esp, 12
|
||||||
|
441 00000230 682D000000 push 45
|
||||||
|
442 00000235 E8(00000000) call _putc
|
||||||
|
443 0000023A 81C410000000 add esp, 16
|
||||||
|
444 00000240 F75D08 neg DWORD [ebp+8]
|
||||||
|
445 L9:
|
||||||
|
446 00000243 C745FC01000000 mov DWORD [ebp-4], 1
|
||||||
|
447 0000024A C645FB00 mov BYTE [ebp-5], 0
|
||||||
|
448 L10:
|
||||||
|
449 0000024E 8B4508 mov eax, DWORD [ebp+8]
|
||||||
|
450 00000251 3B45FC cmp eax, DWORD [ebp-4]
|
||||||
|
451 00000254 7305 jae L12
|
||||||
|
452 00000256 E912000000 jmp L11
|
||||||
|
453 L12:
|
||||||
|
454 0000025B 8B45FC mov eax, DWORD [ebp-4]
|
||||||
|
455 0000025E 89C2 mov edx, eax
|
||||||
|
456 00000260 C1E202 sal edx, 2
|
||||||
|
457 00000263 01C2 add edx, eax
|
||||||
|
458 00000265 8D0412 lea eax, [edx+edx]
|
||||||
|
459 00000268 8945FC mov DWORD [ebp-4], eax
|
||||||
|
460 0000026B EBE1 jmp L10
|
||||||
|
461 L11:
|
||||||
|
462 0000026D 8B55FC mov edx, DWORD [ebp-4]
|
||||||
|
463 00000270 B8CDCCCCCC mov eax, -858993459
|
||||||
|
464 00000275 F7E2 mul edx
|
||||||
|
465 00000277 89D0 mov eax, edx
|
||||||
|
466 00000279 C1E803 shr eax, 3
|
||||||
|
467 0000027C 8945FC mov DWORD [ebp-4], eax
|
||||||
|
468 L13:
|
||||||
|
469 0000027F 817DFC01000000 cmp DWORD [ebp-4], 1
|
||||||
|
470 00000286 7705 ja L15
|
||||||
|
471 00000288 E959000000 jmp L14
|
||||||
|
472 L15:
|
||||||
|
473 0000028D 8B5508 mov edx, DWORD [ebp+8]
|
||||||
|
474 00000290 89D0 mov eax, edx
|
||||||
|
475 00000292 BA00000000 mov edx, 0
|
||||||
|
476 00000297 F775FC div DWORD [ebp-4]
|
||||||
|
477 0000029A 8945F4 mov DWORD [ebp-12], eax
|
||||||
|
478 0000029D 8A45F4 mov al, BYTE [ebp-12]
|
||||||
|
479 000002A0 8845FB mov BYTE [ebp-5], al
|
||||||
|
480 000002A3 B800000000 mov eax, 0
|
||||||
|
481 000002A8 8A45FB mov al, BYTE [ebp-5]
|
||||||
|
482 000002AB 0FAF45FC imul eax, DWORD [ebp-4]
|
||||||
|
483 000002AF 294508 sub DWORD [ebp+8], eax
|
||||||
|
484 000002B2 8B55FC mov edx, DWORD [ebp-4]
|
||||||
|
485 000002B5 B8CDCCCCCC mov eax, -858993459
|
||||||
|
486 000002BA F7E2 mul edx
|
||||||
|
487 000002BC 89D0 mov eax, edx
|
||||||
|
488 000002BE C1E803 shr eax, 3
|
||||||
|
489 000002C1 8945FC mov DWORD [ebp-4], eax
|
||||||
|
490 000002C4 8D45FB lea eax, [ebp-5]
|
||||||
|
491 000002C7 800030 add BYTE [eax], 48
|
||||||
|
492 000002CA 81EC0C000000 sub esp, 12
|
||||||
|
493 000002D0 B800000000 mov eax, 0
|
||||||
|
494 000002D5 8A45FB mov al, BYTE [ebp-5]
|
||||||
|
495 000002D8 50 push eax
|
||||||
|
496 000002D9 E8(00000000) call _putc
|
||||||
|
497 000002DE 81C410000000 add esp, 16
|
||||||
|
498 000002E4 EB99 jmp L13
|
||||||
|
499 L14:
|
||||||
|
500 000002E6 81EC0C000000 sub esp, 12
|
||||||
|
501 000002EC 8A4508 mov al, BYTE [ebp+8]
|
||||||
|
502 000002EF 0530000000 add eax, 48
|
||||||
|
503 000002F4 25FF000000 and eax, 255
|
||||||
|
504 000002F9 50 push eax
|
||||||
|
505 000002FA E8(00000000) call _putc
|
||||||
|
506 000002FF 81C410000000 add esp, 16
|
||||||
|
507 00000305 C9 leave
|
||||||
|
508 00000306 C3 ret
|
||||||
|
509
|
||||||
|
510
|
492
kernel/lst/kernel.lst
Normal file
492
kernel/lst/kernel.lst
Normal file
@ -0,0 +1,492 @@
|
|||||||
|
1 ;kernel.asm
|
||||||
|
2 ;Author: Josh Holtrop
|
||||||
|
3 ;Date: 10/30/03
|
||||||
|
4 ;Modified: 10/30/03
|
||||||
|
5
|
||||||
|
6 %define GDT_P 0x100000; ;1mb physical - Global Descriptor Table space
|
||||||
|
7 %define GDT_V GDT_P+0xC0000000
|
||||||
|
8 %define IDT_P 0x102000 ;1mb+8kb - Interrupt Descriptor Table space
|
||||||
|
9 %define IDT_V IDT_P+0xC0000000
|
||||||
|
10 %define PDBR_P 0x104000 ;1mb+16kb - Page Directory Base Register (first PD)
|
||||||
|
11 %define PDBR_V PDBR_P+0xC0000000
|
||||||
|
12 %define LOPT_P 0x105000 ;1mb+20kb - LOw Page Table for mapping first 4mb
|
||||||
|
13 %define LOPT_V LOPT_P+0xC0000000
|
||||||
|
14 %define KERNEL_P 0x106000 ;1mb+24kb - the kernel's physical address
|
||||||
|
15 %define KERNEL_V KERNEL_P+0xC0000000 ;3gb+1mb+24kb, the virtual address of the kernel
|
||||||
|
16
|
||||||
|
17 [global _start]
|
||||||
|
18 [extern _isr]
|
||||||
|
19 [extern _k_init]
|
||||||
|
20 [extern _putc]
|
||||||
|
21
|
||||||
|
22 bits 32
|
||||||
|
23
|
||||||
|
24 ;This is where the kernel begins execution
|
||||||
|
25 ;At this point, the temporary gdt is set up to "map" 0xC000_0000 to 0x0.
|
||||||
|
26 ;We must enable paging with the first 4mb mapped 1:1 virtual:physical
|
||||||
|
27 ; and with the 4mb starting at 0xC000_0000 mapped to the first 4mb physical.
|
||||||
|
28 ;Then we can start using our "real" gdt, then unmap the lower 4mb.
|
||||||
|
29 _start:
|
||||||
|
30 00000000 FA cli ;if they weren't already off
|
||||||
|
31
|
||||||
|
32 00000001 31C0 xor eax, eax
|
||||||
|
33 00000003 BF004010C0 mov edi, PDBR_V
|
||||||
|
34 00000008 B900040000 mov ecx, 1024 ;clear the PDBR
|
||||||
|
35 0000000D F3AB rep stosd
|
||||||
|
36 0000000F C705004010C0035010- mov [PDBR_V], dword LOPT_P|0x03 ;store the physical address of the LOw Page Table (read/write, present)
|
||||||
|
37 00000018 00
|
||||||
|
38 00000019 C705004C10C0035010- mov [PDBR_V+0xC00], dword LOPT_P|0x03 ;store the physical address of the LOw Page Table (read/write, present)
|
||||||
|
39 00000022 00
|
||||||
|
40
|
||||||
|
41 00000023 BF005010C0 mov edi, LOPT_V
|
||||||
|
42 00000028 B900040000 mov ecx, 1024
|
||||||
|
43 0000002D B803000000 mov eax, 0x03 ;starting physical address = 0x0 (read/write, present flags)
|
||||||
|
44 fill_lopt_loop: ;fill the page table
|
||||||
|
45 00000032 AB stosd
|
||||||
|
46 00000033 0500100000 add eax, 4096 ;increment next phsyical address by 4kb
|
||||||
|
47 00000038 E2F8 loop fill_lopt_loop
|
||||||
|
48
|
||||||
|
49 0000003A B800401000 mov eax, PDBR_P
|
||||||
|
50 0000003F 0F22D8 mov cr3, eax ;store the Page Directory Base Address
|
||||||
|
51 00000042 0F20C0 mov eax, cr0
|
||||||
|
52 00000045 0D00000080 or eax, 0x80000000 ;set page enable bit
|
||||||
|
53 0000004A 0F22C0 mov cr0, eax ;now paging is active!
|
||||||
|
54
|
||||||
|
55
|
||||||
|
56 0000004D BF000010C0 mov edi, GDT_V
|
||||||
|
57 00000052 BE[D4000000] mov esi, gdt
|
||||||
|
58 00000057 B948000000 mov ecx, gdt_end-gdt
|
||||||
|
59 copy_gdt:
|
||||||
|
60 0000005C AC lodsb
|
||||||
|
61 0000005D AA stosb
|
||||||
|
62 0000005E E2FC loop copy_gdt
|
||||||
|
63
|
||||||
|
64 00000060 BF002010C0 mov edi, IDT_V ;destination
|
||||||
|
65 00000065 BE[22010000] mov esi, isr_0 ;address of isr0
|
||||||
|
66 0000006A BA0B000000 mov edx, isr_1-isr_0 ;distance between isr labels
|
||||||
|
67 0000006F B932000000 mov ecx, 50 ;number of isrlabels
|
||||||
|
68 fill_idt:
|
||||||
|
69 00000074 89F3 mov ebx, esi
|
||||||
|
70 00000076 6689F0 mov ax, si
|
||||||
|
71 00000079 66AB stosw ;0 offset 15:0
|
||||||
|
72 0000007B 66B80800 mov ax, KERNEL_CODE
|
||||||
|
73 0000007F 66AB stosw ;2 selector 15:0
|
||||||
|
74 00000081 66B8008E mov ax, 0x8E00
|
||||||
|
75 00000085 66AB stosw ;4 [P][DPL][0][TYPE][0][0][0][0][0][0][0][0]
|
||||||
|
76 00000087 C1EE10 shr esi, 16
|
||||||
|
77 0000008A 6689F0 mov ax, si
|
||||||
|
78 0000008D 66AB stosw ;6 offset 31:16
|
||||||
|
79 0000008F 89DE mov esi, ebx
|
||||||
|
80 00000091 01D6 add esi, edx
|
||||||
|
81 00000093 E2DF loop fill_idt
|
||||||
|
82 00000095 66C705842110C000EE mov word [IDT_V+0x30*8+4], 0xEE00 ;interrupt 0x30 has user priviledges
|
||||||
|
83
|
||||||
|
84 0000009E 0F0115[CE000000] lgdt [gdtr] ;load gdt
|
||||||
|
85 000000A5 EA[AC000000]0800 jmp KERNEL_CODE:newgdtcontinue
|
||||||
|
86 newgdtcontinue:
|
||||||
|
87 000000AC 66B81000 mov ax, KERNEL_DATA
|
||||||
|
88 000000B0 8EC0 mov es, ax
|
||||||
|
89 000000B2 8ED8 mov ds, ax
|
||||||
|
90 000000B4 8EE8 mov gs, ax
|
||||||
|
91 000000B6 8EE0 mov fs, ax
|
||||||
|
92 000000B8 8ED0 mov ss, ax
|
||||||
|
93 000000BA BC000020C0 mov esp, 0xc0200000 ;stack just under 3gb+2mb, moves downward
|
||||||
|
94 000000BF 0F011D[1C010000] lidt [idtr] ;load idt
|
||||||
|
95
|
||||||
|
96 000000C6 E8(00000000) call _k_init
|
||||||
|
97 haltit:
|
||||||
|
98 000000CB F4 hlt ;halt processor when k_init is done
|
||||||
|
99 000000CC EBFD jmp haltit ;shouldn't get here...
|
||||||
|
100
|
||||||
|
101 %include "gdt.inc"
|
||||||
|
102 <1> ;gdt.inc
|
||||||
|
103 <1> ;Author: Josh Holtrop
|
||||||
|
104 <1> ;Date: 10/30/03
|
||||||
|
105 <1> ;Modified: 03/02/04
|
||||||
|
106 <1>
|
||||||
|
107 <1> gdtr:
|
||||||
|
108 000000CE 4700 <1> dw gdt_end-gdt-1
|
||||||
|
109 000000D0 000010C0 <1> dd GDT_V
|
||||||
|
110 <1> gdt:
|
||||||
|
111 000000D4 00000000 <1> dd 0
|
||||||
|
112 000000D8 00000000 <1> dd 0
|
||||||
|
113 <1> KERNEL_CODE equ $-gdt
|
||||||
|
114 000000DC FFFF <1> dw 0xffff ;limit 15:0
|
||||||
|
115 000000DE 0000 <1> dw 0x0000 ;base 15:0
|
||||||
|
116 000000E0 00 <1> db 0x00 ;base 23:16
|
||||||
|
117 000000E1 9A <1> db 0x9A ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
|
||||||
|
118 000000E2 CF <1> db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16
|
||||||
|
119 000000E3 00 <1> db 0x00 ;base 31:24
|
||||||
|
120 <1> KERNEL_DATA equ $-gdt
|
||||||
|
121 000000E4 FFFF <1> dw 0xffff ;limit 15:0
|
||||||
|
122 000000E6 0000 <1> dw 0x0000 ;base 15:0
|
||||||
|
123 000000E8 00 <1> db 0x00 ;base 23:16
|
||||||
|
124 000000E9 92 <1> db 0x92 ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
|
||||||
|
125 000000EA CF <1> db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16
|
||||||
|
126 000000EB 00 <1> db 0x00 ;base 31:24
|
||||||
|
127 <1> USER_CODE equ $-gdt
|
||||||
|
128 000000EC FFFF <1> dw 0xffff ;limit 15:0
|
||||||
|
129 000000EE 0000 <1> dw 0x0000 ;base 15:0
|
||||||
|
130 000000F0 00 <1> db 0x00 ;base 23:16
|
||||||
|
131 000000F1 FA <1> db 0xFA ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
|
||||||
|
132 000000F2 CF <1> db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16
|
||||||
|
133 000000F3 00 <1> db 0x00 ;base 31:24
|
||||||
|
134 <1> USER_DATA equ $-gdt
|
||||||
|
135 000000F4 FFFF <1> dw 0xffff ;limit 15:0
|
||||||
|
136 000000F6 0000 <1> dw 0x0000 ;base 15:0
|
||||||
|
137 000000F8 00 <1> db 0x00 ;base 23:16
|
||||||
|
138 000000F9 F2 <1> db 0xF2 ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
|
||||||
|
139 000000FA CF <1> db 0xCF ;flags ([G][D/B][0][0]) / limit 19:16
|
||||||
|
140 000000FB 00 <1> db 0x00 ;base 31:24
|
||||||
|
141 <1> gVESA_CODE equ $-gdt
|
||||||
|
142 000000FC FFFF <1> dw 0xffff ;limit 15:0
|
||||||
|
143 000000FE 0000 <1> dw 0x0000 ;base 15:0
|
||||||
|
144 00000100 00 <1> db 0x00 ;base 23:16
|
||||||
|
145 00000101 9A <1> db 0x9A ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
|
||||||
|
146 00000102 40 <1> db 0x40 ;flags ([G][D/B][0][0]) / limit 19:16
|
||||||
|
147 00000103 00 <1> db 0x00 ;base 31:24
|
||||||
|
148 <1> VESA_DATA equ $-gdt
|
||||||
|
149 00000104 FFFF <1> dw 0xffff ;limit 15:0
|
||||||
|
150 00000106 0000 <1> dw 0x0000 ;base 15:0
|
||||||
|
151 00000108 00 <1> db 0x00 ;base 23:16
|
||||||
|
152 00000109 92 <1> db 0x92 ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
|
||||||
|
153 0000010A 40 <1> db 0x40 ;flags ([G][D/B][0][0]) / limit 19:16
|
||||||
|
154 0000010B 00 <1> db 0x00 ;base 31:24
|
||||||
|
155 <1> VIDEO_TEXT equ $-gdt
|
||||||
|
156 0000010C FF7F <1> dw 0x7FFF ;limit 15:0
|
||||||
|
157 0000010E 0080 <1> dw 0x8000 ;base 15:0
|
||||||
|
158 00000110 0B <1> db 0x0B ;base 23:16
|
||||||
|
159 00000111 92 <1> db 0x92 ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
|
||||||
|
160 00000112 40 <1> db 0x40 ;flags ([G][D/B][0][0]) / limit 19:16
|
||||||
|
161 00000113 00 <1> db 0x00 ;base 31:24
|
||||||
|
162 <1> VIDEO_GRAPHICS equ $-gdt
|
||||||
|
163 00000114 FFFF <1> dw 0xFFFF ;limit 15:0
|
||||||
|
164 00000116 0000 <1> dw 0x0000 ;base 15:0
|
||||||
|
165 00000118 0A <1> db 0x0A ;base 23:16
|
||||||
|
166 00000119 92 <1> db 0x92 ;access ([P][DPL][1][Executable][Direction/Conforming][Writable/Readable][A])
|
||||||
|
167 0000011A 40 <1> db 0x40 ;flags ([G][D/B][0][0]) / limit 19:16
|
||||||
|
168 0000011B 00 <1> db 0x00 ;base 31:24
|
||||||
|
169 <1> gdt_end:
|
||||||
|
170 <1>
|
||||||
|
171 <1>
|
||||||
|
172 <1>
|
||||||
|
173 %include "idt.inc"
|
||||||
|
174 <1> ;idt.inc
|
||||||
|
175 <1> ;Author: Josh Holtrop
|
||||||
|
176 <1> ;Date: 10/30/03
|
||||||
|
177 <1> ;Modified: 03/02/04
|
||||||
|
178 <1>
|
||||||
|
179 <1> idtr:
|
||||||
|
180 0000011C 8F01 <1> dw 50*8-1 ;size of idt
|
||||||
|
181 0000011E 002010C0 <1> dd IDT_V ;address of idt
|
||||||
|
182 <1>
|
||||||
|
183 <1>
|
||||||
|
184 <1> %macro isr_label 1
|
||||||
|
185 <1> isr_%1:
|
||||||
|
186 <1> push eax
|
||||||
|
187 <1> mov eax, %1
|
||||||
|
188 <1> jmp isr_main
|
||||||
|
189 <1> %endmacro
|
||||||
|
190 <1>
|
||||||
|
191 <1> isr_label 0
|
||||||
|
192 <2> isr_%1:
|
||||||
|
193 00000122 50 <2> push eax
|
||||||
|
194 00000123 B800000000 <2> mov eax, %1
|
||||||
|
195 00000128 E91B020000 <2> jmp isr_main
|
||||||
|
196 <1> isr_label 1
|
||||||
|
197 <2> isr_%1:
|
||||||
|
198 0000012D 50 <2> push eax
|
||||||
|
199 0000012E B801000000 <2> mov eax, %1
|
||||||
|
200 00000133 E910020000 <2> jmp isr_main
|
||||||
|
201 <1> isr_label 2
|
||||||
|
202 <2> isr_%1:
|
||||||
|
203 00000138 50 <2> push eax
|
||||||
|
204 00000139 B802000000 <2> mov eax, %1
|
||||||
|
205 0000013E E905020000 <2> jmp isr_main
|
||||||
|
206 <1> isr_label 3
|
||||||
|
207 <2> isr_%1:
|
||||||
|
208 00000143 50 <2> push eax
|
||||||
|
209 00000144 B803000000 <2> mov eax, %1
|
||||||
|
210 00000149 E9FA010000 <2> jmp isr_main
|
||||||
|
211 <1> isr_label 4
|
||||||
|
212 <2> isr_%1:
|
||||||
|
213 0000014E 50 <2> push eax
|
||||||
|
214 0000014F B804000000 <2> mov eax, %1
|
||||||
|
215 00000154 E9EF010000 <2> jmp isr_main
|
||||||
|
216 <1> isr_label 5
|
||||||
|
217 <2> isr_%1:
|
||||||
|
218 00000159 50 <2> push eax
|
||||||
|
219 0000015A B805000000 <2> mov eax, %1
|
||||||
|
220 0000015F E9E4010000 <2> jmp isr_main
|
||||||
|
221 <1> isr_label 6
|
||||||
|
222 <2> isr_%1:
|
||||||
|
223 00000164 50 <2> push eax
|
||||||
|
224 00000165 B806000000 <2> mov eax, %1
|
||||||
|
225 0000016A E9D9010000 <2> jmp isr_main
|
||||||
|
226 <1> isr_label 7
|
||||||
|
227 <2> isr_%1:
|
||||||
|
228 0000016F 50 <2> push eax
|
||||||
|
229 00000170 B807000000 <2> mov eax, %1
|
||||||
|
230 00000175 E9CE010000 <2> jmp isr_main
|
||||||
|
231 <1> isr_label 8
|
||||||
|
232 <2> isr_%1:
|
||||||
|
233 0000017A 50 <2> push eax
|
||||||
|
234 0000017B B808000000 <2> mov eax, %1
|
||||||
|
235 00000180 E9C3010000 <2> jmp isr_main
|
||||||
|
236 <1> isr_label 9
|
||||||
|
237 <2> isr_%1:
|
||||||
|
238 00000185 50 <2> push eax
|
||||||
|
239 00000186 B809000000 <2> mov eax, %1
|
||||||
|
240 0000018B E9B8010000 <2> jmp isr_main
|
||||||
|
241 <1> isr_label 10
|
||||||
|
242 <2> isr_%1:
|
||||||
|
243 00000190 50 <2> push eax
|
||||||
|
244 00000191 B80A000000 <2> mov eax, %1
|
||||||
|
245 00000196 E9AD010000 <2> jmp isr_main
|
||||||
|
246 <1> isr_label 11
|
||||||
|
247 <2> isr_%1:
|
||||||
|
248 0000019B 50 <2> push eax
|
||||||
|
249 0000019C B80B000000 <2> mov eax, %1
|
||||||
|
250 000001A1 E9A2010000 <2> jmp isr_main
|
||||||
|
251 <1> isr_label 12
|
||||||
|
252 <2> isr_%1:
|
||||||
|
253 000001A6 50 <2> push eax
|
||||||
|
254 000001A7 B80C000000 <2> mov eax, %1
|
||||||
|
255 000001AC E997010000 <2> jmp isr_main
|
||||||
|
256 <1> isr_label 13
|
||||||
|
257 <2> isr_%1:
|
||||||
|
258 000001B1 50 <2> push eax
|
||||||
|
259 000001B2 B80D000000 <2> mov eax, %1
|
||||||
|
260 000001B7 E98C010000 <2> jmp isr_main
|
||||||
|
261 <1> isr_label 14
|
||||||
|
262 <2> isr_%1:
|
||||||
|
263 000001BC 50 <2> push eax
|
||||||
|
264 000001BD B80E000000 <2> mov eax, %1
|
||||||
|
265 000001C2 E981010000 <2> jmp isr_main
|
||||||
|
266 <1> isr_label 15
|
||||||
|
267 <2> isr_%1:
|
||||||
|
268 000001C7 50 <2> push eax
|
||||||
|
269 000001C8 B80F000000 <2> mov eax, %1
|
||||||
|
270 000001CD E976010000 <2> jmp isr_main
|
||||||
|
271 <1> isr_label 16
|
||||||
|
272 <2> isr_%1:
|
||||||
|
273 000001D2 50 <2> push eax
|
||||||
|
274 000001D3 B810000000 <2> mov eax, %1
|
||||||
|
275 000001D8 E96B010000 <2> jmp isr_main
|
||||||
|
276 <1> isr_label 17
|
||||||
|
277 <2> isr_%1:
|
||||||
|
278 000001DD 50 <2> push eax
|
||||||
|
279 000001DE B811000000 <2> mov eax, %1
|
||||||
|
280 000001E3 E960010000 <2> jmp isr_main
|
||||||
|
281 <1> isr_label 18
|
||||||
|
282 <2> isr_%1:
|
||||||
|
283 000001E8 50 <2> push eax
|
||||||
|
284 000001E9 B812000000 <2> mov eax, %1
|
||||||
|
285 000001EE E955010000 <2> jmp isr_main
|
||||||
|
286 <1> isr_label 19
|
||||||
|
287 <2> isr_%1:
|
||||||
|
288 000001F3 50 <2> push eax
|
||||||
|
289 000001F4 B813000000 <2> mov eax, %1
|
||||||
|
290 000001F9 E94A010000 <2> jmp isr_main
|
||||||
|
291 <1> isr_label 20
|
||||||
|
292 <2> isr_%1:
|
||||||
|
293 000001FE 50 <2> push eax
|
||||||
|
294 000001FF B814000000 <2> mov eax, %1
|
||||||
|
295 00000204 E93F010000 <2> jmp isr_main
|
||||||
|
296 <1> isr_label 21
|
||||||
|
297 <2> isr_%1:
|
||||||
|
298 00000209 50 <2> push eax
|
||||||
|
299 0000020A B815000000 <2> mov eax, %1
|
||||||
|
300 0000020F E934010000 <2> jmp isr_main
|
||||||
|
301 <1> isr_label 22
|
||||||
|
302 <2> isr_%1:
|
||||||
|
303 00000214 50 <2> push eax
|
||||||
|
304 00000215 B816000000 <2> mov eax, %1
|
||||||
|
305 0000021A E929010000 <2> jmp isr_main
|
||||||
|
306 <1> isr_label 23
|
||||||
|
307 <2> isr_%1:
|
||||||
|
308 0000021F 50 <2> push eax
|
||||||
|
309 00000220 B817000000 <2> mov eax, %1
|
||||||
|
310 00000225 E91E010000 <2> jmp isr_main
|
||||||
|
311 <1> isr_label 24
|
||||||
|
312 <2> isr_%1:
|
||||||
|
313 0000022A 50 <2> push eax
|
||||||
|
314 0000022B B818000000 <2> mov eax, %1
|
||||||
|
315 00000230 E913010000 <2> jmp isr_main
|
||||||
|
316 <1> isr_label 25
|
||||||
|
317 <2> isr_%1:
|
||||||
|
318 00000235 50 <2> push eax
|
||||||
|
319 00000236 B819000000 <2> mov eax, %1
|
||||||
|
320 0000023B E908010000 <2> jmp isr_main
|
||||||
|
321 <1> isr_label 26
|
||||||
|
322 <2> isr_%1:
|
||||||
|
323 00000240 50 <2> push eax
|
||||||
|
324 00000241 B81A000000 <2> mov eax, %1
|
||||||
|
325 00000246 E9FD000000 <2> jmp isr_main
|
||||||
|
326 <1> isr_label 27
|
||||||
|
327 <2> isr_%1:
|
||||||
|
328 0000024B 50 <2> push eax
|
||||||
|
329 0000024C B81B000000 <2> mov eax, %1
|
||||||
|
330 00000251 E9F2000000 <2> jmp isr_main
|
||||||
|
331 <1> isr_label 28
|
||||||
|
332 <2> isr_%1:
|
||||||
|
333 00000256 50 <2> push eax
|
||||||
|
334 00000257 B81C000000 <2> mov eax, %1
|
||||||
|
335 0000025C E9E7000000 <2> jmp isr_main
|
||||||
|
336 <1> isr_label 29
|
||||||
|
337 <2> isr_%1:
|
||||||
|
338 00000261 50 <2> push eax
|
||||||
|
339 00000262 B81D000000 <2> mov eax, %1
|
||||||
|
340 00000267 E9DC000000 <2> jmp isr_main
|
||||||
|
341 <1> isr_label 30
|
||||||
|
342 <2> isr_%1:
|
||||||
|
343 0000026C 50 <2> push eax
|
||||||
|
344 0000026D B81E000000 <2> mov eax, %1
|
||||||
|
345 00000272 E9D1000000 <2> jmp isr_main
|
||||||
|
346 <1> isr_label 31
|
||||||
|
347 <2> isr_%1:
|
||||||
|
348 00000277 50 <2> push eax
|
||||||
|
349 00000278 B81F000000 <2> mov eax, %1
|
||||||
|
350 0000027D E9C6000000 <2> jmp isr_main
|
||||||
|
351 <1> isr_label 32
|
||||||
|
352 <2> isr_%1:
|
||||||
|
353 00000282 50 <2> push eax
|
||||||
|
354 00000283 B820000000 <2> mov eax, %1
|
||||||
|
355 00000288 E9BB000000 <2> jmp isr_main
|
||||||
|
356 <1> isr_label 33
|
||||||
|
357 <2> isr_%1:
|
||||||
|
358 0000028D 50 <2> push eax
|
||||||
|
359 0000028E B821000000 <2> mov eax, %1
|
||||||
|
360 00000293 E9B0000000 <2> jmp isr_main
|
||||||
|
361 <1> isr_label 34
|
||||||
|
362 <2> isr_%1:
|
||||||
|
363 00000298 50 <2> push eax
|
||||||
|
364 00000299 B822000000 <2> mov eax, %1
|
||||||
|
365 0000029E E9A5000000 <2> jmp isr_main
|
||||||
|
366 <1> isr_label 35
|
||||||
|
367 <2> isr_%1:
|
||||||
|
368 000002A3 50 <2> push eax
|
||||||
|
369 000002A4 B823000000 <2> mov eax, %1
|
||||||
|
370 000002A9 E99A000000 <2> jmp isr_main
|
||||||
|
371 <1> isr_label 36
|
||||||
|
372 <2> isr_%1:
|
||||||
|
373 000002AE 50 <2> push eax
|
||||||
|
374 000002AF B824000000 <2> mov eax, %1
|
||||||
|
375 000002B4 E98F000000 <2> jmp isr_main
|
||||||
|
376 <1> isr_label 37
|
||||||
|
377 <2> isr_%1:
|
||||||
|
378 000002B9 50 <2> push eax
|
||||||
|
379 000002BA B825000000 <2> mov eax, %1
|
||||||
|
380 000002BF E984000000 <2> jmp isr_main
|
||||||
|
381 <1> isr_label 38
|
||||||
|
382 <2> isr_%1:
|
||||||
|
383 000002C4 50 <2> push eax
|
||||||
|
384 000002C5 B826000000 <2> mov eax, %1
|
||||||
|
385 000002CA E979000000 <2> jmp isr_main
|
||||||
|
386 <1> isr_label 39
|
||||||
|
387 <2> isr_%1:
|
||||||
|
388 000002CF 50 <2> push eax
|
||||||
|
389 000002D0 B827000000 <2> mov eax, %1
|
||||||
|
390 000002D5 E96E000000 <2> jmp isr_main
|
||||||
|
391 <1> isr_label 40
|
||||||
|
392 <2> isr_%1:
|
||||||
|
393 000002DA 50 <2> push eax
|
||||||
|
394 000002DB B828000000 <2> mov eax, %1
|
||||||
|
395 000002E0 E963000000 <2> jmp isr_main
|
||||||
|
396 <1> isr_label 41
|
||||||
|
397 <2> isr_%1:
|
||||||
|
398 000002E5 50 <2> push eax
|
||||||
|
399 000002E6 B829000000 <2> mov eax, %1
|
||||||
|
400 000002EB E958000000 <2> jmp isr_main
|
||||||
|
401 <1> isr_label 42
|
||||||
|
402 <2> isr_%1:
|
||||||
|
403 000002F0 50 <2> push eax
|
||||||
|
404 000002F1 B82A000000 <2> mov eax, %1
|
||||||
|
405 000002F6 E94D000000 <2> jmp isr_main
|
||||||
|
406 <1> isr_label 43
|
||||||
|
407 <2> isr_%1:
|
||||||
|
408 000002FB 50 <2> push eax
|
||||||
|
409 000002FC B82B000000 <2> mov eax, %1
|
||||||
|
410 00000301 E942000000 <2> jmp isr_main
|
||||||
|
411 <1> isr_label 44
|
||||||
|
412 <2> isr_%1:
|
||||||
|
413 00000306 50 <2> push eax
|
||||||
|
414 00000307 B82C000000 <2> mov eax, %1
|
||||||
|
415 0000030C E937000000 <2> jmp isr_main
|
||||||
|
416 <1> isr_label 45
|
||||||
|
417 <2> isr_%1:
|
||||||
|
418 00000311 50 <2> push eax
|
||||||
|
419 00000312 B82D000000 <2> mov eax, %1
|
||||||
|
420 00000317 E92C000000 <2> jmp isr_main
|
||||||
|
421 <1> isr_label 46
|
||||||
|
422 <2> isr_%1:
|
||||||
|
423 0000031C 50 <2> push eax
|
||||||
|
424 0000031D B82E000000 <2> mov eax, %1
|
||||||
|
425 00000322 E921000000 <2> jmp isr_main
|
||||||
|
426 <1> isr_label 47
|
||||||
|
427 <2> isr_%1:
|
||||||
|
428 00000327 50 <2> push eax
|
||||||
|
429 00000328 B82F000000 <2> mov eax, %1
|
||||||
|
430 0000032D E916000000 <2> jmp isr_main
|
||||||
|
431 <1> isr_label 48
|
||||||
|
432 <2> isr_%1:
|
||||||
|
433 00000332 50 <2> push eax
|
||||||
|
434 00000333 B830000000 <2> mov eax, %1
|
||||||
|
435 00000338 E90B000000 <2> jmp isr_main
|
||||||
|
436 <1> isr_label 49
|
||||||
|
437 <2> isr_%1:
|
||||||
|
438 0000033D 50 <2> push eax
|
||||||
|
439 0000033E B831000000 <2> mov eax, %1
|
||||||
|
440 00000343 E900000000 <2> jmp isr_main
|
||||||
|
441 <1>
|
||||||
|
442 <1> isr_main:
|
||||||
|
443 00000348 3D30000000 <1> cmp eax, 0x30
|
||||||
|
444 0000034D 7414 <1> jz isr_syscall
|
||||||
|
445 <1>
|
||||||
|
446 0000034F 60 <1> pusha
|
||||||
|
447 00000350 1E <1> push ds
|
||||||
|
448 00000351 06 <1> push es
|
||||||
|
449 <1>
|
||||||
|
450 00000352 50 <1> push eax
|
||||||
|
451 <1>
|
||||||
|
452 00000353 E8(00000000) <1> call _isr
|
||||||
|
453 <1>
|
||||||
|
454 00000358 81C404000000 <1> add esp, 4
|
||||||
|
455 <1>
|
||||||
|
456 0000035E 07 <1> pop es
|
||||||
|
457 0000035F 1F <1> pop ds
|
||||||
|
458 00000360 61 <1> popa
|
||||||
|
459 00000361 58 <1> pop eax
|
||||||
|
460 <1>
|
||||||
|
461 00000362 CF <1> iret
|
||||||
|
462 <1>
|
||||||
|
463 <1>
|
||||||
|
464 <1> isr_syscall:
|
||||||
|
465 00000363 58 <1> pop eax ;syscall function number
|
||||||
|
466 00000364 60 <1> pusha
|
||||||
|
467 00000365 1E <1> push ds
|
||||||
|
468 00000366 06 <1> push es
|
||||||
|
469 <1>
|
||||||
|
470 <1> sc1:
|
||||||
|
471 00000367 3D01000000 <1> cmp eax, 1 ;syscall 1 - putc
|
||||||
|
472 0000036C 7511 <1> jnz sc2
|
||||||
|
473 0000036E 53 <1> push ebx
|
||||||
|
474 0000036F E8(00000000) <1> call _putc
|
||||||
|
475 00000374 81C404000000 <1> add esp, 4
|
||||||
|
476 0000037A E900000000 <1> jmp scdone
|
||||||
|
477 <1> sc2:
|
||||||
|
478 <1>
|
||||||
|
479 <1> scdone:
|
||||||
|
480 0000037F 07 <1> pop es
|
||||||
|
481 00000380 1F <1> pop ds
|
||||||
|
482 00000381 61 <1> popa
|
||||||
|
483 00000382 CF <1> iret
|
||||||
|
484 <1>
|
||||||
|
485 <1>
|
||||||
|
486 <1>
|
||||||
|
487 <1>
|
||||||
|
488 <1>
|
||||||
|
489 <1>
|
||||||
|
490 <1>
|
||||||
|
491
|
||||||
|
492
|
Loading…
x
Reference in New Issue
Block a user