Chameleon

Chameleon Commit Details

Date:2011-08-06 19:36:30 (12 years 7 months ago)
Author:Evan Lojewski
Commit:1297
Parents: 1296
Message:Removed libsaioh from all modules. Removed i386 includes from modules.
Changes:
M/branches/xZenu/src/modules/MakeInc.dir
M/branches/xZenu/src/modules/Disk/Makefile
M/branches/xZenu/src/modules/klibc/klibc.c
M/branches/xZenu/src/modules/klibc/zalloc.c
M/branches/xZenu/src/modules/uClibcxx/new_op.cpp
M/branches/xZenu/src/modules/uClibcxx/uClibc++.c
M/branches/xZenu/src/modules/klibc/__udivmodsi4.c
M/branches/xZenu/src/modules/Disk/i386/BiosDisk.cpp
M/branches/xZenu/src/modules/klibc/__udivmoddi4.c
M/branches/xZenu/src/modules/uClibcxx/new_opnt.cpp
M/branches/xZenu/src/modules/Disk/GUIDPartition.cpp
M/branches/xZenu/src/modules/Disk/Main.cpp
M/branches/xZenu/src/modules/uClibcxx/new_opv.cpp
M/branches/xZenu/src/modules/uClibcxx/new_opvnt.cpp

File differences

branches/xZenu/src/modules/uClibcxx/new_opvnt.cpp
2121
2222
2323
24
25
26
24
2725
2826
2927
#include <new>
#include <cstdlib>
#include <func_exception>
extern "C" {
#include "libsaio.h"
};
#ifndef NO_NOTHROW
_UCXXEXPORT void* operator new[](std::size_t numBytes, const std::nothrow_t& ) throw(){
return malloc(numBytes);
branches/xZenu/src/modules/uClibcxx/new_opnt.cpp
2121
2222
2323
24
25
26
24
2725
2826
2927
#include <new>
#include <cstdlib>
#include <func_exception>
extern "C" {
#include "libsaio.h"
};
#ifndef NO_NOTHROW
_UCXXEXPORT void* operator new(std::size_t numBytes, const std::nothrow_t& ) throw(){
return malloc(numBytes);
branches/xZenu/src/modules/uClibcxx/new_opv.cpp
2121
2222
2323
24
25
26
24
2725
2826
2927
#include <new>
#include <cstdlib>
#include <func_exception>
extern "C" {
#include "libsaio.h"
};
_UCXXEXPORT void* operator new[](std::size_t numBytes) throw(std::bad_alloc){
//C++ stardard 5.3.4.8 requires that a valid pointer be returned for
//a call to new(0). Thus:
branches/xZenu/src/modules/uClibcxx/new_op.cpp
2020
2121
2222
23
24
25
2623
2724
2825
#include <cstdlib>
#include <func_exception>
extern "C" {
#include "libsaio.h"
};
_UCXXEXPORT void* operator new(std::size_t numBytes) throw(std::bad_alloc){
//C++ stardard 5.3.4.8 requires that a valid pointer be returned for
branches/xZenu/src/modules/uClibcxx/uClibc++.c
1
1
22
33
44
......
66
77
88
9
9
10
1011
1112
1213
#include "libsaio.h"
#include <stdio.h>
void uClibcxx_start()
{
void abort()
{
stop("uClibc+: abort()\n");
printf("uClibc+: abort()\n");
while(1);
}
branches/xZenu/src/modules/MakeInc.dir
4949
5050
5151
52
52
5353
5454
5555
MODULE_INCLUDES := $(foreach x,ModuleSystem $(MODULE_DEPENDENCIES),-I$(SRCROOT)/modules/$(x)/include/)
INC = -I$(SRCROOT)/include/ -I$(SRCROOT)/sym/ -I$(SRCROOT)/modules/include/ -Iinclude/ -I$(SRCROOT)/arch/i386/libsaio/ -I$(SRCROOT)/arch/i386/libsa/ -I$(SRCROOT)/arch/i386/include/ -I$(SRCROOT)/i386/boot2/ $(MODULE_INCLUDES)
INC = -I$(SRCROOT)/include/ -I$(SRCROOT)/sym/ -I$(SRCROOT)/modules/include/ -Iinclude/ $(MODULE_INCLUDES)
DEFINES := -D__KLIBC__ $(DEFINES)
MODULE_DEPENDENCIES := $(wildcard $(foreach x,$(MODULE_DEPENDENCIES),$(SYMROOT)/$(x).dylib)) \
branches/xZenu/src/modules/klibc/klibc.c
44
55
66
7
7
88
99
1010
......
1414
1515
1616
17
18
17
18
1919
2020
2121
......
2525
2626
2727
28
28
29
2930
3031
3132
* glue + initialization
*/
#include "libsaio.h"
#include <stdio.h>
int _DefaultRuneLocale;// todo: fixme
void _exit(int status)
{
stop("exit() called\n");
while(1) halt(); // this is never reached
printf("exit() called\n");
while(1);
}
char __toupper(char c)
void __divide_error()
{
stop("Divide by 0\n");
printf("Divide by 0\n");
while(1);
}
// hack
branches/xZenu/src/modules/klibc/zalloc.c
2929
3030
3131
32
33
34
32
33
3534
36
37
38
39
40
41
4235
4336
4437
......
5649
5750
5851
59
60
61
62
6352
6453
6554
......
7463
7564
7665
77
66
7867
7968
8069
......
8574
8675
8776
77
78
79
80
81
82
83
84
85
86
87
88
89
8890
8991
9092
9193
9294
95
9396
9497
9598
......
106109
107110
108111
109
110
112
113
111114
112115
113116
......
168171
169172
170173
171
174
172175
173
174
175
176176
177177
178178
......
200200
201201
202202
203
204
205
206
207203
208204
209
210
211
212205
213206
214207
......
216209
217210
218211
219
220
221
222212
223213
224214
......
262252
263253
264254
265
266
267
268
269255
270256
271257
......
325311
326312
327313
328
314
329315
330316
331317
*
*/
#include "libsa.h"
//#include "saio_internal.h" - Azi: needed for ZDEBUG (printf)
#include "memory.h"
#include <stdio.h>
#include <string.h>
#define ZDEBUG 0 //Azi: booter doesn't load with this enabled; instant reboot at "boot1: ..."
#if ZDEBUG
int zout;
#endif
typedef struct {
char * start;
size_t size;
static void zdelete(zmem * zp, int ndx);
static void zcoalesce(void);
#if ZDEBUG
size_t zalloced_size;
#endif
#define ZALLOC_NODES16384
static void malloc_error(char *addr, size_t size, const char *file, int line)
// define the block of memory that the allocator will use
void malloc_init(char * start, int size, int nodes, void (*malloc_err_fn)(char *, size_t, const char *, int))
{
zalloc_base = start ? start : (char *)ZALLOC_ADDR;
/*zalloc_base = start ? start : (char *)ZALLOC_ADDR;
totalNodes = nodes ? nodes : ZALLOC_NODES;
zalloced = (zmem *) zalloc_base;
zavailable = (zmem *) zalloc_base + sizeof(zmem) * totalNodes;
availableNodes = 1;
allocedNodes = 0;
zerror = malloc_err_fn ? malloc_err_fn : malloc_error;
*/
zalloc_base = start;
totalNodes = nodes;
zalloced = (zmem *) zalloc_base;
zavailable = (zmem *) zalloc_base + sizeof(zmem) * totalNodes;
zavailable[0].start = (char *)zavailable + sizeof(zmem) * totalNodes;
zavailable[0].size = size - (zavailable[0].start - zalloc_base);
zalloc_end = zalloc_base + size;
availableNodes = 1;
allocedNodes = 0;
zerror = malloc_err_fn ? malloc_err_fn : malloc_error;
}
#define BEST_FIT 1
#undef malloc
void * safe_malloc(size_t size, const char *file, int line);
void *malloc(size_t size)
{
return safe_malloc(size, __FILE__, __LINE__);
if ( !zalloc_base )
{
// this used to follow the bss but some bios' corrupted it...
malloc_init((char *)ZALLOC_ADDR, ZALLOC_LEN, ZALLOC_NODES, malloc_error);
printf("malloc_init not called.\n");
while(1);
}
size = ((size + 0xf) & ~0xf);
}
if (ret != 0)
{
bzero(ret, size);
memset(ret, 0, size);
}
#if ZDEBUG
zalloced_size += size;
#endif
return (void *) ret;
}
if ( zalloced[i].start == start )
{
tsize = zalloced[i].size;
#if ZDEBUG
zout -= tsize;
printf(" zz out %d\n",zout);
#endif
zdelete(zalloced, i); allocedNodes--;
found = 1;
#if ZDEBUG
memset(pointer, 0x5A, tsize);
#endif
break;
}
}
if (zerror) (*zerror)(pointer, rp, "free", 0);
else return;
}
#if ZDEBUG
zalloced_size -= tsize;
#endif
for (i = 0; i < availableNodes; i++)
{
static void
zallocate(char * start,int size)
{
#if ZDEBUG
zout += size;
printf(" alloc %d, total 0x%x\n",size,zout);
#endif
zalloced[allocedNodes].start = start;
zalloced[allocedNodes].size = size;
if (++allocedNodes > totalNodes) {
void * realloc(void * start, size_t newsize)
{
void * newstart = safe_malloc(newsize, __FILE__, __LINE__);
bcopy(start, newstart, newsize);
memcpy(start, newstart, newsize);
free(start);
return newstart;
}
branches/xZenu/src/modules/klibc/__udivmoddi4.c
1
1
22
33
44
#include "libsaio.h"
#include <stdint.h>
extern void __divide_error();
branches/xZenu/src/modules/klibc/__udivmodsi4.c
1
1
2
23
34
45
#include "libsaio.h"
#include <stdint.h>
extern void __divide_error();
uint32_t __udivmodsi4(uint32_t num, uint32_t den, uint32_t * rem_p)
{
branches/xZenu/src/modules/Disk/GUIDPartition.cpp
55
66
77
8
9
10
11
12
138
149
1510
#include <GUIDPartition.hpp>
#include <Disk.hpp>
extern "C"
{
#include "libsaio.h"
#include "stdio.h"
}
GUIDPartition::GUIDPartition(Disk* disk, UInt8 partitionNumber) : Partition(disk, partitionNumber)
{
branches/xZenu/src/modules/Disk/Main.cpp
22
33
44
5
56
67
78
......
1213
1314
1415
15
1616
1717
1818
......
5050
5151
5252
53
53
5454
5555
5656
* Copyright (c) 2011 Evan Lojewski. All rights reserved.
*
*/
#include <stdio.h>
#include <IOKit/IOTypes.h>
#include <BiosDisk.hpp>
#define BIOSBUFFER 512 * 8 /* 4Kb */
extern "C"
{
#include "libsaio.h"
void Disk_start();
}
halt();
while (1);
}
void DetermineDisks()
branches/xZenu/src/modules/Disk/i386/BiosDisk.cpp
4545
4646
4747
48
48
4949
50
51
52
53
54
55
5650
5751
5852
* - Converted to c++
* - Converted to UInt* style variable types
*/
#include <stdio.h>
#include <BiosDisk.hpp>
extern "C"
{
#include "libsaio.h"
#include "stdio.h"
}
BiosDisk::BiosDisk(const char* name)
{
branches/xZenu/src/modules/Disk/Makefile
99
1010
1111
12
12
1313
1414
DIR = Disk
MODULE_OBJS = Disk Partition FDiskPartition GUIDPartition Main
I386_OBJS = BiosDisk
#I386_OBJS = BiosDisk
include ../MakeInc.dir

Archive Download the corresponding diff file

Revision: 1297