Compare commits

..

No commits in common. "9b339273bb80e7d16776b645be9651c36343f181" and "67a2839d0a5b955ab15a87fbcf1be703ac44ca9f" have entirely different histories.

9 changed files with 32 additions and 17 deletions

View file

@ -44,7 +44,7 @@ AlignTrailingComments:
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Empty
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: true

View file

@ -28,7 +28,8 @@ main()
__sync_synchronize();
started = 1;
} else {
while(started == 0) {}
while(started == 0)
;
__sync_synchronize();
printf("hart %d starting\n", cpuid());
kvminithart(); // turn on paging

View file

@ -123,7 +123,8 @@ panic(char *s)
printf(s);
printf("\n");
panicked = 1; // freeze uart output from other CPUs
for(;;) {}
for(;;)
;
}
void

View file

@ -60,8 +60,9 @@ acquire(struct spinlock *lk)
if(holding(lk)) // If the lock is already held, panic.
panic("acquire");
// Spin until aquired. See file header for details
while(__sync_lock_test_and_set(&lk->locked, 1) != 0) {}
// See file header for details
while(__sync_lock_test_and_set(&lk->locked, 1) != 0)
;
__sync_synchronize(); // No loads/stores after this point
// Record info about lock acquisition for holding() and debugging.

View file

@ -73,7 +73,8 @@ strncpy(char *s, const char *t, int n)
char *os;
os = s;
while(n-- > 0 && (*s++ = *t++) != 0) {}
while(n-- > 0 && (*s++ = *t++) != 0)
;
while(n-- > 0)
*s++ = 0;
return os;
@ -88,7 +89,8 @@ safestrcpy(char *s, const char *t, int n)
os = s;
if(n <= 0)
return os;
while(--n > 0 && (*s++ = *t++) != 0) {}
while(--n > 0 && (*s++ = *t++) != 0)
;
*s = 0;
return os;
}
@ -98,6 +100,7 @@ strlen(const char *s)
{
int n;
for(n = 0; s[n]; n++) {}
for(n = 0; s[n]; n++)
;
return n;
}

View file

@ -89,7 +89,8 @@ uartputc(int c)
acquire(&uart_tx_lock);
if(panicked) {
for(;;) {}
for(;;)
;
}
while(uart_tx_w == uart_tx_r + UART_TX_BUF_SIZE) {
// buffer is full.
@ -112,11 +113,13 @@ uartputc_sync(int c)
push_off();
if(panicked) {
for(;;) {}
for(;;)
;
}
// wait for Transmit Holding Empty to be set in LSR.
while((ReadReg(LSR) & LSR_TX_IDLE) == 0) {}
while((ReadReg(LSR) & LSR_TX_IDLE) == 0)
;
WriteReg(THR, c);
pop_off();

View file

@ -10,7 +10,8 @@ fmtname(char *path)
char *p;
// Find first character after last slash.
for(p = path + strlen(path); p >= path && *p != '/'; p--) {}
for(p = path + strlen(path); p >= path && *p != '/'; p--)
;
p++;
// Return blank-padded name.

View file

@ -20,7 +20,8 @@ strcpy(char *s, const char *t)
char *os;
os = s;
while((*s++ = *t++) != 0) {}
while((*s++ = *t++) != 0)
;
return os;
}
@ -37,7 +38,8 @@ strlen(const char *s)
{
int n;
for(n = 0; s[n]; n++) {}
for(n = 0; s[n]; n++)
;
return n;
}

View file

@ -823,7 +823,8 @@ preempt(char *s)
exit(1);
}
if(pid1 == 0)
for(;;) {}
for(;;)
;
pid2 = fork();
if(pid2 < 0) {
@ -831,7 +832,8 @@ preempt(char *s)
exit(1);
}
if(pid2 == 0)
for(;;) {}
for(;;)
;
pipe(pfds);
pid3 = fork();
@ -844,7 +846,8 @@ preempt(char *s)
if(write(pfds[1], "x", 1) != 1)
printf("%s: preempt write error", s);
close(pfds[1]);
for(;;) {}
for(;;)
;
}
close(pfds[1]);