git.ucc.asn.au
/
tpg
/
acess2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c48c61d
)
Fiddling with the x86_64 port
author
John Hodge
<
[email protected]
>
Wed, 23 Mar 2011 05:26:28 +0000
(13:26 +0800)
committer
John Hodge
<
[email protected]
>
Wed, 23 Mar 2011 05:26:28 +0000
(13:26 +0800)
Kernel/arch/x86_64/include/proc.h
patch
|
blob
|
history
Kernel/arch/x86_64/main.c
patch
|
blob
|
history
Kernel/arch/x86_64/mm_phys.c
patch
|
blob
|
history
Kernel/arch/x86_64/mm_virt.c
patch
|
blob
|
history
Kernel/arch/x86_64/proc.c
patch
|
blob
|
history
Kernel/arch/x86_64/time.c
patch
|
blob
|
history
Kernel/arch/x86_64/vm8086.c
patch
|
blob
|
history
diff --git
a/Kernel/arch/x86_64/include/proc.h
b/Kernel/arch/x86_64/include/proc.h
index
cf9a446
..
94d2127
100644
(file)
--- a/
Kernel/arch/x86_64/include/proc.h
+++ b/
Kernel/arch/x86_64/include/proc.h
@@
-44,5
+44,9
@@
typedef struct sTaskState
// === CONSTANTS ===
#define KERNEL_STACK_SIZE 0x10000 // 64 KiB
// === CONSTANTS ===
#define KERNEL_STACK_SIZE 0x10000 // 64 KiB
+// === FUNCTIONS ===
+extern void Proc_Start(void);
+extern int Proc_Clone(Uint *Err, Uint Flags);
+
#endif
#endif
diff --git
a/Kernel/arch/x86_64/main.c
b/Kernel/arch/x86_64/main.c
index
4e6001d
..
af231ee
100644
(file)
--- a/
Kernel/arch/x86_64/main.c
+++ b/
Kernel/arch/x86_64/main.c
@@
-3,6
+3,7
@@
*/
#include <acess.h>
#include <mboot.h>
*/
#include <acess.h>
#include <mboot.h>
+#include <init.h>
// === IMPORTS ===
extern void Desctab_Init(void);
// === IMPORTS ===
extern void Desctab_Init(void);
@@
-15,6
+16,7
@@
extern void System_Init(char *Commandline);
extern void MM_InitPhys_Multiboot(tMBoot_Info *MBoot);
// === PROTOTYPES ===
extern void MM_InitPhys_Multiboot(tMBoot_Info *MBoot);
// === PROTOTYPES ===
+void kmain(Uint MbMagic, void *MbInfoPtr);
// === GLOBALS ==
char *gsBootCmdLine = NULL;
// === GLOBALS ==
char *gsBootCmdLine = NULL;
@@
-81,7
+83,7
@@
void Arch_LoadBootModules(void)
}
}
-void StartupPrint(char *String)
+void StartupPrint(c
onst c
har *String)
{
}
{
}
diff --git
a/Kernel/arch/x86_64/mm_phys.c
b/Kernel/arch/x86_64/mm_phys.c
index
f3cdceb
..
062b138
100644
(file)
--- a/
Kernel/arch/x86_64/mm_phys.c
+++ b/
Kernel/arch/x86_64/mm_phys.c
@@
-24,10
+24,10
@@
extern char gKernelEnd[];
// === PROTOTYPES ===
void MM_InitPhys_Multiboot(tMBoot_Info *MBoot);
// === PROTOTYPES ===
void MM_InitPhys_Multiboot(tMBoot_Info *MBoot);
-
tPAddr
MM_AllocPhysRange(int Num, int Bits);
-
tPAddr
MM_AllocPhys(void);
-
void
MM_RefPhys(tPAddr PAddr);
-
void
MM_DerefPhys(tPAddr PAddr);
+
//tPAddr
MM_AllocPhysRange(int Num, int Bits);
+
//tPAddr
MM_AllocPhys(void);
+
//void
MM_RefPhys(tPAddr PAddr);
+
//void
MM_DerefPhys(tPAddr PAddr);
int MM_int_GetRangeID( tPAddr Addr );
// === GLOBALS ===
int MM_int_GetRangeID( tPAddr Addr );
// === GLOBALS ===
diff --git
a/Kernel/arch/x86_64/mm_virt.c
b/Kernel/arch/x86_64/mm_virt.c
index
2605a86
..
90c3721
100644
(file)
--- a/
Kernel/arch/x86_64/mm_virt.c
+++ b/
Kernel/arch/x86_64/mm_virt.c
@@
-38,10
+38,12
@@
// === PROTOTYPES ===
void MM_InitVirt(void);
// === PROTOTYPES ===
void MM_InitVirt(void);
-
void
MM_FinishVirtualInit(void);
+
//void
MM_FinishVirtualInit(void);
void MM_PageFault(tVAddr Addr, Uint ErrorCode, tRegs *Regs);
void MM_DumpTables(tVAddr Start, tVAddr End);
void MM_PageFault(tVAddr Addr, Uint ErrorCode, tRegs *Regs);
void MM_DumpTables(tVAddr Start, tVAddr End);
- int MM_Map(tVAddr VAddr, tPAddr PAddr);
+// int MM_Map(tVAddr VAddr, tPAddr PAddr);
+void MM_Unmap(tVAddr VAddr);
+void MM_ClearUser(void);
int MM_GetPageEntry(tVAddr Addr, tPAddr *Phys, Uint *Flags);
// === GLOBALS ===
int MM_GetPageEntry(tVAddr Addr, tPAddr *Phys, Uint *Flags);
// === GLOBALS ===
@@
-656,7
+658,15
@@
tVAddr MM_NewKStack(void)
//Log("MM_NewKStack: Found one at %p", base + KERNEL_STACK_SIZE);
for( i = 0; i < KERNEL_STACK_SIZE; i += 0x1000)
//Log("MM_NewKStack: Found one at %p", base + KERNEL_STACK_SIZE);
for( i = 0; i < KERNEL_STACK_SIZE; i += 0x1000)
- MM_Allocate(base+i);
+ {
+ if( !MM_Allocate(base+i) )
+ {
+ Log_Warning("MM", "MM_NewKStack - Allocation failed");
+ for( i -= 0x1000; i; i -= 0x1000)
+ MM_Deallocate(base+i);
+ return 0;
+ }
+ }
return base + KERNEL_STACK_SIZE;
}
return base + KERNEL_STACK_SIZE;
}
diff --git
a/Kernel/arch/x86_64/proc.c
b/Kernel/arch/x86_64/proc.c
index
5739470
..
105a59a
100644
(file)
--- a/
Kernel/arch/x86_64/proc.c
+++ b/
Kernel/arch/x86_64/proc.c
@@
-42,9
+42,7
@@
extern int giNextTID;
extern int giTotalTickets;
extern int giNumActiveThreads;
extern tThread gThreadZero;
extern int giTotalTickets;
extern int giNumActiveThreads;
extern tThread gThreadZero;
-//extern tThread *Threads_GetNextToRun(int CPU);
extern void Threads_Dump(void);
extern void Threads_Dump(void);
-extern tThread *Threads_CloneTCB(Uint *Err, Uint Flags);
extern void Proc_ReturnToUser(void);
extern int GetCPUNum(void);
extern void Proc_ReturnToUser(void);
extern int GetCPUNum(void);
@@
-54,11
+52,15
@@
void ArchThreads_Init(void);
void MP_StartAP(int CPU);
void MP_SendIPI(Uint8 APICID, int Vector, int DeliveryMode);
#endif
void MP_StartAP(int CPU);
void MP_SendIPI(Uint8 APICID, int Vector, int DeliveryMode);
#endif
-
void
Proc_Start(void);
-
tThread
*Proc_GetCurThread(void);
+
//void
Proc_Start(void);
+
//tThread
*Proc_GetCurThread(void);
void Proc_ChangeStack(void);
void Proc_ChangeStack(void);
- int Proc_Clone(Uint *Err, Uint Flags);
+// int Proc_Clone(Uint *Err, Uint Flags);
+// int Proc_SpawnWorker(void);
+Uint Proc_MakeUserStack(void);
+void Proc_StartUser(Uint Entrypoint, Uint *Bases, int ArgC, char **ArgV, char **EnvP, int DataSize);
void Proc_StartProcess(Uint16 SS, Uint Stack, Uint Flags, Uint16 CS, Uint IP);
void Proc_StartProcess(Uint16 SS, Uint Stack, Uint Flags, Uint16 CS, Uint IP);
+ int Proc_Demote(Uint *Err, int Dest, tRegs *Regs);
void Proc_CallFaultHandler(tThread *Thread);
void Proc_Scheduler(int CPU);
void Proc_CallFaultHandler(tThread *Thread);
void Proc_Scheduler(int CPU);
@@
-304,7
+306,10
@@
void ArchThreads_Init(void)
outb(0x40, (TIMER_DIVISOR>>8)&0xFF); // High Byte
// Create Per-Process Data Block
outb(0x40, (TIMER_DIVISOR>>8)&0xFF); // High Byte
// Create Per-Process Data Block
- MM_Allocate(MM_PPD_CFG);
+ if( !MM_Allocate(MM_PPD_CFG) )
+ {
+ Warning("Oh, hell, Unable to allocate PPD for Thread#0");
+ }
// Change Stacks
Proc_ChangeStack();
// Change Stacks
Proc_ChangeStack();
@@
-386,7
+391,7
@@
void Proc_Start(void)
if(Proc_Clone(0, 0) == 0)
{
gaCPUs[0].IdleThread = Proc_GetCurThread();
if(Proc_Clone(0, 0) == 0)
{
gaCPUs[0].IdleThread = Proc_GetCurThread();
- gaCPUs[0].IdleThread->ThreadName = "Idle Thread";
+ gaCPUs[0].IdleThread->ThreadName =
(char*)
"Idle Thread";
Threads_SetPriority( gaCPUs[0].IdleThread, -1 ); // Never called randomly
gaCPUs[0].IdleThread->Quantum = 1; // 1 slice quantum
for(;;) HALT(); // Just yeilds
Threads_SetPriority( gaCPUs[0].IdleThread, -1 ); // Never called randomly
gaCPUs[0].IdleThread->Quantum = 1; // 1 slice quantum
for(;;) HALT(); // Just yeilds
@@
-611,8
+616,17
@@
Uint Proc_MakeUserStack(void)
if(i != -1) return 0;
// Allocate Stack - Allocate incrementally to clean up MM_Dump output
if(i != -1) return 0;
// Allocate Stack - Allocate incrementally to clean up MM_Dump output
- for( i = 0; i < USER_STACK_SZ/4069; i++ )
- MM_Allocate( base + (i<<12) );
+ for( i = 0; i < USER_STACK_SZ/0x1000; i++ )
+ {
+ if( !MM_Allocate( base + (i<<12) ) )
+ {
+ // Error
+ Log_Error("Proc", "Unable to allocate user stack (%i pages requested)", USER_STACK_SZ/0x1000);
+ while( i -- )
+ MM_Deallocate( base + (i<<12) );
+ return 0;
+ }
+ }
return base + USER_STACK_SZ;
}
return base + USER_STACK_SZ;
}
diff --git
a/Kernel/arch/x86_64/time.c
b/Kernel/arch/x86_64/time.c
index
ec1e19d
..
6153db2
100644
(file)
--- a/
Kernel/arch/x86_64/time.c
+++ b/
Kernel/arch/x86_64/time.c
@@
-28,7
+28,7
@@
volatile Uint64 giTime_TSCAtLastTick = 0;
volatile Uint64 giTime_TSCPerTick = 0;
// === PROTOTYPES ===
volatile Uint64 giTime_TSCPerTick = 0;
// === PROTOTYPES ===
-
Sint64
now(void);
+
//Sint64
now(void);
int Time_Setup(void);
void Time_Interrupt(int);
Uint64 Time_ReadTSC(void);
int Time_Setup(void);
void Time_Interrupt(int);
Uint64 Time_ReadTSC(void);
diff --git
a/Kernel/arch/x86_64/vm8086.c
b/Kernel/arch/x86_64/vm8086.c
index
40860c8
..
4251570
100644
(file)
--- a/
Kernel/arch/x86_64/vm8086.c
+++ b/
Kernel/arch/x86_64/vm8086.c
@@
-12,8
+12,8
@@
// === PROTOTYPES ===
int VM8086_Install(char **Arguments);
// === PROTOTYPES ===
int VM8086_Install(char **Arguments);
-
tVM8086
*VM8086_Init(void);
-
void
VM8086_Free(tVM8086 *State);
+
//tVM8086
*VM8086_Init(void);
+
//void
VM8086_Free(tVM8086 *State);
// === GLOBALS ===
MODULE_DEFINE(0, 0x100, VM8086, VM8086_Install, NULL, NULL);
// === GLOBALS ===
MODULE_DEFINE(0, 0x100, VM8086, VM8086_Install, NULL, NULL);
UCC
git Repository :: git.ucc.asn.au