Date: 2014-11-22 23:23 (UTC)
pm215: (Default)
From: [personal profile] pm215
In 4th Ed the relevant code is in nsys/ken/clock.c, where the clock interrupt (60Hz, US mains frequency) increments the time[0]:time[1] count every 60 interrupts, more or less:
	if(++lbolt >= 60) {
		if((ps&0340) != 0)
			return;
		lbolt =- 60;
		if(++time[1] == 0)
			++time[0];
The time() syscall then just copies the current values of time[0]:time[1] to the user's registers.

The only earlier extant kernel code than this is 1st Ed, which is in assembly (in file u4.s), and just increments the time variable pair unconditionally on every clock interrupt:

clock: / interrupt from 60 cycle clock
       mov     r0,-(sp) / save r0
       tst     *$lks / restart clock?
       mov     $s.time+2,r0 / increment the time of day
       inc     (r0)
       bne     1f
       inc     -(r0)
1:
I wouldn't be surprised if changing the frequency of time() was one of the things that happened in the asm-to-C conversion (given that 3rd Ed was also asm).

This account has disabled anonymous posting.
(will be screened if not on Access List)
(will be screened if not on Access List)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

July 2025

S M T W T F S
  1 2345
6789101112
13141516171819
20212223242526
2728293031  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated 2025-07-05 07:47
Powered by Dreamwidth Studios