Kernel Products

smx86™
Support for the x86 Processor Family
smx86 supports the Intel x86 processor family, including compatibles, such as the NEC V series, AMD 18x and Elan series, National Geode, VAutomation Turbo 186, ZF Micro MachZ, and STMicroelectronics ST100. It has many features to facilitate x86 development and offers support for real-mode, 16-bit protected mode, and 32-bit protected mode. Features common to all smx versions are detailed in the smx datasheet and smx Special Features brochure.
80x86 Specialization
Although it now supports many other processor families, smx was originally designed solely for x86 real-mode. It was then extended to 16-bit segmented protected mode (16spm) and then to 32-bit flat protected mode (32fpm). Recently smx86 was again extended to support 24-bit addressing, in real-mode, for the VAutomation Turbo186 core. Support for 32-bit segmented protected mode (32spm) is currently on hold due to questionable tool availability.
Along the way, several x86 support products were added to smx86. These are summarized later in this brochure. smx86 has an x86 heritage and a depth of x86 support, which are unequalled in the industry.
smx Saves Memory
smx is one of the few kernels that supports all memory models in real-mode and 16spm. "This gave us a 20KB reduction in size over Nucleus" according to Carl McCauley of Checkmate Electronics. smx is the kernel for you if you are trying to shoehorn your application into limited memory. smx also has a unique stack-sharing capability that is helpful for limited-RAM applications.
smx86 Versions
Real Mode (rm)
The 16-bit real-mode (rm) version of smx86 is intended for users who are using 8086, 186, or equivalent, processors or who do not have large applications and do not need the protection mechanisms of 386-class processors. smx86 is also used for running with DOS. (See section on DOS Support, below.)
smx86 for real mode supports the four main x86 memory models: Small, Medium, Compact, and Large. This offers optimum speed and memory usage for small applications. An smx library is provided for each model. Regardless of the memory model, all smx variables and control blocks reside in near data memory and all smx code resides in near code memory. This gives optimum performance for smx operations.
An smx86 rm application can be built as an OMF, HEX, or BIN file using a linker/locator or built as an EXE to run under DOS or to be boot-loaded by the smx Real Mode Bootloader. (See discussion, below.) Linker/locator support includes startup code and a build script for the Protosystem. These can be used for the application, with very little change. Locator startup code copies initialized variables from ROM to RAM. It also offers the option to start from the reset vector or to start as a BIOS extension. Paradigm C++ is supported for building located code; Microsoft and Borland 16-bit tools are supported for building an EXE.
A recent extension to real mode has been offered by VAutomation. It is called the Turbo186 processor. By increasing the x86 paragraph size from 16 bytes to 256 bytes, VAutomation is able to offer 24-bit addressing. This allows up to 16MB of memory access. smx86 and Paradigm C++ support this new mode of addressing. The Turbo186 also offers a JTAG debug interface, which is supported by VSA-186 from First Silicon Solutions.
As another example of the special support smx86 offers for the x86, it supports use of the processor 3 compiler switch, which allows the compiler to use 32-bit registers for 386-class processors. This can result in smaller and faster code if many 32-bit integer operations are done. See our white paper "Using 32-bit Registers in 16-bit Modes" in the Articles section of our web site. This option requires smx source code.
16-bit Segmented Protected-Mode (16spm)
The 16spm version of smx86 is intended for users who have exceeded the 1 megabyte limit of real-mode, or the 640KB limit of DOS, or who want the segment protection offered by 386-class processors, but who wish to continue using familiar tools. This version provides an easy step into protected mode from real mode; little change is required to the application code, since it is still 16-bit C/C++ code.
One smx library is provided for each of the four memory models (which are the same as for real mode.) As in real mode, the processor 3 switch can be used for better performance and reduced code size on a 386-class processor. (See the Real Mode section above)
An smx86 16spm application can be built as an OMF, HEX, or BIN file using a linker/locator or built as an EXE (NE format) to run under pmEasy16. Linker/locator support includes startup code and a build script for the Protosystem. These can be used for the application, with very little change. Startup code copies descriptor tables and initialized variables from ROM to RAM. It also offers the option to start from the reset vector or to start as a BIOS extension. Microsoft and Borland 16-bit tools and the Embedded Power Link & Locate 386 and Visual Probe are supported for building located code; Microsoft and Borland 16-bit tools and the Soft-Scope debugger are supported for building an EXE.
32-Bit Flat Protected Mode (32fpm)
The 32fpm version of smx86 provides 32-bit protected mode support, without segmentation. Many users prefer flat-mode addressing, because it is simpler. This is the only 32-bit mode supported by the Microsoft and Borland 32-bit x86 compilers. In this mode, the segment registers are loaded only once, during startup. Assembly language portions of smx86 have been rewritten to take advantage of 32-bit instructions and to remove segmentation.
The services provided by smx86 for 32fpm are the same as for rm and for 16spm, except for the omission of the far heap, far stacks, and other far objects. A single flat-model smx library is provided. When smxSim is also purchased (see below), a special version of the smx library is provided that is suitable for execution of the Protosystem/application in a Win32 environment.
An smx86 32fpm application can be built as an OMF, HEX, or BIN file using a linker/locator or built as an EXE (PE format) to run under pmEasy32. Linker/locator support includes startup code and a build script for the Protosystem. These can be used for the application, with very little change. Startup code copies descriptor tables and initialized variables from ROM to RAM. It also offers the option to start from the reset vector or to start as a BIOS extension. Paradigm C++ is supported for building located code. Microsoft and Borland 32-bit tools and the Embedded Power Link & Locate 386 and Visual Probe are also supported for building located code. Microsoft and Borland 32-bit tools and the Soft-Scope debugger are supported for building an EXE. smxSim is for use with EXE builds to allow them to run in a Win32 environment.
For more information on picking the best version of smx86, for your project, see our whitepaper Choosing an smx86 Version.
Additional x86 Features
Stack Flexibility
In addition to the stack flexibility provided by all versions of smx, segmented smx86 allows stacks to be allocated from either the near heap or the far heap on a task-by-task basis. Thus, a task requiring a near stack, so that ss == ds, can get its stack from the near heap. However, since the near heap is very small, this is possible only for small stacks. For other tasks, stacks of up to almost 64KB can be allocated from the far heap. For compact and large memory modules, the stack pool is in its own segment, allowing up to 64KB of stack pool space and conserving precious space in near memory. In this case, ss != ds, which is ok for smx (but may not be for all application code).
Coprocessor State Saving
For a task using the x87 coprocessor, smx86 will automatically save the coprocessor registers when the task is suspended and restore coprocessor registers when the task is resumed. The coprocessor's state is saved only for tasks that use it - and only in sections of the task that use it, if desired. This way, tasks not using the coprocessor are not burdened with this extra overhead (which is significant).
DOS Support
Although smx86 was designed as a ROM'able kernel, the real-mode version will run with DOS. The smx DOS Protosystem provides code to trap DOS calls so that only one task, at a time, may perform a DOS call. If a higher priority task attempts a simultaneous DOS call, it is automatically suspended on the in_dos semaphore until the current task completes its DOS call. The DOS Protosystem also inhibits smx stack checking when in a DOS call because DOS switches stacks. It exits cleanly back to DOS, when the application is terminated.
Hand-tuned Scheduler
The smx86 scheduler is written in x86 assembly language and is hand-tuned for optimal performance, using many advanced x86 techniques.
PC Operation
smx86 includes a Board Support Package (BSP) for operation on standard PC's. This includes most PC-clone boards (e.g. PC104). The smx86 BSP includes a keyboard handler, direct screen write functions, 16550 UART driver, and tick handler. Normally, the BIOS provides board initialization.
x86 Support Products
smx86 is supported by a wealth of other Micro Digital products. What follows is a brief description of each. For more information, see corresponding brochures and manuals.
smxProbe
smxProbe permits task-level debugging. It allows the user to display control blocks, queues, and trace buffers, symbolically for all symbols entered into the smx handle table. It keeps trace information for tasks, smx calls, and smx errors. Sophisticated stop-trace points may be set. smxProbe uses the target's keyboard and display. If the target does not have these, smxProbe may be operated from a remote terminal via a cable connected to a serial port on the target. smxProbe will also operate with debuggers such as Turbo Debugger and CodeView to inspect smx objects while stopped at a breakpoint. smxProbe is now included with smx86 at no additional charge.
smxAware for Paradigm C++, VisualProbe, and Soft-Scope
smxAware is a DLL that is loaded by the host debugger thereby, adding smx awareness. This permits viewing smx objects and queues symbolically by selecting the smx pull-down menu. smx objects may also be placed in a watch window, and task-aware breakpoints may be set.
smxWindows
smxWindows is a text-based windowing package. It is a step beyond the simple direct screen write functions provided with smx. It contains 25 calls for functions such as creating a window, displaying a pop-up window, accepting a menu selection, moving a window to the top of the of the stack or to the bottom, displaying a string of characters or a character, entering keyboard input into a window, setting the cursor position, clearing or scrolling a window, and other operations. The package requires only 10.5KB, max. It works with standard PC monitors and keyboards. Full source code is provided to permit modifying smxWindows for use with other hardware. smxWindows is now included with smx86 at no additional charge.
Bootloader and unDOS
The Real Mode EXE Bootloader is capable of loading and executing a real-mode, EXE file from boot, without DOS present. It relies only on BIOS services. This saves the cost of DOS royalties and frees additional memory for the application. Virtually the entire RAM below 1MB is available to the application, since the space occupied by the loader becomes available, once the load has completed.
If the application makes int 21h DOS calls or certain BIOS calls, unDOS may be used to emulate those calls. This may permit a DOS application to considerably extend its memory above the 640K limit of DOS.
pmEasy and unDOS
pmEasy is used for protected mode EXE applications. It will bootload from the BIOS or can be loaded via DOS. It switches the processor from real-mode to protected-mode and loads the protected-mode application from one of several possible storage devices. pmEasy also provides services to perform protected mode operations such as memory allocation, hooking interrupts, creating descriptors, etc. These services are DPMI-compatible. (The DOS Protected Mode Interface is a standard developed by Intel, Microsoft, and others for protected-mode services.)
If loaded by DOS, pmEasy exits cleanly back to DOS when the application is terminated. This is convenient for running DOS utilities after the application performs its function.
If the application makes int 21h DOS calls or certain BIOS calls, unDOS may be used to emulate those calls. Thus, pmEasy with unDOS provides an alternative to using a DOS extender. pmEasy with unDOS is simpler than a DOS extender and it provides much better performance. This is because pmEasy was designed for real-time embedded systems, whereas DOS extenders were intended for desktop systems.
unWin
unWin includes unDOS and provides some Win32 emulation for 32fpm applications.
smxSim
smxSim permits running 32fpm smx applications under Windows 9x and NT. The application can be developed and debugged under Microsoft Visual Studio or the Borland IDE. This ability to run on the host is convenient since it avoids waiting for code to download to the target and avoids concerns about hardware startup code. It also allows getting started before the target hardware is available. When running in the IDE or directly on Win 9x or NT the application linked with smx runs as a Windows app. As such, it is subject to limitations imposed by Windows.
smxSim, which is inexpensive, has been used in many projects to reduce debugger expense. It is adequate for task and GUI code development seats. Thus, only a few seats of expensive debuggers may be necessary for BSP and integration work.
|
Sample Execution Times |
| |
|
|
| |
| function |
conditions |
A |
B |
C |
D |
| -------- |
---------- |
--- |
--- |
--- |
--- |
| bump_task |
No preempt |
267 |
78 |
41 |
9 |
| bump_task |
Preempt |
364 |
103 |
62 |
13 |
| create_rq |
4 levels |
164 |
44 |
23 |
5 |
| create_task |
|
113 |
32 |
20 |
4 |
| create_xchg |
1 level |
185 |
51 |
27 |
6 |
| create_xchg |
2 task and message levels |
251 |
66 |
35 |
7 |
| interrupt latency |
Maximum |
21 |
13 |
7 |
1 |
| interrupt response |
Interrupt->isr->lsr->task |
448 |
120 |
72 |
15 |
| receive |
Message waiting |
131 |
38 |
24 |
5 |
| receive_stop |
Message waiting (task restarts) |
342 |
93 |
52 |
11 |
| send |
No task waiting |
201 |
56 |
28 |
6 |
| send |
Waiting task put into rq |
241 |
65 |
34 |
7 |
| start idle task |
Unbound and not in a queue |
182 |
51 |
30 |
6 |
| stop task |
In rq |
128 |
38 |
17 |
4 |
| task switch |
Due to task suspend and resume |
268 |
69 |
58 |
12 |
| |
|
|
|
|
|
| |
processor A: 10 MHz 80C188 |
|
|
|
|
| |
processor B: 12 MHz 80286 |
|
|
|
|
| |
processor C: 20 MHz 80386 |
|
|
|
|
| |
processor D: 50 MHz 80486 |
|
|
|
|
| |
|
|
|
|
|
| |
Maximum Interrupt Latency |
|
|
|
|
| |
|
|
|
|
|
| |
10 MHz 80C188 |
15 usec |
|
|
|
|
| |
20 MHz 80386 |
5 usec |
|
|
|
|
| |
50 MHz 80486 |
1 usec |
|
|
|
|
| |
|
|
|
|
|
| All times were measured for the small model with maximum optimization. |
|
|
| |
|
|
| |
|
|
| |
RAM Usage |
|
| |
|
|
| |
| |
Sample Sizes* |
| |
16-bit |
32-bit |
| RAM usage is the sum of: |
|
|
| Stack pool (shared stacks) |
7000 |
9100 |
| Near Heap Space: |
|
|
| Control Blocks |
2030 |
3160 |
| lsr queue |
80 |
160 |
| Bound Near Stacks |
|
|
| Far Heap Space: |
|
|
| Bound Far Stacks |
|
|
| Error Buffer (optional) |
500 |
800 |
| Handle Table (smxDLM, smxProbe) |
400 |
400 |
| Call Trace Buffer (smxProbe) |
|
|
| Task Trace Buffer (smxProbe) |
|
|
| Dynamically Allocated Regions |
|
|
| Block and Message Pools |
2000 |
300 |
| smx Global Variables |
300 |
500 |
| |
|
|
Total |
12K |
17K |
|
|
| |
|
|
| |
Control Blocks are generally 8 to 16 bytes in size for 16-bit modes and 12 to 28 bytes for 32-bit modes. One control block is needed for every smx object (i.e. tasks, semaphores, pipes, messages, etc.) and for each lower level of the ready queue, semaphores, and exchanges.
Heap space: Add to these the amount of heap required by the application.
DAR's (dynamically allocated region) are blocks of memory from which pools may be allocated.
smx global variables include the configuration table and handles such as ct (current task) and rq_top (top task in ready queue).
*Sample Sizes: These numbers reflect data usage by a medium-sized application. The stack pool usage reflects 7 medium stacks. It is better to have smaller stack pool stacks and use bound stacks where larger ones are necessary. Control block usage is a total of all control blocks needed by this particular sample application: 15 tasks, 7 stacks, 100 queue levels, 5 timers, 18 messages, 8 pipes, 2 buckets, 6 pools, and 14 blocks. The number of control blocks allocated of each type and the sizes of the heaps, dar, lsr queue, handle table, error buffers are user-tunable to the requirements of the application. |
|
| |
|
|
| |
|
|
| |
Function Sizes v3.6 |
|
| |
|
|
| |
| |
smx function |
p1 S |
p1 L |
p3 |
| |
|
|
|
|
|
bump_msg |
300 |
300 |
323 |
|
bump_task |
646 |
646 |
590 |
|
clear_q |
1468 |
1484 |
1481 |
|
count |
422 |
424 |
466 |
|
count_stop |
564 |
566 |
614 |
|
create_cx |
116 |
120 |
151 |
|
create_dpool |
762 |
792 |
782 |
|
create_eq |
90 |
96 |
107 |
|
create_et |
104 |
106 |
99 |
+ |
create_fbpool |
102 |
102 |
122 |
|
create_hmsgf |
228 |
240 |
— |
|
create_hmsgn |
228 |
240 |
273 |
|
create_hpoolf |
406 |
422 |
— |
|
create_hpooln |
402 |
420 |
464 |
+ |
create_rq |
142 |
146 |
169 |
+ |
create_sema |
274 |
280 |
306 |
|
create_taskf |
312 |
330 |
— |
+ |
create_taskn |
300 |
324 |
361 |
+ |
create_xchga |
460 |
472 |
458 |
|
delete_cx |
148 |
154 |
170 |
|
delete_eq |
124 |
130 |
135 |
|
delete_et |
312 |
314 |
309 |
|
delete_hmsg |
322 |
328 |
201 |
|
delete_hpool |
298 |
312 |
276 |
|
delete_sem |
188 |
196 |
185 |
|
delete_task |
362 |
374 |
372 |
|
delete_xchg |
220 |
228 |
224 |
|
dq_msg |
124 |
124 |
120 |
+ |
error manager |
828 |
1039 |
912 |
|
fcallocx |
202 |
212 |
— |
|
ffreex |
496 |
510 |
— |
|
fheapchkx |
30 |
32 |
— |
+ |
fheapinix |
428 |
434 |
— |
|
fheapsetx |
458 |
470 |
— |
|
fheapwalkx |
826 |
842 |
— |
+ |
fmallocx |
644 |
658 |
— |
|
freallocx |
1128 |
1160 |
— |
|
find_next |
184 |
184 |
219 |
|
find_pool |
120 |
120 |
139 |
|
get_block |
144 |
144 |
179 |
+ |
get_fblocks |
338 |
354 |
347 |
|
get_msg |
128 |
128 |
151 |
+ |
go_smx |
1437 |
1747 |
1909 |
|
handle table |
1055 |
1210 |
983 |
|
hook |
122 |
146 |
110 |
+ |
invoke |
100 |
106 |
114 |
+ |
keep_time |
346 |
362 |
337 |
|
locate |
258 |
258 |
353 |
|
lsrs_on |
26 |
26 |
23 |
|
miscl |
775 |
811 |
763 |
|
ncallocx |
90 |
94 |
43 |
|
nfreex |
142 |
142 |
182 |
|
nheapchkx |
30 |
32 |
27 |
+ |
nheapinix |
210 |
212 |
257 |
|
nheapsetx |
236 |
236 |
258 |
|
nheapwalkx |
326 |
326 |
422 |
+ |
nmallocx |
300 |
302 |
365 |
|
nreallocx |
368 |
382 |
389 |
|
num_in_pipe |
102 |
102 |
123 |
|
pget_char |
736 |
738 |
753 |
|
pget_char_stop |
932 |
934 |
965 |
|
pput_char |
752 |
754 |
756 |
|
pput_char_stop |
950 |
952 |
999 |
|
put_msg |
182 |
186 |
226 |
|
qsize |
384 |
384 |
496 |
|
read_timer |
194 |
194 |
170 |
+ |
receive |
666 |
668 |
673 |
|
receive_stop |
662 |
664 |
652 |
|
rel_all_blocks |
94 |
94 |
102 |
|
rel_all_msgs |
136 |
142 |
140 |
|
rel_block |
70 |
70 |
77 |
+ |
rel_fblock |
102 |
108 |
108 |
|
reset_flags |
66 |
66 |
71 |
+ |
resume |
336 |
336 |
349 |
|
resume_pget |
346 |
346 |
362 |
|
resume_pput |
360 |
360 |
369 |
+ |
resume_to |
428 |
430 |
446 |
+ |
sendx |
542 |
548 |
534 |
|
set_flags |
342 |
342 |
326 |
+ |
signalx |
510 |
510 |
591 |
|
sleepx |
236 |
244 |
236 |
|
sleep_stop |
236 |
244 |
232 |
|
sort_fblocks |
260 |
310 |
288 |
+ |
startx |
574 |
582 |
591 |
|
start_timer |
294 |
304 |
270 |
|
stop |
448 |
450 |
460 |
|
stop_timer |
252 |
254 |
201 |
|
suspend |
434 |
436 |
449 |
+ |
test |
368 |
370 |
404 |
|
test_flags |
460 |
462 |
504 |
|
test_flags_stop |
458 |
460 |
494 |
|
test_stop |
616 |
618 |
654 |
|
unhook |
90 |
90 |
87 |
+ |
unlockx |
86 |
86 |
96 |
+ |
scheduler |
1696 |
1750 |
1757 |
|
|
|
|
|
|
|
|
|
|
+ |
min kernel |
11217 |
11926 |
11206 |
|
max kernel |
36599 |
37937 |
33251 |
|
|
| |
|
|
| |
Notes
- p1 S = real mode, small model; p1 L = real mode, large model; p3 = 32-bit flat protected mode.
- smx v3.6.1 library built with full optimizations for speed (not size). SMX_EVB = 0; SMX_PROFILING = 0.
Test Mode enabled (smx error testing). Built with Paradigm C++.
|
For More Information
|