Compare commits
2 commits
67a2839d0a
...
9b339273bb
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9b339273bb | ||
![]() |
fbfb728b8f |
9 changed files with 17 additions and 32 deletions
|
@ -44,7 +44,7 @@ AlignTrailingComments:
|
|||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowBreakBeforeNoexceptSpecifier: Never
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortBlocksOnASingleLine: Empty
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortCompoundRequirementOnASingleLine: true
|
||||
AllowShortEnumsOnASingleLine: true
|
||||
|
|
|
@ -28,8 +28,7 @@ main()
|
|||
__sync_synchronize();
|
||||
started = 1;
|
||||
} else {
|
||||
while(started == 0)
|
||||
;
|
||||
while(started == 0) {}
|
||||
__sync_synchronize();
|
||||
printf("hart %d starting\n", cpuid());
|
||||
kvminithart(); // turn on paging
|
||||
|
|
|
@ -123,8 +123,7 @@ panic(char *s)
|
|||
printf(s);
|
||||
printf("\n");
|
||||
panicked = 1; // freeze uart output from other CPUs
|
||||
for(;;)
|
||||
;
|
||||
for(;;) {}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -60,9 +60,8 @@ acquire(struct spinlock *lk)
|
|||
if(holding(lk)) // If the lock is already held, panic.
|
||||
panic("acquire");
|
||||
|
||||
// See file header for details
|
||||
while(__sync_lock_test_and_set(&lk->locked, 1) != 0)
|
||||
;
|
||||
// Spin until aquired. 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.
|
||||
|
|
|
@ -73,8 +73,7 @@ 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;
|
||||
|
@ -89,8 +88,7 @@ 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;
|
||||
}
|
||||
|
@ -100,7 +98,6 @@ strlen(const char *s)
|
|||
{
|
||||
int n;
|
||||
|
||||
for(n = 0; s[n]; n++)
|
||||
;
|
||||
for(n = 0; s[n]; n++) {}
|
||||
return n;
|
||||
}
|
||||
|
|
|
@ -89,8 +89,7 @@ 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.
|
||||
|
@ -113,13 +112,11 @@ 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();
|
||||
|
|
|
@ -10,8 +10,7 @@ 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.
|
||||
|
|
|
@ -20,8 +20,7 @@ strcpy(char *s, const char *t)
|
|||
char *os;
|
||||
|
||||
os = s;
|
||||
while((*s++ = *t++) != 0)
|
||||
;
|
||||
while((*s++ = *t++) != 0) {}
|
||||
return os;
|
||||
}
|
||||
|
||||
|
@ -38,8 +37,7 @@ strlen(const char *s)
|
|||
{
|
||||
int n;
|
||||
|
||||
for(n = 0; s[n]; n++)
|
||||
;
|
||||
for(n = 0; s[n]; n++) {}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
|
@ -823,8 +823,7 @@ preempt(char *s)
|
|||
exit(1);
|
||||
}
|
||||
if(pid1 == 0)
|
||||
for(;;)
|
||||
;
|
||||
for(;;) {}
|
||||
|
||||
pid2 = fork();
|
||||
if(pid2 < 0) {
|
||||
|
@ -832,8 +831,7 @@ preempt(char *s)
|
|||
exit(1);
|
||||
}
|
||||
if(pid2 == 0)
|
||||
for(;;)
|
||||
;
|
||||
for(;;) {}
|
||||
|
||||
pipe(pfds);
|
||||
pid3 = fork();
|
||||
|
@ -846,8 +844,7 @@ preempt(char *s)
|
|||
if(write(pfds[1], "x", 1) != 1)
|
||||
printf("%s: preempt write error", s);
|
||||
close(pfds[1]);
|
||||
for(;;)
|
||||
;
|
||||
for(;;) {}
|
||||
}
|
||||
|
||||
close(pfds[1]);
|
||||
|
|
Loading…
Add table
Reference in a new issue