Import backup from 2004-06-12

This commit is contained in:
Josh Holtrop 2004-06-12 22:00:00 -04:00
parent 9a8d2c29cb
commit c76725eac3
10 changed files with 224 additions and 185 deletions

View File

@ -13,23 +13,26 @@
Device::Device()
{
major = minor = permissions = type = 0;
uid = gid = major = minor = permissions = type = 0;
}
Device::Device(string aname)
{
major = minor = permissions = type = 0;
uid = gid = major = minor = permissions = type = 0;
name = aname;
}
//Types:
// h = hard link (. and .. only)
// l = link, call setLink()
// d = directory, automatically initializes a new DeviceFolder object
// b = block device
// c = char device
Device::Device(string aname, dword amajor, dword aminor, char atype, word apermissions)
Device::Device(string aname, dword auid, dword agid, dword amajor, dword aminor, char atype, word apermissions)
{
name = aname;
uid = auid;
gid = agid;
permissions = apermissions;
type = atype;
switch (type)
@ -37,13 +40,14 @@ Device::Device(string aname, dword amajor, dword aminor, char atype, word apermi
case 'd':
folder = new DeviceFolder();
break;
case 'l':
break;
case 'b':
case 'c':
major = amajor;
minor = aminor;
break;
case 'l':
case 'h':
default:
}
}
@ -52,6 +56,7 @@ Device::~Device()
switch (type)
{
case 'l':
case 'h':
delete link;
break;
case 'd':
@ -63,6 +68,8 @@ Device::~Device()
Device::Device(const Device & orig)
{
name = orig.name;
uid = orig.uid;
gid = orig.gid;
permissions = orig.permissions;
type = orig.type;
switch (type)
@ -74,6 +81,7 @@ Device::Device(const Device & orig)
minor = orig.minor;
break;
case 'l':
case 'h':
link = new string(*orig.link);
break;
case 'd':
@ -88,6 +96,8 @@ Device & Device::operator=(const Device & orig)
{
this->~Device();
name = orig.name;
uid = orig.uid;
gid = orig.gid;
permissions = orig.permissions;
type = orig.type;
switch (type)
@ -99,6 +109,7 @@ Device & Device::operator=(const Device & orig)
minor = orig.minor;
break;
case 'l':
case 'h':
link = new string(*orig.link);
break;
case 'd':
@ -111,7 +122,7 @@ Device & Device::operator=(const Device & orig)
void Device::setLink(string alink)
{
if (type == 'l')
if (type == 'l' || type == 'h')
link = new string(alink);
}

View File

@ -28,13 +28,15 @@ public:
void *folder;
string *link;
};
dword uid;
dword gid;
dword minor;
word permissions; //0644 or similar
char type; //'b', 'c', 'l', 'd'
Device();
Device(string aname);
Device(string aname, dword amajor, dword aminor, char atype, word apermissions);
Device(string aname, dword auid, dword agid, dword amajor, dword aminor, char atype, word apermissions);
Device(const Device & orig);
~Device();
Device & operator=(const Device & orig);

View File

@ -18,15 +18,16 @@ void DeviceFolder::ls()
{
printf("%c", (*it).type);
const char *bitmask = "rwxrwxrwx";
for (dword mask = 0x100; mask; mask = mask >> 1)
int i = 0;
for (dword mask = 0x100; mask; mask >>= 1)
{
if ((*it).permissions & mask)
printf("%c", *bitmask);
printf("%c", bitmask[i]);
else
printf("-");
bitmask++;
i++;
}
printf("\t");
printf("\t%d\t%d\t", (*it).uid, (*it).gid);
switch ((*it).type)
{
case 'b':
@ -45,8 +46,9 @@ void DeviceFolder::ls()
}
}
DeviceFolder::DeviceFolder()
DeviceFolder::DeviceFolder(string location)
{
//initialize . and .. here
}
int DeviceFolder::addDevice(Device dev)
@ -65,23 +67,22 @@ int DeviceFolder::addDevice(Device dev)
return 0;
}
int DeviceFolder::mkdir(string name, word permissions)
int DeviceFolder::mkdir(string name, dword uid, dword gid, word permissions)
{
Device dev(name, 0, 0, 'd', permissions);
Device dev(name, uid, gid, 0, 0, 'd', permissions);
return addDevice(dev);
}
int DeviceFolder::mklink(string name, string link)
int DeviceFolder::mklink(string name, dword uid, dword gid, string link)
{
Device dev(name, 0, 0, 'l', 0777);
Device dev(name, uid, gid, 0, 0, 'l', 0777);
dev.setLink(link);
return addDevice(dev);
}
int DeviceFolder::mknod(string name, dword major, dword minor, char type, word permissions)
int DeviceFolder::mknod(string name, dword uid, dword gid, dword major, dword minor, char type, word permissions)
{
Device dev(name, major, minor, type, permissions);
printf("Well, we got here successfully.\n");
Device dev(name, uid, gid, major, minor, type, permissions);
return addDevice(dev);
}

View File

@ -18,11 +18,11 @@ private:
LinkedList<Device> devices;
int addDevice(Device name);
public:
DeviceFolder();
DeviceFolder(string location);
int size();
int mkdir(string name, word permissions);
int mklink(string name, string link);
int mknod(string name, dword major, dword minor, char type, word permissions);
int mkdir(string name, dword uid, dword gid, word permissions);
int mklink(string name, dword uid, dword gid, string link);
int mknod(string name, dword uid, dword gid, dword major, dword minor, char type, word permissions);
void ls();
};

View File

@ -15,17 +15,15 @@ DeviceFolder *dev;
void devfs_init(string mountPoint)
{
printf("I'm going to make a new DeviceFolder\n");
dev = new DeviceFolder();
printf("I'm going to make a new Device\n");
Device device("aDevice", 3, 1, 'b', 0644);
dev = new DeviceFolder(mountPoint);
printf("I'm going to add hda1 to devfs\n");
dev->mknod("hda1", 3, 1, 'b', 0632);
/* dev->mkdir("test", 0644);
dev->mkdir("test1", 0755);
dev->mkdir("test1", 0644);
dev->mknod("psmouse", 4, 1, 'c', 0677);
dev->mklink("root", "hda1");
*/
dev->mknod("hda1", 0, 0, 3, 1, 'b', 0632);
dev->mkdir("test", 0, 501, 0644);
dev->mkdir("test1", 0, 0, 0755);
dev->mkdir("test1", 1, 1, 0644);
dev->mknod("psmouse", 2, 3, 4, 1, 'c', 0677);
dev->mklink("root", 5, 6, "hda1");
printf("I'm going to list the devices i know about:\n");
dev->ls();
// vfs_mount("devfs", mountPoint, 0755, 0, 0);

View File

@ -20,6 +20,8 @@
#define BOOT_VIDEO_MODE_INFO_BLOCK 0xC0090306
#define BOOT_HASRD 0xC0090000
#define NULL 0
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned int dword;

View File

@ -51,15 +51,13 @@ public:
{
return theNode->data;
}
Element & operator++() //prefix
void operator++() //prefix
{
theNode = theNode->next;
return theNode->data;
}
Element & operator++(int dum) //postfix
void operator++(int dum) //postfix
{
theNode = theNode->next;
return theNode->prev->data;
}
bool operator==(const iterator & second) const
{ return theNode == second.theNode; }
@ -84,15 +82,13 @@ public:
{
return theNode->data;
}
Element & operator++() //prefix
void operator++() //prefix
{
theNode = theNode->prev;
return theNode->data;
}
Element & operator++(int dum) //postfix
void operator++(int dum) //postfix
{
theNode = theNode->prev;
return theNode->next->data;
}
bool operator==(const reverse_iterator & second) const
{ return theNode == second.theNode; }

View File

@ -7,7 +7,7 @@ Name Origin Length Attributes
Linker script and memory map
.text 0x00000000c0106000 0x5000
.text 0x00000000c0106000 0x6000
0x00000000c0106000 code = .
0x00000000c0106000 _code = .
0x00000000c0106000 __code = .
@ -197,188 +197,187 @@ Linker script and memory map
.text 0x00000000c010a1e8 0x3a vfs.o
0x00000000c010a1e8 __Z8vfs_initv
*fill* 0x00000000c010a222 0x2 00
.text 0x00000000c010a224 0x10b devfs.o
.text 0x00000000c010a224 0x20d devfs.o
0x00000000c010a224 __Z10devfs_init6string
*fill* 0x00000000c010a32f 0x1 00
.text 0x00000000c010a330 0x607 Device.o
0x00000000c010a590 __ZN6DeviceD2Ev
0x00000000c010a5fc __ZN6DeviceD1Ev
0x00000000c010a3ac __ZN6DeviceC2E6string
0x00000000c010a818 __ZN6DeviceaSERKS_
0x00000000c010a668 __ZN6DeviceC2ERKS_
0x00000000c010a740 __ZN6DeviceC1ERKS_
0x00000000c010a44c __ZN6DeviceC2E6stringjjct
0x00000000c010a36e __ZN6DeviceC1Ev
0x00000000c010a330 __ZN6DeviceC2Ev
0x00000000c010a3fc __ZN6DeviceC1E6string
0x00000000c010a8fe __ZN6Device7setLinkE6string
0x00000000c010a4ee __ZN6DeviceC1E6stringjjct
*fill* 0x00000000c010a937 0x1 00
.text 0x00000000c010a938 0x54e DeviceFolder.o
0x00000000c010acfc __ZN12DeviceFolder6mklinkE6stringS0_
0x00000000c010ae70 __ZN12DeviceFolder4sizeEv
0x00000000c010ab1a __ZN12DeviceFolderC2Ev
0x00000000c010ab30 __ZN12DeviceFolderC1Ev
0x00000000c010adbc __ZN12DeviceFolder5mknodE6stringjjct
0x00000000c010ab46 __ZN12DeviceFolder9addDeviceE6Device
0x00000000c010a938 __ZN12DeviceFolder2lsEv
0x00000000c010ac62 __ZN12DeviceFolder5mkdirE6stringt
0x00000000c010b000 . = ALIGN (0x1000)
*fill* 0x00000000c010ae86 0x80b23740000017a 00
.gnu.linkonce.t._ZN10LinkedListI6DeviceE5beginEv
0x00000000c010b000 0x27
.gnu.linkonce.t._ZN10LinkedListI6DeviceE5beginEv
0x00000000c010b000 0x27 DeviceFolder.o
0x00000000c010b000 __ZN10LinkedListI6DeviceE5beginEv
.gnu.linkonce.t._ZN10LinkedListI6DeviceE3endEv
0x00000000c010b028 0x28
.gnu.linkonce.t._ZN10LinkedListI6DeviceE3endEv
0x00000000c010b028 0x28 DeviceFolder.o
0x00000000c010b028 __ZN10LinkedListI6DeviceE3endEv
.gnu.linkonce.t._ZNK10LinkedListI6DeviceE8iteratorneERKS2_
0x00000000c010b050 0x17
.gnu.linkonce.t._ZNK10LinkedListI6DeviceE8iteratorneERKS2_
0x00000000c010b050 0x17 DeviceFolder.o
0x00000000c010b050 __ZNK10LinkedListI6DeviceE8iteratorneERKS2_
.gnu.linkonce.t._ZN10LinkedListI6DeviceE8iteratordeEv
0x00000000c010b068 0xa
.gnu.linkonce.t._ZN10LinkedListI6DeviceE8iteratordeEv
0x00000000c010b068 0xa DeviceFolder.o
0x00000000c010b068 __ZN10LinkedListI6DeviceE8iteratordeEv
.gnu.linkonce.t._ZN10LinkedListI6DeviceE8iteratorppEi
0x00000000c010b072 0x1a
.gnu.linkonce.t._ZN10LinkedListI6DeviceE8iteratorppEi
0x00000000c010b072 0x1a DeviceFolder.o
0x00000000c010b072 __ZN10LinkedListI6DeviceE8iteratorppEi
.gnu.linkonce.t._ZN10LinkedListI6DeviceEC1Ev
0x00000000c010b08c 0x43
.gnu.linkonce.t._ZN10LinkedListI6DeviceEC1Ev
0x00000000c010b08c 0x43 DeviceFolder.o
0x00000000c010b08c __ZN10LinkedListI6DeviceEC1Ev
.gnu.linkonce.t._ZN10LinkedListI6DeviceE6insertEiS0_
0x00000000c010b0d0 0x101
.gnu.linkonce.t._ZN10LinkedListI6DeviceE6insertEiS0_
0x00000000c010b0d0 0x101 DeviceFolder.o
0x00000000c010b0d0 __ZN10LinkedListI6DeviceE6insertEiS0_
.gnu.linkonce.t._ZN10LinkedListI6DeviceE4sizeEv
0x00000000c010b1d2 0xb
.gnu.linkonce.t._ZN10LinkedListI6DeviceE4sizeEv
0x00000000c010b1d2 0xb DeviceFolder.o
0x00000000c010b1d2 __ZN10LinkedListI6DeviceE4sizeEv
.gnu.linkonce.t._ZN10LinkedListI6DeviceE8iteratorC1EPNS1_10LinkedNodeE
0x00000000c010b1de 0xd
.gnu.linkonce.t._ZN10LinkedListI6DeviceE8iteratorC1EPNS1_10LinkedNodeE
0x00000000c010b1de 0xd DeviceFolder.o
0x00000000c010b1de __ZN10LinkedListI6DeviceE8iteratorC1EPNS1_10LinkedNodeE
.gnu.linkonce.t._ZN10LinkedListI6DeviceE10LinkedNodeC1Ev
0x00000000c010b1ec 0x2a
.gnu.linkonce.t._ZN10LinkedListI6DeviceE10LinkedNodeC1Ev
0x00000000c010b1ec 0x2a DeviceFolder.o
0x00000000c010b1ec __ZN10LinkedListI6DeviceE10LinkedNodeC1Ev
.gnu.linkonce.t._ZN10LinkedListI6DeviceE9push_backES0_
0x00000000c010b216 0x82
.gnu.linkonce.t._ZN10LinkedListI6DeviceE9push_backES0_
0x00000000c010b216 0x82 DeviceFolder.o
0x00000000c010b216 __ZN10LinkedListI6DeviceE9push_backES0_
.gnu.linkonce.t._ZN10LinkedListI6DeviceE10LinkedNodeC1ES0_
0x00000000c010b298 0x40
.gnu.linkonce.t._ZN10LinkedListI6DeviceE10LinkedNodeC1ES0_
0x00000000c010b298 0x40 DeviceFolder.o
0x00000000c010b298 __ZN10LinkedListI6DeviceE10LinkedNodeC1ES0_
.data 0x00000000c010b2d8 0xd28
0x00000000c010b2d8 data = .
0x00000000c010b2d8 _data = .
0x00000000c010b2d8 __data = .
*(.data)
.data 0x00000000c010b2d8 0x18 stdfont.o
0x00000000c010b2d8 _fonts
.data 0x00000000c010b2f0 0x10 video.o
0x00000000c010b2f0 _vid_ptr16
0x00000000c010b2fc _video_psetp
0x00000000c010b2f8 _vid_ptr32
0x00000000c010b2f4 _vid_ptr24
.data 0x00000000c010b300 0x4 vmm.o
0x00000000c010b300 _firstHeapEntry
*fill* 0x00000000c010a431 0x3 00
.text 0x00000000c010a434 0x6e7 Device.o
0x00000000c010a72c __ZN6DeviceD2Ev
0x00000000c010a798 __ZN6DeviceD1Ev
0x00000000c010a4e4 __ZN6DeviceC2E6string
0x00000000c010a9e4 __ZN6DeviceaSERKS_
0x00000000c010a678 __ZN6DeviceC1E6stringjjjjct
0x00000000c010a804 __ZN6DeviceC2ERKS_
0x00000000c010a8f4 __ZN6DeviceC1ERKS_
0x00000000c010a48c __ZN6DeviceC1Ev
0x00000000c010a434 __ZN6DeviceC2Ev
0x00000000c010a554 __ZN6DeviceC1E6string
0x00000000c010aae2 __ZN6Device7setLinkE6string
0x00000000c010a5c4 __ZN6DeviceC2E6stringjjjjct
*fill* 0x00000000c010ab1b 0x1 00
.text 0x00000000c010ab1c 0x572 DeviceFolder.o
0x00000000c010b078 __ZN12DeviceFolder4sizeEv
0x00000000c010ad2c __ZN12DeviceFolderC2Ev
0x00000000c010ad42 __ZN12DeviceFolderC1Ev
0x00000000c010ae74 __ZN12DeviceFolder5mkdirE6stringjjt
0x00000000c010afd2 __ZN12DeviceFolder5mknodE6stringjjjjct
0x00000000c010ad58 __ZN12DeviceFolder9addDeviceE6Device
0x00000000c010af10 __ZN12DeviceFolder6mklinkE6stringjjS0_
0x00000000c010ab1c __ZN12DeviceFolder2lsEv
0x00000000c010c000 . = ALIGN (0x1000)
*fill* 0x00000000c010b304 0x812a70800000cfc 00
*fill* 0x00000000c010b08e 0x80b237400000f72 00
.rodata 0x00000000c010c000 0x2000
0x00000000c010c000 rodata = .
0x00000000c010c000 _rodata = .
0x00000000c010c000 __rodata = .
.gnu.linkonce.t._ZN10LinkedListI6DeviceE5beginEv
0x00000000c010c000 0x27
.gnu.linkonce.t._ZN10LinkedListI6DeviceE5beginEv
0x00000000c010c000 0x27 DeviceFolder.o
0x00000000c010c000 __ZN10LinkedListI6DeviceE5beginEv
.gnu.linkonce.t._ZN10LinkedListI6DeviceE3endEv
0x00000000c010c028 0x28
.gnu.linkonce.t._ZN10LinkedListI6DeviceE3endEv
0x00000000c010c028 0x28 DeviceFolder.o
0x00000000c010c028 __ZN10LinkedListI6DeviceE3endEv
.gnu.linkonce.t._ZNK10LinkedListI6DeviceE8iteratorneERKS2_
0x00000000c010c050 0x17
.gnu.linkonce.t._ZNK10LinkedListI6DeviceE8iteratorneERKS2_
0x00000000c010c050 0x17 DeviceFolder.o
0x00000000c010c050 __ZNK10LinkedListI6DeviceE8iteratorneERKS2_
.gnu.linkonce.t._ZN10LinkedListI6DeviceE8iteratordeEv
0x00000000c010c068 0xa
.gnu.linkonce.t._ZN10LinkedListI6DeviceE8iteratordeEv
0x00000000c010c068 0xa DeviceFolder.o
0x00000000c010c068 __ZN10LinkedListI6DeviceE8iteratordeEv
.gnu.linkonce.t._ZN10LinkedListI6DeviceE8iteratorppEi
0x00000000c010c072 0x12
.gnu.linkonce.t._ZN10LinkedListI6DeviceE8iteratorppEi
0x00000000c010c072 0x12 DeviceFolder.o
0x00000000c010c072 __ZN10LinkedListI6DeviceE8iteratorppEi
.gnu.linkonce.t._ZN10LinkedListI6DeviceEC1Ev
0x00000000c010c084 0x43
.gnu.linkonce.t._ZN10LinkedListI6DeviceEC1Ev
0x00000000c010c084 0x43 DeviceFolder.o
0x00000000c010c084 __ZN10LinkedListI6DeviceEC1Ev
.gnu.linkonce.t._ZN10LinkedListI6DeviceE6insertEiS0_
0x00000000c010c0c8 0x101
.gnu.linkonce.t._ZN10LinkedListI6DeviceE6insertEiS0_
0x00000000c010c0c8 0x101 DeviceFolder.o
0x00000000c010c0c8 __ZN10LinkedListI6DeviceE6insertEiS0_
.gnu.linkonce.t._ZN10LinkedListI6DeviceE4sizeEv
0x00000000c010c1ca 0xb
.gnu.linkonce.t._ZN10LinkedListI6DeviceE4sizeEv
0x00000000c010c1ca 0xb DeviceFolder.o
0x00000000c010c1ca __ZN10LinkedListI6DeviceE4sizeEv
.gnu.linkonce.t._ZN10LinkedListI6DeviceE8iteratorC1EPNS1_10LinkedNodeE
0x00000000c010c1d6 0xd
.gnu.linkonce.t._ZN10LinkedListI6DeviceE8iteratorC1EPNS1_10LinkedNodeE
0x00000000c010c1d6 0xd DeviceFolder.o
0x00000000c010c1d6 __ZN10LinkedListI6DeviceE8iteratorC1EPNS1_10LinkedNodeE
.gnu.linkonce.t._ZN10LinkedListI6DeviceE10LinkedNodeC1Ev
0x00000000c010c1e4 0x2a
.gnu.linkonce.t._ZN10LinkedListI6DeviceE10LinkedNodeC1Ev
0x00000000c010c1e4 0x2a DeviceFolder.o
0x00000000c010c1e4 __ZN10LinkedListI6DeviceE10LinkedNodeC1Ev
.gnu.linkonce.t._ZN10LinkedListI6DeviceE9push_backES0_
0x00000000c010c20e 0x82
.gnu.linkonce.t._ZN10LinkedListI6DeviceE9push_backES0_
0x00000000c010c20e 0x82 DeviceFolder.o
0x00000000c010c20e __ZN10LinkedListI6DeviceE9push_backES0_
.gnu.linkonce.t._ZN10LinkedListI6DeviceE10LinkedNodeC1ES0_
0x00000000c010c290 0x40
.gnu.linkonce.t._ZN10LinkedListI6DeviceE10LinkedNodeC1ES0_
0x00000000c010c290 0x40 DeviceFolder.o
0x00000000c010c290 __ZN10LinkedListI6DeviceE10LinkedNodeC1ES0_
.data 0x00000000c010c2d0 0xd30
0x00000000c010c2d0 data = .
0x00000000c010c2d0 _data = .
0x00000000c010c2d0 __data = .
*(.data)
.data 0x00000000c010c2d0 0x18 stdfont.o
0x00000000c010c2d0 _fonts
.data 0x00000000c010c2e8 0x10 video.o
0x00000000c010c2e8 _vid_ptr16
0x00000000c010c2f4 _video_psetp
0x00000000c010c2f0 _vid_ptr32
0x00000000c010c2ec _vid_ptr24
.data 0x00000000c010c2f8 0x4 vmm.o
0x00000000c010c2f8 _firstHeapEntry
0x00000000c010d000 . = ALIGN (0x1000)
*fill* 0x00000000c010c2fc 0x812a70800000d04 00
.rodata 0x00000000c010d000 0x2000
0x00000000c010d000 rodata = .
0x00000000c010d000 _rodata = .
0x00000000c010d000 __rodata = .
*(.rodata)
.rodata 0x00000000c010c000 0x141 kernel.o
*fill* 0x00000000c010c141 0x1f 00
.rodata 0x00000000c010c160 0x141 keyboard.o
*fill* 0x00000000c010c2a1 0x3 00
.rodata 0x00000000c010c2a4 0x1e4 kio.o
*fill* 0x00000000c010c488 0x18 00
.rodata 0x00000000c010c4a0 0x1200 stdfont.o
.rodata 0x00000000c010d6a0 0x5 vfs.o
*fill* 0x00000000c010d6a5 0x1b 00
.rodata 0x00000000c010d6c0 0xed devfs.o
*fill* 0x00000000c010d7ad 0x13 00
.rodata 0x00000000c010d7c0 0x61 DeviceFolder.o
0x00000000c010e000 . = ALIGN (0x1000)
*fill* 0x00000000c010d821 0x812a77c000007df 00
.rodata 0x00000000c010d000 0x141 kernel.o
*fill* 0x00000000c010d141 0x1f 00
.rodata 0x00000000c010d160 0x141 keyboard.o
*fill* 0x00000000c010d2a1 0x3 00
.rodata 0x00000000c010d2a4 0x1e4 kio.o
*fill* 0x00000000c010d488 0x18 00
.rodata 0x00000000c010d4a0 0x1200 stdfont.o
.rodata 0x00000000c010e6a0 0x5 vfs.o
*fill* 0x00000000c010e6a5 0x1b 00
.rodata 0x00000000c010e6c0 0xad devfs.o
.rodata 0x00000000c010e76d 0x33 DeviceFolder.o
0x00000000c010f000 . = ALIGN (0x1000)
*fill* 0x00000000c010e7a0 0x812a77c00000860 00
.bss 0x00000000c010e000 0x22000
0x00000000c010e000 bss = .
0x00000000c010e000 _bss = .
0x00000000c010e000 __bss = .
.bss 0x00000000c010f000 0x22000
0x00000000c010f000 bss = .
0x00000000c010f000 _bss = .
0x00000000c010f000 __bss = .
*(.bss)
.bss 0x00000000c010e000 0x4 kernel.o
0x00000000c010e000 _timer
*fill* 0x00000000c010e004 0x4 00
*fill* 0x00000000c010e008 0x18 00
.bss 0x00000000c010e020 0x12b keyboard.o
0x00000000c010e040 _kbdBuffer
0x00000000c010e148 _kbdExt
0x00000000c010e021 _kbdAscii
0x00000000c010e149 _kbdExt2
0x00000000c010e14a _ackReason
0x00000000c010e140 _kbdBufferStart
0x00000000c010e022 _kbdScan
0x00000000c010e144 _kbdBufferLen
0x00000000c010e020 _kbdFlags
*fill* 0x00000000c010e14b 0x15 00
.bss 0x00000000c010e160 0xfc0 kio.o
0x00000000c010e180 _console_memory
0x00000000c010e160 _graphical
0x00000000c010e164 _cursorPosition
.bss 0x00000000c010f120 0x20020 mm.o
0x00000000c010f124 _mm_megabytes
0x00000000c010f140 _page_bitmap
0x00000000c010f120 _mm_totalmem
.bss 0x00000000c012f140 0x1c mouse.o
0x00000000c012f144 _mouse_y
0x00000000c012f148 _mouse_bytesRead
0x00000000c012f140 _mouse_x
0x00000000c012f14c _mouse_inbuffer
*fill* 0x00000000c012f15c 0x4 00
.bss 0x00000000c012f160 0x104 video.o
0x00000000c012f160 _video_mode
0x00000000c012f260 _videoMode
.bss 0x00000000c012f264 0x4 devfs.o
0x00000000c012f264 _dev
0x00000000c0130000 . = ALIGN (0x1000)
*fill* 0x00000000c012f268 0x812a8e000000d98 00
0x00000000c0130000 end = .
0x00000000c0130000 _end = .
0x00000000c0130000 __end = .
.bss 0x00000000c010f000 0x4 kernel.o
0x00000000c010f000 _timer
*fill* 0x00000000c010f004 0x4 00
*fill* 0x00000000c010f008 0x18 00
.bss 0x00000000c010f020 0x12b keyboard.o
0x00000000c010f040 _kbdBuffer
0x00000000c010f148 _kbdExt
0x00000000c010f021 _kbdAscii
0x00000000c010f149 _kbdExt2
0x00000000c010f14a _ackReason
0x00000000c010f140 _kbdBufferStart
0x00000000c010f022 _kbdScan
0x00000000c010f144 _kbdBufferLen
0x00000000c010f020 _kbdFlags
*fill* 0x00000000c010f14b 0x15 00
.bss 0x00000000c010f160 0xfc0 kio.o
0x00000000c010f180 _console_memory
0x00000000c010f160 _graphical
0x00000000c010f164 _cursorPosition
.bss 0x00000000c0110120 0x20020 mm.o
0x00000000c0110124 _mm_megabytes
0x00000000c0110140 _page_bitmap
0x00000000c0110120 _mm_totalmem
.bss 0x00000000c0130140 0x1c mouse.o
0x00000000c0130144 _mouse_y
0x00000000c0130148 _mouse_bytesRead
0x00000000c0130140 _mouse_x
0x00000000c013014c _mouse_inbuffer
*fill* 0x00000000c013015c 0x4 00
.bss 0x00000000c0130160 0x104 video.o
0x00000000c0130160 _video_mode
0x00000000c0130260 _videoMode
.bss 0x00000000c0130264 0x4 devfs.o
0x00000000c0130264 _dev
0x00000000c0131000 . = ALIGN (0x1000)
*fill* 0x00000000c0130268 0x812a8e000000d98 00
0x00000000c0131000 end = .
0x00000000c0131000 _end = .
0x00000000c0131000 __end = .
LOAD ks.o
LOAD kernel.o
LOAD asmfuncs.o

View File

@ -113,7 +113,7 @@ void *malloc(unsigned int bytes)
if (attempt)
return attempt;
if(vmm_moreCore(bytes))
return 0; //we could not get any more heap memory
return NULL; //we could not get any more heap memory
return vmm_getFreeChunk(bytes);
}
@ -341,12 +341,40 @@ HeapEntry *vmm_getHeapEntryByBase(unsigned int base)
if (!he)
break;
}
return 0;
return NULL;
}
// This function re-allocates memory already allocated, preserving the old contents
// (as long as newSize is greater than oldSize)
void *realloc(void *orig, unsigned int newSize)
{
void *newMem;
if ((newMem = malloc(newSize)))
{
HeapEntry *he = vmm_getHeapEntryByBase((unsigned int) orig);
if (!he)
return NULL; //old chunk not found / nonexistent
memcpy(newMem, orig, (he->size < newSize ? he->size : newSize));
free(orig);
return newMem;
}
else
return NULL; //could not get mem for new chunk
}
// This function allocates and zeros memory for the given number of objects,
// given the size of each object
void *calloc(unsigned int number, unsigned int size)
{
void *mem = malloc(number * size);
if (!mem)
return NULL; //could not get memory
memset(mem, 0, number * size);
return mem;
}

View File

@ -48,6 +48,8 @@ void vmm_addHeapEntryBlock();
int vmm_moreCore(unsigned int bytes);
void vmm_coalesceHeapEntry(HeapEntry *he);
HeapEntry *vmm_getHeapEntryByBase(unsigned int base);
void *realloc(void *orig, unsigned int newSize);
void *calloc(unsigned int number, unsigned int size);
#endif