[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] Ssystem


When playing with Ssystem capabilities, I think I stumbled upon a
bug:  the function supposed to return the compile date of the
kernel incorrectly returns the year as 208, instead of 2000.

This is using an 1.15.5 kernel compiled with LIB 0.55.2 (AFAIK).

I've enclosed my little test program's sources, so anyone can try
for themselves.  Btw, I am no C expert, so I might have mistyped
the offset for the COMPILEDATE's year field; see for yourself
(then again, the function names seem to have changed between
1.15.5 kernel documentation and LIB 0.55 headers e.g. TOSHEADER 
became S_OSHEADER, if I recall correctly).

Needless to say, there is also probably a shorter and more
efficient way of extracting all these fields. Improvements are
quite welcome, even though this is not any utility, but only a
little demo.

Martin-Éric Racine  http://funkyware.atari.org/  Atari TT030 FAQ
Lappeenranta, Finland.  Surfing on a Intel/Microsoft-free GEM OS
/* Ssystem() test

#include <stdio.h>
#include <mintbind.h>
#include <mint/ssystem.h>

#define KERN(x) (int) ((x >> 24) & 255), (int) ((x >> 16) & 255), (int) ((x >> 8) & 255), (int) (x & 255)
#define KERD(x) (int) (x & 255), (int) ((x >> 16) & 255), (int) ((x >> 24) & 255)

#define HILO(x) (int) ((x >> 8) & 255), (int) (x & 255)
#define HI(x) (int) ((x >> 8) & 255)
#define LO(x) (int) (x & 255)


	static long kervers;
    	static int osvers;
	static long my_cpu;		/* CPU installed on system */
	static long cc_dat;
	static long cc_opt;		/* CPU and FPU compiler options */
	static long cc_cpu;
	static long cc_fpu;

	kervers = Ssystem(S_OSVERSION, NULL, NULL);

	osvers = (int)(Ssystem(S_OSHEADER, 0L, NULL)&0x0000ffff);

	my_cpu = Ssystem(S_GETCOOKIE, 0x5f435055L, NULL);

	cc_dat = Ssystem(S_OSBUILDDATE, NULL, NULL);

	cc_opt = Ssystem(S_OSCOMPILE, NULL, NULL);
	cc_cpu = LO(cc_opt);
	cc_fpu = HI(cc_opt);

	printf("MiNT %d.%d.%d%c #%d-%02d-%02d m680%02d (TOS %d.%02d mc680%02d)\n\r", KERN(kervers), KERD(cc_dat), cc_cpu, HILO(osvers), my_cpu);