DEPFILES = $(filter %.o,$(OBJ) $(N_OBJ) $(K_OBJ))\r
DEPFILES := $(DEPFILES:%=%.dep)\r
\r
-KCPPFLAGS = -I include/ -I $(KERNEL_SRC)include/ -I$(LDACESS_SRC)include_exp/\r
+KCPPFLAGS = -I include/ -I $(KERNEL_SRC)include/ -I$(LDACESS_SRC)include_exp/ -D KERNEL_VERSION=${ACESS_VERSION}\r
CFLAGS += -Wall -g -std=gnu99\r
CPPFLAGS += $(shell sdl-config --cflags) -I /usr/include/\r
LDFLAGS += $(shell sdl-config --libs) -g -Wl,--defsym,__buildnum=$(BUILD_NUM)\r
$(OBJ): obj-$(PLATFORM)/%.o: %.c\r
@mkdir -p $(dir $@)\r
@echo [CC] -o $@\r
- @$(CC) -c $< -o $@ $(CFLAGS) $(KCPPFLAGS) $(CPPFLAGS)\r
+ @$(CC) -c $< -o $@ $(CFLAGS) $(KCPPFLAGS) $(CPPFLAGS) -MMD -MP -MF
[email protected]\r
\r
$(K_OBJ): $(KERNEL_SRC)obj-native-$(PLATFORM)/%.o: $(KERNEL_SRC)%.c\r
@mkdir -p $(dir $@)\r
@echo [CC] -o $@\r
- @$(CC) -ffreestanding -c $< -o $@ $(CFLAGS) $(KCPPFLAGS) $(CPPFLAGS)\r
+ @$(CC) -ffreestanding -c $< -o $@ $(CFLAGS) $(KCPPFLAGS) $(CPPFLAGS) -MMD -MP -MF
[email protected]\r
\r
\r
$(N_OBJ): obj-$(PLATFORM)/%.o: %.c\r
@mkdir -p $(dir $@)\r
@echo [CC] -o $@\r
- @$(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS)\r
\r
$(BUILDINFO_SRC): $(filter-out $(BUILDINFO_OBJ), $(OBJ)) Makefile\r
@echo "" > $@\r
gpCurrentThread->EventState &= ~EventMask;
}
+// --------------------------------------------------------------------
+// Signals
+// --------------------------------------------------------------------
+void Threads_PostSignal(int SigNum)
+{
+ Log_Error("Threads", "TODO: %s", __func__);
+}
+void Threads_SignalGroup(tPGID PGID, int SignalNum)
+{
+ Log_Error("Threads", "TODO: %s", __func__);
+}
+
#include <pthread.h>
#include <assert.h>
+#define NORETURN __attribute__((noreturn))
#include <logdebug.h> // Kernel land, but uses standards
// === CODE ===
SDL_Event event;
Uint32 acess_sym;
- for( ;; )
+ while( SDL_WaitEvent(&event) )
{
- while(SDL_PollEvent(&event))
+ switch(event.type)
{
- switch(event.type)
- {
- case SDL_QUIT:
- AcessNative_Exit();
- return ;
-
- case SDL_KEYDOWN:
- acess_sym = UI_GetAcessKeyFromSDL(event.key.keysym.sym);
- // Enter key on acess returns \n, but SDL returns \r
- if(event.key.keysym.sym == SDLK_RETURN)
- event.key.keysym.unicode = '\n';
-
- if( gUI_KeyboardCallback ) {
- gUI_KeyboardCallback(KEY_ACTION_RAWSYM|acess_sym);
- gUI_KeyboardCallback(KEY_ACTION_PRESS|event.key.keysym.unicode);
- }
- break;
+ case SDL_QUIT:
+ AcessNative_Exit();
+ return ;
- case SDL_KEYUP:
- acess_sym = UI_GetAcessKeyFromSDL(event.key.keysym.sym);
-
- if( gUI_KeyboardCallback ) {
- gUI_KeyboardCallback(KEY_ACTION_RAWSYM|acess_sym);
- gUI_KeyboardCallback(KEY_ACTION_RELEASE|0);
- }
- break;
-
- case SDL_USEREVENT:
- SDL_UpdateRect(gScreen, 0, 0, giUI_Width, giUI_Height);
- SDL_Flip(gScreen);
- break;
+ case SDL_KEYDOWN:
+ acess_sym = UI_GetAcessKeyFromSDL(event.key.keysym.sym);
+ // Enter key on acess returns \n, but SDL returns \r
+ if(event.key.keysym.sym == SDLK_RETURN)
+ event.key.keysym.unicode = '\n';
+
+ if( gUI_KeyboardCallback ) {
+ gUI_KeyboardCallback(KEY_ACTION_RAWSYM|acess_sym);
+ gUI_KeyboardCallback(KEY_ACTION_PRESS|event.key.keysym.unicode);
+ }
+ break;
+
+ case SDL_KEYUP:
+ acess_sym = UI_GetAcessKeyFromSDL(event.key.keysym.sym);
- case SDL_MOUSEMOTION: {
- int abs[] = {event.motion.x, event.motion.y};
- int delta[] = {event.motion.xrel, event.motion.yrel};
- Mouse_HandleEvent(UI_GetButtonBits(SDL_GetMouseState(NULL, NULL)), delta, abs);
- break; }
- case SDL_MOUSEBUTTONUP:
- case SDL_MOUSEBUTTONDOWN: {
- int abs[] = {event.button.x, event.button.y};
- Mouse_HandleEvent(UI_GetButtonBits(SDL_GetMouseState(NULL, NULL)), NULL, abs);
- break; }
-
- default:
- break;
+ if( gUI_KeyboardCallback ) {
+ gUI_KeyboardCallback(KEY_ACTION_RAWSYM|acess_sym);
+ gUI_KeyboardCallback(KEY_ACTION_RELEASE|0);
}
+ break;
+
+ case SDL_USEREVENT:
+ SDL_UpdateRect(gScreen, 0, 0, giUI_Width, giUI_Height);
+ SDL_Flip(gScreen);
+ break;
+
+ case SDL_MOUSEMOTION: {
+ int abs[] = {event.motion.x, event.motion.y};
+ int delta[] = {event.motion.xrel, event.motion.yrel};
+ Mouse_HandleEvent(UI_GetButtonBits(SDL_GetMouseState(NULL, NULL)), delta, abs);
+ break; }
+ case SDL_MOUSEBUTTONUP:
+ case SDL_MOUSEBUTTONDOWN: {
+ int abs[] = {event.button.x, event.button.y};
+ Mouse_HandleEvent(UI_GetButtonBits(SDL_GetMouseState(NULL, NULL)), NULL, abs);
+ break; }
+
+ default:
+ break;
}
}
}
#include <stdarg.h>
#include <stddef.h>
-#define DEBUG(v...) Debug(v)
-//#define DEBUG(v...) do{}while(0)//Debug(v)
+#define DEBUG(v...) do{if(gbSyscallDebugEnabled)Debug(v);}while(0)
#define PAGE_SIZE 4096
#define TODO() Warning("TODO: %s", __func__)
// === GLOBALS ===
int acess__errno;
+ int gbSyscallDebugEnabled = 0;
char *gsExecutablePath = "./ld-acess";
// === CODE ===
return _Syscall(SYS_IOCTL, ">i >i ?d", fd, id, len, data);
}
int acess__SysFInfo(int fd, t_sysFInfo *info, int maxacls) {
-// DEBUG("offsetof(size, t_sysFInfo) = %i", offsetof(t_sysFInfo, size));
SYSTRACE("_SysFInfo(%i, %p, %i)", fd, info, maxacls);
return _Syscall(SYS_FINFO, ">i <d >i",
fd,
return -1;
}
+// --- System ---
+int acess__SysLoadModule(const char *Path)
+{
+ TODO();
+ return -1;
+}
+
// --- Timekeeping ---
int64_t acess__SysTimestamp(void)
{
// _Syscall(SYS_SLEEP, "");
//}
+void acess__SysTimedSleep(int64_t Delay)
+{
+ DEBUG("%s(%lli)", __func__, Delay);
+ // Not accurate, but fuck it
+ //if( Delay > 1000 ) sleep(Delay / 1000);
+ //if( Delay % 1000 ) usleep( (Delay % 1000) * 1000 );
+ //_Syscall(SYS_TIMEDSLEEP, ">I", Delay);
+}
+
int acess__SysWaitTID(int TID, int *ExitStatus)
{
DEBUG("%s(%i, %p)", __func__, TID, ExitStatus);
int acess_gettid(void) { return _Syscall(SYS_GETTID, ""); }
int acess__SysGetPID(void) { return _Syscall(SYS_GETPID, ""); }
int acess__SysGetUID(void) { return _Syscall(SYS_GETUID, ""); }
+int acess__SysGetGID(void) { return _Syscall(SYS_GETGID, ""); }
int acess_getgid(void) { return _Syscall(SYS_GETGID, ""); }
int acess__SysSendMessage(int DestTID, int Length, void *Data)
// === IMPORTS ===
extern int gSocket;
extern int giSyscall_ClientID;
+extern int gbSyscallDebugEnabled;
extern void acess__exit(int Status);
extern void Request_Preinit(void);
}
continue ;
}
+ if( strcmp(argv[i], "--trace") == 0 ) {
+ gbSyscallDebugEnabled = 1;
+ continue ;
+ }
if( argv[i][0] != '-' ) break;
}
// === Types ===
// === IMPORTS ===
+extern int gbSyscallDebugEnabled;
// === GLOBALS ===
FILE *gaSyscall_LocalFPs[MAX_FPS];
free( req );
free( retPtrs );
- SYSTRACE(": %i 0x%llx", SyscallID, retValue);
+ if( gbSyscallDebugEnabled ) {
+ SYSTRACE(": %i 0x%llx", SyscallID, retValue);
+ }
return retValue;
}
return 0;
}
+void ldacess_DumpLoadedLibraries(void)
+{
+ Debug("ldacess_DumpLoadedLibraries");
+}
+
#define SYSCALL_TRACE 1
#if SYSCALL_TRACE
-#define SYSTRACE(str, x...) Debug(str, x)
+#define SYSTRACE(str, x...) do{ if(gbSyscallDebugEnabled)Debug(str, x); }while(0)
#else
#define SYSTRACE(...) do{}while(0)
#endif
extern void format_date(tTime TS, int *year, int *month, int *day, int *hrs, int *mins, int *sec, int *ms);
#define PACKED __attribute__((packed))
+#define NORETURN __attribute__((noreturn))
#define DEPRECATED
#define EXPORT(s)
#define EXPORTV(s)