[Stormdos-develop] docs of 25 Oct. 2004
Status: Planning
Brought to you by:
exhu
From: Juras <yb...@tu...> - 2004-10-25 16:00:59
|
Hello stormdos-develop, == console.txt == Input/output, file IO uses UTF-8. console works also with UTF-8 but displays symbols according to the mode limitations, i.e. in 80x25 VGA text mode only 256 symbols could be displayed, so it uses DOS code page. The "undisplayable" symbols are shown as question marks or as magic sequences like #u0123 however the system doesn't actually uses question marks... Console buffer is probably encoded by 32-bit DWORDs 80*25*4=8kB - text data + 80*25=2kB - text attributes = 10 kB == mem.txt == Memory management in SD-32 ~~~~~~~~~~~~~~~~~~~~~~~~~~ Designed with the usage of page translation mode of IA-32. 1) one list of free physical memory blocks - the lowest layer 2) one list [0, 80000000h) (2GiB)- shared addresses, "global memory" which points to the same physical addresses in address spaces of every context. This memory is allocated by the kernel for the kernel and drivers use (maps video memory, keep system structures and everything which must be accessed by the kernel being run withing the address space of a context...) 3) per application (application has threads which share the same address space) list of free virtual addresses in the range of [80000000h, C0000000) (1GiB)- memory used by process (application), i.e. where the executable image is loaded and relocated. 4) one list of free virtual addresses in the range of [C0000000, FFFFFFFF] (1GiB)- addresses for DLLs. We need this region separated because when any application loads a DLL we must provide the ability for the rest of applications running or which will be run later to use the same addresses for the same DLL attached to a new process. Memory maps for 3) and 4) map their SHARED and READ-ONLY sections to the same physical addresses (like in MS Windows). FUNCTIONS ~~~~~~~~~ AllocPhysical - allocates only continuous blocks ReallocPhysical - reallocates only continuous blocks FreePhysical AllocVirtual - allocates only addresses (continuous) ReallocVirtual FreeVirtual MapAddresses - uses allocated page dir to map addresses to physical DisableAddresses - uses allocated page dir to mark pages as unpresent. AllocVirtualPhys - allocates physical memory and virtual addresses and modifies page directory. underlying physical memory may be fragmented. ReallocVirtualPhys - underlying physical memory may be fragmented FreeVirtualPhys == sysint.txt === Kernel Syscalls ~~~~~~~~~~~~~~~ The system interrupt doesn't make a context switch - it executes using PDBR of the caller. Hence it runs in the address space of the caller. The kernel function is called with interrupts disabled however another system call can be running in the context of another thread. That is why the kernel must be - thread-safe, provide locking mechanism - interruptable - share the same addresses for its memory inspite of the current thread address space (see mem.txt point#2 ) -- Best regards, Juras mailto:yb...@tu... |