Makefile: ../Makefile.cfg arch/$(ARCHDIR)/Makefile
+drv/proc.o.%: Makefile.BuildNum
+
# Dependency Files
-include $(DEPFILES)
-BUILD_NUM = 59
+BUILD_NUM = 94
; ---------------------
[extern ErrorHandler]
ErrorCommon:
+ ;xchg bx, bx
pusha
push ds
push es
#define _MM_VIRT_H
// === FUNCTIONS ===
+extern void MM_FinishVirtualInit();
extern void MM_SetCR3(Uint32 CR3);
extern tPAddr MM_Allocate(tVAddr VAddr);
extern void MM_Deallocate(tVAddr VAddr);
* 0xFF - System Calls / Kernel's User Code
*/
#define DEBUG 1
+#define SANITY 1
#include <acess.h>
#include <mm_phys.h>
#include <proc.h>
void MM_PreinitVirtual()
{
#if USE_PAE
- //gaInitPDPT[ 0 ] = 0;
gaInitPageDir[ ((PAGE_TABLE_ADDR >> TAB)-3*512+3)*2 ] = ((tTabEnt)&gaInitPageDir - KERNEL_BASE) | 3;
#else
- //gaInitPageDir[ 0 ] = 0; // Needed for SMP startup code
gaInitPageDir[ PAGE_TABLE_ADDR >> 22 ] = ((tTabEnt)&gaInitPageDir - KERNEL_BASE) | 3;
#endif
INVLPG( PAGE_TABLE_ADDR );
#endif
}
+/**
+ * \brief Cleans up the SMP required mappings
+ */
+void MM_FinishVirtualInit()
+{
+ #if USE_PAE
+ gaInitPDPT[ 0 ] = 0;
+ #else
+ gaInitPageDir[ 0 ] = 0;
+ #endif
+}
+
/**
* \fn void MM_PageFault(tVAddr Addr, Uint ErrorCode, tRegs *Regs)
* \brief Called on a page fault
}
else
{
+ //Log("MM_PageFault: COW - MM_DuplicatePage(0x%x)", Addr);
paddr = MM_DuplicatePage( Addr );
MM_DerefPhys( gaPageTable[Addr>>12] & ~0xFFF );
gaPageTable[Addr>>12] &= PF_USER;
//LOG("paddr = 0x%llx (new table)", paddr);
if( paddr == 0 ) {
Warning("MM_Allocate - Out of Memory (Called by %p)", __builtin_return_address(0));
- LEAVE('i',0);
+ //LEAVE('i',0);
return 0;
}
// Map
memsetd( gaTmpDir, 0, 1024 );
// Copy Tables
- for(i=0;i<768;i++)
+ for( i = 0; i < 768; i ++)
{
// Check if table is allocated
if( !(gaPageDir[i] & PF_PRESENT) ) {
Uint temp;
int wasRO = 0;
+ //ENTER("xVAddr", VAddr);
+
// Check if mapped
if( !(gaPageDir [VAddr >> 22] & PF_PRESENT) ) return 0;
if( !(gaPageTable[VAddr >> 12] & PF_PRESENT) ) return 0;
if(!wasRO) gaPageTable[VAddr >> 12] |= PF_WRITE;
INVLPG(VAddr);
+ //LEAVE('X', ret);
return ret;
}
// === GLOBALS ===
// --- Multiprocessing ---
#if USE_MP
+volatile int giNumInitingCPUs = 0;
tMPInfo *gMPFloatPtr = NULL;
tAPIC *gpMP_LocalAPIC = NULL;
Uint8 gaAPIC_to_CPU[256] = {0};
if( giNumCPUs > MAX_CPUS ) {
Warning("Too many CPUs detected (%i), only using %i of them", giNumCPUs, MAX_CPUS);
+ giNumCPUs = MAX_CPUS;
}
+
+ while( giNumInitingCPUs )
+ MM_FinishVirtualInit();
Panic("Uh oh... MP Table Parsing is unimplemented\n");
}
#else
giNumCPUs = 1;
gTSSs = &gTSS0;
+ MM_FinishVirtualInit();
#endif
// Initialise Double Fault TSS
*(Uint16*)(KERNEL_BASE|0x469) = 0xFFFF;
outb(0x70, 0x0F); outb(0x71, 0x0A); // Warm Reset
MP_SendIPI(gaCPUs[CPU].APICID, 0, 5);
+ giNumInitingCPUs ++;
}
void MP_SendIPI(Uint8 APICID, int Vector, int DeliveryMode)
#endif
// Update Kernel Stack pointer
- gTSSs[CPU].ESP0 = thread->KernelStack;
+ gTSSs[CPU].ESP0 = thread->KernelStack-4;
// Set address space
#if USE_PAE
[extern gpMP_LocalAPIC]\r
[extern gaAPIC_to_CPU]\r
[extern gaCPUs]\r
+[extern giNumInitingCPUs]\r
lGDTPtr: ; Local GDT Pointer\r
dw 2*8-1\r
dd gGDT-KERNEL_BASE\r
mov cl, BYTE [gaAPIC_to_CPU+ecx]\r
; CL is now the CPU ID\r
mov BYTE [gaCPUs+ecx*8+1], 1\r
+ ; Decrement the remaining CPU count\r
+ dec DWORD [giNumInitingCPUs]\r
; CPU is now marked as initialised\r
sti\r
.hlt:\r
Base, ident&0xFF, ident>>8, ident>>16, ident>>24);\r
return 0;\r
}\r
+\r
+// === EXPORTS ===\r
+EXPORT(Binary_FindSymbol);\r
+EXPORT(Binary_Unload);\r
char *p = NULL;
int isLongLong = 0;
Uint64 arg;
-
+
while((c = *format++) != 0)
{
// Non control character
va_start(args, RetType);
+ if( i == -1 ) {
+ gDebug_Level = 0;
+ i = 0;
+ }
// Indenting
while(i--) E9(' ');
#include <tpl_drv_terminal.h>
#include <errno.h>
+#define USE_CTRL_ALT 0
+
// === CONSTANTS ===
#define VERSION ((0<<8)|(50))
Codepoint &= 0x7FFFFFFF;
switch(Codepoint)
{
+ #if !USE_CTRL_ALT
+ case KEY_RSHIFT: gbVT_CtrlDown = 0; break;
+ case KEY_LSHIFT: gbVT_AltDown = 0; break;
+ #else
case KEY_LALT:
case KEY_RALT:
gbVT_AltDown = 0;
case KEY_RCTRL:
gbVT_CtrlDown = 0;
break;
+ #endif
}
return;
}
switch(Codepoint)
{
+ #if !USE_CTRL_ALT
+ case KEY_RSHIFT: gbVT_CtrlDown = 1; break;
+ case KEY_LSHIFT: gbVT_AltDown = 1; break;
+ #else
case KEY_LALT:
case KEY_RALT:
gbVT_AltDown = 1;
case KEY_RCTRL:
gbVT_CtrlDown = 1;
break;
+ #endif
default:
+ #if USE_CTRL_ALT
if(!gbVT_AltDown || !gbVT_CtrlDown)
break;
+ #endif
switch(Codepoint)
{
case KEY_F1: VT_SetTerminal(0); return;
if(Regs->Num < NUM_SYSCALLS)
LOG("Syscall %s", cSYSCALL_NAMES[Regs->Num]);
LOG("Arg1: 0x%x, Arg2: 0x%x, Arg3: 0x%x, Arg4: 0x%x", Regs->Arg1, Regs->Arg2, Regs->Arg3, Regs->Arg4);
- //#endif
switch(Regs->Num)
{
}
}
}
+ LEAVE('s', "Assuming 0");
// Path, **Argv, **Envp
ret = Proc_Execve((char*)Regs->Arg1, (char**)Regs->Arg2, (char**)Regs->Arg3);
break;
Regs->Error = err;
#if DEBUG
LOG("err = %i", err);
- LEAVE('x', ret);
+ if(Regs->Num != SYS_EXECVE)
+ LEAVE('x', ret);
+ else
+ LOG("Actual %i", ret);
#endif
}
# (Oh man! This is hacky, but beautiful at the same time, much like the
# rest of Acess)
+-include Makefile.cfg
+
.PHONY: all clean
SUBMAKE = $(MAKE) --no-print-directory
-MODULES = FS_Ext2 FDD BochsGA IPStack NE2000 USB
+MODULES += $(DYNMODS)
USRLIBS = ld-acess.so libacess.so libgcc.so libc.so
USRAPPS = init login CLIShell cat ls mount ifconfig
$(CLEAN_MODULES) clean-Kernel $(CLEAN_USRLIBS) $(CLEAN_USRAPPS) \
$(INSTALL_MODULES) install-Kernel $(INSTALL_USRLIBS) $(INSTALL_USRAPPS)
+kmode: $(ALLINSTALL_MODULES) allinstall-Kernel
+
all: $(ALL_MODULES) all-Kernel $(ALL_USRLIBS) $(ALL_USRAPPS)
-all-install: $(ALLINSTALL_MODULES) all-Kernel $(ALLINSTALL_USRLIBS) $(ALLINSTALL_USRAPPS)
+all-install: $(ALLINSTALL_MODULES) allinstall-Kernel $(ALLINSTALL_USRLIBS) $(ALLINSTALL_USRAPPS)
clean: $(CLEAN_MODULES) clean-Kernel $(CLEAN_USRLIBS) $(CLEAN_USRAPPS)
install: $(INSTALL_MODULES) install-Kernel $(INSTALL_USRLIBS) $(INSTALL_USRAPPS)
FILESYSTEMS = fat
DRIVERS = ata_x86
-MODULES = FS_Ext2 FDD NE2000 BochsGA
+MODULES = FS_Ext2 FDD NE2000 BochsGA IPStack
+DYNMODS = USB
+# UDI
#DISTROOT = /mnt/AcessHDD/Acess2
#DISTROOT = ~/Projects/Acess2/Filesystem
#include <drv_pci.h>\r
#include <tpl_drv_video.h>\r
\r
-//#define INT static\r
#define INT\r
\r
// === TYPEDEFS ===\r
+++ /dev/null
-/**
- */
-#ifndef _UDI_LOGGING_H
-#define _UDI_LOGGING_H
-
-typedef void udi_log_write_call_t( udi_cb_t *gcb, udi_status_t correlated_status );
-
-extern void udi_log_write(
- udi_log_write_call_t *callback,
- udi_cb_t *gcb,
- udi_trevent_t trace_event,
- udi_ubit8_t severity,
- udi_index_t meta_idx,
- udi_status_t original_status,
- udi_ubit32_t msgnum,
- ...
- );
-
-/* Values for severity */
-#define UDI_LOG_DISASTER 1
-#define UDI_LOG_ERROR 2
-#define UDI_LOG_WARNING 3
-#define UDI_LOG_INFORMATION 4
-
-#endif
+++ /dev/null
-/*
- * Acess2 UDI Support
- * _udi/meta_gio.h
- * - General IO Metalanguage
- */
-#ifndef _UDI_META_GIO_H_
-#define _UDI_META_GIO_H_
-
-typedef struct {
- udi_channel_event_ind_op_t *channel_event_ind_op ;
- udi_gio_bind_ack_op_t *gio_bind_ack_op ;
- udi_gio_unbind_ack_op_t *gio_unbind_ack_op ;
- udi_gio_xfer_ack_op_t *gio_xfer_ack_op ;
- udi_gio_xfer_nak_op_t *gio_xfer_nak_op ;
- udi_gio_event_ind_op_t *gio_event_ind_op ;
-} udi_gio_client_ops_t;
-
-typedef struct {
- udi_channel_event_ind_op_t *channel_event_ind_op ;
- udi_gio_bind_req_op_t *gio_bind_req_op ;
- udi_gio_unbind_req_op_t *gio_unbind_req_op ;
- udi_gio_xfer_req_op_t *gio_xfer_req_op ;
- udi_gio_event_res_op_t *gio_event_res_op ;
-} udi_gio_provider_ops_t ;
-
-#endif
+++ /dev/null
-/*
- * Acess2 UDI Support
- * _udi/meta_mgmt.h
- * - Mangement Metalanguage
- */
-#ifndef _UDI_META_MGMT_H_
-#define _UDI_META_MGMT_H_
-
-typedef struct {
- udi_cb_t gcb;
-} udi_mgmt_cb_t;
-
-typedef struct {
- udi_cb_t gcb;
- udi_trevent_t trace_mask;
- udi_index_t meta_idx;
-} udi_usage_cb_t;
-
-typedef struct {
- udi_cb_t gcb;
- udi_ubit32_t child_ID;
- void *child_data;
- udi_instance_attr_list_t *attr_list;
- udi_ubit8_t attr_valid_length;
- const udi_filter_element_t *filter_list;
- udi_ubit8_t filter_list_length;
- udi_ubit8_t parent_ID;
-} udi_enumerate_cb_t;
-
-
-typedef void udi_usage_ind_op_t(udi_usage_cb_t *, udi_ubit8_t);
-typedef void udi_enumerate_req_op_t(udi_enumerate_cb_t *, udi_ubit8_t);
-typedef void udi_devmgmt_req_op_t(udi_mgmt_cb_t *, udi_ubit8_t);
-typedef void udi_final_cleanup_req_op_t(udi_mgmt_cb_t *);
-
-typedef const struct {
- udi_usage_ind_op_t *usage_ind_op;
- udi_enumerate_req_op_t *enumerate_req_op;
- udi_devmgmt_req_op_t *devmgmt_req_op;
- udi_final_cleanup_req_op_t *final_cleanup_req_op;
-} udi_mgmt_ops_t;
-
-extern void udi_devmgmt_ack(udi_mgmt_cb_t *cb, udi_ubit8_t flags, udi_status_t status)
-/* Values for flags */
-#define UDI_DMGMT_NONTRANSPARENT (1U<<0)
-/* Meta-Specific Status Codes */
-#define UDI_DMGMT_STAT_ROUTING_CHANGE (UDI_STAT_META_SPECIFIC|1)
-
-#endif
+++ /dev/null
-#ifndef _UDI_VALUES_H_
-#define _UDI_VALUES_H_
-
-typedef udi_ubit8_t udi_instance_attr_type_t;
-/* Instance Attribute Types */
-#define UDI_ATTR_NONE 0
-#define UDI_ATTR_STRING 1
-#define UDI_ATTR_ARRAY8 2
-#define UDI_ATTR_UBIT32 3
-#define UDI_ATTR_BOOLEAN 4
-#define UDI_ATTR_FILE 5
-
-#endif
-/*
- * Acess2 UDI Support
- * udi.h
+/**
+ * \file udi.h
*/
-#ifndef _UDI_H_
-#define _UDI_H_
-
-#include <udi_arch.h>
+#ifndef _UDI_ARCH_H_
+#define _UDI_ARCH_H_
-typedef void udi_op_t(void);
+// Use the core acess file to use the specific size types (plus va_arg)
+#include <acess.h>
-typedef udi_op_t const *udi_ops_vector_t;
+typedef Sint8 udi_sbit8_t; /* signed 8-bit: -2^7..2^7-1 */
+typedef Sint16 udi_sbit16_t; /* signed 16-bit: -2^15..2^15-1 */
+typedef Sint32 udi_sbit32_t; /* signed 32-bit: -2^31..2^31-1 */
+typedef Uint8 udi_ubit8_t; /* unsigned 8-bit: 0..28-1 */
+typedef Uint16 udi_ubit16_t; /* unsigned 16-bit: 0..216-1 */
+typedef Uint32 udi_ubit32_t; /* unsigned 32-bit: 0..232-1 */
-typedef const udi_ubit8_t udi_layout_t;
+typedef udi_ubit8_t udi_boolean_t; /* 0=False; 1..28-1=True */
+#define FALSE 0
+#define TRUE 1
-typedef udi_ubit32_t udi_trevent_t;
+typedef size_t udi_size_t; /* buffer size */
+typedef size_t udi_index_t; /* zero-based index type */
-#include <_udi/values.h>
-
-typedef struct {
- udi_channel_t channel;
- void *context;
- void *scratch;
- void *initiator_context;
- udi_origin_t origin;
-} udi_cb_t;
+/* Channel Handle */
+typedef void *udi_channel_t;
+#define UDI_NULL_CHANNEL NULL
/**
- * \name Attributes
- * \{
- */
-#define UDI_MAX_ATTR_NAMELEN 32
-#define UDI_MAX_ATTR_SIZE 64
-typedef struct {
- char attr_name[UDI_MAX_ATTR_NAMELEN];
- udi_ubit8_t attr_value[UDI_MAX_ATTR_SIZE];
- udi_ubit8_t attr_length;
- udi_instance_attr_type_t attr_type;
-} udi_instance_attr_list_t;
-
-typedef struct {
- char attr_name[UDI_MAX_ATTR_NAMELEN];
- udi_ubit8_t attr_min[UDI_MAX_ATTR_SIZE];
- udi_ubit8_t attr_min_len;
- udi_ubit8_t attr_max[UDI_MAX_ATTR_SIZE];
- udi_ubit8_t attr_max_len;
- udi_instance_attr_type_t attr_type;
- udi_ubit32_t attr_stride;
-} udi_filter_element_t;
-/**
- * \}
+ * \brief Buffer Path
*/
+typedef void *udi_buf_path_t;
+#define UDI_NULL_BUF_PATH NULL
+typedef void *udi_origin_t;
+#define UDI_NULL_ORIGIN NULL
+typedef Sint64 udi_timestamp_t;
-#include <_udi/meta_mgmt.h>
-
-/**
- */
-typedef const struct {
- udi_index_t cb_idx;
- udi_size_t scratch_requirement;
-} udi_gcb_init_t;
-
-/**
- */
-typedef const struct {
- udi_index_t ops_idx;
- udi_index_t cb_idx;
-} udi_cb_select_t;
+#define UDI_HANDLE_IS_NULL(handle, handle_type) (handle == NULL)
+#define UDI_HANDLE_ID(handle, handle_type) ((Uint32)handle)
/**
+ * \name va_arg wrapper
+ * \{
*/
-typedef const struct {
- udi_index_t cb_idx;
- udi_index_t meta_idx;
- udi_index_t meta_cb_num;
- udi_size_t scratch_requirement;
- udi_size_t inline_size;
- udi_layout_t *inline_layout;
-} udi_cb_init_t;
-
+#define UDI_VA_ARG(pvar, type, va_code) va_arg(pvar,type)
+#define UDI_VA_UBIT8_T
+#define UDI_VA_SBIT8_T
+#define UDI_VA_UBIT16_T
+#define UDI_VA_SBIT16_T
+#define UDI_VA_UBIT32_T
+#define UDI_VA_SBIT32_T
+#define UDI_VA_BOOLEAN_T
+#define UDI_VA_INDEX_T
+#define UDI_VA_SIZE_T
+#define UDI_VA_STATUS_T
+#define UDI_VA_CHANNEL_T
+#define UDI_VA_ORIGIN_T
+#define UDI_VA_POINTER
/**
- * The \a udi_ops_init_t structure contains information the environment
- * needs to subsequently create channel endpoints for a particular type of ops
- * vector and control block usage. This structure is part of \a udi_init_info.
+ * \}
*/
-typedef const struct {
- udi_index_t ops_idx; //!< Non Zero driver assigned number
- udi_index_t meta_idx; //!< Metalanguage Selector
- udi_index_t meta_ops_num; //!< Metalanguage Operation
- udi_size_t chan_context_size;
- udi_ops_vector_t *ops_vector; //!< Array of function pointers
- const udi_ubit8_t *op_flags;
-} udi_ops_init_t;
/**
+ * \brief Status Type
*/
-typedef const struct {
- udi_index_t region_idx;
- udi_size_t rdata_size;
-} udi_secondary_init_t;
-
+typedef udi_ubit32_t udi_status_t;
/**
+ * \name Values and Flags for udi_status_t
+ * \{
*/
-typedef const struct {
- udi_mgmt_ops_t *mgmt_ops;
- const udi_ubit8_t *mgmt_op_flags;
- udi_size_t mgmt_scratch_requirement;
- udi_ubit8_t enumeration_attr_list_length;
- udi_size_t rdata_size;
- udi_size_t child_data_size;
- udi_ubit8_t per_parent_paths;
-} udi_primary_init_t;
-
+#define UDI_STATUS_CODE_MASK 0x0000FFFF
+#define UDI_STAT_META_SPECIFIC 0x00008000
+#define UDI_SPECIFIC_STATUS_MASK 0x00007FFF
+#define UDI_CORRELATE_OFFSET 16
+#define UDI_CORRELATE_MASK 0xFFFF0000
+/* Common Status Values */
+#define UDI_OK 0
+#define UDI_STAT_NOT_SUPPORTED 1
+#define UDI_STAT_NOT_UNDERSTOOD 2
+#define UDI_STAT_INVALID_STATE 3
+#define UDI_STAT_MISTAKEN_IDENTITY 4
+#define UDI_STAT_ABORTED 5
+#define UDI_STAT_TIMEOUT 6
+#define UDI_STAT_BUSY 7
+#define UDI_STAT_RESOURCE_UNAVAIL 8
+#define UDI_STAT_HW_PROBLEM 9
+#define UDI_STAT_NOT_RESPONDING 10
+#define UDI_STAT_DATA_UNDERRUN 11
+#define UDI_STAT_DATA_OVERRUN 12
+#define UDI_STAT_DATA_ERROR 13
+#define UDI_STAT_PARENT_DRV_ERROR 14
+#define UDI_STAT_CANNOT_BIND 15
+#define UDI_STAT_CANNOT_BIND_EXCL 16
+#define UDI_STAT_TOO_MANY_PARENTS 17
+#define UDI_STAT_BAD_PARENT_TYPE 18
+#define UDI_STAT_TERMINATED 19
+#define UDI_STAT_ATTR_MISMATCH 20
/**
+ * \}
*/
-typedef const struct {
- udi_primary_init_t *primary_init_info;
- udi_secondary_init_t *secondary_init_list; //!< Array
- udi_ops_init_t *ops_init_list;
- udi_cb_init_t *cb_init_list;
- udi_gcb_init_t *gcb_init_list;
- udi_cb_select_t *cb_select_list;
-} udi_init_t;
-
-
-//
-// == Regions ==
-//
/**
- * udi_limits_t reflects implementation-dependent system limits, such as
- * memory allocation and timer resolution limits, for a particular region. These
- * limits may vary from region to region, but will remain constant for the life of
- * a region.
+ * \name Data Layout Specifiers
+ * \{
*/
-typedef struct {
- udi_size_t max_legal_alloc;
- udi_size_t max_safe_alloc;
- udi_size_t max_trace_log_formatted_len;
- udi_size_t max_instance_attr_len;
- udi_ubit32_t min_curtime_res;
- udi_ubit32_t min_timer_res;
-} udi_limits_t;
-
+typedef const udi_ubit8_t udi_layout_t;
+/* Specific-Length Layout Type Codes */
+#define UDI_DL_UBIT8_T 1
+#define UDI_DL_SBIT8_T 2
+#define UDI_DL_UBIT16_T 3
+#define UDI_DL_SBIT16_T 4
+#define UDI_DL_UBIT32_T 5
+#define UDI_DL_SBIT32_T 6
+#define UDI_DL_BOOLEAN_T 7
+#define UDI_DL_STATUS_T 8
+/* Abstract Element Layout Type Codes */
+#define UDI_DL_INDEX_T 20
+/* Opaque Handle Element Layout Type Codes */
+#define UDI_DL_CHANNEL_T 30
+#define UDI_DL_ORIGIN_T 32
+/* Indirect Element Layout Type Codes */
+#define UDI_DL_BUF 40
+#define UDI_DL_CB 41
+#define UDI_DL_INLINE_UNTYPED 42
+#define UDI_DL_INLINE_DRIVER_TYPED 43
+#define UDI_DL_MOVABLE_UNTYPED 44
+/* Nested Element Layout Type Codes */
+#define UDI_DL_INLINE_TYPED 50
+#define UDI_DL_MOVABLE_TYPED 51
+#define UDI_DL_ARRAY 52
+#define UDI_DL_END 0
/**
-The \a udi_init_context_t structure is stored at the front of the region
-data area of each newly created region, providing initial data that a driver will
-need to begin executing in the region. A pointer to this structure (and therefore
-the region data area as a whole) is made available to the driver as the initial
-channel context for its first channel.
+ * \}
*/
-typedef struct {
- udi_index_t region_idx;
- udi_limits_t limits;
-} udi_init_context_t;
-
-typedef struct {
- void *rdata;
-} udi_chan_context_t;
-
-// === FUNCTIONS ===
-extern void udi_final_cleanup_ack(udi_mgmt_cb_t *cb);
-
-// --- Channel Events ---
-extern void udi_channel_event_complete(udi_channel_event_cb_t *cb, udi_status_t status);
-
-
+// === INCLUDE SUB-SECTIONS ===
+#include "udi_meta_mgmt.h" // Management Metalanguage
+#include "udi_init.h" // Init
#endif
+++ /dev/null
-/*
- * Acess2 UDI Support
- * - Architecture Dependent Definitions
- */
-#ifndef _UDI_ARCH_H_
-#define _UDI_ARCH_H_
-
-//#if ARCH == x86
-typedef char udi_sbit8_t; /* signed 8-bit: -2^7..2^7-1 */
-typedef short udi_sbit16_t; /* signed 16-bit: -2^15..2^15-1 */
-typedef long udi_sbit32_t; /* signed 32-bit: -2^31..2^31-1 */
-typedef unsigned char udi_ubit8_t; /* unsigned 8-bit: 0..2^8-1 */
-typedef unsigned short udi_ubit16_t; /* unsigned 16-bit: 0..2^16-1 */
-typedef unsigned long udi_ubit32_t; /* unsigned 32-bit: 0..2^32-1 */
-typedef udi_ubit8_t udi_boolean_t; /* 0=False; 1..255=True */
-
-
-typedef unsigned int udi_size_t; /* buffer size (equiv to size_t) */
-typedef unsigned int udi_index_t; /* zero-based index type */
-
-typedef void* udi_channel_t; /* UDI_NULL_CHANNEL */
-typedef void* udi_buf_path_t; /* UDI_NULL_BUF_PATH */
-typedef void* udi_origin_t; /* UDI_NULL_ORIGIN */
-
-typedef void* udi_timestamp_t;
-//#endif
-
-#endif
--- /dev/null
+/**
+ * \file udi_init.h
+ */
+#ifndef _UDI_INIT_H_
+#define _UDI_INIT_H_
+
+typedef struct udi_init_s udi_init_t;
+typedef struct udi_primary_init_s udi_primary_init_t;
+typedef struct udi_secondary_init_s udi_secondary_init_t;
+typedef struct udi_ops_init_s udi_ops_init_t;
+typedef struct udi_cb_init_s udi_cb_init_t;
+typedef struct udi_cb_select_s udi_cb_select_t;
+typedef struct udi_gcb_init_s udi_gcb_init_t;
+
+typedef struct udi_init_context_s udi_init_context_t;
+typedef struct udi_limits_s udi_limits_t;
+typedef struct udi_chan_context_s udi_chan_context_t;
+typedef struct udi_child_chan_context_s udi_child_chan_context_t;
+
+/**
+ * \brief UDI Initialisation Structure
+ *
+ * Defines how to initialise and use a UDI driver
+ */
+struct udi_init_s
+{
+ /**
+ * \brief Defines the primary region
+ * \note For secondary modules this must be NULL
+ */
+ udi_primary_init_t *primary_init_info;
+
+ /**
+ * \brief Defines all secondary regions
+ * Pointer to a list (so, essentially an array) of ::udi_secondary_init_t
+ * It is terminated by an entry with ::udi_secondary_init_t.region_idx
+ * set to zero.
+ * \note If NULL, it is to be treated as an empty list
+ */
+ udi_secondary_init_t *secondary_init_list;
+
+ /**
+ * \brief Channel operations
+ * Pointer to a ::udi_ops_init_t.ops_idx == 0 terminated list that
+ * defines the channel opterations usage for each ops vector implemented
+ * in this module.
+ * \note Must contain at least one entry for each metalanguage used
+ */
+ udi_ops_init_t *ops_init_list;
+
+ /**
+ * \brief Control Blocks
+ */
+ udi_cb_init_t *cb_init_list;
+
+ /**
+ * \brief Generic Control Blocks
+ */
+ udi_gcb_init_t *gcb_init_list;
+
+ /**
+ * \brief Overrides for control blocks
+ * Allows a control block to override the ammount of scratch space it
+ * gets for a specific ops vector.
+ */
+ udi_cb_select_t *cb_select_list;
+};
+
+
+/**
+ * \name Flags for ::udi_primary_init_t.mgmt_op_flags
+ * \{
+ */
+
+/**
+ * \brief Tells the environment that this operation may take some time
+ * Used as a hint in scheduling tasks
+ */
+#define UDI_OP_LONG_EXEC 0x01
+
+/**
+ * \}
+ */
+
+/**
+ * \brief Describes the Primary Region
+ * Tells the environment how to set up the driver's primary region.
+ */
+struct udi_primary_init_s
+{
+ /**
+ * \brief Management Ops Vector
+ * Pointer to a list of functions for the Management Metalanguage
+ */
+ udi_mgmt_ops_t *mgmt_ops;
+
+ /**
+ * \brief Flags for \a mgmt_ops
+ * Each entry in \a mgmt_ops is acommanied by an entry in this array.
+ * Each entry contains the flags that apply to the specified ops vector.
+ * \see UDI_OP_LONG_EXEC
+ */
+ const udi_ubit8_t *mgmt_op_flags;
+
+ /**
+ * \brief Scratch space size
+ * Specifies the number of bytes to allocate for each control block
+ * passed by the environment.
+ * \note must not exceed ::UDI_MAX_SCRATCH
+ */
+ udi_size_t mgmt_scratch_requirement;
+
+ /**
+ * \todo What is this?
+ */
+ udi_ubit8_t enumeration_attr_list_length;
+
+ /**
+ * \brief Size in bytes to allocate to each instance of the primary
+ * region
+ * Essentially the size of the driver's instance state
+ * \note Must be at least sizeof(udi_init_context_t) and not more
+ * than UDI_MIN_ALLOC_LIMIT
+ */
+ udi_size_t rdata_size;
+
+ /**
+ * \brief Size in bytes to allocate for each call to ::udi_enumerate_req
+ * \note Must not exceed UDI_MIN_ALLOC_LIMIT
+ */
+ udi_size_t child_data_size;
+
+ /**
+ * \brief Number of path handles for each parent bound to this driver
+ * \todo What the hell are path handles?
+ */
+ udi_ubit8_t per_parent_paths;
+};
+
+/**
+ * \brief Tells the environment how to create a secondary region
+ */
+struct udi_secondary_init_s
+{
+ /**
+ * \brief Region Index
+ * Non-zero driver-dependent index value that identifies the region
+ * \note This corresponds to a "region" declaration in the udiprops.txt
+ * file.
+ */
+ udi_index_t region_idx;
+ /**
+ * \brief Number of bytes to allocate
+ *
+ * \note Again, must be between sizeof(udi_init_context_t) and
+ * UDI_MIN_ALLOC_LIMIT
+ */
+ udi_size_t rdata_size;
+};
+
+/**
+ * \brief Defines channel endpoints (ways of communicating with the driver)
+ *
+ */
+struct udi_ops_init_s
+{
+ /**
+ * \brief ops index number
+ * Used to uniquely this entry
+ * \note If this is zero, it marks the end of the list
+ */
+ udi_index_t ops_idx;
+ /**
+ * \brief Metalanguage Index
+ * Defines what metalanguage is used
+ */
+ udi_index_t meta_idx;
+ /**
+ * \brief Metalanguage Operation
+ * Defines what metalanguage operation is used
+ */
+ udi_index_t meta_ops_num;
+ /**
+ * \brief Size of the context area
+ * \note If non-zero, must be at least
+ */
+ udi_size_t chan_context_size;
+ /**
+ * \brief Pointer to the operations
+ * Pointer to a <<meta>>_<<role>>_ops_t structure
+ */
+ udi_ops_vector_t *ops_vector;
+ /**
+ * \brief Flags for each entry in \a ops_vector
+ */
+ const udi_ubit8_t *op_flags;
+};
+
+/**
+ * \brief Defines control blocks
+ * Much the same as ::udi_ops_init_t
+ */
+struct udi_cb_init_s
+{
+ udi_index_t cb_idx;
+ udi_index_t meta_idx;
+ udi_index_t meta_cb_num;
+ udi_size_t scratch_requirement;
+ /**
+ * \brief Size of inline memory
+ */
+ udi_size_t inline_size;
+ /**
+ * \brief Layout of inline memory
+ */
+ udi_layout_t *inline_layout;
+};
+
+/**
+ * \brief Overrides the scratch size for an operation
+ */
+struct udi_cb_select_s
+{
+ udi_index_t ops_idx;
+ udi_index_t cb_idx;
+};
+
+/**
+ * \brief General Control Blocks
+ * These control blocks can only be used as general data storage, not
+ * for any channel operations.
+ */
+struct udi_gcb_init_s
+{
+ udi_index_t cb_idx;
+ udi_size_t scratch_requirement;
+};
+
+
+// ===
+// ===
+/**
+ * \brief
+ */
+struct udi_init_context_s
+{
+ udi_index_t region_idx;
+ udi_limits_t limits;
+};
+
+/**
+ * \brief Environement Imposed Limits
+ */
+struct udi_limits_s
+{
+ /**
+ * \brief Maximum legal ammount of memory that can be allocated
+ */
+ udi_size_t max_legal_alloc;
+
+ /**
+ * \brief Maximum ammount of guaranteed memory
+ */
+ udi_size_t max_safe_alloc;
+ /**
+ * \brief Maximum size of the final string from ::udi_trace_write
+ * or ::udi_log_write
+ */
+ udi_size_t max_trace_log_formatted_len;
+ /**
+ * \brief Maximum legal size of an instanct attribute value
+ */
+ udi_size_t max_instance_attr_len;
+ /**
+ * \brief Minumum time difference (in nanoseconds between unique values
+ * returned by ::udi_time_current
+ */
+ udi_ubit32_t min_curtime_res;
+ /**
+ * \brief Minimum resolution of timers
+ * \see ::udi_timer_start_repeating, ::udi_timer_start
+ */
+ udi_ubit32_t min_timer_res;
+};
+
+/**
+ * \brief Channel context data
+ */
+struct udi_chan_context_s
+{
+ /**
+ * \brief Pointer to the driver instance's initial region data
+ */
+ void *rdata;
+};
+
+/**
+ * \brief Child Channel context
+ */
+struct udi_child_chan_context_s
+{
+ /**
+ * \brief Pointer to the driver instance's initial region data
+ */
+ void *rdata;
+ /**
+ * \brief Some sort of unique ID number
+ */
+ udi_ubit32_t child_ID;
+};
+
+#endif
--- /dev/null
+/**
+ * \file udi_meta_mgmt.h
+ */
+#ifndef _UDI_META_MGMT_H_
+#define _UDI_META_MGMT_H_
+
+typedef struct udi_mgmt_ops_s udi_mgmt_ops_t;
+typedef struct udi_mgmt_cb_s udi_mgmt_cb_t;
+typedef struct udi_usage_cb_s udi_usage_cb_t;
+typedef struct udi_filter_element_s udi_filter_element_t;
+typedef struct udi_enumerate_cb_s udi_enumerate_cb_t;
+
+/**
+ * \name Specify Usage
+ * \{
+ */
+typedef void udi_usage_ind_op_t(udi_usage_cb_t *cb, udi_ubit8_t resource_level);
+/* Values for resource_level */
+#define UDI_RESOURCES_CRITICAL 1
+#define UDI_RESOURCES_LOW 2
+#define UDI_RESOURCES_NORMAL 3
+#define UDI_RESOURCES_PLENTIFUL 4
+/* Proxy */
+extern udi_usage_ind_op_t udi_static_usage;
+/**
+ * \}
+ */
+
+typedef void udi_usage_res_op_t(udi_usage_cb_t *cb);
+
+/**
+ * \name Enumerate this driver
+ * \{
+ */
+typedef void udi_enumerate_req_op_t(udi_enumerate_cb_t *cb, udi_ubit8_t enumeration_level);
+/* Values for enumeration_level */
+#define UDI_ENUMERATE_START 1
+#define UDI_ENUMERATE_START_RESCAN 2
+#define UDI_ENUMERATE_NEXT 3
+#define UDI_ENUMERATE_NEW 4
+#define UDI_ENUMERATE_DIRECTED 5
+#define UDI_ENUMERATE_RELEASE 6
+/* Proxy */
+extern udi_enumerate_req_op_t udi_enumerate_no_children;
+/**
+ * \}
+ */
+
+/**
+ * \name Enumeration Acknowlagement
+ * \{
+ */
+typedef void udi_enumerate_ack_op_t(udi_enumerate_cb_t *cb, udi_ubit8_t enumeration_result, udi_index_t ops_idx);
+/* Values for enumeration_result */
+#define UDI_ENUMERATE_OK 0
+#define UDI_ENUMERATE_LEAF 1
+#define UDI_ENUMERATE_DONE 2
+#define UDI_ENUMERATE_RESCAN 3
+#define UDI_ENUMERATE_REMOVED 4
+#define UDI_ENUMERATE_REMOVED_SELF 5
+#define UDI_ENUMERATE_RELEASED 6
+#define UDI_ENUMERATE_FAILED 255
+/**
+ * \}
+ */
+
+/**
+ * \name
+ * \{
+ */
+typedef void udi_devmgmt_req_op_t(udi_mgmt_cb_t *cb, udi_ubit8_t mgmt_op, udi_ubit8_t parent_ID);
+/* Values for mgmt_op */
+#define UDI_DMGMT_PREPARE_TO_SUSPEND 1
+#define UDI_DMGMT_SUSPEND 2
+#define UDI_DMGMT_SHUTDOWN 3
+#define UDI_DMGMT_PARENT_SUSPENDED 4
+#define UDI_DMGMT_RESUME 5
+#define UDI_DMGMT_UNBIND 6
+
+typedef void udi_devmgmt_ack_op_t(udi_mgmt_cb_t *cb, udi_ubit8_t flags, udi_status_t status);
+/* Values for flags */
+#define UDI_DMGMT_NONTRANSPARENT (1U<<0)
+/* Meta-Specific Status Codes */
+#define UDI_DMGMT_STAT_ROUTING_CHANGE (UDI_STAT_META_SPECIFIC|1)
+/**
+ * \}
+ */
+typedef void udi_final_cleanup_req_op_t(udi_mgmt_cb_t *cb);
+typedef void udi_final_cleanup_ack_op_t(udi_mgmt_cb_t *cb);
+
+
+
+
+
+struct udi_mgmt_ops_s
+{
+ udi_usage_ind_op_t *usage_ind_op;
+ udi_enumerate_req_op_t *enumerate_req_op;
+ udi_devmgmt_req_op_t *devmgmt_req_op;
+ udi_final_cleanup_req_op_t *final_cleanup_req_op;
+};
+
+struct udi_mgmt_cb_s
+{
+ udi_cb_t gcb;
+};
+
+struct udi_usage_cb_s
+{
+ udi_cb_t gcb;
+ udi_trevent_t trace_mask;
+ udi_index_t meta_idx;
+};
+
+
+struct udi_filter_element_s
+{
+ char attr_name[UDI_MAX_ATTR_NAMELEN];
+ udi_ubit8_t attr_min[UDI_MAX_ATTR_SIZE];
+ udi_ubit8_t attr_min_len;
+ udi_ubit8_t attr_max[UDI_MAX_ATTR_SIZE];
+ udi_ubit8_t attr_max_len;
+ udi_instance_attr_type_t attr_type;
+ udi_ubit32_t attr_stride;
+};
+struct udi_enumerate_cb_s
+{
+ udi_cb_t gcb;
+ udi_ubit32_t child_ID;
+ void *child_data;
+ udi_instance_attr_list_t *attr_list;
+ udi_ubit8_t attr_valid_length;
+ const udi_filter_element_t *filter_list;
+ udi_ubit8_t filter_list_length;
+ udi_ubit8_t parent_ID;
+};
+/* Special parent_ID filter values */
+#define UDI_ANY_PARENT_ID 0
+
+#endif
+++ /dev/null
-/**
- */
-#ifndef _UDI_PHYSIO_H_
-#include <udi.h>
-
-/**
- * \name Bus Operations
- * \{
- */
-typedef struct {
- udi_cb_t gcb;
-} udi_bus_bind_cb_t;
-
-/**
- * \brief Bus Bind Control Block Group Number
- */
-#define UDI_BUS_BIND_CB_NUM 1
-
-extern void udi_bus_bind_req(udi_bus_bind_cb_t *cb);
-
-extern void udi_bus_unbind_req(udi_bus_bind_cb_t *cb);
-/**
- * \}
- */
-
-#endif
* \file logging.c
* \author John Hodge (thePowersGang)
*/
-#include <common.h>
+#include <acess.h>
#include <udi.h>
// === PROTOTYPES ===
*/
#define DEBUG 0
#define VERSION ((0<<8)|1)
-#include <common.h>
+#include <acess.h>
#include <modules.h>
#include <udi.h>
int UDI_LoadDriver(void *Base)
{
udi_init_t *info;
- char *udiprops;
+ char *udiprops = NULL;
+ int udiprops_size;
int i, j;
if( Binary_FindSymbol(Base, "udi_init_info", (Uint*)&info) == 0) {
return 0;
}
+ if( Binary_FindSymbol(Base, "_udiprops", (Uint*)&udiprops) == 0 ) {
+ Warning("[UDI ] _udiprops is not defined, this is usually bad");
+ }
+ else {
+ Binary_FindSymbol(Base, "_udiprops_size", (Uint*)&udiprops_size);
+ }
+
Log("primary_init_info = %p", info->primary_init_info);
Log("secondary_init_list = %p", info->secondary_init_list);
Log("ops_init_list = %p", info->ops_init_list);
{
int tmp, fd;
char path[sizeof(IPSTACK_ROOT)+5+1]; // ip000
- uint8_t addr[4] = {10,0,0,55};
- uint8_t gw[4] = {10,0,0,1};
+ uint8_t addr[4] = {10,0,2,55};
+ uint8_t gw[4] = {10,0,2,1};
int subnet = 8;
tmp = AddInterface(Device);